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/GrGLSL.h" | 10 #include "gl/GrGLSL.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 this->direction() == s.direction() && | 204 this->direction() == s.direction() && |
205 this->useBounds() == s.useBounds() && | 205 this->useBounds() == s.useBounds() && |
206 0 == memcmp(fBounds, s.fBounds, sizeof(fBounds)) && | 206 0 == memcmp(fBounds, s.fBounds, sizeof(fBounds)) && |
207 0 == memcmp(fKernel, s.fKernel, this->width() * sizeof(float))); | 207 0 == memcmp(fKernel, s.fKernel, this->width() * sizeof(float))); |
208 } | 208 } |
209 | 209 |
210 /////////////////////////////////////////////////////////////////////////////// | 210 /////////////////////////////////////////////////////////////////////////////// |
211 | 211 |
212 GR_DEFINE_EFFECT_TEST(GrConvolutionEffect); | 212 GR_DEFINE_EFFECT_TEST(GrConvolutionEffect); |
213 | 213 |
214 GrEffectRef* GrConvolutionEffect::TestCreate(SkRandom* random, | 214 GrEffect* GrConvolutionEffect::TestCreate(SkRandom* random, |
215 GrContext*, | 215 GrContext*, |
216 const GrDrawTargetCaps&, | 216 const GrDrawTargetCaps&, |
217 GrTexture* textures[]) { | 217 GrTexture* textures[]) { |
218 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 218 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
219 GrEffectUnitTest::kAlphaTextureIdx; | 219 GrEffectUnitTest::kAlphaTextureIdx; |
220 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; | 220 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; |
221 int radius = random->nextRangeU(1, kMaxKernelRadius); | 221 int radius = random->nextRangeU(1, kMaxKernelRadius); |
222 float kernel[kMaxKernelWidth]; | 222 float kernel[kMaxKernelWidth]; |
223 for (size_t i = 0; i < SK_ARRAY_COUNT(kernel); ++i) { | 223 for (size_t i = 0; i < SK_ARRAY_COUNT(kernel); ++i) { |
224 kernel[i] = random->nextSScalar1(); | 224 kernel[i] = random->nextSScalar1(); |
225 } | 225 } |
226 float bounds[2]; | 226 float bounds[2]; |
227 for (size_t i = 0; i < SK_ARRAY_COUNT(bounds); ++i) { | 227 for (size_t i = 0; i < SK_ARRAY_COUNT(bounds); ++i) { |
228 bounds[i] = random->nextF(); | 228 bounds[i] = random->nextF(); |
229 } | 229 } |
230 | 230 |
231 bool useBounds = random->nextBool(); | 231 bool useBounds = random->nextBool(); |
232 return GrConvolutionEffect::Create(textures[texIdx], | 232 return GrConvolutionEffect::Create(textures[texIdx], |
233 dir, | 233 dir, |
234 radius, | 234 radius, |
235 kernel, | 235 kernel, |
236 useBounds, | 236 useBounds, |
237 bounds); | 237 bounds); |
238 } | 238 } |
OLD | NEW |