From 5a950060d0d86cee44fcd82e820300f6c95fca93 Mon Sep 17 00:00:00 2001 From: Fred Kiefer Date: Mon, 13 Jun 2011 12:34:52 +0000 Subject: [PATCH] * Source/cairo/CairoContext.m (-supportsDrawGState): Delegate to gstate. * Headers/cairo/CairoGState.h (-supportsDrawGState): Declare this method. * Source/cairo/CairoGState.m (-supportsDrawGState): Only allow the faster drawing operation when the clip can be represented as a list of rectangles. * Source/cairo/CairoGState.m (-copyWithZone:): Always free the clip rectangle list. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@33289 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 10 ++++++++++ Headers/cairo/CairoGState.h | 1 + Source/cairo/CairoContext.m | 2 +- Source/cairo/CairoGState.m | 21 +++++++++++++++++++-- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 106fc28..6a1fd2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-06-13 Fred Kiefer + + * Source/cairo/CairoContext.m (-supportsDrawGState): Delegate to gstate. + * Headers/cairo/CairoGState.h (-supportsDrawGState): Declare this method. + * Source/cairo/CairoGState.m (-supportsDrawGState): Only allow the + faster drawing operation when the clip can be represented as a + list of rectangles. + * Source/cairo/CairoGState.m (-copyWithZone:): Always free the + clip rectangle list. + 2011-06-01 Wolfgang Lux * Headers/x11/XGServerWindow.h (GSMaxWMProtocols, _gswindow_device_t): diff --git a/Headers/cairo/CairoGState.h b/Headers/cairo/CairoGState.h index b8b322b..ad077ba 100644 --- a/Headers/cairo/CairoGState.h +++ b/Headers/cairo/CairoGState.h @@ -44,6 +44,7 @@ - (void) GSSetSurface: (CairoSurface *)surface : (int)x : (int)y; - (void) showPage; +- (BOOL) supportsDrawGState; @end #endif diff --git a/Source/cairo/CairoContext.m b/Source/cairo/CairoContext.m index 23ab4f0..884c2e7 100644 --- a/Source/cairo/CairoContext.m +++ b/Source/cairo/CairoContext.m @@ -98,7 +98,7 @@ - (BOOL) supportsDrawGState { - return YES; + return [CGSTATE supportsDrawGState]; } - (void) flushGraphics diff --git a/Source/cairo/CairoGState.m b/Source/cairo/CairoGState.m index 6c43db3..fc0f8a5 100644 --- a/Source/cairo/CairoGState.m +++ b/Source/cairo/CairoGState.m @@ -229,8 +229,6 @@ static float floatToUserSpace(NSAffineTransform *ctm, float f) cairo_clip(copy->_ct); } } - - cairo_rectangle_list_destroy(clip_rects); } else if (status == CAIRO_STATUS_CLIP_NOT_REPRESENTABLE) { @@ -248,6 +246,8 @@ static float floatToUserSpace(NSAffineTransform *ctm, float f) { NSLog(@"Cairo status '%s' in copy clip", cairo_status_to_string(status)); } + + cairo_rectangle_list_destroy(clip_rects); #endif } } @@ -1400,6 +1400,23 @@ _set_op(cairo_t *ct, NSCompositingOperation op) cairo_restore(_ct); } +- (BOOL) supportsDrawGState +{ +#if CAIRO_VERSION > CAIRO_VERSION_ENCODE(1, 4, 0) + cairo_rectangle_list_t *clip_rects; + cairo_status_t status; + + clip_rects = cairo_copy_clip_rectangle_list(_ct); + status = clip_rects->status; + cairo_rectangle_list_destroy(clip_rects); + if (status == CAIRO_STATUS_SUCCESS) + { + return YES; + } +#endif + return NO; +} + /** Unlike -compositeGState, -drawGSstate fully respects the AppKit CTM but doesn't support to use the receiver cairo target as the source. */ - (void) drawGState: (CairoGState *)source