From 4645ed97031bb2ce1122ec890a6c6ac55590c94a Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 29 Jan 2010 21:16:20 +0000 Subject: defined macro FL_CGRECTMAKE_COCOA that contains the correct way to transform x,y,w,h into a CGRect adequate for clipping git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7035 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/mac.H | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'FL') diff --git a/FL/mac.H b/FL/mac.H index 59412e78d..97fa20d77 100644 --- a/FL/mac.H +++ b/FL/mac.H @@ -54,7 +54,7 @@ #ifndef MAC_OS_X_VERSION_MAX_ALLOWED #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_3 #endif -#endif //__APPLE_COCOA__ +#endif // __APPLE_COCOA__ #ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h #if defined(__LP64__) && __LP64__ @@ -62,7 +62,7 @@ typedef double CGFloat; #else typedef float CGFloat; #endif -#endif //CGFLOAT_DEFINED +#endif // CGFLOAT_DEFINED // Now make some fixes to the headers... @@ -73,9 +73,11 @@ struct XPoint { int x, y; }; struct XRectangle {int x, y, width, height;}; #ifdef __APPLE_COCOA__ +// necessary so a CGRect matches exactly what is denoted x,y,w,h for clipping purposes +#define FL_CGRECTMAKE_COCOA(x,y,w,h) CGRectMake(x, y, w > 0 ? w - 0.9 : 0, h > 0 ? h - 0.9 : 0) -typedef void *Window; //this is really a pter to the subclass FLWindow of NSWindow -typedef struct flCocoaRegion{ +typedef void *Window; // this is really a pter to the subclass FLWindow of NSWindow +typedef struct flCocoaRegion { int count; CGRect *rects; } *Fl_Region; // a region is the union of a series of rectangles @@ -83,7 +85,7 @@ inline Fl_Region 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) = CGRectMake(x, y, w > 0 ? w - 0.9 : 0, h > 0 ? h - 0.9 : 0); + *(R->rects) = FL_CGRECTMAKE_COCOA(x, y, w, h); return R; } inline void XDestroyRegion(Fl_Region r) { @@ -145,10 +147,6 @@ public: void flush(); // Quartz additions: CGContextRef gc; // graphics context (NULL when using QD) -#ifndef __APPLE_COCOA__ - static ATSUTextLayout atsu_layout; // windows share a global font - static ATSUStyle atsu_style; -#endif static void q_fill_context(); // fill a Quartz context with current FLTK state static void q_clear_clipping(); // remove all clipping from a Quartz context static void q_release_context(Fl_X *x=0); // free all resources associated with fl_gc -- cgit v1.2.3