aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrShape.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-07-20 07:15:44 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-20 07:15:44 -0700
commit487f8d385be2e0dcc7e46339d7bb12e4820b91c8 (patch)
tree93d93a09d3f46a8acfe22bdbb366fc20c63c3183 /src/gpu/GrShape.cpp
parentfbbf01af042e246602413483c690cd8b77e9d3f5 (diff)
Consolidate special case shape transformation logic in GrShapeTest.
Enable all tests on all geometry types. Add conversion of fill+miter-stroke->fill for rect geometries in GrShape. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2157013003 Review-Url: https://codereview.chromium.org/2157013003
Diffstat (limited to 'src/gpu/GrShape.cpp')
-rw-r--r--src/gpu/GrShape.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp
index 698ff48373..65c982571d 100644
--- a/src/gpu/GrShape.cpp
+++ b/src/gpu/GrShape.cpp
@@ -403,6 +403,16 @@ void GrShape::attemptToSimplifyRRect() {
// Dashing ignores the inverseness (currently). skbug.com/5421
fRRectData.fInverted = false;
}
+ // Turn a stroke-and-filled miter rect into a filled rect. TODO: more rrect stroke shortcuts.
+ if (!fStyle.hasPathEffect() &&
+ fStyle.strokeRec().getStyle() == SkStrokeRec::kStrokeAndFill_Style &&
+ fStyle.strokeRec().getJoin() == SkPaint::kMiter_Join &&
+ fStyle.strokeRec().getMiter() >= SK_ScalarSqrt2 &&
+ fRRectData.fRRect.isRect()) {
+ SkScalar r = fStyle.strokeRec().getWidth() / 2;
+ fRRectData.fRRect = SkRRect::MakeRect(fRRectData.fRRect.rect().makeOutset(r, r));
+ fStyle = GrStyle::SimpleFill();
+ }
}
void GrShape::attemptToSimplifyLine() {