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

Unified Diff: Source/core/platform/graphics/skia/SkiaUtils.cpp

Issue 19846006: Use const path in SkPathContainsPoint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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/core/platform/graphics/skia/SkiaUtils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/graphics/skia/SkiaUtils.cpp
diff --git a/Source/core/platform/graphics/skia/SkiaUtils.cpp b/Source/core/platform/graphics/skia/SkiaUtils.cpp
index 7c2bfdd806715bd001c8f385f575c76bd166b046..77ed53cf118a190e49be748d8754390ad18600d3 100644
--- a/Source/core/platform/graphics/skia/SkiaUtils.cpp
+++ b/Source/core/platform/graphics/skia/SkiaUtils.cpp
@@ -139,9 +139,9 @@ void ClipRectToCanvas(const GraphicsContext* context, const SkRect& srcRect, SkR
destRect->setEmpty();
}
-bool SkPathContainsPoint(SkPath* originalPath, const FloatPoint& point, SkPath::FillType ft)
+bool SkPathContainsPoint(const SkPath& originalPath, const FloatPoint& point, SkPath::FillType ft)
{
- SkRect bounds = originalPath->getBounds();
+ SkRect bounds = originalPath.getBounds();
// We can immediately return false if the point is outside the bounding
// rect. We don't use bounds.contains() here, since it would exclude
@@ -167,21 +167,17 @@ bool SkPathContainsPoint(SkPath* originalPath, const FloatPoint& point, SkPath::
SkRegion rgn;
SkRegion clip;
SkMatrix m;
- SkPath scaledPath;
-
- SkPath::FillType originalFillType = originalPath->getFillType();
- originalPath->setFillType(ft);
+ SkPath scaledPath(originalPath);
+ scaledPath.setFillType(ft);
m.setScale(scale, scale);
- originalPath->transform(m, &scaledPath);
+ scaledPath.transform(m, 0);
pdr. 2013/07/23 00:27:21 Oh my, we create a transform just to scale the pat
int x = static_cast<int>(floorf(0.5f + point.x() * scale));
int y = static_cast<int>(floorf(0.5f + point.y() * scale));
clip.setRect(x - 1, y - 1, x + 1, y + 1);
- bool contains = rgn.setPath(scaledPath, clip);
- originalPath->setFillType(originalFillType);
- return contains;
+ return rgn.setPath(scaledPath, clip);
}
} // namespace WebCore
« no previous file with comments | « Source/core/platform/graphics/skia/SkiaUtils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698