Replace calls to Fl_Surface_Device::set_current() by calls to Fl_Surface_Device::push_current()

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12690 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy
2018-02-25 16:54:21 +00:00
parent ff64d09cf7
commit ba5106e758
+4 -7
View File
@@ -180,7 +180,6 @@ int Fl_Cocoa_Printer_Driver::start_job (int pagecount, int *frompage, int *topag
if (status != noErr) return 1;
y_offset = x_offset = 0;
this->set_current();
return 0;
}
@@ -298,7 +297,7 @@ int Fl_Cocoa_Printer_Driver::start_page (void)
#endif
}
driver()->gc(gc);
set_current();
Fl_Surface_Device::push_current(this);
PMRect pmRect;
float win_scale_x, win_scale_y;
@@ -339,6 +338,7 @@ int Fl_Cocoa_Printer_Driver::end_page (void)
CGContextRestoreGState(gc);
OSStatus status = PMSessionEndPageNoDialog(printSession);
gc = NULL;
Fl_Surface_Device::pop_current();
return status != noErr;
}
@@ -358,8 +358,6 @@ void Fl_Cocoa_Printer_Driver::end_job (void)
PMRelease(printSession);
}
#endif
Fl_Display_Device::display_device()->set_current();
driver()->gc(0);
Fl_Window *w = Fl::first_window();
if (w) w->show();
}
@@ -367,14 +365,13 @@ void Fl_Cocoa_Printer_Driver::end_job (void)
// version that prints at high res if using a retina display
void Fl_Cocoa_Printer_Driver::print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y)
{
Fl_Surface_Device *current = Fl_Surface_Device::surface();
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();
CGImageRef img = Fl_Cocoa_Window_Driver::driver(win)->CGImage_from_window_rect(x, y, w, h);
if (save_front != win) save_front->show();
current->set_current();
Fl_Surface_Device::pop_current();
((Fl_Quartz_Graphics_Driver*)driver())->draw_CGImage(img,delta_x, delta_y, w, h, 0,0,w,h);
CFRelease(img);
}