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

Side by Side Diff: src/effects/SkBlurImageFilter.cpp

Issue 1245183002: Misc cleanup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address gcc complaint Created 5 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The Android Open Source Project 2 * Copyright 2011 The Android Open Source Project
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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 *lowOffset = *highOffset - 1; 142 *lowOffset = *highOffset - 1;
143 *kernelSize3 = d + 1; 143 *kernelSize3 = d + 1;
144 } 144 }
145 } 145 }
146 146
147 bool SkBlurImageFilter::onFilterImage(Proxy* proxy, 147 bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
148 const SkBitmap& source, const Context& ctx , 148 const SkBitmap& source, const Context& ctx ,
149 SkBitmap* dst, SkIPoint* offset) const { 149 SkBitmap* dst, SkIPoint* offset) const {
150 SkBitmap src = source; 150 SkBitmap src = source;
151 SkIPoint srcOffset = SkIPoint::Make(0, 0); 151 SkIPoint srcOffset = SkIPoint::Make(0, 0);
152 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcO ffset)) { 152 if (this->getInput(0) &&
153 !this->getInput(0)->filterImage(proxy, source, ctx, &src, &srcOffset)) {
153 return false; 154 return false;
154 } 155 }
155 156
156 if (src.colorType() != kN32_SkColorType) { 157 if (src.colorType() != kN32_SkColorType) {
157 return false; 158 return false;
158 } 159 }
159 160
160 SkIRect srcBounds, dstBounds; 161 SkIRect srcBounds, dstBounds;
161 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &srcBounds, &src)) { 162 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &srcBounds, &src)) {
162 return false; 163 return false;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } else if (kernelSizeY > 0) { 225 } else if (kernelSizeY > 0) {
225 boxBlurYX(s, sw, d, kernelSizeY, lowOffsetY, highOffsetY, h, w); 226 boxBlurYX(s, sw, d, kernelSizeY, lowOffsetY, highOffsetY, h, w);
226 boxBlurX(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w); 227 boxBlurX(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w);
227 boxBlurXY(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w); 228 boxBlurXY(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w);
228 } 229 }
229 return true; 230 return true;
230 } 231 }
231 232
232 233
233 void SkBlurImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const { 234 void SkBlurImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
234 if (getInput(0)) { 235 if (this->getInput(0)) {
235 getInput(0)->computeFastBounds(src, dst); 236 this->getInput(0)->computeFastBounds(src, dst);
236 } else { 237 } else {
237 *dst = src; 238 *dst = src;
238 } 239 }
239 240
240 dst->outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)), 241 dst->outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)),
241 SkScalarMul(fSigma.height(), SkIntToScalar(3))); 242 SkScalarMul(fSigma.height(), SkIntToScalar(3)));
242 } 243 }
243 244
244 bool SkBlurImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, 245 bool SkBlurImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
245 SkIRect* dst) const { 246 SkIRect* dst) const {
246 SkIRect bounds = src; 247 SkIRect bounds = src;
247 SkVector sigma = mapSigma(fSigma, ctm); 248 SkVector sigma = mapSigma(fSigma, ctm);
248 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), 249 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))),
249 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); 250 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3))));
250 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { 251 if (this->getInput(0) && !this->getInput(0)->filterBounds(bounds, ctm, &boun ds)) {
251 return false; 252 return false;
252 } 253 }
253 *dst = bounds; 254 *dst = bounds;
254 return true; 255 return true;
255 } 256 }
256 257
257 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 258 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
258 SkBitmap* result, SkIPoint* offset) const { 259 SkBitmap* result, SkIPoint* offset) const {
259 #if SK_SUPPORT_GPU 260 #if SK_SUPPORT_GPU
260 SkBitmap input = src; 261 SkBitmap input = src;
261 SkIPoint srcOffset = SkIPoint::Make(0, 0); 262 SkIPoint srcOffset = SkIPoint::Make(0, 0);
262 if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &input, &srcOffset)) { 263 if (this->getInput(0) &&
264 !this->getInput(0)->getInputResultGPU(proxy, src, ctx, &input, &srcOffse t)) {
263 return false; 265 return false;
264 } 266 }
265 SkIRect rect; 267 SkIRect rect;
266 if (!this->applyCropRect(ctx, proxy, input, &srcOffset, &rect, &input)) { 268 if (!this->applyCropRect(ctx, proxy, input, &srcOffset, &rect, &input)) {
267 return false; 269 return false;
268 } 270 }
269 GrTexture* source = input.getTexture(); 271 GrTexture* source = input.getTexture();
270 SkVector sigma = mapSigma(fSigma, ctx.ctm()); 272 SkVector sigma = mapSigma(fSigma, ctx.ctm());
271 offset->fX = rect.fLeft; 273 offset->fX = rect.fLeft;
272 offset->fY = rect.fTop; 274 offset->fY = rect.fTop;
(...skipping 21 matching lines...) Expand all
294 str->appendf("SkBlurImageFilter: ("); 296 str->appendf("SkBlurImageFilter: (");
295 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); 297 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight);
296 298
297 if (this->getInput(0)) { 299 if (this->getInput(0)) {
298 this->getInput(0)->toString(str); 300 this->getInput(0)->toString(str);
299 } 301 }
300 302
301 str->append("))"); 303 str->append("))");
302 } 304 }
303 #endif 305 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698