summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorcaryclark@chromium.org <caryclark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-31 21:37:07 +0000
committercaryclark@chromium.org <caryclark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-31 21:37:07 +0000
commit368e5d436270f1657295dde0a7875277aeb591ae (patch)
tree71cb65defabfacca10ecc4bacc74f24eeb99ed16 /skia
parentdf18d796cfb434c8a58e7d5bd71f3a7508776c41 (diff)
downloadchromium_src-368e5d436270f1657295dde0a7875277aeb591ae.zip
chromium_src-368e5d436270f1657295dde0a7875277aeb591ae.tar.gz
chromium_src-368e5d436270f1657295dde0a7875277aeb591ae.tar.bz2
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
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/skia_utils_mac.mm10
1 files changed, 9 insertions, 1 deletions
diff --git a/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm
index ab44d82..6781a93 100644
--- a/skia/ext/skia_utils_mac.mm
+++ b/skia/ext/skia_utils_mac.mm
@@ -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();