OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrDistanceFieldTextureEffect.h" | 8 #include "GrDistanceFieldTextureEffect.h" |
9 #include "gl/GrGLEffect.h" | 9 #include "gl/GrGLEffect.h" |
10 #include "gl/GrGLSL.h" | 10 #include "gl/GrGLSL.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 202 } |
203 | 203 |
204 const GrBackendEffectFactory& GrDistanceFieldTextureEffect::getFactory() const { | 204 const GrBackendEffectFactory& GrDistanceFieldTextureEffect::getFactory() const { |
205 return GrTBackendEffectFactory<GrDistanceFieldTextureEffect>::getInstance(); | 205 return GrTBackendEffectFactory<GrDistanceFieldTextureEffect>::getInstance(); |
206 } | 206 } |
207 | 207 |
208 /////////////////////////////////////////////////////////////////////////////// | 208 /////////////////////////////////////////////////////////////////////////////// |
209 | 209 |
210 GR_DEFINE_EFFECT_TEST(GrDistanceFieldTextureEffect); | 210 GR_DEFINE_EFFECT_TEST(GrDistanceFieldTextureEffect); |
211 | 211 |
212 GrEffectRef* GrDistanceFieldTextureEffect::TestCreate(SkRandom* random, | 212 GrEffect* GrDistanceFieldTextureEffect::TestCreate(SkRandom* random, |
213 GrContext*, | 213 GrContext*, |
214 const GrDrawTargetCaps&, | 214 const GrDrawTargetCaps&, |
215 GrTexture* textures[]) { | 215 GrTexture* textures[]) { |
216 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 216 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
217 GrEffectUnitTest::kAlphaTextureIdx; | 217 GrEffectUnitTest::kAlphaTextureIdx; |
218 #ifdef SK_GAMMA_APPLY_TO_A8 | 218 #ifdef SK_GAMMA_APPLY_TO_A8 |
219 int texIdx2 = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 219 int texIdx2 = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
220 GrEffectUnitTest::kAlphaTextureIdx; | 220 GrEffectUnitTest::kAlphaTextureIdx; |
221 #endif | 221 #endif |
222 static const SkShader::TileMode kTileModes[] = { | 222 static const SkShader::TileMode kTileModes[] = { |
223 SkShader::kClamp_TileMode, | 223 SkShader::kClamp_TileMode, |
224 SkShader::kRepeat_TileMode, | 224 SkShader::kRepeat_TileMode, |
225 SkShader::kMirror_TileMode, | 225 SkShader::kMirror_TileMode, |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 461 } |
462 | 462 |
463 const GrBackendEffectFactory& GrDistanceFieldLCDTextureEffect::getFactory() cons
t { | 463 const GrBackendEffectFactory& GrDistanceFieldLCDTextureEffect::getFactory() cons
t { |
464 return GrTBackendEffectFactory<GrDistanceFieldLCDTextureEffect>::getInstance
(); | 464 return GrTBackendEffectFactory<GrDistanceFieldLCDTextureEffect>::getInstance
(); |
465 } | 465 } |
466 | 466 |
467 /////////////////////////////////////////////////////////////////////////////// | 467 /////////////////////////////////////////////////////////////////////////////// |
468 | 468 |
469 GR_DEFINE_EFFECT_TEST(GrDistanceFieldLCDTextureEffect); | 469 GR_DEFINE_EFFECT_TEST(GrDistanceFieldLCDTextureEffect); |
470 | 470 |
471 GrEffectRef* GrDistanceFieldLCDTextureEffect::TestCreate(SkRandom* random, | 471 GrEffect* GrDistanceFieldLCDTextureEffect::TestCreate(SkRandom* random, |
472 GrContext*, | 472 GrContext*, |
473 const GrDrawTargetCaps&
, | 473 const GrDrawTargetCaps&, |
474 GrTexture* textures[])
{ | 474 GrTexture* textures[]) { |
475 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 475 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
476 GrEffectUnitTest::kAlphaTextureIdx; | 476 GrEffectUnitTest::kAlphaTextureIdx; |
477 int texIdx2 = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 477 int texIdx2 = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
478 GrEffectUnitTest::kAlphaTextureIdx; | 478 GrEffectUnitTest::kAlphaTextureIdx; |
479 static const SkShader::TileMode kTileModes[] = { | 479 static const SkShader::TileMode kTileModes[] = { |
480 SkShader::kClamp_TileMode, | 480 SkShader::kClamp_TileMode, |
481 SkShader::kRepeat_TileMode, | 481 SkShader::kRepeat_TileMode, |
482 SkShader::kMirror_TileMode, | 482 SkShader::kMirror_TileMode, |
483 }; | 483 }; |
484 SkShader::TileMode tileModes[] = { | 484 SkShader::TileMode tileModes[] = { |
485 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 485 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
486 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 486 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
487 }; | 487 }; |
488 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 488 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : |
489 GrTextureParams::kNone_FilterMode); | 489 GrTextureParams::kNone_FilterMode); |
490 GrTextureParams params2(tileModes, random->nextBool() ? GrTextureParams::kBi
lerp_FilterMode : | 490 GrTextureParams params2(tileModes, random->nextBool() ? GrTextureParams::kBi
lerp_FilterMode : |
491 GrTextureParams::kNone_FilterMode); | 491 GrTextureParams::kNone_FilterMode); |
492 GrColor textColor = GrColorPackRGBA(random->nextULessThan(256), | 492 GrColor textColor = GrColorPackRGBA(random->nextULessThan(256), |
493 random->nextULessThan(256), | 493 random->nextULessThan(256), |
494 random->nextULessThan(256), | 494 random->nextULessThan(256), |
495 random->nextULessThan(256)); | 495 random->nextULessThan(256)); |
496 return GrDistanceFieldLCDTextureEffect::Create(textures[texIdx], params, | 496 return GrDistanceFieldLCDTextureEffect::Create(textures[texIdx], params, |
497 textures[texIdx2], params2, | 497 textures[texIdx2], params2, |
498 textColor, | 498 textColor, |
499 random->nextBool(), random->n
extBool()); | 499 random->nextBool(), random->n
extBool()); |
500 } | 500 } |
OLD | NEW |