aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/SkDashPath.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-11-04 13:33:50 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-04 13:33:50 -0800
commit9f2251c73ed6f417dd1057d487bf523e04488440 (patch)
tree8d2195fb4413dbd74b7cd7f6cd7c8a2c6c832f68 /src/utils/SkDashPath.cpp
parent0e66aaa503fd30b9860c0306ae20e8d7758b0fe6 (diff)
Crop the fast path dashed lines to the cull rect
Without: maxrss loops min median mean max stddev samples config bench 56M 1 13.3ms 13.6ms 13.6ms 14.2ms 2% Ooooo..... 8888 GM_dashing5_bw 56M 13 390us 417us 416us 459us 5% ooooO..o.o gpu GM_dashing5_bw 56M 1 13.4ms 13.9ms 14.1ms 15ms 3% Oooo..ooOo 8888 GM_dashing5_aa 56M 13 402us 421us 416us 425us 2% Ooo.ooOOOO gpu GM_dashing5_aa With: 40M 1 1.53ms 1.54ms 1.54ms 1.55ms 0% oo.O...o.. 8888 GM_dashing5_bw 40M 12 407us 412us 415us 445us 3% ...Oo..... gpu GM_dashing5_bw 40M 1 1.7ms 1.7ms 1.7ms 1.72ms 0% o.O....... 8888 GM_dashing5_aa 43M 13 405us 409us 409us 415us 1% ooo.Ooo..o gpu GM_dashing5_aa The GM images (including the new one) are the same with and without this CL. BUG=428296 Review URL: https://codereview.chromium.org/699623003
Diffstat (limited to 'src/utils/SkDashPath.cpp')
-rw-r--r--src/utils/SkDashPath.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp
index 3c4aef343d..02de98f1d6 100644
--- a/src/utils/SkDashPath.cpp
+++ b/src/utils/SkDashPath.cpp
@@ -115,14 +115,15 @@ static bool cull_path(const SkPath& srcPath, const SkStrokeRec& rec,
SkScalar minX = pts[0].fX;
SkScalar maxX = pts[1].fX;
- if (maxX < bounds.fLeft || minX > bounds.fRight) {
- return false;
- }
-
if (dx < 0) {
SkTSwap(minX, maxX);
}
+ SkASSERT(minX < maxX);
+ if (maxX < bounds.fLeft || minX > bounds.fRight) {
+ return false;
+ }
+
// Now we actually perform the chop, removing the excess to the left and
// right of the bounds (keeping our new line "in phase" with the dash,
// hence the (mod intervalLength).