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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(SkRandom* random, |
290 GrContext*, | 290 GrContext*, |
291 const GrDrawTargetCaps&, | 291 const GrCaps&, |
292 GrTexture* textures[]) { | 292 GrTexture* textures[]) { |
293 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : | 293 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : |
294 GrProcessorUnitTest::kAlphaTextureIdx; | 294 GrProcessorUnitTest::kAlphaTextureIdx; |
295 SkRect domain; | 295 SkRect domain; |
296 domain.fLeft = random->nextUScalar1(); | 296 domain.fLeft = random->nextUScalar1(); |
297 domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1); | 297 domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1); |
298 domain.fTop = random->nextUScalar1(); | 298 domain.fTop = random->nextUScalar1(); |
299 domain.fBottom = random->nextRangeScalar(domain.fTop, SK_Scalar1); | 299 domain.fBottom = random->nextRangeScalar(domain.fTop, SK_Scalar1); |
300 GrTextureDomain::Mode mode = | 300 GrTextureDomain::Mode mode = |
301 (GrTextureDomain::Mode) random->nextULessThan(GrTextureDomain::kModeCoun
t); | 301 (GrTextureDomain::Mode) random->nextULessThan(GrTextureDomain::kModeCoun
t); |
302 const SkMatrix& matrix = GrTest::TestMatrix(random); | 302 const SkMatrix& matrix = GrTest::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 : kDevice_GrCoord
Set; | 304 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoord
Set; |
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 |