Combine analytic edges with tolerance
If not, we sometimes would end up with only one edge for a convex path. That
either triggers SkASSERT(count >= 2) failure in debug build or SIGSEGV in
release build. After the change, we should return 0 edges for such a path
because everything is totally combined.
Note that this change also makes the SkAnalyticEdge's CombineVertical function
behave more similarly to SkEdge's CombineVertical function: SkEdge only
compares fFirstY and fLastY which are integer values, which is equivalent to
setting our tolerance to SK_Fixed1 (our current tolerance is 0x100, 1/256 of
SK_Fixed1). And this is intentional.
BUG=chrome:662914
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2477373002
Review-Url: https://codereview.chromium.org/2477373002
diff --git a/gm/aaa.cpp b/gm/aaa.cpp
index d49d3f0..4788969 100644
--- a/gm/aaa.cpp
+++ b/gm/aaa.cpp
@@ -50,6 +50,17 @@
canvas->drawRectCoords(20, 200, 200, 200.1f, p);
canvas->drawCircle(100, 100, 30, p);
canvas->restore();
+
+ // The following path is empty but it'll reveal bug chrome:662914
+ SkPath path;
+ path.moveTo(SkBits2Float(0x429b9d5c), SkBits2Float(0x4367a041)); // 77.8073f, 231.626f
+ // 77.8075f, 231.626f, 77.8074f, 231.625f, 77.8073f, 231.625f
+ path.cubicTo(SkBits2Float(0x429b9d71), SkBits2Float(0x4367a022),
+ SkBits2Float(0x429b9d64), SkBits2Float(0x4367a009),
+ SkBits2Float(0x429b9d50), SkBits2Float(0x43679ff2));
+ path.lineTo(SkBits2Float(0x429b9d5c), SkBits2Float(0x4367a041)); // 77.8073f, 231.626f
+ path.close();
+ canvas->drawPath(path, p);
}
private: