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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 } else { | 274 } else { |
275 this->updateInvariantOutputForModulation(inout); | 275 this->updateInvariantOutputForModulation(inout); |
276 } | 276 } |
277 } | 277 } |
278 | 278 |
279 /////////////////////////////////////////////////////////////////////////////// | 279 /////////////////////////////////////////////////////////////////////////////// |
280 | 280 |
281 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect); | 281 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect); |
282 | 282 |
283 GrFragmentProcessor* GrTextureDomainEffect::TestCreate(GrProcessorTestData* d) { | 283 const GrFragmentProcessor* GrTextureDomainEffect::TestCreate(GrProcessorTestData
* d) { |
284 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
: | 284 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
: |
285 GrProcessorUnitTest::kAlphaTextureIdx; | 285 GrProcessorUnitTest::kAlphaTextureIdx; |
286 SkRect domain; | 286 SkRect domain; |
287 domain.fLeft = d->fRandom->nextUScalar1(); | 287 domain.fLeft = d->fRandom->nextUScalar1(); |
288 domain.fRight = d->fRandom->nextRangeScalar(domain.fLeft, SK_Scalar1); | 288 domain.fRight = d->fRandom->nextRangeScalar(domain.fLeft, SK_Scalar1); |
289 domain.fTop = d->fRandom->nextUScalar1(); | 289 domain.fTop = d->fRandom->nextUScalar1(); |
290 domain.fBottom = d->fRandom->nextRangeScalar(domain.fTop, SK_Scalar1); | 290 domain.fBottom = d->fRandom->nextRangeScalar(domain.fTop, SK_Scalar1); |
291 GrTextureDomain::Mode mode = | 291 GrTextureDomain::Mode mode = |
292 (GrTextureDomain::Mode) d->fRandom->nextULessThan(GrTextureDomain::kMode
Count); | 292 (GrTextureDomain::Mode) d->fRandom->nextULessThan(GrTextureDomain::kMode
Count); |
293 const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); | 293 const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); |
294 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; | 294 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; |
295 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; | 295 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; |
296 return GrTextureDomainEffect::Create(d->fProcDataManager, | 296 return GrTextureDomainEffect::Create(d->fProcDataManager, |
297 d->fTextures[texIdx], | 297 d->fTextures[texIdx], |
298 matrix, | 298 matrix, |
299 domain, | 299 domain, |
300 mode, | 300 mode, |
301 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, | 301 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, |
302 coords); | 302 coords); |
303 } | 303 } |
OLD | NEW |