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

Unified Diff: src/gpu/GrStyle.cpp

Issue 1949193002: Make cap only affect the keys of GrShapes that are possibly-open (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: due Created 4 years, 7 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/GrShapeTest.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 7d70baa1bcda4fc7e7395e8d1481849236f28d88..6480fb341a48a61219bc31488607d645d6dd08e8 100644
--- a/src/gpu/GrStyle.cpp
+++ b/src/gpu/GrStyle.cpp
@@ -7,7 +7,7 @@
#include "GrStyle.h"
-int GrStyle::KeySize(const GrStyle &style, Apply apply) {
+int GrStyle::KeySize(const GrStyle &style, Apply apply, uint32_t flags) {
GR_STATIC_ASSERT(sizeof(uint32_t) == sizeof(SkScalar));
int size = 0;
if (style.isDashed()) {
@@ -29,7 +29,7 @@ int GrStyle::KeySize(const GrStyle &style, Apply apply) {
return size;
}
-void GrStyle::WriteKey(uint32_t *key, const GrStyle &style, Apply apply) {
+void GrStyle::WriteKey(uint32_t *key, const GrStyle &style, Apply apply, uint32_t flags) {
SkASSERT(key);
SkASSERT(KeySize(style, apply) >= 0);
GR_STATIC_ASSERT(sizeof(uint32_t) == sizeof(SkScalar));
@@ -63,9 +63,17 @@ void GrStyle::WriteKey(uint32_t *key, const GrStyle &style, Apply apply) {
GR_STATIC_ASSERT(SkStrokeRec::kStyleCount <= (1 << kStyleBits));
GR_STATIC_ASSERT(SkPaint::kJoinCount <= (1 << kJoinBits));
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 {
+ cap = style.strokeRec().getCap();
+ }
key[i++] = style.strokeRec().getStyle() |
style.strokeRec().getJoin() << kJoinShift |
- style.strokeRec().getCap() << kCapShift;
+ cap << kCapShift;
SkScalar scalar;
// Miter limit only affects miter joins
« no previous file with comments | « src/gpu/GrStyle.h ('k') | tests/GrShapeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698