diff options
| author | Manolo Gouy <Manolo> | 2017-07-31 07:47:48 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-07-31 07:47:48 +0000 |
| commit | 87b1ff244d2c9129e6c20ba3c1e9f44097e20baf (patch) | |
| tree | 60fb7454d522a276da4261fea65cf66ff59fa207 /src | |
| parent | c4e04e4c7f446464ef65382cf10bc13417563b3b (diff) | |
Improve Fl_Widget_Surface::print_window_part() with better quality when scaling factor > 1.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12368 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Widget_Surface.cxx | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/Fl_Widget_Surface.cxx b/src/Fl_Widget_Surface.cxx index 4241bbc0c..a542eee69 100644 --- a/src/Fl_Widget_Surface.cxx +++ b/src/Fl_Widget_Surface.cxx @@ -152,23 +152,18 @@ void Fl_Widget_Surface::origin(int x, int y) { */ void Fl_Widget_Surface::print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y) { - Fl_Display_Device::display_device()->set_current(); + Fl_Surface_Device::push_current(Fl_Display_Device::display_device()); Fl_Window *save_front = Fl::first_window(); win->show(); Fl::check(); win->driver()->flush(); // makes the window current - const uchar *image_data; Fl_RGB_Image *img = Fl_Screen_Driver::traverse_to_gl_subwindows(win, NULL, x, y, w, h, 0, NULL); - if (img->w() != w) { - Fl_RGB_Image *img2 = (Fl_RGB_Image*)img->copy(w, h); - delete img; - img = img2; - } - image_data = img->array; + Fl_Shared_Image *shared = Fl_Shared_Image::get(img); + shared->scale(w, h, 1, 1); if (save_front != win) save_front->show(); - set_current(); - fl_draw_image(image_data, delta_x, delta_y, w, h, 3); - delete img; + Fl_Surface_Device::pop_current(); + shared->draw(delta_x, delta_y); + shared->release(); } /** |
