summaryrefslogtreecommitdiff
path: root/src/drivers/GDI
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-04-18 15:03:51 +0000
committerManolo Gouy <Manolo>2018-04-18 15:03:51 +0000
commit15e3f4b2d2fca4e501e13a2a303880013955dfcd (patch)
tree537ced5b9968b57fd21c8c428fc6d7a616892ac5 /src/drivers/GDI
parent231e0edff6817b196abdd69b9c7539a213582d52 (diff)
Simplify the implementation of printing of Fl_Pixmap images under Windows.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12851 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/GDI')
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.H1
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx21
2 files changed, 9 insertions, 13 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
index bca0b2177..a4225d82d 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
@@ -42,6 +42,7 @@ private:
void set_current_();
void draw_fixed(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
void draw_fixed(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
+ virtual void make_unused_color_(unsigned char &r, unsigned char &g, unsigned char &b);
protected:
void draw_fixed(Fl_RGB_Image *rgb, int XP, int YP, int WP, int HP, int cx, int cy);
void cache(Fl_RGB_Image *rgb);
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index 90ab6a13d..26439fa7b 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -647,7 +647,9 @@ void Fl_GDI_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm, int X, int Y, int W, int
RestoreDC(new_gc,save);
DeleteDC(new_gc);
} else {
+ float s = scale_; scale_ = 1;
copy_offscreen(X, Y, W, H, (Fl_Offscreen)*Fl_Graphics_Driver::id(pxm), cx, cy);
+ scale_ = s;
}
unscale_clip(r2);
}
@@ -658,16 +660,9 @@ void Fl_GDI_Printer_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP,
if (start_image(pxm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
transparent_f_type fl_TransparentBlt = TransparentBlt();
if (fl_TransparentBlt) {
- bool recache = false;
- if (*id(pxm)) {
- int *pw, *ph;
- cache_w_h(pxm, pw, ph);
- recache = (*pw != pxm->data_w() || *ph != pxm->data_h());
- }
- if (recache || !*id(pxm)) {
- pxm->uncache();
- cache(pxm);
- }
+ need_pixmap_bg_color = 1;
+ pxm->uncache();
+ cache(pxm);
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
SelectObject(new_gc, (void*)*Fl_Graphics_Driver::id(pxm));
@@ -675,10 +670,11 @@ void Fl_GDI_Printer_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP,
float scaleW = pxm->data_w()/float(pxm->w());
float scaleH = pxm->data_h()/float(pxm->h());
fl_TransparentBlt(gc_, X, Y, W, H, new_gc, cx * scaleW, cy * scaleH, W * scaleW, H * scaleH,
- *Fl_Graphics_Driver::pixmap_bg_color(pxm) );
+ need_pixmap_bg_color );
+ need_pixmap_bg_color = 0;
RestoreDC(new_gc,save);
DeleteDC(new_gc);
- if (recache) pxm->uncache();
+ need_pixmap_bg_color = 0;
}
else {
copy_offscreen(X, Y, W, H, (Fl_Offscreen)*Fl_Graphics_Driver::id(pxm), cx, cy);
@@ -692,7 +688,6 @@ void Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) {
uchar **pbitmap = surf->driver()->mask_bitmap();
*pbitmap = 0;
fl_draw_pixmap(img->data(), 0, 0, FL_BLACK);
- *Fl_Graphics_Driver::pixmap_bg_color(img) = Fl_WinAPI_System_Driver::win_pixmap_bg_color; // computed by fl_draw_pixmap()
uchar *bitmap = *pbitmap;
if (bitmap) {
*Fl_Graphics_Driver::mask(img) = (fl_uintptr_t)create_bitmask(img->data_w(), img->data_h(), bitmap);