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

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

Issue 617853003: Revert of Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 GrProcessor::InvariantOutput inout; 173 GrColor color;
174 inout.fIsSingleComponent = false; 174 uint32_t validComponentFlags;
175 if (!this->hasColorVertexAttribute()) { 175 if (!this->hasColorVertexAttribute()) {
176 inout.fColor = ds.getColor(); 176 color = ds.getColor();
177 inout.fValidFlags = kRGBA_GrColorComponentFlags; 177 validComponentFlags = kRGBA_GrColorComponentFlags;
178 } else { 178 } else {
179 if (ds.vertexColorsAreOpaque()) { 179 if (ds.vertexColorsAreOpaque()) {
180 inout.fColor = 0xFF << GrColor_SHIFT_A; 180 color = 0xFF << GrColor_SHIFT_A;
181 inout.fValidFlags = kA_GrColorComponentFlag; 181 validComponentFlags = kA_GrColorComponentFlag;
182 } else { 182 } else {
183 inout.fValidFlags = 0; 183 validComponentFlags = 0;
184 // not strictly necessary but we get false alarms from tools about u ninit. 184 color = 0; // not strictly necessary but we get false alarms from to ols about uninit.
185 inout.fColor = 0;
186 } 185 }
187 } 186 }
188 187
189 for (int i = 0; i < ds.numColorStages(); ++i) { 188 for (int i = 0; i < ds.numColorStages(); ++i) {
190 const GrFragmentProcessor* fp = ds.getColorStage(i).getFragmentProcessor (); 189 const GrFragmentProcessor* fp = ds.getColorStage(i).getFragmentProcessor ();
191 if (!fp->willUseInputColor()) { 190 if (!fp->willUseInputColor()) {
192 firstColorStage = i; 191 firstColorStage = i;
193 fInputColorIsUsed = false; 192 fInputColorIsUsed = false;
194 } 193 }
195 fp->computeInvariantOutput(&inout); 194 fp->getConstantColorComponents(&color, &validComponentFlags);
196 if (kRGBA_GrColorComponentFlags == inout.fValidFlags) { 195 if (kRGBA_GrColorComponentFlags == validComponentFlags) {
197 firstColorStage = i + 1; 196 firstColorStage = i + 1;
198 fColor = inout.fColor; 197 fColor = color;
199 fInputColorIsUsed = true; 198 fInputColorIsUsed = true;
200 this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribB inding); 199 this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribB inding);
201 } 200 }
202 } 201 }
203 if (firstColorStage < ds.numColorStages()) { 202 if (firstColorStage < ds.numColorStages()) {
204 fColorStages.reset(&ds.getColorStage(firstColorStage), 203 fColorStages.reset(&ds.getColorStage(firstColorStage),
205 ds.numColorStages() - firstColorStage); 204 ds.numColorStages() - firstColorStage);
206 } else { 205 } else {
207 fColorStages.reset(); 206 fColorStages.reset();
208 } 207 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 } 330 }
332 } 331 }
333 332
334 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, 333 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices,
335 that.fFixedFunctionVertexAttribIndices, 334 that.fFixedFunctionVertexAttribIndices,
336 sizeof(this->fFixedFunctionVertexAttribIndices))); 335 sizeof(this->fFixedFunctionVertexAttribIndices)));
337 336
338 return true; 337 return true;
339 } 338 }
340 339
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