Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: src/gpu/GrPath.cpp

Issue 1457073002: [Reland] Fix NVPR assert for equivalent ovals (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: don't enable GpuDrawPath Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrPath.h ('k') | tests/GpuDrawPathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
+
« no previous file with comments | « src/gpu/GrPath.h ('k') | tests/GpuDrawPathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698