summaryrefslogtreecommitdiff
path: root/src/drivers/Quartz
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-03-30 20:16:40 +0000
committerManolo Gouy <Manolo>2016-03-30 20:16:40 +0000
commitd67f395031b0e9cfb266bf31a4a5e08a2d109e3b (patch)
tree6a38b9180802e79b16af5de3ff031e6d739ac16c /src/drivers/Quartz
parent7799245100a91b10b9a4ca9c6e818a3cdd8d5dc9 (diff)
Rewrite functions XRectangleRegion(), XDestroyRegion() under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11479 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Quartz')
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H1
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx22
2 files changed, 22 insertions, 1 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
index 7530c331f..d18484a10 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
@@ -63,6 +63,7 @@ public:
void uncache(Fl_RGB_Image *img, fl_uintptr_t &id_, fl_uintptr_t &mask_);
void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
void draw_CGImage(CGImageRef cgimg, int x, int y, int w, int h, int srcx, int srcy, int sw, int sh);
+ static CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h);
protected:
void transformed_vertex0(float x, float y);
void fixloop();
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
index a829534d3..c288a5666 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
@@ -71,8 +71,13 @@ void Fl_Quartz_Graphics_Driver::copy_offscreen(int x,int y,int w,int h,Fl_Offscr
CGDataProviderRelease(src_bytes);
}
+// so a CGRect matches exactly what is denoted x,y,w,h for clipping purposes
+CGRect Fl_Quartz_Graphics_Driver::fl_cgrectmake_cocoa(int x, int y, int w, int h) {
+ return CGRectMake(x - 0.5, y - 0.5, w, h);
+}
+
void Fl_Graphics_Driver::add_rectangle_to_region(Fl_Region r, int X, int Y, int W, int H) {
- CGRect arg = fl_cgrectmake_cocoa(X, Y, W, H);
+ CGRect arg = Fl_Quartz_Graphics_Driver::fl_cgrectmake_cocoa(X, Y, W, H);
int j; // don't add a rectangle totally inside the Fl_Region
for(j = 0; j < r->count; j++) {
if(CGRectContainsRect(r->rects[j], arg)) break;
@@ -83,6 +88,21 @@ void Fl_Graphics_Driver::add_rectangle_to_region(Fl_Region r, int X, int Y, int
}
}
+Fl_Region Fl_Graphics_Driver::XRectangleRegion(int x, int y, int w, int h) {
+ Fl_Region R = (Fl_Region)malloc(sizeof(*R));
+ R->count = 1;
+ R->rects = (CGRect *)malloc(sizeof(CGRect));
+ *(R->rects) = Fl_Quartz_Graphics_Driver::fl_cgrectmake_cocoa(x, y, w, h);
+ return R;
+}
+
+void Fl_Graphics_Driver::XDestroyRegion(Fl_Region r) {
+ if(r) {
+ free(r->rects);
+ free(r);
+ }
+}
+
//
// End of "$Id$".
//