| 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/GrGLProcessor.h" | 9 #include "gl/GrGLProcessor.h" |
| 10 #include "gl/GrGLSL.h" | 10 #include "gl/GrGLSL.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 0 == memcmp(fBounds, s.fBounds, sizeof(fBounds)) && | 213 0 == memcmp(fBounds, s.fBounds, sizeof(fBounds)) && |
| 214 0 == memcmp(fKernel, s.fKernel, this->width() * sizeof(float))); | 214 0 == memcmp(fKernel, s.fKernel, this->width() * sizeof(float))); |
| 215 } | 215 } |
| 216 | 216 |
| 217 /////////////////////////////////////////////////////////////////////////////// | 217 /////////////////////////////////////////////////////////////////////////////// |
| 218 | 218 |
| 219 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvolutionEffect); | 219 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvolutionEffect); |
| 220 | 220 |
| 221 GrFragmentProcessor* GrConvolutionEffect::TestCreate(SkRandom* random, | 221 GrFragmentProcessor* GrConvolutionEffect::TestCreate(SkRandom* random, |
| 222 GrContext*, | 222 GrContext*, |
| 223 const GrDrawTargetCaps&, | 223 const GrCaps&, |
| 224 GrTexture* textures[]) { | 224 GrTexture* textures[]) { |
| 225 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : | 225 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : |
| 226 GrProcessorUnitTest::kAlphaTextureIdx; | 226 GrProcessorUnitTest::kAlphaTextureIdx; |
| 227 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; | 227 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; |
| 228 int radius = random->nextRangeU(1, kMaxKernelRadius); | 228 int radius = random->nextRangeU(1, kMaxKernelRadius); |
| 229 float kernel[kMaxKernelWidth]; | 229 float kernel[kMaxKernelWidth]; |
| 230 for (size_t i = 0; i < SK_ARRAY_COUNT(kernel); ++i) { | 230 for (size_t i = 0; i < SK_ARRAY_COUNT(kernel); ++i) { |
| 231 kernel[i] = random->nextSScalar1(); | 231 kernel[i] = random->nextSScalar1(); |
| 232 } | 232 } |
| 233 float bounds[2]; | 233 float bounds[2]; |
| 234 for (size_t i = 0; i < SK_ARRAY_COUNT(bounds); ++i) { | 234 for (size_t i = 0; i < SK_ARRAY_COUNT(bounds); ++i) { |
| 235 bounds[i] = random->nextF(); | 235 bounds[i] = random->nextF(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 bool useBounds = random->nextBool(); | 238 bool useBounds = random->nextBool(); |
| 239 return GrConvolutionEffect::Create(textures[texIdx], | 239 return GrConvolutionEffect::Create(textures[texIdx], |
| 240 dir, | 240 dir, |
| 241 radius, | 241 radius, |
| 242 kernel, | 242 kernel, |
| 243 useBounds, | 243 useBounds, |
| 244 bounds); | 244 bounds); |
| 245 } | 245 } |
| OLD | NEW |