[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: supportsDrawGState
From: |
Eric Wasylishen |
Subject: |
Re: supportsDrawGState |
Date: |
Tue, 14 Jun 2011 10:31:32 -0600 |
Hi Quentin & Fred,
>
> Before Eric's composite rewrite two months ago or so, there was no DPSgsave()
> and DPSrestore() around the final drawing code in -nativeDrawInRect:… see
> http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSImage.m?revision=32434&view=markup
> Unless I'm overlooking something, a possible solution could be:
>
> //NSLog(@"Draw in %@ from %@ from cache rect %@",
> NSStringFromRect(dstRect),
> // NSStringFromRect(srcRect), NSStringFromRect(srcRectInCache));
>
> NSAffineTransform *currentCTM = [ctxt GSCurrentCTM]; <--- rather DPSsave()
>
> transform = [NSAffineTransform transform];
> [transform translateXBy: dstRect.origin.x yBy: dstRect.origin.y];
> [transform scaleXBy: dstRect.size.width / srcRectInCache.size.width
> yBy: dstRect.size.height / srcRectInCache.size.height];
> [transform concat];
>
> [ctxt GSdraw: gState
> toPoint: NSMakePoint(0,0)
> fromRect: srcRectInCache
> operation: op
> fraction: delta];
>
> [ctxt GSSetCTM: currentCTM]; <--- rather DPSrestore()
>
> [ctxt GSUndefineGState: gState];
> DESTROY(cache);
>
> What do you think?
>
> Cheers,
> Quentin.
Sorry, that was my mistake - I don't know why I added the DPSgsave/DPSgrestore.
I committed Quentin's patch and drawing images with a non-rectangular clip
works again. btw, I have a test case which I'll commit to GSTest soon.
Cheers
Eric