summaryrefslogtreecommitdiff
path: root/src/drivers/Xlib
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2016-03-02 16:19:18 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2016-03-02 16:19:18 +0000
commit76b240d79d0972a34225aba06323a1f45ca1156f (patch)
tree5f5bd82b9d458cd3a69f38a27c60a1d8b23eda03 /src/drivers/Xlib
parent5a8f3f908b2caccd1addd8a2ffe5dd1f02a48ecc (diff)
Fix negative 'd' and 'ld' args in fl_draw_image() (X11 + Windows).
This commit fixes a regression in FLTK 1.3.x, where negative values of 'd' (pixel delta) and 'ld' (line delta) didn't work anymore under Unix/Linux (X11) and Windows. With this commit the regression is fixed on all supported platforms. Equivalent of branch-1.3, svn r11270. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11272 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Xlib')
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
index 723c22838..069fc925e 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
@@ -458,7 +458,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
Fl_Draw_Image_Cb cb, void* userdata,
const bool alpha, GC gc)
{
- if (!linedelta) linedelta = W*delta;
+ if (!linedelta) linedelta = W*abs(delta);
int dx, dy, w, h;
fl_clip_box(X,Y,W,H,dx,dy,w,h);
@@ -565,22 +565,27 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
void Fl_Xlib_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
- const bool alpha = !!(d & FL_IMAGE_WITH_ALPHA);
- d &= ~FL_IMAGE_WITH_ALPHA;
+ const bool alpha = !!(abs(d) & FL_IMAGE_WITH_ALPHA);
+ if (alpha) d ^= FL_IMAGE_WITH_ALPHA;
+ const int mono = (d>-3 && d<3);
- innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0,alpha,gc_);
+ innards(buf,x,y,w,h,d,l,mono,0,0,alpha,gc_);
}
+
void Fl_Xlib_Graphics_Driver::draw_image(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
- const bool alpha = !!(d & FL_IMAGE_WITH_ALPHA);
- d &= ~FL_IMAGE_WITH_ALPHA;
+ const bool alpha = !!(abs(d) & FL_IMAGE_WITH_ALPHA);
+ if (alpha) d ^= FL_IMAGE_WITH_ALPHA;
+ const int mono = (d>-3 && d<3);
- innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data,alpha,gc_);
+ innards(0,x,y,w,h,d,0,mono,cb,data,alpha,gc_);
}
+
void Fl_Xlib_Graphics_Driver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
innards(buf,x,y,w,h,d,l,1,0,0,0,gc_);
}
+
void Fl_Xlib_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
innards(0,x,y,w,h,d,0,1,cb,data,0,gc_);