Author: manolo
Date: 2010-03-16 05:03:48 -0700 (Tue, 16 Mar 2010)
New Revision: 7275
Log:
Fixed WIN32 printing of RGB images without transparency. Still 
print_window_part() problem.

Modified:
   branches/branch-1.3/src/fl_draw_image_win32.cxx

Modified: branches/branch-1.3/src/fl_draw_image_win32.cxx
===================================================================
--- branches/branch-1.3/src/fl_draw_image_win32.cxx     2010-03-16 09:08:27 UTC 
(rev 7274)
+++ branches/branch-1.3/src/fl_draw_image_win32.cxx     2010-03-16 12:03:48 UTC 
(rev 7275)
@@ -49,7 +49,8 @@
 #include <FL/fl_draw.H>
 #include <FL/x.H>
 
-#define MAXBUFFER 0x40000 // 256k
+//#define MAXBUFFER 0x40000 // 256k
+#define MAXBUFFER 0x100000 // 1024k
 
 #if USE_COLORMAP
 
@@ -254,6 +255,22 @@
         }            
       }
     }
+    if(Fl_Device::current()->type() == Fl_Device::gdi_printer) {
+      // if print context, device and logical units are not equal, so 
SetDIBitsToDevice
+      // does not do the expected job, whereas StretchDIBits does it.
+      // TODO with Fl_Printer::print_window_part(), StretchDIBits does not 
work well 
+      // with large captures whereas SetDIBitsToDevice does.
+      StretchDIBits(fl_gc, x, y+j-k, w, k, 0, 0, w, k,
+                   (LPSTR)((uchar*)buffer+(blocking-k)*linesize),
+                   &bmi,
+#if USE_COLORMAP
+                   indexed ? DIB_PAL_COLORS : DIB_RGB_COLORS
+#else
+                   DIB_RGB_COLORS
+#endif
+                   , SRCCOPY );
+    }
+    else {
       SetDIBitsToDevice(fl_gc, x, y+j-k, w, k, 0, 0, 0, k,
                        (LPSTR)((uchar*)buffer+(blocking-k)*linesize),
                        &bmi,
@@ -263,6 +280,7 @@
                        DIB_RGB_COLORS
 #endif
                        );
+      }
   }
 }
 

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

Reply via email to