diff options
| author | Manolo Gouy <Manolo> | 2010-02-02 17:13:55 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2010-02-02 17:13:55 +0000 |
| commit | 5ec87ac84845728cc004ef2920502a8e4eb4d9a0 (patch) | |
| tree | 2c562c77c544dce0d595e0aa1385612a87cc04a7 /src/fl_rect.cxx | |
| parent | c7b67bc25275b587d357939a21df6c534d56b5e9 (diff) | |
simplifying clipping algorithm: done once in make_current() instead of repeated at each fl_restore_clip() call
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7037 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_rect.cxx')
| -rw-r--r-- | src/fl_rect.cxx | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx index c0696559c..15c303dd1 100644 --- a/src/fl_rect.cxx +++ b/src/fl_rect.cxx @@ -564,7 +564,6 @@ Fl_Region XRectangleRegion(int x, int y, int w, int h) { // warning: the Quartz implementation currently uses Quickdraw calls to achieve // clipping. A future version should instead use 'CGContectClipToRect' // and friends. -extern Fl_Region fl_window_region; #endif /** Undoes any clobbering of clip done by your program */ @@ -577,19 +576,17 @@ void fl_restore_clip() { #elif defined(WIN32) SelectClipRgn(fl_gc, r); //if r is NULL, clip is automatically cleared #elif defined(__APPLE_QUARTZ__) - if ( fl_window ) // clipping for a true window - { -#ifdef __APPLE_COCOA__ - Fl_X::q_clear_clipping(); - Fl_X::q_fill_context();//flip coords and translate if subwindow - //apply window's clip - CGContextClipToRects(fl_gc, fl_window_region->rects, fl_window_region->count ); - //apply additional program clip - if(r) { - CGContextClipToRects(fl_gc, r->rects, r->count); - } -#else - GrafPtr port = GetWindowPort( fl_window ); + if ( fl_window ) { // clipping for a true window +#ifdef __APPLE_COCOA__ + Fl_X::q_clear_clipping(); + Fl_X::q_fill_context();//flip coords if bitmap context + //apply program clip + if(r) { + CGContextClipToRects(fl_gc, r->rects, r->count); + } +#else + extern Fl_Region fl_window_region; + GrafPtr port = GetWindowPort( fl_window ); if ( port ) { RgnHandle portClip = NewRgn(); CopyRgn( fl_window_region, portClip ); // changed @@ -603,20 +600,20 @@ void fl_restore_clip() { } #endif } else if (fl_gc) { // clipping for an offscreen drawing world (CGBitmap) - Rect portRect; - portRect.top = 0; - portRect.left = 0; - portRect.bottom = CGBitmapContextGetHeight(fl_gc); - portRect.right = CGBitmapContextGetWidth(fl_gc); - Fl_X::q_clear_clipping(); - if (r) { + Fl_X::q_clear_clipping(); + if (r) { #ifdef __APPLE_COCOA__ - CGContextClipToRects(fl_gc, r->rects, r->count); + CGContextClipToRects(fl_gc, r->rects, r->count); #else - ClipCGContextToRegion(fl_gc, &portRect, r); + Rect portRect; + portRect.top = 0; + portRect.left = 0; + portRect.bottom = CGBitmapContextGetHeight(fl_gc); + portRect.right = CGBitmapContextGetWidth(fl_gc); + ClipCGContextToRegion(fl_gc, &portRect, r); #endif - } - Fl_X::q_fill_context(); + } + Fl_X::q_fill_context(); } #else # error unsupported platform |
