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

Side by Side Diff: src/gpu/effects/GrTextureDomain.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/effects/GrTextureDomain.h ('k') | src/gpu/effects/GrYUVtoRGBEffect.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 2012 Google Inc. 2 * Copyright 2012 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 "gl/builders/GrGLProgramBuilder.h" 8 #include "gl/builders/GrGLProgramBuilder.h"
9 #include "GrTextureDomain.h" 9 #include "GrTextureDomain.h"
10 #include "GrSimpleTextureEffect.h" 10 #include "GrSimpleTextureEffect.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 const GrBackendFragmentProcessorFactory& GrTextureDomainEffect::getFactory() con st { 262 const GrBackendFragmentProcessorFactory& GrTextureDomainEffect::getFactory() con st {
263 return GrTBackendFragmentProcessorFactory<GrTextureDomainEffect>::getInstanc e(); 263 return GrTBackendFragmentProcessorFactory<GrTextureDomainEffect>::getInstanc e();
264 } 264 }
265 265
266 bool GrTextureDomainEffect::onIsEqual(const GrProcessor& sBase) const { 266 bool GrTextureDomainEffect::onIsEqual(const GrProcessor& sBase) const {
267 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>(); 267 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>();
268 return this->hasSameTextureParamsMatrixAndSourceCoords(s) && 268 return this->hasSameTextureParamsMatrixAndSourceCoords(s) &&
269 this->fTextureDomain == s.fTextureDomain; 269 this->fTextureDomain == s.fTextureDomain;
270 } 270 }
271 271
272 void GrTextureDomainEffect::onComputeInvariantOutput(InvariantOutput* inout) con st { 272 void GrTextureDomainEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const {
273 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper 273 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper
274 inout->fValidFlags = 0; 274 *validFlags = 0;
275 } else { 275 } else {
276 this->updateInvariantOutputForModulation(inout); 276 this->updateConstantColorComponentsForModulation(color, validFlags);
277 } 277 }
278 inout->fIsSingleComponent = false;
279 } 278 }
280 279
281 /////////////////////////////////////////////////////////////////////////////// 280 ///////////////////////////////////////////////////////////////////////////////
282 281
283 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect); 282 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect);
284 283
285 GrFragmentProcessor* GrTextureDomainEffect::TestCreate(SkRandom* random, 284 GrFragmentProcessor* GrTextureDomainEffect::TestCreate(SkRandom* random,
286 GrContext*, 285 GrContext*,
287 const GrDrawTargetCaps&, 286 const GrDrawTargetCaps&,
288 GrTexture* textures[]) { 287 GrTexture* textures[]) {
289 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : 288 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
290 GrProcessorUnitTest::kAlphaTextureIdx; 289 GrProcessorUnitTest::kAlphaTextureIdx;
291 SkRect domain; 290 SkRect domain;
292 domain.fLeft = random->nextUScalar1(); 291 domain.fLeft = random->nextUScalar1();
293 domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1); 292 domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1);
294 domain.fTop = random->nextUScalar1(); 293 domain.fTop = random->nextUScalar1();
295 domain.fBottom = random->nextRangeScalar(domain.fTop, SK_Scalar1); 294 domain.fBottom = random->nextRangeScalar(domain.fTop, SK_Scalar1);
296 GrTextureDomain::Mode mode = 295 GrTextureDomain::Mode mode =
297 (GrTextureDomain::Mode) random->nextULessThan(GrTextureDomain::kModeCoun t); 296 (GrTextureDomain::Mode) random->nextULessThan(GrTextureDomain::kModeCoun t);
298 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); 297 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random);
299 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f alse; 298 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f alse;
300 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo rdSet; 299 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo rdSet;
301 return GrTextureDomainEffect::Create(textures[texIdx], 300 return GrTextureDomainEffect::Create(textures[texIdx],
302 matrix, 301 matrix,
303 domain, 302 domain,
304 mode, 303 mode,
305 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode, 304 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode,
306 coords); 305 coords);
307 } 306 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureDomain.h ('k') | src/gpu/effects/GrYUVtoRGBEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698