Index: src/gpu/GrPath.cpp |
diff --git a/src/gpu/GrPath.cpp b/src/gpu/GrPath.cpp |
index 4e1119dfbb45036f2a38cd9135006454364c29e2..8ac356dd2d2f8845c347987754b77c5256041a7c 100644 |
--- a/src/gpu/GrPath.cpp |
+++ b/src/gpu/GrPath.cpp |
@@ -36,7 +36,8 @@ inline static bool compute_key_for_line_path(const SkPath& path, const GrStrokeI |
inline static bool compute_key_for_oval_path(const SkPath& path, const GrStrokeInfo& stroke, |
GrUniqueKey* key) { |
SkRect rect; |
- if (!path.isOval(&rect)) { |
+ // Point order is significant when dashing, so we cannot devolve to a rect key. |
+ if (stroke.isDashed() || !path.isOval(&rect)) { |
return false; |
} |
static_assert((sizeof(rect) % sizeof(uint32_t)) == 0 && sizeof(rect) > sizeof(uint32_t), |
@@ -171,3 +172,20 @@ void GrPath::ComputeKey(const SkPath& path, const GrStrokeInfo& stroke, GrUnique |
*outIsVolatile = path.isVolatile(); |
} |
+#ifdef SK_DEBUG |
+bool GrPath::isEqualTo(const SkPath& path, const GrStrokeInfo& stroke) const { |
+ if (!fStroke.hasEqualEffect(stroke)) { |
+ return false; |
+ } |
+ |
+ // We treat same-rect ovals as identical - but only when not dashing. |
+ SkRect ovalBounds; |
+ if (!fStroke.isDashed() && fSkPath.isOval(&ovalBounds)) { |
+ SkRect otherOvalBounds; |
+ return path.isOval(&otherOvalBounds) && ovalBounds == otherOvalBounds; |
+ } |
+ |
+ return fSkPath == path; |
+} |
+#endif |
+ |