Removed degenerate quads from zero radius Chrome-style round rects
https://codereview.appspot.com/6737059/
git-svn-id: http://skia.googlecode.com/svn/trunk@6053 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 9723db9..b8df23b 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1030,6 +1030,15 @@
// bounding box (and break the circle special case).
pts[0].set(oval.fRight, oval.centerY());
return 1;
+ } else if (0 == oval.width() && 0 == oval.height()) {
+ // Chrome will sometimes create 0 radius round rects. Having degenerate
+ // quad segments in the path prevents the path from being recognized as
+ // a rect.
+ // TODO: optimizing the case where only one of width or height is zero
+ // should also be considered. This case, however, doesn't seem to be
+ // as common as the single point case.
+ pts[0].set(oval.fRight, oval.fTop);
+ return 1;
}
SkVector start, stop;