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

Unified Diff: tools/sk_tool_utils.cpp

Issue 2214033002: Add new GM for occluded blurmask filter draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Appease compilers Created 4 years, 4 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 | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/sk_tool_utils.cpp
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index 38880f820433175da57c9ac5df2b911f2d7f0b29..0978058238a5890cf18061bf7141968c0c131c65 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -513,4 +513,36 @@ SkRect compute_central_occluder(const SkRRect& rr) {
return SkRect::MakeLTRB(newL, newT, newR, newB);
}
+// The widest inset rect
+SkRect compute_widest_occluder(const SkRRect& rr) {
+ const SkRect& r = rr.getBounds();
+
+ const SkVector& ul = rr.radii(SkRRect::kUpperLeft_Corner);
+ const SkVector& ur = rr.radii(SkRRect::kUpperRight_Corner);
+ const SkVector& lr = rr.radii(SkRRect::kLowerRight_Corner);
+ const SkVector& ll = rr.radii(SkRRect::kLowerLeft_Corner);
+
+ SkScalar maxT = SkTMax(ul.fY, ur.fY);
+ SkScalar maxB = SkTMax(ll.fY, lr.fY);
+
+ return SkRect::MakeLTRB(r.fLeft, r.fTop + maxT, r.fRight, r.fBottom - maxB);
+
+}
+
+// The tallest inset rect
+SkRect compute_tallest_occluder(const SkRRect& rr) {
+ const SkRect& r = rr.getBounds();
+
+ const SkVector& ul = rr.radii(SkRRect::kUpperLeft_Corner);
+ const SkVector& ur = rr.radii(SkRRect::kUpperRight_Corner);
+ const SkVector& lr = rr.radii(SkRRect::kLowerRight_Corner);
+ const SkVector& ll = rr.radii(SkRRect::kLowerLeft_Corner);
+
+ SkScalar maxL = SkTMax(ul.fX, ll.fX);
+ SkScalar maxR = SkTMax(ur.fX, lr.fX);
+
+ return SkRect::MakeLTRB(r.fLeft + maxL, r.fTop, r.fRight - maxR, r.fBottom);
+}
+
+
} // namespace sk_tool_utils
« no previous file with comments | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698