summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-02-25 16:54:21 +0000
committerManolo Gouy <Manolo>2018-02-25 16:54:21 +0000
commitba5106e7587820dceca217055f4c666c05d7cb48 (patch)
treebfff3af4b78c002e9622fba18a6b4cc2014f8615
parentff64d09cf7ad6d11e3f702e4317f46d69b384468 (diff)
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
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
index 192eb6878..c61f09df1 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
+++ b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
@@ -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);
}