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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 float scale = 1.0f / sum; | 187 float scale = 1.0f / sum; |
188 for (int i = 0; i < width; ++i) { | 188 for (int i = 0; i < width; ++i) { |
189 fKernel[i] *= scale; | 189 fKernel[i] *= scale; |
190 } | 190 } |
191 memcpy(fBounds, bounds, sizeof(fBounds)); | 191 memcpy(fBounds, bounds, sizeof(fBounds)); |
192 } | 192 } |
193 | 193 |
194 GrConvolutionEffect::~GrConvolutionEffect() { | 194 GrConvolutionEffect::~GrConvolutionEffect() { |
195 } | 195 } |
196 | 196 |
197 void GrConvolutionEffect::getGLProcessorKey(const GrGLSLCaps& caps, | 197 void GrConvolutionEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, |
198 GrProcessorKeyBuilder* b) const { | 198 GrProcessorKeyBuilder* b) const { |
199 GrGLConvolutionEffect::GenKey(*this, caps, b); | 199 GrGLConvolutionEffect::GenKey(*this, caps, b); |
200 } | 200 } |
201 | 201 |
202 GrGLFragmentProcessor* GrConvolutionEffect::createGLInstance() const { | 202 GrGLFragmentProcessor* GrConvolutionEffect::createGLInstance() const { |
203 return SkNEW_ARGS(GrGLConvolutionEffect, (*this)); | 203 return SkNEW_ARGS(GrGLConvolutionEffect, (*this)); |
204 } | 204 } |
205 | 205 |
206 bool GrConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 206 bool GrConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
207 const GrConvolutionEffect& s = sBase.cast<GrConvolutionEffect>(); | 207 const GrConvolutionEffect& s = sBase.cast<GrConvolutionEffect>(); |
(...skipping 24 matching lines...) Expand all Loading... |
232 | 232 |
233 bool useBounds = d->fRandom->nextBool(); | 233 bool useBounds = d->fRandom->nextBool(); |
234 return GrConvolutionEffect::Create(d->fProcDataManager, | 234 return GrConvolutionEffect::Create(d->fProcDataManager, |
235 d->fTextures[texIdx], | 235 d->fTextures[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 |