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