| 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 "GrSimpleTextureEffect.h" | 8 #include "GrSimpleTextureEffect.h" |
| 9 #include "gl/GrGLEffect.h" | 9 #include "gl/GrGLEffect.h" |
| 10 #include "gl/GrGLSL.h" | 10 #include "gl/GrGLSL.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 const GrBackendEffectFactory& GrSimpleTextureEffect::getFactory() const { | 46 const GrBackendEffectFactory& GrSimpleTextureEffect::getFactory() const { |
| 47 return GrTBackendEffectFactory<GrSimpleTextureEffect>::getInstance(); | 47 return GrTBackendEffectFactory<GrSimpleTextureEffect>::getInstance(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 /////////////////////////////////////////////////////////////////////////////// | 50 /////////////////////////////////////////////////////////////////////////////// |
| 51 | 51 |
| 52 GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect); | 52 GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect); |
| 53 | 53 |
| 54 GrEffectRef* GrSimpleTextureEffect::TestCreate(SkRandom* random, | 54 GrEffect* GrSimpleTextureEffect::TestCreate(SkRandom* random, |
| 55 GrContext*, | 55 GrContext*, |
| 56 const GrDrawTargetCaps&, | 56 const GrDrawTargetCaps&, |
| 57 GrTexture* textures[]) { | 57 GrTexture* textures[]) { |
| 58 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 58 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
| 59 GrEffectUnitTest::kAlphaTextureIdx; | 59 GrEffectUnitTest::kAlphaTextureIdx; |
| 60 static const SkShader::TileMode kTileModes[] = { | 60 static const SkShader::TileMode kTileModes[] = { |
| 61 SkShader::kClamp_TileMode, | 61 SkShader::kClamp_TileMode, |
| 62 SkShader::kRepeat_TileMode, | 62 SkShader::kRepeat_TileMode, |
| 63 SkShader::kMirror_TileMode, | 63 SkShader::kMirror_TileMode, |
| 64 }; | 64 }; |
| 65 SkShader::TileMode tileModes[] = { | 65 SkShader::TileMode tileModes[] = { |
| 66 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 66 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
| 67 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 67 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
| 68 }; | 68 }; |
| 69 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 69 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : |
| 70 GrTextureParams::kNon
e_FilterMode); | 70 GrTextureParams::kNon
e_FilterMode); |
| 71 | 71 |
| 72 static const GrCoordSet kCoordSets[] = { | 72 static const GrCoordSet kCoordSets[] = { |
| 73 kLocal_GrCoordSet, | 73 kLocal_GrCoordSet, |
| 74 kPosition_GrCoordSet | 74 kPosition_GrCoordSet |
| 75 }; | 75 }; |
| 76 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord
Sets))]; | 76 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord
Sets))]; |
| 77 | 77 |
| 78 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); | 78 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); |
| 79 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); | 79 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); |
| 80 } | 80 } |
| OLD | NEW |