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 "GrBitmapTextGeoProc.h" | 8 #include "GrBitmapTextGeoProc.h" |
9 #include "GrFontAtlasSizes.h" | 9 #include "GrFontAtlasSizes.h" |
10 #include "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 GrGLPrimitiveProcessor* | 145 GrGLPrimitiveProcessor* |
146 GrBitmapTextGeoProc::createGLInstance(const GrBatchTracker& bt, | 146 GrBitmapTextGeoProc::createGLInstance(const GrBatchTracker& bt, |
147 const GrGLSLCaps& caps) const { | 147 const GrGLSLCaps& caps) const { |
148 return SkNEW_ARGS(GrGLBitmapTextGeoProc, (*this, bt)); | 148 return SkNEW_ARGS(GrGLBitmapTextGeoProc, (*this, bt)); |
149 } | 149 } |
150 | 150 |
151 /////////////////////////////////////////////////////////////////////////////// | 151 /////////////////////////////////////////////////////////////////////////////// |
152 | 152 |
153 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc); | 153 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc); |
154 | 154 |
155 GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(SkRandom* random, | 155 GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* d) { |
156 GrContext*, | 156 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
: |
157 const GrCaps&, | 157 GrProcessorUnitTest::kAlphaTextureIdx; |
158 GrTexture* textures[]) { | |
159 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : | |
160 GrProcessorUnitTest::kAlphaTextureIdx; | |
161 static const SkShader::TileMode kTileModes[] = { | 158 static const SkShader::TileMode kTileModes[] = { |
162 SkShader::kClamp_TileMode, | 159 SkShader::kClamp_TileMode, |
163 SkShader::kRepeat_TileMode, | 160 SkShader::kRepeat_TileMode, |
164 SkShader::kMirror_TileMode, | 161 SkShader::kMirror_TileMode, |
165 }; | 162 }; |
166 SkShader::TileMode tileModes[] = { | 163 SkShader::TileMode tileModes[] = { |
167 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 164 kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
168 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 165 kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
169 }; | 166 }; |
170 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 167 GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::
kBilerp_FilterMode : |
171 GrTextureParams::kNon
e_FilterMode); | 168 GrTextureParams::kNon
e_FilterMode); |
172 | 169 |
173 GrMaskFormat format; | 170 GrMaskFormat format; |
174 switch (random->nextULessThan(3)) { | 171 switch (d->fRandom->nextULessThan(3)) { |
175 default: | |
176 SkFAIL("Incomplete enum\n"); | |
177 case 0: | 172 case 0: |
178 format = kA8_GrMaskFormat; | 173 format = kA8_GrMaskFormat; |
179 break; | 174 break; |
180 case 1: | 175 case 1: |
181 format = kA565_GrMaskFormat; | 176 format = kA565_GrMaskFormat; |
182 break; | 177 break; |
183 case 2: | 178 case 2: |
184 format = kARGB_GrMaskFormat; | 179 format = kARGB_GrMaskFormat; |
185 break; | 180 break; |
186 } | 181 } |
187 | 182 |
188 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx],
params, | 183 return GrBitmapTextGeoProc::Create(GrRandomColor(d->fRandom), d->fTextures[t
exIdx], params, |
189 format, GrTest::TestMatrix(random), rando
m->nextBool()); | 184 format, GrTest::TestMatrix(d->fRandom), |
| 185 d->fRandom->nextBool()); |
190 } | 186 } |
OLD | NEW |