summaryrefslogtreecommitdiff
path: root/src/Fl_x.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2016-10-14 16:35:52 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2016-10-14 16:35:52 +0000
commite3670dfda6799aa92ed30c770dd9c811f4d74b54 (patch)
treecf239d764293f70e6653cbf4827b905af2b65221 /src/Fl_x.cxx
parent242d5365e66af53fc936b5ceba5cbcb8b0acf24b (diff)
Fix inconsistent interpretation of ld() in image handling (STR #3308).
Documentation has been fixed and clarified, and ld() handling is now consistent in Fl_(RGB_)Image, their subclasses and fl_draw_image() and similar functions. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12029 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_x.cxx')
-rw-r--r--src/Fl_x.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 3ba9ba6bc..93ef26d78 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -2612,9 +2612,11 @@ static void icons_to_property(const Fl_RGB_Image *icons[], int count,
data[1] = image->h();
data += 2;
+ const int extra_data = image->ld() ? (image->ld()-image->w()*image->d()) : 0;
+
const uchar *in = (const uchar*)*image->data();
- for (int y = 0;y < image->h();y++) {
- for (int x = 0;x < image->w();x++) {
+ for (int y = 0; y < image->h(); y++) {
+ for (int x = 0; x < image->w(); x++) {
switch (image->d()) {
case 1:
*data = ( 0xff<<24) | (in[0]<<16) | (in[0]<<8) | in[0];
@@ -2632,7 +2634,7 @@ static void icons_to_property(const Fl_RGB_Image *icons[], int count,
in += image->d();
data++;
}
- in += image->ld();
+ in += extra_data;
}
}
}
@@ -2748,6 +2750,7 @@ int Fl_X11_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int ho
if (!cursor)
return 0;
+ const int extra_data = image->ld() ? (image->ld()-image->w()*image->d()) : 0;
const uchar *i = (const uchar*)*image->data();
XcursorPixel *o = cursor->pixels;
for (int y = 0;y < image->h();y++) {
@@ -2769,7 +2772,7 @@ int Fl_X11_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int ho
i += image->d();
o++;
}
- i += image->ld();
+ i += extra_data;
}
cursor->xhot = hotx;