aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrShape.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-12-20 13:28:55 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-20 18:47:36 +0000
commit2fad74a0fdc5eb3f505a052849c3cbeffa6e2d17 (patch)
tree6a3ec7975dc7ff37a6e8ccfe817fc3ccbd723b18 /src/gpu/GrShape.cpp
parent939e6719abb657096b5837d67d594256aa69da45 (diff)
Make GrRenderTargetContext::drawPath() use GrShape to identify simpler
geometries. Change-Id: I24230efc8bcb60f00c0c855090e3311ad13d7da8 Reviewed-on: https://skia-review.googlesource.com/85962 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrShape.cpp')
-rw-r--r--src/gpu/GrShape.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp
index 8c56054135..4c9338409c 100644
--- a/src/gpu/GrShape.cpp
+++ b/src/gpu/GrShape.cpp
@@ -539,11 +539,22 @@ void GrShape::attemptToSimplifyPath() {
void GrShape::attemptToSimplifyRRect() {
SkASSERT(Type::kRRect == fType);
SkASSERT(!fInheritedKey.count());
- // TODO: This isn't valid for strokes.
if (fRRectData.fRRect.isEmpty()) {
- // Dashing ignores the inverseness currently. skbug.com/5421
- fType = fRRectData.fInverted && !fStyle.isDashed() ? Type::kInvertedEmpty : Type::kEmpty;
- return;
+ // An empty filled rrect is equivalent to a filled empty path with inversion preserved.
+ if (fStyle.isSimpleFill()) {
+ fType = fRRectData.fInverted ? Type::kInvertedEmpty : Type::kEmpty;
+ fStyle = GrStyle::SimpleFill();
+ return;
+ }
+ // Dashing a rrect with no width or height is equivalent to filling an emtpy path.
+ // When skbug.com/7387 is fixed this should be modified or removed as a dashed zero length
+ // line will produce cap geometry if the effect begins in an "on" interval.
+ if (fStyle.isDashed() && !fRRectData.fRRect.width() && !fRRectData.fRRect.height()) {
+ // Dashing ignores the inverseness (currently). skbug.com/5421.
+ fType = Type::kEmpty;
+ fStyle = GrStyle::SimpleFill();
+ return;
+ }
}
if (!this->style().hasPathEffect()) {
fRRectData.fDir = kDefaultRRectDir;