Author: manolo
Date: 2012-03-28 06:19:33 -0700 (Wed, 28 Mar 2012)
New Revision: 9308
Log:
WIN32: Fl_Pixmap printing uses a global variable called win_pixmap_bg_color 
equal to the color
used for the pixmap background, and treats this color as transparent. FLTK 
assigns to this variable
a color unused by the processed pixmap. In theory this variable should be 
specific to each processed
pixmap. In practice, it's very unlikely that several values are needed. A new 
member variable is
added to the Fl_Pixmap object to hold this value. This member is made static if 
FLTK_ABI_VERSION
< 10302 for ABI compatibility. The correct thing, though, is for a non-static 
member.

Modified:
   branches/branch-1.3/FL/Fl_Pixmap.H
   branches/branch-1.3/src/Fl_Pixmap.cxx

Modified: branches/branch-1.3/FL/Fl_Pixmap.H
===================================================================
--- branches/branch-1.3/FL/Fl_Pixmap.H  2012-03-27 15:02:55 UTC (rev 9307)
+++ branches/branch-1.3/FL/Fl_Pixmap.H  2012-03-28 13:19:33 UTC (rev 9308)
@@ -22,6 +22,9 @@
 #ifndef Fl_Pixmap_H
 #define Fl_Pixmap_H
 #  include "Fl_Image.H"
+#if defined(WIN32)
+#  include "x.H"
+#endif
 
 class Fl_Widget;
 struct Fl_Menu_Item;
@@ -56,6 +59,12 @@
   
   private:
 
+#if defined(WIN32)
+#if FLTK_ABI_VERSION < 10302
+  static // a static member is needed for ABI compatibility
+#endif
+  UINT pixmap_bg_color; // RGB color used for pixmap background
+#endif // WIN32
 #if defined(__APPLE__) || defined(WIN32)
   void *id_; // for internal use
   void *mask_; // for internal use (mask bitmap)

Modified: branches/branch-1.3/src/Fl_Pixmap.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Pixmap.cxx       2012-03-27 15:02:55 UTC (rev 
9307)
+++ branches/branch-1.3/src/Fl_Pixmap.cxx       2012-03-28 13:19:33 UTC (rev 
9308)
@@ -113,6 +113,10 @@
 #endif
     fl_draw_pixmap(data(), 0, 0, FL_BLACK);
 #ifndef __APPLE__
+#if defined(WIN32)
+    extern UINT win_pixmap_bg_color; // computed by fl_draw_pixmap()
+    this->pixmap_bg_color = win_pixmap_bg_color;
+#endif
     fl_mask_bitmap = 0;
     if (bitmap) {
       mask_ = fl_create_bitmask(w(), h(), bitmap);
@@ -149,6 +153,10 @@
   }
 }
 
+#if FLTK_ABI_VERSION < 10302
+COLORREF Fl_Pixmap::pixmap_bg_color = 0;
+#endif
+
 void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int 
WP, int HP, int cx, int cy) {
   int X, Y, W, H;
   if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
@@ -164,8 +172,7 @@
     int save = SaveDC(new_gc);
     SelectObject(new_gc, (void*)pxm->id_);
     // print all of offscreen but its parts in background color
-    extern UINT win_pixmap_bg_color; // computed by fl_draw_pixmap()
-    fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, pxm->w(), pxm->h(), 
win_pixmap_bg_color );
+    fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, pxm->w(), pxm->h(), 
pxm->pixmap_bg_color );
     RestoreDC(new_gc,save);
     DeleteDC(new_gc);
   }

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to