summaryrefslogtreecommitdiff
path: root/src/drivers/Quartz
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-12-16 16:06:07 +0000
committerManolo Gouy <Manolo>2016-12-16 16:06:07 +0000
commitd0f6ef5d3207d39b5209a608117d3078e40acb39 (patch)
treefecace913df1491a5a93725e0e70a859dffc6d2a /src/drivers/Quartz
parent1fc01c7cbb23fe21b1cf07261659badfb1dd3fb9 (diff)
Improve Fl_Graphics_Driver::copy_offscreen() so it accepts an Fl_Offscreen argument even if not created by fl_create_offscreen().
With this, fl_copy_offscreen() can be used with any drawing surface (e.g., PostScript) and any Fl_Offscreen argument (e.g., returned by Fl_image_Surface::offscreen()). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12148 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Quartz')
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx
index cb22904aa..2404c531f 100644
--- a/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx
@@ -30,7 +30,7 @@ class Fl_Quartz_Image_Surface_Driver : public Fl_Image_Surface_Driver {
virtual void end_current_();
public:
Window pre_window;
- Fl_Quartz_Image_Surface_Driver(int w, int h, int high_res);
+ Fl_Quartz_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
~Fl_Quartz_Image_Surface_Driver();
void set_current();
void translate(int x, int y);
@@ -39,17 +39,17 @@ public:
};
-Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen)
+Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off)
{
- return new Fl_Quartz_Image_Surface_Driver(w, h, high_res);
+ return new Fl_Quartz_Image_Surface_Driver(w, h, high_res, off);
}
-Fl_Quartz_Image_Surface_Driver::Fl_Quartz_Image_Surface_Driver(int w, int h, int high_res) : Fl_Image_Surface_Driver(w, h, high_res, 0) {
+Fl_Quartz_Image_Surface_Driver::Fl_Quartz_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Image_Surface_Driver(w, h, high_res, 0) {
int W = high_res ? 2*w : w;
int H = high_res ? 2*h : h;
CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
- offscreen = CGBitmapContextCreate(calloc(W*H,4), W, H, 8, W*4, lut, kCGImageAlphaPremultipliedLast);
+ offscreen = off ? off : CGBitmapContextCreate(calloc(W*H,4), W, H, 8, W*4, lut, kCGImageAlphaPremultipliedLast);
CGColorSpaceRelease(lut);
driver(new Fl_Quartz_Graphics_Driver);
CGContextTranslateCTM(offscreen, 0.5, -0.5); // as when drawing to a window