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

Unified Diff: third_party/WebKit/Source/platform/graphics/Path.cpp

Issue 1536803003: Drop SkPathContainsPoint in favor of SkPath::contains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify. Created 5 years 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 | « no previous file | third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698