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 "GrConvolutionEffect.h" | 8 #include "GrConvolutionEffect.h" |
9 #include "gl/GrGLEffect.h" | 9 #include "gl/GrGLEffect.h" |
10 #include "gl/GrGLEffectMatrix.h" | 10 #include "gl/GrGLEffectMatrix.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 GR_DEFINE_EFFECT_TEST(GrConvolutionEffect); | 220 GR_DEFINE_EFFECT_TEST(GrConvolutionEffect); |
221 | 221 |
222 GrEffectRef* GrConvolutionEffect::TestCreate(SkMWCRandom* random, | 222 GrEffectRef* GrConvolutionEffect::TestCreate(SkMWCRandom* random, |
223 GrContext*, | 223 GrContext*, |
224 const GrDrawTargetCaps&, | 224 const GrDrawTargetCaps&, |
225 GrTexture* textures[]) { | 225 GrTexture* textures[]) { |
226 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 226 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
227 GrEffectUnitTest::kAlphaTextureIdx; | 227 GrEffectUnitTest::kAlphaTextureIdx; |
228 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; | 228 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; |
229 int radius = random->nextRangeU(1, kMaxKernelRadius); | 229 int radius = random->nextRangeU(1, kMaxKernelRadius); |
230 float kernel[kMaxKernelRadius]; | 230 float kernel[kMaxKernelWidth]; |
231 for (int i = 0; i < kMaxKernelRadius; ++i) { | 231 for (size_t i = 0; i < SK_ARRAY_COUNT(kernel); ++i) { |
232 kernel[i] = random->nextSScalar1(); | 232 kernel[i] = random->nextSScalar1(); |
233 } | 233 } |
234 float bounds[2]; | 234 float bounds[2]; |
235 for (int i = 0; i < 2; ++i) { | 235 for (int i = 0; i < 2; ++i) { |
236 bounds[i] = random->nextF(); | 236 bounds[i] = random->nextF(); |
237 } | 237 } |
238 | 238 |
239 bool useBounds = random->nextBool(); | 239 bool useBounds = random->nextBool(); |
240 return GrConvolutionEffect::Create(textures[texIdx], | 240 return GrConvolutionEffect::Create(textures[texIdx], |
241 dir, | 241 dir, |
242 radius, | 242 radius, |
243 kernel, | 243 kernel, |
244 useBounds, | 244 useBounds, |
245 bounds); | 245 bounds); |
246 } | 246 } |
OLD | NEW |