summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm14
-rw-r--r--src/Fl_win32.cxx5
-rw-r--r--src/Fl_x.cxx3
3 files changed, 12 insertions, 10 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 748f686d2..da3d27116 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -3729,24 +3729,24 @@ int Fl_Cocoa_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int
NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
- pixelsWide:image->w()
- pixelsHigh:image->h()
+ pixelsWide:image->data_w()
+ pixelsHigh:image->data_h()
bitsPerSample:8
samplesPerPixel:image->d()
hasAlpha:!(image->d() & 1)
isPlanar:NO
colorSpaceName:(image->d()<=2) ? NSDeviceWhiteColorSpace : NSDeviceRGBColorSpace
- bytesPerRow:(image->w() * image->d())
+ bytesPerRow:(image->data_w() * image->d())
bitsPerPixel:(image->d()*8)];
// Alpha needs to be premultiplied for this format
const uchar *i = (const uchar*)*image->data();
- const int extra_data = image->ld() ? (image->ld() - image->w() * image->d()) : 0;
+ const int extra_data = image->ld() ? (image->ld() - image->data_w() * image->d()) : 0;
unsigned char *o = [bitmap bitmapData];
- for (int y = 0;y < image->h();y++) {
+ for (int y = 0;y < image->data_h();y++) {
if (!(image->d() & 1)) {
- for (int x = 0;x < image->w();x++) {
+ for (int x = 0;x < image->data_w();x++) {
unsigned int alpha;
if (image->d() == 4) {
alpha = i[3];
@@ -3761,7 +3761,7 @@ int Fl_Cocoa_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int
}
} else {
// No alpha, so we can just copy everything directly.
- int len = image->w() * image->d();
+ int len = image->data_w() * image->d();
memcpy(o, i, len);
o += len;
i += len;
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 245225795..033c809db 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -2530,8 +2530,9 @@ int Fl_WinAPI_Window_Driver::set_cursor(Fl_Cursor c) {
int Fl_WinAPI_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) {
HCURSOR new_cursor;
-
- new_cursor = image_to_icon(image, false, hotx, hoty);
+ Fl_RGB_Image *scaled_image = (Fl_RGB_Image*)image->copy();
+ new_cursor = image_to_icon(scaled_image, false, hotx, hoty);
+ delete scaled_image;
if (new_cursor == NULL)
return 0;
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 6855f9915..0a8f80d50 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -2934,6 +2934,7 @@ int Fl_X11_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int ho
if (!cursor)
return 0;
+ image = (Fl_RGB_Image*)image->copy();
const int extra_data = image->ld() ? (image->ld()-image->w()*image->d()) : 0;
const uchar *i = (const uchar*)*image->data();
XcursorPixel *o = cursor->pixels;
@@ -2984,7 +2985,7 @@ int Fl_X11_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int ho
XFreeCursor(fl_display, xc);
XcursorImageDestroy(cursor);
-
+ delete image;
return 1;
#endif
}