aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-06-07 12:20:15 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-07 12:20:15 -0700
commitd67238421d661ea5dfd110a8028973801a7d42a1 (patch)
treeb7cccc55a5d78f765a90e79b386f8c1612cafc04 /src
parent3db2028126e12a9c1c1fb2f878d552a2de0e1452 (diff)
Make GrShape use the original path when path effect fails.
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrShape.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp
index 9fcc6ee911..7605cbf1ff 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.