diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrPath.cpp | 20 | ||||
-rw-r--r-- | src/gpu/GrPath.h | 4 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/gpu/GrPath.cpp b/src/gpu/GrPath.cpp index 4e1119dfbb..8ac356dd2d 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 + diff --git a/src/gpu/GrPath.h b/src/gpu/GrPath.h index f74baf317d..2edfd4cb5e 100644 --- a/src/gpu/GrPath.h +++ b/src/gpu/GrPath.h @@ -36,9 +36,7 @@ public: const SkRect& getBounds() const { return fBounds; } #ifdef SK_DEBUG - bool isEqualTo(const SkPath& path, const GrStrokeInfo& stroke) { - return fSkPath == path && fStroke.hasEqualEffect(stroke); - } + bool isEqualTo(const SkPath& path, const GrStrokeInfo& stroke) const; #endif protected: |