Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: src/gpu/effects/GrConvolutionEffect.cpp

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrConvolutionEffect.h ('k') | src/gpu/effects/GrCoverageSetOpXP.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 b->add32(key); 145 b->add32(key);
146 } 146 }
147 147
148 /////////////////////////////////////////////////////////////////////////////// 148 ///////////////////////////////////////////////////////////////////////////////
149 149
150 GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture, 150 GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture,
151 Direction direction, 151 Direction direction,
152 int radius, 152 int radius,
153 const float* kernel, 153 const float* kernel,
154 bool useBounds, 154 bool useBounds,
155 float bounds[2]) 155 float bounds[2], GrRenderTarget* dst)
156 : INHERITED(texture, direction, radius), fUseBounds(useBounds) { 156 : INHERITED(texture, direction, radius, dst), fUseBounds(useBounds) {
157 this->initClassID<GrConvolutionEffect>(); 157 this->initClassID<GrConvolutionEffect>();
158 SkASSERT(radius <= kMaxKernelRadius); 158 SkASSERT(radius <= kMaxKernelRadius);
159 SkASSERT(kernel); 159 SkASSERT(kernel);
160 int width = this->width(); 160 int width = this->width();
161 for (int i = 0; i < width; i++) { 161 for (int i = 0; i < width; i++) {
162 fKernel[i] = kernel[i]; 162 fKernel[i] = kernel[i];
163 } 163 }
164 memcpy(fBounds, bounds, sizeof(fBounds)); 164 memcpy(fBounds, bounds, sizeof(fBounds));
165 } 165 }
166 166
167 GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture, 167 GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture,
168 Direction direction, 168 Direction direction,
169 int radius, 169 int radius,
170 float gaussianSigma, 170 float gaussianSigma,
171 bool useBounds, 171 bool useBounds,
172 float bounds[2]) 172 float bounds[2], GrRenderTarget* dst)
173 : INHERITED(texture, direction, radius), fUseBounds(useBounds) { 173 : INHERITED(texture, direction, radius, dst), fUseBounds(useBounds) {
174 this->initClassID<GrConvolutionEffect>(); 174 this->initClassID<GrConvolutionEffect>();
175 SkASSERT(radius <= kMaxKernelRadius); 175 SkASSERT(radius <= kMaxKernelRadius);
176 int width = this->width(); 176 int width = this->width();
177 177
178 float sum = 0.0f; 178 float sum = 0.0f;
179 float denom = 1.0f / (2.0f * gaussianSigma * gaussianSigma); 179 float denom = 1.0f / (2.0f * gaussianSigma * gaussianSigma);
180 for (int i = 0; i < width; ++i) { 180 for (int i = 0; i < width; ++i) {
181 float x = static_cast<float>(i - this->radius()); 181 float x = static_cast<float>(i - this->radius());
182 // Note that the constant term (1/(sqrt(2*pi*sigma^2)) of the Gaussian 182 // Note that the constant term (1/(sqrt(2*pi*sigma^2)) of the Gaussian
183 // is dropped here, since we renormalize the kernel below. 183 // is dropped here, since we renormalize the kernel below.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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->fTextures[texIdx], 235 return GrConvolutionEffect::Create(d->fTextures[texIdx],
236 dir, 236 dir,
237 radius, 237 radius,
238 kernel, 238 kernel,
239 useBounds, 239 useBounds,
240 bounds); 240 bounds, NULL);
241 } 241 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConvolutionEffect.h ('k') | src/gpu/effects/GrCoverageSetOpXP.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698