Author: manolo
Date: 2010-03-18 10:56:06 -0700 (Thu, 18 Mar 2010)
New Revision: 7300
Log:
Better WIN32 performance of Fl_Printer::print_window_rect()

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

Modified: branches/branch-1.3/src/Fl_Device.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Device.cxx       2010-03-18 16:08:35 UTC (rev 
7299)
+++ branches/branch-1.3/src/Fl_Device.cxx       2010-03-18 17:56:06 UTC (rev 
7300)
@@ -118,9 +118,14 @@
   uchar *image_data = fl_read_image(NULL, x, y, w, h);
   save_front->show();
   this->set_current();
+#ifdef WIN32
+  fl_draw_image(image_data, delta_x, delta_y, w, h, 3);
+  add_image(NULL, image_data);
+#else
   Fl_RGB_Image *image = new Fl_RGB_Image(image_data, w, h);
   image->draw(delta_x, delta_y);
   add_image(image, image_data);
+#endif
 }
 
 void Fl_Virtual_Printer::add_image(Fl_Image *image, const uchar *data)
@@ -136,7 +141,7 @@
 {
   while(image_list_) {
     struct chain_elt *next = image_list_->next;
-    delete image_list_->image;
+    if(image_list_->image) delete image_list_->image;
     if (image_list_->data) delete image_list_->data;
     free(image_list_);
     image_list_ = next;

Modified: branches/branch-1.3/src/fl_draw_image_win32.cxx
===================================================================
--- branches/branch-1.3/src/fl_draw_image_win32.cxx     2010-03-18 16:08:35 UTC 
(rev 7299)
+++ branches/branch-1.3/src/fl_draw_image_win32.cxx     2010-03-18 17:56:06 UTC 
(rev 7300)
@@ -49,8 +49,7 @@
 #include <FL/fl_draw.H>
 #include <FL/x.H>
 
-//#define MAXBUFFER 0x40000 // 256k
-#define MAXBUFFER 0x100000 // 1024k
+#define MAXBUFFER 0x40000 // 256k
 
 #if USE_COLORMAP
 
@@ -258,8 +257,6 @@
     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,

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

Reply via email to