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 #include -//#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,