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

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: 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
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 GrColor color;
174 uint32_t validComponentFlags; 174 uint32_t validComponentFlags;
175 bool isSingleComponent = false;
175 if (!this->hasColorVertexAttribute()) { 176 if (!this->hasColorVertexAttribute()) {
176 color = ds.getColor(); 177 color = ds.getColor();
177 validComponentFlags = kRGBA_GrColorComponentFlags; 178 validComponentFlags = kRGBA_GrColorComponentFlags;
178 } else { 179 } else {
179 if (ds.vertexColorsAreOpaque()) { 180 if (ds.vertexColorsAreOpaque()) {
180 color = 0xFF << GrColor_SHIFT_A; 181 color = 0xFF << GrColor_SHIFT_A;
181 validComponentFlags = kA_GrColorComponentFlag; 182 validComponentFlags = kA_GrColorComponentFlag;
182 } else { 183 } else {
183 validComponentFlags = 0; 184 validComponentFlags = 0;
184 color = 0; // not strictly necessary but we get false alarms from to ols about uninit. 185 color = 0; // not strictly necessary but we get false alarms from to ols about uninit.
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->getConstantColorComponents(&color, &validComponentFlags, &isSingleCo mponent);
195 if (kRGBA_GrColorComponentFlags == validComponentFlags) { 196 if (kRGBA_GrColorComponentFlags == validComponentFlags) {
196 firstColorStage = i + 1; 197 firstColorStage = i + 1;
197 fColor = color; 198 fColor = color;
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);
(...skipping 125 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

Powered by Google App Engine
This is Rietveld 408576698