summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-03-24 21:44:45 +0000
committerManolo Gouy <Manolo>2010-03-24 21:44:45 +0000
commit309e47801322afea091619f9d5ac45fea04158ab (patch)
treea39917b29124469262896c6e594e20884a5e3fbb
parent64482fa3116719378a76938548fe391ce1943e32 (diff)
Fixed Fl_Abstract_Printer::print_window_parts for MSWin bug with large screen captures
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7329 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_Device.cxx28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/Fl_Device.cxx b/src/Fl_Device.cxx
index 26db1583c..82e8b7b56 100644
--- a/src/Fl_Device.cxx
+++ b/src/Fl_Device.cxx
@@ -110,22 +110,36 @@ void Fl_Abstract_Printer::origin(int *x, int *y)
void Fl_Abstract_Printer::print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y)
{
+ int slice, width, offset, count = 0;
Fl_Device::display_device()->set_current();
Fl_Window *save_front = Fl::first_window();
win->show();
+ fl_gc = NULL;
Fl::check();
win->make_current();
- uchar *image_data = fl_read_image(NULL, x, y, w, h);
+ uchar *image_data[20];
+#ifdef WIN32 // because of bug in StretchDIBits, vertically cut image in pieces of width slice
+ slice = 500;
+#else
+ slice = w;
+#endif
+ for ( offset = 0; offset < w; offset += slice) {
+ width = slice;
+ if (offset + width > w) width = w - offset;
+ image_data[count++] = fl_read_image(NULL, x + offset, y, width, 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);
+ for ( int i = 0, offset = 0; i < count; i++, offset += slice) {
+ width = slice;
+ if (offset + width > w) width = w - offset;
+ fl_draw_image(image_data[i], delta_x + offset, delta_y, width, h, 3);
+#ifdef __APPLE__
+ add_image(NULL, image_data[i]);
#else
- Fl_RGB_Image *image = new Fl_RGB_Image(image_data, w, h);
- image->draw(delta_x, delta_y);
- add_image(image, image_data);
+ delete image_data[i];
#endif
+ }
}
void Fl_Abstract_Printer::add_image(Fl_Image *image, const uchar *data)