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

Unified Diff: src/gpu/GrStyle.cpp

Issue 2151313002: In GrShape detect that stroked axis-aligned lines are rrects. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Add accidentally delete semicolon back Created 4 years, 5 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 | « src/gpu/GrStyle.h ('k') | tests/DFPathRendererTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrStyle.cpp
diff --git a/src/gpu/GrStyle.cpp b/src/gpu/GrStyle.cpp
index 43718db97f3eade05336ee695e93f06ed39ffa23..7ea5193b35bf1eeb8f4b06b2292b6527fb1d146f 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);
}
« no previous file with comments | « src/gpu/GrStyle.h ('k') | tests/DFPathRendererTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698