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

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

Issue 719203002: Add GrProcOptInfo class to track various output information for color and coverage stages. (Closed) Base URL: https://skia.googlesource.com/skia.git@moveIO
Patch Set: initialize values Created 6 years, 1 month 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 | « gyp/gpu.gypi ('k') | src/gpu/GrDrawState.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 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 void setToUnknown(ReadInput readsInput) { 87 void setToUnknown(ReadInput readsInput) {
88 this->internalSetToUnknown(); 88 this->internalSetToUnknown();
89 fNonMulStageFound= true; 89 fNonMulStageFound= true;
90 if (kWillNot_ReadInput == readsInput) { 90 if (kWillNot_ReadInput == readsInput) {
91 fWillUseInputColor = false; 91 fWillUseInputColor = false;
92 } 92 }
93 } 93 }
94 94
95 bool isOpaque() const {
96 return ((fValidFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpack A(fColor));
97 }
98
99 bool isSolidWhite() const {
100 return (fValidFlags == kRGBA_GrColorComponentFlags && 0xFFFFFFFF == fCol or);
101 }
102
103 GrColor color() const { return fColor; } 95 GrColor color() const { return fColor; }
104 uint8_t validFlags() const { return fValidFlags; } 96 uint8_t validFlags() const { return fValidFlags; }
105 97
106 bool willUseInputColor() const { return fWillUseInputColor; }
107 void resetWillUseInputColor() { fWillUseInputColor = true; }
108
109 void resetNonMulStageFound() { fNonMulStageFound = false; }
110
111 /** 98 /**
112 * If isSingleComponent is true, then the flag values for r, g, b, and a mus t all be the 99 * If isSingleComponent is true, then the flag values for r, g, b, and a mus t all be the
113 * same. If the flags are all set then all color components must be equal. 100 * same. If the flags are all set then all color components must be equal.
114 */ 101 */
115 SkDEBUGCODE(void validate() const;) 102 SkDEBUGCODE(void validate() const;)
116 103
117 protected: 104 protected:
118 GrColor fColor; 105 GrColor fColor;
119 uint32_t fValidFlags; 106 uint32_t fValidFlags;
120 bool fIsSingleComponent; 107 bool fIsSingleComponent;
121 bool fNonMulStageFound; 108 bool fNonMulStageFound;
122 bool fWillUseInputColor; 109 bool fWillUseInputColor;
123 110
124 private: 111 private:
112 friend class GrProcOptInfo;
113
114 void reset(GrColor color, GrColorComponentFlags flags, bool isSingleComponen t) {
115 fColor = color;
116 fValidFlags = flags;
117 fIsSingleComponent = isSingleComponent;
118 fNonMulStageFound = false;
119 fWillUseInputColor = true;
120 }
121
125 void internalSetToTransparentBlack() { 122 void internalSetToTransparentBlack() {
126 fValidFlags = kRGBA_GrColorComponentFlags; 123 fValidFlags = kRGBA_GrColorComponentFlags;
127 fColor = 0; 124 fColor = 0;
128 fIsSingleComponent = true; 125 fIsSingleComponent = true;
129 } 126 }
130 127
131 void internalSetToUnknown() { 128 void internalSetToUnknown() {
132 fValidFlags = 0; 129 fValidFlags = 0;
133 fIsSingleComponent = false; 130 fIsSingleComponent = false;
134 } 131 }
135 132
136 bool hasZeroAlpha() const { 133 bool hasZeroAlpha() const {
137 return ((fValidFlags & kA_GrColorComponentFlag) && 0 == GrColorUnpackA(f Color)); 134 return ((fValidFlags & kA_GrColorComponentFlag) && 0 == GrColorUnpackA(f Color));
138 } 135 }
139 136
137 bool isOpaque() const {
138 return ((fValidFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpack A(fColor));
139 }
140
141 bool isSolidWhite() const {
142 return (fValidFlags == kRGBA_GrColorComponentFlags && 0xFFFFFFFF == fCol or);
143 }
144
145 bool willUseInputColor() const { return fWillUseInputColor; }
146 void resetWillUseInputColor() { fWillUseInputColor = true; }
147
148 void resetNonMulStageFound() { fNonMulStageFound = false; }
149
140 SkDEBUGCODE(bool colorComponentsAllEqual() const;) 150 SkDEBUGCODE(bool colorComponentsAllEqual() const;)
141 /** 151 /**
142 * If alpha is valid, check that any valid R,G,B values are <= A 152 * If alpha is valid, check that any valid R,G,B values are <= A
143 */ 153 */
144 SkDEBUGCODE(bool validPreMulColor() const;) 154 SkDEBUGCODE(bool validPreMulColor() const;)
145 }; 155 };
146 156
147 #endif 157 #endif
148 158
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698