make SpecialLineRec::addSegment assert more permissive to accomodate rounding error
authorlsalzman <lsalzman@mozilla.com>
Mon, 8 Aug 2016 20:40:27 +0000 (13:40 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 8 Aug 2016 20:40:27 +0000 (13:40 -0700)
Because the driving code that calls SpecialLineRec::addSegment uses double precision,
when converted back to single precision this may round such that d0 and d1 are the same.
This causes the assert to trigger. The simplest thing to do here is to modify the assert
to not be so picky and allow the rare/occasional equality.

Downstream Firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1290628

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2209303004

Review-Url: https://codereview.chromium.org/2209303004

src/utils/SkDashPath.cpp

index e06c2d2..c0cdcc1 100644 (file)
@@ -186,7 +186,7 @@ public:
     }
 
     void addSegment(SkScalar d0, SkScalar d1, SkPath* path) const {
-        SkASSERT(d0 < fPathLength);
+        SkASSERT(d0 <= fPathLength);
         // clamp the segment to our length
         if (d1 > fPathLength) {
             d1 = fPathLength;