[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSgradient bug
From: |
Fred Kiefer |
Subject: |
Re: NSgradient bug |
Date: |
Sun, 24 Nov 2013 21:26:25 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
On 24.11.2013 13:02, Riccardo Canalicchio wrote:
> hi there,
> i'm unable to draw a gradient clipped by a bezierpath.
> I'm trying to fill a roundeded rectangle path with a gradient
> here you can see the code that i'm using to draw:
> https://github.com/nongio/gs-testDrawing
>
> I don't know if it is a cairo backend problem or a NSGradient bug...
> I managed to get it works changing drawInBezierPath method of NSGradients:
>
> [currentContext saveGraphicsState];
> [path addClip];
> [self drawInRect: [path bounds] angle: angle];
> [currentContext restoreGraphicsState];
>
> I have changed drawInRect with drawFromPoint:toPoint
Thank you very much for reporting this problem. I used your example
application and was able to reproduce the issue. When I remove the
saveGraphicsState/restoreGraphicsState calls from drawInRect:angle: it
works as expected.
Looking at the cairo backend code again the memory comes back. We are
only able to transfer the clip if it is representable by a set of
rectangles. Which of course is not the case for your rounded corners.
This is a limitation of the cairo backend that we have to live with.
Looks like I need to find a simple solution for the NSGradient code.
It will be easy to move the rest of the code into a new helper method
and use it from both places.
Fred
- NSgradient bug, Riccardo Canalicchio, 2013/11/24
- Re: NSgradient bug,
Fred Kiefer <=