summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-03-18 17:56:06 +0000
committerManolo Gouy <Manolo>2010-03-18 17:56:06 +0000
commitc72a57a56bc164b1d02b246e66d8fae54c994f05 (patch)
treefb3104ca5a74da38f8eea0c5b036ef7a03ea69af /src
parentc0550793a18d06905c415c2f76a5e2a9e055cec6 (diff)
Better WIN32 performance of Fl_Printer::print_window_rect()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7300 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Device.cxx7
-rw-r--r--src/fl_draw_image_win32.cxx5
2 files changed, 7 insertions, 5 deletions
diff --git a/src/Fl_Device.cxx b/src/Fl_Device.cxx
index c07e45647..a35c2b5c2 100644
--- a/src/Fl_Device.cxx
+++ b/src/Fl_Device.cxx
@@ -118,9 +118,14 @@ void Fl_Virtual_Printer::print_window_part(Fl_Window *win, int x, int y, int w,
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 @@ void Fl_Virtual_Printer::delete_image_list()
{
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;
diff --git a/src/fl_draw_image_win32.cxx b/src/fl_draw_image_win32.cxx
index 82dcc5ee4..403dfd9fe 100644
--- a/src/fl_draw_image_win32.cxx
+++ b/src/fl_draw_image_win32.cxx
@@ -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 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
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,