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

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: Less ugly. 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..069ce1eb6b70fcef1554098467b61c6ff9b3eb68 100644
--- a/third_party/WebKit/Source/platform/graphics/Path.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Path.cpp
@@ -74,12 +74,20 @@ 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));
+ SkScalar x = WebCoreFloatToSkScalar(point.x());
+ SkScalar y = WebCoreFloatToSkScalar(point.y());
+ SkPath::FillType fillType = WebCoreWindRuleToSkFillType(rule);
+ if (m_path.getFillType() != fillType) {
+ SkPath tmp(m_path);
+ tmp.setFillType(fillType);
+ return tmp.contains(x, y);
+ }
+ return m_path.contains(x, y);
}
// FIXME: this method ignores the CTM and may yield inaccurate results for large scales.
@@ -100,7 +108,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