diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-02-13 12:11:04 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-02-13 12:11:04 +0100 |
| commit | f459fdb6374a81a7ebb2fdc95e6dd7ec7041c3ec (patch) | |
| tree | e125f30f2ad6374020ce7b64f2d7850785cbd540 /src/Fl_cocoa.mm | |
| parent | bb74d263e25720dc3f4103df489853739de1bd9f (diff) | |
Allow scaled image in Fl_Window::cursor(const Fl_RGB_Image *, int, int)
Diffstat (limited to 'src/Fl_cocoa.mm')
| -rw-r--r-- | src/Fl_cocoa.mm | 14 |
1 files changed, 7 insertions, 7 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; |
