summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx6
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx19
2 files changed, 15 insertions, 10 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index f750e1785..070c65568 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -106,6 +106,8 @@ static void monodither(uchar* to, const uchar* from, int w, int delta) {
#endif // USE_COLORMAP
+static int fl_abs(int v) { return v<0 ? -v : v; }
+
static void innards(const uchar *buf, int X, int Y, int W, int H,
int delta, int linedelta, int depth,
Fl_Draw_Image_Cb cb, void* userdata, HDC gc)
@@ -120,7 +122,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
if (indexed || !fl_can_do_alpha_blending())
depth = (depth-1)|1;
- if (!linedelta) linedelta = W*delta;
+ if (!linedelta) linedelta = W*fl_abs(delta);
int x, y, w, h;
fl_clip_box(X,Y,W,H,x,y,w,h);
@@ -281,8 +283,6 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
}
}
-static int fl_abs(int v) { return v<0 ? -v : v; }
-
void Fl_GDI_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
d ^= FL_IMAGE_WITH_ALPHA;
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_);