Set CG clip to empty explicitly

Skia draws Mac user elements by creating a CoreGraphics context
that mirrors Skia's SkCanvas' context.

CoreGraphics does not consider a newly created path to be empty.
Explicitly set it to empty so the subsequent drawing is clipped out.

BUG: 111642
TEST: http://jsfiddle.net/kenjibaheux/UN3Dt/3/

Review URL: http://codereview.chromium.org/9104010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119962 0039d316-1c4b-4281-b951-d872f2087c98
parent df18d796
......@@ -333,7 +333,15 @@ CGContextRef SkiaBitLocker::cgContext() {
// Apply clip in device coordinates.
CGMutablePathRef clipPath = CGPathCreateMutable();
SkRegion::Iterator iter(canvas_->getTotalClip());
const SkRegion& clipRgn = canvas_->getTotalClip();
if (clipRgn.isEmpty()) {
// CoreGraphics does not consider a newly created path to be empty.
// Explicitly set it to empty so the subsequent drawing is clipped out.
// It would be better to make the CGContext hidden if there was a CG call
// that does that.
CGPathAddRect(clipPath, 0, CGRectMake(0, 0, 0, 0));
}
SkRegion::Iterator iter(clipRgn);
const SkIPoint& pt = device->getOrigin();
for (; !iter.done(); iter.next()) {
SkIRect skRect = iter.rect();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment