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

Unified Diff: src/gpu/GrShape.cpp

Issue 2044793002: Make GrShape use the original path when path effect fails. (Closed) Base URL: https://skia.googlesource.com/skia.git@segments
Patch Set: update commnet Created 4 years, 6 months 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 | « no previous file | tests/GrShapeTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrShape.cpp
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp
index 9fcc6ee91158aca88bcea7366a9fadbf31936b3f..7605cbf1ffabebfc7ec3d12713cef8fa94150c96 100644
--- a/src/gpu/GrShape.cpp
+++ b/src/gpu/GrShape.cpp
@@ -204,11 +204,16 @@ GrShape::GrShape(const GrShape& parent, GrStyle::Apply apply, SkScalar scale) {
SkStrokeRec strokeRec = parent.fStyle.strokeRec();
strokeRec.setResScale(scale);
if (!pe->filterPath(fPath.get(), *srcForPathEffect, &strokeRec, nullptr)) {
- // Make an empty unstyled shape if filtering fails.
- fType = Type::kEmpty;
- fStyle = GrStyle();
- fPath.reset();
- return;
+ // If the path effect fails then we continue as though there was no path effect.
+ // If the original was a rrect that we couldn't canonicalize because of the path
+ // effect, then do so now.
+ if (parent.fType == Type::kRRect && (parent.fRRectDir != kDefaultRRectDir ||
+ parent.fRRectStart != kDefaultRRectStart)) {
+ SkASSERT(srcForPathEffect == tmpPath.get());
+ tmpPath.get()->reset();
+ tmpPath.get()->addRRect(parent.fRRect, kDefaultRRectDir, kDefaultRRectDir);
+ }
+ *fPath.get() = *srcForPathEffect;
}
// A path effect has access to change the res scale but we aren't expecting it to and it
// would mess up our key computation.
« no previous file with comments | « no previous file | tests/GrShapeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698