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 "GrTextureDomainEffect.h" | 8 #include "GrTextureDomainEffect.h" |
9 #include "GrSimpleTextureEffect.h" | 9 #include "GrSimpleTextureEffect.h" |
10 #include "GrTBackendEffectFactory.h" | 10 #include "GrTBackendEffectFactory.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 *validFlags = 0; | 203 *validFlags = 0; |
204 } else { | 204 } else { |
205 this->updateConstantColorComponentsForModulation(color, validFlags); | 205 this->updateConstantColorComponentsForModulation(color, validFlags); |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 /////////////////////////////////////////////////////////////////////////////// | 209 /////////////////////////////////////////////////////////////////////////////// |
210 | 210 |
211 GR_DEFINE_EFFECT_TEST(GrTextureDomainEffect); | 211 GR_DEFINE_EFFECT_TEST(GrTextureDomainEffect); |
212 | 212 |
213 GrEffectRef* GrTextureDomainEffect::TestCreate(SkMWCRandom* random, | 213 GrEffectRef* GrTextureDomainEffect::TestCreate(SkRandom* random, |
214 GrContext*, | 214 GrContext*, |
215 const GrDrawTargetCaps&, | 215 const GrDrawTargetCaps&, |
216 GrTexture* textures[]) { | 216 GrTexture* textures[]) { |
217 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 217 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
218 GrEffectUnitTest::kAlphaTextureIdx; | 218 GrEffectUnitTest::kAlphaTextureIdx; |
219 SkRect domain; | 219 SkRect domain; |
220 domain.fLeft = random->nextUScalar1(); | 220 domain.fLeft = random->nextUScalar1(); |
221 domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1); | 221 domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1); |
222 domain.fTop = random->nextUScalar1(); | 222 domain.fTop = random->nextUScalar1(); |
223 domain.fBottom = random->nextRangeScalar(domain.fTop, SK_Scalar1); | 223 domain.fBottom = random->nextRangeScalar(domain.fTop, SK_Scalar1); |
224 WrapMode wrapMode = random->nextBool() ? kClamp_WrapMode : kDecal_WrapMode; | 224 WrapMode wrapMode = random->nextBool() ? kClamp_WrapMode : kDecal_WrapMode; |
225 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); | 225 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); |
226 bool bilerp = random->nextBool(); | 226 bool bilerp = random->nextBool(); |
227 CoordsType coords = random->nextBool() ? kLocal_CoordsType : kPosition_Coord
sType; | 227 CoordsType coords = random->nextBool() ? kLocal_CoordsType : kPosition_Coord
sType; |
228 return GrTextureDomainEffect::Create(textures[texIdx], | 228 return GrTextureDomainEffect::Create(textures[texIdx], |
229 matrix, | 229 matrix, |
230 domain, | 230 domain, |
231 wrapMode, | 231 wrapMode, |
232 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, | 232 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, |
233 coords); | 233 coords); |
234 } | 234 } |
OLD | NEW |