summaryrefslogtreecommitdiff
path: root/src/Fl_win32.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_win32.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_win32.cxx')
-rw-r--r--src/Fl_win32.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 04facd944..f3f20a40c 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -1957,8 +1957,10 @@ static HICON image_to_icon(const Fl_RGB_Image *image, bool is_icon,
return NULL;
const uchar *i = (const uchar*)*image->data();
- for (int y = 0;y < image->h();y++) {
- for (int x = 0;x < image->w();x++) {
+ const int extra_data = image->ld() ? (image->ld()-image->w()*image->d()) : 0;
+
+ for (int y = 0; y < image->h(); y++) {
+ for (int x = 0; x < image->w(); x++) {
switch (image->d()) {
case 1:
*bits = (0xff<<24) | (i[0]<<16) | (i[0]<<8) | i[0];
@@ -1976,7 +1978,7 @@ static HICON image_to_icon(const Fl_RGB_Image *image, bool is_icon,
i += image->d();
bits++;
}
- i += image->ld();
+ i += extra_data;
}
// A mask bitmap is still needed even though it isn't used
@@ -1999,9 +2001,6 @@ static HICON image_to_icon(const Fl_RGB_Image *image, bool is_icon,
DeleteObject(bitmap);
DeleteObject(mask);
- if (icon == NULL)
- return NULL;
-
return icon;
}