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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
289 GrFragmentProcessor* GrTextureDomainEffect::TestCreate(SkRandom* random, | 289 GrFragmentProcessor* GrTextureDomainEffect::TestCreate(GrProcessorTestData* d) { |
290 GrContext*, | 290 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
: |
291 const GrCaps&, | 291 GrProcessorUnitTest::kAlphaTextureIdx; |
292 GrTexture* textures[]) { | |
293 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : | |
294 GrProcessorUnitTest::kAlphaTextureIdx; | |
295 SkRect domain; | 292 SkRect domain; |
296 domain.fLeft = random->nextUScalar1(); | 293 domain.fLeft = d->fRandom->nextUScalar1(); |
297 domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1); | 294 domain.fRight = d->fRandom->nextRangeScalar(domain.fLeft, SK_Scalar1); |
298 domain.fTop = random->nextUScalar1(); | 295 domain.fTop = d->fRandom->nextUScalar1(); |
299 domain.fBottom = random->nextRangeScalar(domain.fTop, SK_Scalar1); | 296 domain.fBottom = d->fRandom->nextRangeScalar(domain.fTop, SK_Scalar1); |
300 GrTextureDomain::Mode mode = | 297 GrTextureDomain::Mode mode = |
301 (GrTextureDomain::Mode) random->nextULessThan(GrTextureDomain::kModeCoun
t); | 298 (GrTextureDomain::Mode) d->fRandom->nextULessThan(GrTextureDomain::kMode
Count); |
302 const SkMatrix& matrix = GrTest::TestMatrix(random); | 299 const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); |
303 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f
alse; | 300 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; |
304 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoord
Set; | 301 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; |
305 return GrTextureDomainEffect::Create(textures[texIdx], | 302 return GrTextureDomainEffect::Create(d->fTextures[texIdx], |
306 matrix, | 303 matrix, |
307 domain, | 304 domain, |
308 mode, | 305 mode, |
309 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, | 306 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, |
310 coords); | 307 coords); |
311 } | 308 } |
OLD | NEW |