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 "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
9 #include "GrConvolutionEffect.h" | 9 #include "GrConvolutionEffect.h" |
10 #include "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 /////////////////////////////////////////////////////////////////////////////// | 151 /////////////////////////////////////////////////////////////////////////////// |
152 | 152 |
153 GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture, | 153 GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture, |
154 Direction direction, | 154 Direction direction, |
155 int radius, | 155 int radius, |
156 const float* kernel, | 156 const float* kernel, |
157 bool useBounds, | 157 bool useBounds, |
158 float bounds[2]) | 158 float bounds[2]) |
159 : Gr1DKernelEffect(texture, direction, radius), fUseBounds(useBounds) { | 159 : Gr1DKernelEffect(texture, direction, radius), fUseBounds(useBounds) { |
160 SkASSERT(radius <= kMaxKernelRadius); | 160 SkASSERT(radius <= kMaxKernelRadius); |
161 SkASSERT(NULL != kernel); | 161 SkASSERT(kernel); |
162 int width = this->width(); | 162 int width = this->width(); |
163 for (int i = 0; i < width; i++) { | 163 for (int i = 0; i < width; i++) { |
164 fKernel[i] = kernel[i]; | 164 fKernel[i] = kernel[i]; |
165 } | 165 } |
166 memcpy(fBounds, bounds, sizeof(fBounds)); | 166 memcpy(fBounds, bounds, sizeof(fBounds)); |
167 } | 167 } |
168 | 168 |
169 GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture, | 169 GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture, |
170 Direction direction, | 170 Direction direction, |
171 int radius, | 171 int radius, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 | 233 |
234 bool useBounds = random->nextBool(); | 234 bool useBounds = random->nextBool(); |
235 return GrConvolutionEffect::Create(textures[texIdx], | 235 return GrConvolutionEffect::Create(textures[texIdx], |
236 dir, | 236 dir, |
237 radius, | 237 radius, |
238 kernel, | 238 kernel, |
239 useBounds, | 239 useBounds, |
240 bounds); | 240 bounds); |
241 } | 241 } |
OLD | NEW |