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

Unified Diff: src/core/SkDraw.cpp

Issue 1003813003: some utils for rect and matrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 | « include/gpu/GrCoordTransform.h ('k') | src/core/SkRRect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index bd4e40e9f112c3acea7fb874023701b63bc29d33..ef268bfed341452e3414243f5bba093d9128d888 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -2181,11 +2181,7 @@ static bool compute_bounds(const SkPath& devPath, const SkIRect* clipBounds,
}
// init our bounds from the path
- {
- SkRect pathBounds = devPath.getBounds();
- pathBounds.inset(-SK_ScalarHalf, -SK_ScalarHalf);
- pathBounds.roundOut(bounds);
- }
+ *bounds = devPath.getBounds().makeOutset(SK_ScalarHalf, SK_ScalarHalf).roundOut();
SkIPoint margin = SkIPoint::Make(0, 0);
if (filter) {
@@ -2204,7 +2200,6 @@ static bool compute_bounds(const SkPath& devPath, const SkIRect* clipBounds,
// (possibly) trim the bounds to reflect the clip
// (plus whatever slop the filter needs)
if (clipBounds) {
- SkIRect tmp = *clipBounds;
// Ugh. Guard against gigantic margins from wacky filters. Without this
// check we can request arbitrary amounts of slop beyond our visible
// clip, and bring down the renderer (at least on finite RAM machines
@@ -2212,9 +2207,8 @@ static bool compute_bounds(const SkPath& devPath, const SkIRect* clipBounds,
// quality of large filters like blurs, and the corresponding memory
// requests.
static const int MAX_MARGIN = 128;
- tmp.inset(-SkMin32(margin.fX, MAX_MARGIN),
- -SkMin32(margin.fY, MAX_MARGIN));
- if (!bounds->intersect(tmp)) {
+ if (!bounds->intersect(clipBounds->makeOutset(SkMin32(margin.fX, MAX_MARGIN),
+ SkMin32(margin.fY, MAX_MARGIN)))) {
return false;
}
}
« no previous file with comments | « include/gpu/GrCoordTransform.h ('k') | src/core/SkRRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698