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

Side by Side Diff: include/gpu/GrInvariantOutput.h

Issue 1348583002: Make skpaint->grpaint flow work for composing draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: small cleanup Created 5 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 #ifndef GrInvariantOutput_DEFINED 8 #ifndef GrInvariantOutput_DEFINED
9 #define GrInvariantOutput_DEFINED 9 #define GrInvariantOutput_DEFINED
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 fColor = color; 214 fColor = color;
215 fIsSingleComponent = false; 215 fIsSingleComponent = false;
216 fNonMulStageFound = true; 216 fNonMulStageFound = true;
217 if (kWillNot_ReadInput == readsInput) { 217 if (kWillNot_ReadInput == readsInput) {
218 fWillUseInputColor = false; 218 fWillUseInputColor = false;
219 } 219 }
220 if (kRGBA_GrColorComponentFlags == fValidFlags) { 220 if (kRGBA_GrColorComponentFlags == fValidFlags) {
221 uint32_t a; 221 uint32_t a;
222 if (GetAlphaAndCheckSingleChannel(color, &a)) { 222 if (GetAlphaAndCheckSingleChannel(color, &a)) {
223 fIsSingleComponent = true; 223 fIsSingleComponent = true;
224 } 224 }
robertphillips 2015/09/25 19:52:17 rm this else ?
bsalomon 2015/09/25 20:45:07 Done.
225 } else if (kA_GrColorComponentFlag & fValidFlags) { 225 } else if (kA_GrColorComponentFlag & fValidFlags) {
226 // Assuming fColor is premul means if a is 0 the color must be all 0 s.
227 if (!GrColorUnpackA(fColor)) {
228 this->internalSetToTransparentBlack();
229 }
230 } 226 }
231 SkDEBUGCODE(this->validate()); 227 SkDEBUGCODE(this->validate());
232 } 228 }
233 229
234 void setToUnknown(ReadInput readsInput) { 230 void setToUnknown(ReadInput readsInput) {
235 SkDEBUGCODE(this->validate()); 231 SkDEBUGCODE(this->validate());
236 this->internalSetToUnknown(); 232 this->internalSetToUnknown();
237 fNonMulStageFound= true; 233 fNonMulStageFound= true;
238 if (kWillNot_ReadInput == readsInput) { 234 if (kWillNot_ReadInput == readsInput) {
239 fWillUseInputColor = false; 235 fWillUseInputColor = false;
240 } 236 }
241 SkDEBUGCODE(this->validate()); 237 SkDEBUGCODE(this->validate());
242 } 238 }
243 239
244 // Temporary setter to handle LCD text correctly until we improve texture pi xel config queries 240 // Temporary setter to handle LCD text correctly until we improve texture pi xel config queries
245 // and thus can rely solely on number of coverage components for RGA vs sing le channel coverage. 241 // and thus can rely solely on number of coverage components for RGA vs sing le channel coverage.
246 void setUsingLCDCoverage() { 242 void setUsingLCDCoverage() {
247 fIsLCDCoverage = true; 243 fIsLCDCoverage = true;
248 } 244 }
249 245
250 GrColor color() const { return fColor; } 246 GrColor color() const { return fColor; }
251 GrColorComponentFlags validFlags() const { return fValidFlags; } 247 GrColorComponentFlags validFlags() const { return fValidFlags; }
248 bool willUseInputColor() const { return fWillUseInputColor; }
252 249
253 /** 250 /**
254 * If isSingleComponent is true, then the flag values for r, g, b, and a mus t all be the 251 * If isSingleComponent is true, then the flag values for r, g, b, and a mus t all be the
255 * same. If the flags are all set then all color components must be equal. 252 * same. If the flags are all set then all color components must be equal.
256 */ 253 */
257 SkDEBUGCODE(void validate() const;) 254 SkDEBUGCODE(void validate() const;)
258 255
259 private: 256 private:
260 friend class GrProcOptInfo; 257 friend class GrProcOptInfo;
261 258
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 bool isOpaque() const { 298 bool isOpaque() const {
302 return ((fValidFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpack A(fColor)); 299 return ((fValidFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpack A(fColor));
303 } 300 }
304 301
305 bool isSolidWhite() const { 302 bool isSolidWhite() const {
306 return (fValidFlags == kRGBA_GrColorComponentFlags && 0xFFFFFFFF == fCol or); 303 return (fValidFlags == kRGBA_GrColorComponentFlags && 0xFFFFFFFF == fCol or);
307 } 304 }
308 305
309 bool isSingleComponent() const { return fIsSingleComponent; } 306 bool isSingleComponent() const { return fIsSingleComponent; }
310 307
311 bool willUseInputColor() const { return fWillUseInputColor; }
312 void resetWillUseInputColor() { fWillUseInputColor = true; } 308 void resetWillUseInputColor() { fWillUseInputColor = true; }
313 309
314 bool allStagesMulInput() const { return !fNonMulStageFound; } 310 bool allStagesMulInput() const { return !fNonMulStageFound; }
315 void resetNonMulStageFound() { fNonMulStageFound = false; } 311 void resetNonMulStageFound() { fNonMulStageFound = false; }
316 312
317 bool isLCDCoverage() const { return fIsLCDCoverage; } 313 bool isLCDCoverage() const { return fIsLCDCoverage; }
318 314
319 SkDEBUGCODE(bool colorComponentsAllEqual() const;) 315 SkDEBUGCODE(bool colorComponentsAllEqual() const;)
320 /** 316 /**
321 * If alpha is valid, check that any valid R,G,B values are <= A 317 * If alpha is valid, check that any valid R,G,B values are <= A
322 */ 318 */
323 SkDEBUGCODE(bool validPreMulColor() const;) 319 SkDEBUGCODE(bool validPreMulColor() const;)
324 320
325 GrColor fColor; 321 GrColor fColor;
326 GrColorComponentFlags fValidFlags; 322 GrColorComponentFlags fValidFlags;
327 bool fIsSingleComponent; 323 bool fIsSingleComponent;
328 bool fNonMulStageFound; 324 bool fNonMulStageFound;
329 bool fWillUseInputColor; 325 bool fWillUseInputColor;
330 bool fIsLCDCoverage; // Temorary data member until texture pixel configs are updated 326 bool fIsLCDCoverage; // Temorary data member until texture pixel configs are updated
331 327
332 }; 328 };
333 329
334 #endif 330 #endif
335 331
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698