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
This commit is contained in:
Manolo Gouy 2010-03-18 17:56:06 +00:00
parent c0550793a1
commit c72a57a56b
2 changed files with 7 additions and 5 deletions

View File

@ -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;

View File

@ -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,