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