aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrStyle.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-07-18 07:31:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-18 07:31:13 -0700
commit0ae36a2cebf35c68c3013383d3b640f70034be55 (patch)
treec5d335bf3bc6fc898b1811fcbc810918c943a187 /src/gpu/GrStyle.cpp
parent490c07d77670654ab77299323b56792bddbc053f (diff)
In GrShape detect that stroked axis-aligned lines are rrects.
Diffstat (limited to 'src/gpu/GrStyle.cpp')
-rw-r--r--src/gpu/GrStyle.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/gpu/GrStyle.cpp b/src/gpu/GrStyle.cpp
index 43718db97f..7ea5193b35 100644
--- a/src/gpu/GrStyle.cpp
+++ b/src/gpu/GrStyle.cpp
@@ -75,25 +75,30 @@ void GrStyle::WriteKey(uint32_t *key, const GrStyle &style, Apply apply, SkScala
GR_STATIC_ASSERT(SkPaint::kCapCount <= (1 << kCapBits));
// The cap type only matters for unclosed shapes. However, a path effect could unclose
// the shape before it is stroked.
- SkPaint::Cap cap;
- if ((flags & kClosed_KeyFlag) && !style.pathEffect()) {
- cap = SkPaint::kButt_Cap;
- } else {
+ SkPaint::Cap cap = SkPaint::kDefault_Cap;
+ if (!(flags & kClosed_KeyFlag) || style.pathEffect()) {
cap = style.strokeRec().getCap();
}
+ SkScalar miter = -1.f;
+ SkPaint::Join join = SkPaint::kDefault_Join;
+
+ // Dashing will not insert joins but other path effects may.
+ if (!(flags & kNoJoins_KeyFlag) || style.hasNonDashPathEffect()) {
+ join = style.strokeRec().getJoin();
+ // Miter limit only affects miter joins
+ if (SkPaint::kMiter_Join == join) {
+ miter = style.strokeRec().getMiter();
+ }
+ }
+
key[i++] = style.strokeRec().getStyle() |
- style.strokeRec().getJoin() << kJoinShift |
+ join << kJoinShift |
cap << kCapShift;
- SkScalar scalar;
- // Miter limit only affects miter joins
- scalar = SkPaint::kMiter_Join == style.strokeRec().getJoin()
- ? style.strokeRec().getMiter()
- : -1.f;
- memcpy(&key[i++], &scalar, sizeof(scalar));
+ memcpy(&key[i++], &miter, sizeof(miter));
- scalar = style.strokeRec().getWidth();
- memcpy(&key[i++], &scalar, sizeof(scalar));
+ SkScalar width = style.strokeRec().getWidth();
+ memcpy(&key[i++], &width, sizeof(width));
}
SkASSERT(KeySize(style, apply) == i);
}