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/GrGLEffectMatrix.h" | 10 #include "gl/GrGLEffectMatrix.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 const GrBackendEffectFactory& GrSimpleTextureEffect::getFactory() const { | 90 const GrBackendEffectFactory& GrSimpleTextureEffect::getFactory() const { |
91 return GrTBackendEffectFactory<GrSimpleTextureEffect>::getInstance(); | 91 return GrTBackendEffectFactory<GrSimpleTextureEffect>::getInstance(); |
92 } | 92 } |
93 | 93 |
94 /////////////////////////////////////////////////////////////////////////////// | 94 /////////////////////////////////////////////////////////////////////////////// |
95 | 95 |
96 GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect); | 96 GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect); |
97 | 97 |
98 GrEffectRef* GrSimpleTextureEffect::TestCreate(SkMWCRandom* random, | 98 GrEffectRef* GrSimpleTextureEffect::TestCreate(SkMWCRandom* random, |
99 GrContext*, | 99 GrContext*, |
| 100 const GrDrawTargetCaps&, |
100 GrTexture* textures[]) { | 101 GrTexture* textures[]) { |
101 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 102 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
102 GrEffectUnitTest::kAlphaTextureIdx; | 103 GrEffectUnitTest::kAlphaTextureIdx; |
103 static const SkShader::TileMode kTileModes[] = { | 104 static const SkShader::TileMode kTileModes[] = { |
104 SkShader::kClamp_TileMode, | 105 SkShader::kClamp_TileMode, |
105 SkShader::kRepeat_TileMode, | 106 SkShader::kRepeat_TileMode, |
106 SkShader::kMirror_TileMode, | 107 SkShader::kMirror_TileMode, |
107 }; | 108 }; |
108 SkShader::TileMode tileModes[] = { | 109 SkShader::TileMode tileModes[] = { |
109 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 110 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
110 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 111 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
111 }; | 112 }; |
112 GrTextureParams params(tileModes, random->nextBool()); | 113 GrTextureParams params(tileModes, random->nextBool()); |
113 | 114 |
114 static const CoordsType kCoordsTypes[] = { | 115 static const CoordsType kCoordsTypes[] = { |
115 kLocal_CoordsType, | 116 kLocal_CoordsType, |
116 kPosition_CoordsType, | 117 kPosition_CoordsType, |
117 kCustom_CoordsType | 118 kCustom_CoordsType |
118 }; | 119 }; |
119 CoordsType coordsType = kCoordsTypes[random->nextULessThan(GR_ARRAY_COUNT(kC
oordsTypes))]; | 120 CoordsType coordsType = kCoordsTypes[random->nextULessThan(GR_ARRAY_COUNT(kC
oordsTypes))]; |
120 | 121 |
121 if (kCustom_CoordsType == coordsType) { | 122 if (kCustom_CoordsType == coordsType) { |
122 return GrSimpleTextureEffect::CreateWithCustomCoords(textures[texIdx], p
arams); | 123 return GrSimpleTextureEffect::CreateWithCustomCoords(textures[texIdx], p
arams); |
123 } else { | 124 } else { |
124 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); | 125 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); |
125 return GrSimpleTextureEffect::Create(textures[texIdx], matrix); | 126 return GrSimpleTextureEffect::Create(textures[texIdx], matrix); |
126 } | 127 } |
127 } | 128 } |
OLD | NEW |