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