mirror of
https://github.com/fltk/fltk.git
synced 2026-06-02 07:26:57 +08:00
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
This commit is contained in:
@@ -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)
|
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();
|
Fl_Window *save_front = Fl::first_window();
|
||||||
win->show();
|
win->show();
|
||||||
Fl::check();
|
Fl::check();
|
||||||
win->driver()->flush(); // makes the window current
|
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);
|
Fl_RGB_Image *img = Fl_Screen_Driver::traverse_to_gl_subwindows(win, NULL, x, y, w, h, 0, NULL);
|
||||||
if (img->w() != w) {
|
Fl_Shared_Image *shared = Fl_Shared_Image::get(img);
|
||||||
Fl_RGB_Image *img2 = (Fl_RGB_Image*)img->copy(w, h);
|
shared->scale(w, h, 1, 1);
|
||||||
delete img;
|
|
||||||
img = img2;
|
|
||||||
}
|
|
||||||
image_data = img->array;
|
|
||||||
if (save_front != win) save_front->show();
|
if (save_front != win) save_front->show();
|
||||||
set_current();
|
Fl_Surface_Device::pop_current();
|
||||||
fl_draw_image(image_data, delta_x, delta_y, w, h, 3);
|
shared->draw(delta_x, delta_y);
|
||||||
delete img;
|
shared->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user