Hiding cast of WebCore WindRule to SkPath::FillType

Adding a inline helper function in SkiaUtils.h to hide the cast of WebCore Windrule to SkPath::FillType

Review URL: https://codereview.chromium.org/453233002

git-svn-id: svn://svn.chromium.org/blink/trunk@179968 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a697102f
......@@ -1271,7 +1271,7 @@ void GraphicsContext::fillPath(const Path& pathToFill)
SkPath& path = const_cast<SkPath&>(pathToFill.skPath());
SkPath::FillType previousFillType = path.getFillType();
SkPath::FillType temporaryFillType = static_cast<SkPath::FillType>(immutableState()->fillRule());
SkPath::FillType temporaryFillType = WebCoreWindRuleToSkFillType(immutableState()->fillRule());
path.setFillType(temporaryFillType);
drawPath(path, immutableState()->fillPaint());
......@@ -1462,7 +1462,7 @@ void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule)
SkPath& path = const_cast<SkPath&>(pathToClip.skPath());
SkPath::FillType previousFillType = path.getFillType();
SkPath::FillType temporaryFillType = static_cast<SkPath::FillType>(clipRule);
SkPath::FillType temporaryFillType = WebCoreWindRuleToSkFillType(clipRule);
path.setFillType(temporaryFillType);
clipPath(path, AntiAliased);
......@@ -1499,7 +1499,7 @@ void GraphicsContext::canvasClip(const Path& pathToClip, WindRule clipRule)
SkPath& path = const_cast<SkPath&>(pathToClip.skPath());
SkPath::FillType previousFillType = path.getFillType();
SkPath::FillType temporaryFillType = static_cast<SkPath::FillType>(clipRule);
SkPath::FillType temporaryFillType = WebCoreWindRuleToSkFillType(clipRule);
path.setFillType(temporaryFillType);
clipPath(path);
......
......@@ -277,7 +277,7 @@ WindRule Path::windRule() const
void Path::setWindRule(const WindRule rule)
{
m_path.setFillType(static_cast<SkPath::FillType>(rule));
m_path.setFillType(WebCoreWindRuleToSkFillType(rule));
}
void Path::moveTo(const FloatPoint& point)
......
......@@ -86,6 +86,11 @@ inline bool WebCoreFloatNearlyEqual(float a, float b)
return SkScalarNearlyEqual(WebCoreFloatToSkScalar(a), WebCoreFloatToSkScalar(b));
}
inline SkPath::FillType WebCoreWindRuleToSkFillType(WindRule rule)
{
return static_cast<SkPath::FillType>(rule);
}
// Determine if a given WebKit point is contained in a path
bool PLATFORM_EXPORT SkPathContainsPoint(const SkPath&, const FloatPoint&, SkPath::FillType);
......
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