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