Bug 1483120 - Sum SkDashPath intervals instead of subtracting. r=rhunt, a=RyanVM
authorLee Salzman <lsalzman@mozilla.com>
Wed, 22 Aug 2018 15:19:33 -0400
changeset 450034 df3fb67f0972d0582cfad2fe750432dddbb5e356
parent 450033 12213cfa93d9202807fe4074dd471d5704dc885d
child 450035 2d5cc6eecb7c9b3a1e41ab16136def8f695e6c05
push id151
push userryanvm@gmail.com
push dateThu, 23 Aug 2018 17:52:30 +0000
treeherdermozilla-esr60@b63eb86ff55a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt, RyanVM
bugs1483120
milestone60.1.1
Bug 1483120 - Sum SkDashPath intervals instead of subtracting. r=rhunt, a=RyanVM
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