Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1404)

Unified Diff: Source/platform/graphics/GraphicsContext.cpp

Issue 1147343003: Drop fillRule state from GraphicsContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/GraphicsContext.h ('k') | Source/platform/graphics/GraphicsContextState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/GraphicsContext.cpp
diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp
index 6e0d04afe53013f1eb2edd9e1ea2bf2340116e78..c9dca80fc616908462fd9bc9cbdaddc36fc0feea 100644
--- a/Source/platform/graphics/GraphicsContext.cpp
+++ b/Source/platform/graphics/GraphicsContext.cpp
@@ -1114,16 +1114,7 @@ void GraphicsContext::fillPath(const Path& pathToFill)
if (contextDisabled() || pathToFill.isEmpty())
return;
- // Use const_cast and temporarily modify the fill type instead of copying the path.
- SkPath& path = const_cast<SkPath&>(pathToFill.skPath());
- SkPath::FillType previousFillType = path.getFillType();
-
- SkPath::FillType temporaryFillType = WebCoreWindRuleToSkFillType(immutableState()->fillRule());
- path.setFillType(temporaryFillType);
-
- drawPath(path, immutableState()->fillPaint());
-
- path.setFillType(previousFillType);
+ drawPath(pathToFill.skPath(), immutableState()->fillPaint());
}
void GraphicsContext::fillRect(const FloatRect& rect)
@@ -1467,6 +1458,7 @@ void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const Float
return;
Path path;
+ path.setWindRule(RULE_EVENODD);
path.addRect(rect);
if (!roundedHoleRect.radii().isZero())
@@ -1474,16 +1466,10 @@ void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const Float
else
path.addRect(roundedHoleRect.rect());
- WindRule oldFillRule = immutableState()->fillRule();
- Color oldFillColor = fillColor();
-
- setFillRule(RULE_EVENODD);
- setFillColor(color);
-
- fillPath(path);
+ SkPaint paint(immutableState()->fillPaint());
+ paint.setColor(color.rgb());
- setFillRule(oldFillRule);
- setFillColor(oldFillColor);
+ drawPath(path.skPath(), paint);
}
void GraphicsContext::clearRect(const FloatRect& rect)
« no previous file with comments | « Source/platform/graphics/GraphicsContext.h ('k') | Source/platform/graphics/GraphicsContextState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698