Bug 1483120 - sum SkDashPath intervals instead of subtracting. r=rhunt
authorLee Salzman <lsalzman@mozilla.com>
Wed, 22 Aug 2018 15:19:33 -0400
changeset 490658 54934de382c5b557678a9c3b2b25e7268b6fbeea
parent 490657 d7298a19ae439cd34380166828584051c40a3cb3
child 490659 9b67f745dd3777f0446ddea3ac93887b92cb4378
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1483120
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1483120 - sum SkDashPath intervals instead of subtracting. r=rhunt
gfx/skia/skia/src/utils/SkDashPath.cpp
--- a/gfx/skia/skia/src/utils/SkDashPath.cpp
+++ b/gfx/skia/skia/src/utils/SkDashPath.cpp
@@ -370,22 +370,23 @@ bool SkDashPath::InternalFilter(SkPath* 
     const SkPath* srcPtr = &src;
     if (cull_path(src, *rec, cullRect, intervalLength, &cullPathStorage)) {
         // if rect is closed, starts in a dash, and ends in a dash, add the initial join
         // potentially a better fix is described here: bug.skia.org/7445
         if (src.isRect(nullptr) && src.isLastContourClosed() && is_even(initialDashIndex)) {
             SkScalar pathLength = SkPathMeasure(src, false, rec->getResScale()).getLength();
             SkScalar endPhase = SkScalarMod(pathLength + initialDashLength, intervalLength);
             int index = 0;
-            while (endPhase > intervals[index]) {
-                endPhase -= intervals[index++];
+            SkScalar sum = 0;
+            while (endPhase > sum + intervals[index]) {
+                sum += intervals[index++];
                 SkASSERT(index <= count);
             }
             // if dash ends inside "on", or ends at beginning of "off"
-            if (is_even(index) == (endPhase > 0)) {
+            if (is_even(index) == (endPhase > sum)) {
                 SkPoint midPoint = src.getPoint(0);
                 // get vector at end of rect
                 int last = src.countPoints() - 1;
                 while (midPoint == src.getPoint(last)) {
                     --last;
                     SkASSERT(last >= 0);
                 }
                 // get vector at start of rect