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

Side by Side Diff: src/gpu/GrOptDrawState.cpp

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix isSolidWhite Created 6 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
« no previous file with comments | « src/gpu/GrDrawState.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('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 #include "GrOptDrawState.h" 8 #include "GrOptDrawState.h"
9 9
10 #include "GrDrawState.h" 10 #include "GrDrawState.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 ++dst; 163 ++dst;
164 } 164 }
165 fVACount -= numToRemove; 165 fVACount -= numToRemove;
166 fVAPtr = fOptVA.get(); 166 fVAPtr = fOptVA.get();
167 } 167 }
168 168
169 void GrOptDrawState::copyEffectiveColorStages(const GrDrawState& ds) { 169 void GrOptDrawState::copyEffectiveColorStages(const GrDrawState& ds) {
170 int firstColorStage = 0; 170 int firstColorStage = 0;
171 171
172 // Set up color and flags for ConstantColorComponent checks 172 // Set up color and flags for ConstantColorComponent checks
173 GrColor color; 173 GrProcessor::InvariantOutput inout;
174 uint32_t validComponentFlags; 174 inout.fIsSingleComponent = false;
175 if (!this->hasColorVertexAttribute()) { 175 if (!this->hasColorVertexAttribute()) {
176 color = ds.getColor(); 176 inout.fColor = ds.getColor();
177 validComponentFlags = kRGBA_GrColorComponentFlags; 177 inout.fValidFlags = kRGBA_GrColorComponentFlags;
178 } else { 178 } else {
179 if (ds.vertexColorsAreOpaque()) { 179 if (ds.vertexColorsAreOpaque()) {
180 color = 0xFF << GrColor_SHIFT_A; 180 inout.fColor = 0xFF << GrColor_SHIFT_A;
181 validComponentFlags = kA_GrColorComponentFlag; 181 inout.fValidFlags = kA_GrColorComponentFlag;
182 } else { 182 } else {
183 validComponentFlags = 0; 183 inout.fValidFlags = 0;
184 color = 0; // not strictly necessary but we get false alarms from to ols about uninit. 184 // not strictly necessary but we get false alarms from tools about u ninit.
185 inout.fColor = 0;
185 } 186 }
186 } 187 }
187 188
188 for (int i = 0; i < ds.numColorStages(); ++i) { 189 for (int i = 0; i < ds.numColorStages(); ++i) {
189 const GrFragmentProcessor* fp = ds.getColorStage(i).getFragmentProcessor (); 190 const GrFragmentProcessor* fp = ds.getColorStage(i).getFragmentProcessor ();
190 if (!fp->willUseInputColor()) { 191 if (!fp->willUseInputColor()) {
191 firstColorStage = i; 192 firstColorStage = i;
192 fInputColorIsUsed = false; 193 fInputColorIsUsed = false;
193 } 194 }
194 fp->getConstantColorComponents(&color, &validComponentFlags); 195 fp->computeInvariantOutput(&inout);
195 if (kRGBA_GrColorComponentFlags == validComponentFlags) { 196 if (kRGBA_GrColorComponentFlags == inout.fValidFlags) {
196 firstColorStage = i + 1; 197 firstColorStage = i + 1;
197 fColor = color; 198 fColor = inout.fColor;
198 fInputColorIsUsed = true; 199 fInputColorIsUsed = true;
199 this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribB inding); 200 this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribB inding);
200 } 201 }
201 } 202 }
202 if (firstColorStage < ds.numColorStages()) { 203 if (firstColorStage < ds.numColorStages()) {
203 fColorStages.reset(&ds.getColorStage(firstColorStage), 204 fColorStages.reset(&ds.getColorStage(firstColorStage),
204 ds.numColorStages() - firstColorStage); 205 ds.numColorStages() - firstColorStage);
205 } else { 206 } else {
206 fColorStages.reset(); 207 fColorStages.reset();
207 } 208 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 331 }
331 } 332 }
332 333
333 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, 334 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices,
334 that.fFixedFunctionVertexAttribIndices, 335 that.fFixedFunctionVertexAttribIndices,
335 sizeof(this->fFixedFunctionVertexAttribIndices))); 336 sizeof(this->fFixedFunctionVertexAttribIndices)));
336 337
337 return true; 338 return true;
338 } 339 }
339 340
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698