From: <ho...@us...> - 2006-04-29 11:34:17
|
Revision: 6353 Author: hofman Date: 2006-04-29 04:33:56 -0700 (Sat, 29 Apr 2006) ViewCVS: http://svn.sourceforge.net/bibdesk/?rev=6353&view=rev Log Message: ----------- Save/restore the graphics state when it is affected. Modified Paths: -------------- trunk/bibdesk/NSImage+Toolbox.m Modified: trunk/bibdesk/NSImage+Toolbox.m =================================================================== --- trunk/bibdesk/NSImage+Toolbox.m 2006-04-29 11:33:11 UTC (rev 6352) +++ trunk/bibdesk/NSImage+Toolbox.m 2006-04-29 11:33:56 UTC (rev 6353) @@ -317,12 +317,15 @@ NSImage *flippedImage; NSAffineTransform *transform = [NSAffineTransform transform]; NSSize size = [self size]; + NSRect rect = {NSZeroPoint, size}; NSAffineTransformStruct flip = {-1.0, 0.0, 0.0, 1.0, size.width, 0.0}; flippedImage = [[[NSImage alloc] initWithSize:size] autorelease]; [flippedImage lockFocus]; - [transform setTransformStruct:flip]; + [NSGraphicsContext saveGraphicsState]; + [transform setTransformStruct:flip]; [transform concat]; - [self drawAtPoint:NSMakePoint(0, 0) fromRect:NSMakeRect(0, 0, size.width, size.height) operation:NSCompositeCopy fraction:1.0]; + [self drawAtPoint:NSZeroPoint fromRect:rect operation:NSCompositeCopy fraction:1.0]; + [NSGraphicsContext restoreGraphicsState]; [flippedImage unlockFocus]; return flippedImage; } @@ -338,8 +341,10 @@ [self drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; // blend with black to create a highlighted appearance + [NSGraphicsContext saveGraphicsState]; [[[NSColor blackColor] colorWithAlphaComponent:0.3] set]; NSRectFillUsingOperation(iconRect, NSCompositeSourceAtop); + [NSGraphicsContext restoreGraphicsState]; [newImage unlockFocus]; return [newImage autorelease]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |