Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/Path.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/Path.cpp b/third_party/WebKit/Source/platform/graphics/Path.cpp |
| index 32fd602081e6e29a922e4419b2b2bb64eed088fd..2f8eb3686a4021f36d5cc684e8adbe333618251d 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/Path.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/Path.cpp |
| @@ -74,12 +74,16 @@ bool Path::operator==(const Path& other) const |
| bool Path::contains(const FloatPoint& point) const |
| { |
| - return SkPathContainsPoint(m_path, point, m_path.getFillType()); |
| + return m_path.contains(WebCoreFloatToSkScalar(point.x()), WebCoreFloatToSkScalar(point.y())); |
| } |
| bool Path::contains(const FloatPoint& point, WindRule rule) const |
| { |
| - return SkPathContainsPoint(m_path, point, WebCoreWindRuleToSkFillType(rule)); |
| + SkPath::FillType previousFillType = m_path.getFillType(); |
| + const_cast<SkPath&>(m_path).setFillType(WebCoreWindRuleToSkFillType(rule)); |
|
fs
2015/12/18 15:43:44
Yes, this is pretty horrendous...
f(malita)
2015/12/18 15:56:22
How about something like
if (WebCoreWindRuleToS
fs
2015/12/18 16:48:02
Yes, maybe that's a reasonable trade-off - hopeful
|
| + bool isInside = m_path.contains(WebCoreFloatToSkScalar(point.x()), WebCoreFloatToSkScalar(point.y())); |
| + const_cast<SkPath&>(m_path).setFillType(previousFillType); |
| + return isInside; |
| } |
| // FIXME: this method ignores the CTM and may yield inaccurate results for large scales. |
| @@ -100,7 +104,7 @@ SkPath Path::strokePath(const StrokeData& strokeData) const |
| bool Path::strokeContains(const FloatPoint& point, const StrokeData& strokeData) const |
| { |
| - return SkPathContainsPoint(strokePath(strokeData), point, SkPath::kWinding_FillType); |
| + return strokePath(strokeData).contains(WebCoreFloatToSkScalar(point.x()), WebCoreFloatToSkScalar(point.y())); |
| } |
| FloatRect Path::boundingRect() const |