OLD | NEW |
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 "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 return GrTBackendFragmentProcessorFactory<GrTextureDomainEffect>::getInstanc
e(); | 264 return GrTBackendFragmentProcessorFactory<GrTextureDomainEffect>::getInstanc
e(); |
265 } | 265 } |
266 | 266 |
267 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 267 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
268 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>(); | 268 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>(); |
269 return this->fTextureDomain == s.fTextureDomain; | 269 return this->fTextureDomain == s.fTextureDomain; |
270 } | 270 } |
271 | 271 |
272 void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c
onst { | 272 void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c
onst { |
273 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper | 273 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper |
274 inout->mulByUnknownColor(); | 274 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { |
| 275 inout->mulByUnknownAlpha(); |
| 276 } else { |
| 277 inout->mulByUnknownColor(); |
| 278 } |
275 } else { | 279 } else { |
276 this->updateInvariantOutputForModulation(inout); | 280 this->updateInvariantOutputForModulation(inout); |
277 } | 281 } |
278 } | 282 } |
279 | 283 |
280 /////////////////////////////////////////////////////////////////////////////// | 284 /////////////////////////////////////////////////////////////////////////////// |
281 | 285 |
282 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect); | 286 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect); |
283 | 287 |
284 GrFragmentProcessor* GrTextureDomainEffect::TestCreate(SkRandom* random, | 288 GrFragmentProcessor* GrTextureDomainEffect::TestCreate(SkRandom* random, |
(...skipping 12 matching lines...) Expand all Loading... |
297 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); | 301 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); |
298 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f
alse; | 302 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f
alse; |
299 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; | 303 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; |
300 return GrTextureDomainEffect::Create(textures[texIdx], | 304 return GrTextureDomainEffect::Create(textures[texIdx], |
301 matrix, | 305 matrix, |
302 domain, | 306 domain, |
303 mode, | 307 mode, |
304 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, | 308 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, |
305 coords); | 309 coords); |
306 } | 310 } |
OLD | NEW |