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

Side by Side Diff: src/gpu/GrShape.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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrShape.h ('k') | src/gpu/GrStyle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrShape.h" 8 #include "GrShape.h"
9 9
10 GrShape& GrShape::operator=(const GrShape& that) { 10 GrShape& GrShape::operator=(const GrShape& that) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 int parentCnt = parent.fInheritedKey.count(); 96 int parentCnt = parent.fInheritedKey.count();
97 bool useParentGeoKey = !parentCnt; 97 bool useParentGeoKey = !parentCnt;
98 if (useParentGeoKey) { 98 if (useParentGeoKey) {
99 parentCnt = parent.unstyledKeySize(); 99 parentCnt = parent.unstyledKeySize();
100 if (parentCnt < 0) { 100 if (parentCnt < 0) {
101 // The parent's geometry has no key so we will have no key. 101 // The parent's geometry has no key so we will have no key.
102 fPath.get()->setIsVolatile(true); 102 fPath.get()->setIsVolatile(true);
103 return; 103 return;
104 } 104 }
105 } 105 }
106 int styleCnt = GrStyle::KeySize(parent.fStyle, apply); 106 uint32_t styleKeyFlags = 0;
107 if (parent.knownToBeClosed()) {
108 styleKeyFlags |= GrStyle::kClosed_KeyFlag;
109 }
110 int styleCnt = GrStyle::KeySize(parent.fStyle, apply, styleKeyFlags);
107 if (styleCnt < 0) { 111 if (styleCnt < 0) {
108 // The style doesn't allow a key, set the path to volatile so that w e fail when 112 // The style doesn't allow a key, set the path to volatile so that w e fail when
109 // we try to get a key for the shape. 113 // we try to get a key for the shape.
110 fPath.get()->setIsVolatile(true); 114 fPath.get()->setIsVolatile(true);
111 return; 115 return;
112 } 116 }
113 fInheritedKey.reset(parentCnt + styleCnt); 117 fInheritedKey.reset(parentCnt + styleCnt);
114 if (useParentGeoKey) { 118 if (useParentGeoKey) {
115 // This will be the geo key. 119 // This will be the geo key.
116 parent.writeUnstyledKey(fInheritedKey.get()); 120 parent.writeUnstyledKey(fInheritedKey.get());
117 } else { 121 } else {
118 // This should be (geo,path_effect). 122 // This should be (geo,path_effect).
119 memcpy(fInheritedKey.get(), parent.fInheritedKey.get(), 123 memcpy(fInheritedKey.get(), parent.fInheritedKey.get(),
120 parentCnt * sizeof(uint32_t)); 124 parentCnt * sizeof(uint32_t));
121 } 125 }
122 // Now turn (geo,path_effect) or (geo) into (geo,path_effect,stroke) 126 // Now turn (geo,path_effect) or (geo) into (geo,path_effect,stroke)
123 GrStyle::WriteKey(fInheritedKey.get() + parentCnt, parent.fStyle, apply) ; 127 GrStyle::WriteKey(fInheritedKey.get() + parentCnt, parent.fStyle, apply, styleKeyFlags);
124 } 128 }
125 } 129 }
126 130
127 GrShape::GrShape(const GrShape& that) : fType(that.fType), fStyle(that.fStyle) { 131 GrShape::GrShape(const GrShape& that) : fType(that.fType), fStyle(that.fStyle) {
128 switch (fType) { 132 switch (fType) {
129 case Type::kEmpty: 133 case Type::kEmpty:
130 return; 134 return;
131 case Type::kRRect: 135 case Type::kRRect:
132 fRRect = that.fRRect; 136 fRRect = that.fRRect;
133 return; 137 return;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 srcForStrokeRec = tmpPath.init(); 214 srcForStrokeRec = tmpPath.init();
211 parent.asPath(tmpPath.get()); 215 parent.asPath(tmpPath.get());
212 } 216 }
213 SkASSERT(parent.fStyle.strokeRec().needToApply()); 217 SkASSERT(parent.fStyle.strokeRec().needToApply());
214 SkAssertResult(parent.fStyle.strokeRec().applyToPath(fPath.get(), *srcFo rStrokeRec)); 218 SkAssertResult(parent.fStyle.strokeRec().applyToPath(fPath.get(), *srcFo rStrokeRec));
215 fStyle.resetToInitStyle(SkStrokeRec::kFill_InitStyle); 219 fStyle.resetToInitStyle(SkStrokeRec::kFill_InitStyle);
216 } 220 }
217 this->attemptToReduceFromPath(); 221 this->attemptToReduceFromPath();
218 this->setInheritedKey(*parentForKey, apply); 222 this->setInheritedKey(*parentForKey, apply);
219 } 223 }
OLDNEW
« no previous file with comments | « src/gpu/GrShape.h ('k') | src/gpu/GrStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698