summaryrefslogtreecommitdiff
path: root/src/fl_draw_pixmap.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-12-30 10:13:17 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-12-30 10:13:17 +0000
commitd3db965083a783672ce39c36883c194a403abdac (patch)
tree0c0c73ef968f7b84fcb5c2f7b59cdb83061287b8 /src/fl_draw_pixmap.cxx
parent10fae2dd8a3b2383d3ec004d68a46fd945a8d4d6 (diff)
Fixed a few memory faults found by Valgrind (yes, I finally got my Linux
machine up and running again) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4723 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_draw_pixmap.cxx')
-rw-r--r--src/fl_draw_pixmap.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/fl_draw_pixmap.cxx b/src/fl_draw_pixmap.cxx
index 20cc293c0..a1fb81d8a 100644
--- a/src/fl_draw_pixmap.cxx
+++ b/src/fl_draw_pixmap.cxx
@@ -263,15 +263,16 @@ int fl_draw_pixmap(const char*const* di, int x, int y, Fl_Color bg) {
for (int Y = 0; Y < d.h; Y++) {
const uchar* p = data[Y];
if (chars_per_pixel <= 1) {
+ int dw = d.w;
for (int X = 0; X < W; X++) {
- uchar b = (*p++ != transparent_index);
- if (*p++ != transparent_index) b |= 2;
- if (*p++ != transparent_index) b |= 4;
- if (*p++ != transparent_index) b |= 8;
- if (*p++ != transparent_index) b |= 16;
- if (*p++ != transparent_index) b |= 32;
- if (*p++ != transparent_index) b |= 64;
- if (*p++ != transparent_index) b |= 128;
+ uchar b = (dw-->0 && *p++ != transparent_index);
+ if (dw-->0 && *p++ != transparent_index) b |= 2;
+ if (dw-->0 && *p++ != transparent_index) b |= 4;
+ if (dw-->0 && *p++ != transparent_index) b |= 8;
+ if (dw-->0 && *p++ != transparent_index) b |= 16;
+ if (dw-->0 && *p++ != transparent_index) b |= 32;
+ if (dw-->0 && *p++ != transparent_index) b |= 64;
+ if (dw-->0 && *p++ != transparent_index) b |= 128;
*bitmap++ = b;
}
} else {