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

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

Issue 137423005: Implement a computeFastBounds() traversal for SkImageFilter. This allows for correct culling of pri… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix Win build; update to ToT Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkBitmapSource.cpp ('k') | src/effects/SkDisplacementMapEffect.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 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 boxBlurX(d, w, t, kernelSizeX, highOffsetX, lowOffsetX, w, h); 217 boxBlurX(d, w, t, kernelSizeX, highOffsetX, lowOffsetX, w, h);
218 boxBlurX(t, w, d, kernelSizeX3, highOffsetX, highOffsetX, w, h); 218 boxBlurX(t, w, d, kernelSizeX3, highOffsetX, highOffsetX, w, h);
219 } else if (kernelSizeY > 0) { 219 } else if (kernelSizeY > 0) {
220 boxBlurYX(s, sw, d, kernelSizeY, lowOffsetY, highOffsetY, h, w); 220 boxBlurYX(s, sw, d, kernelSizeY, lowOffsetY, highOffsetY, h, w);
221 boxBlurX(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w); 221 boxBlurX(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w);
222 boxBlurXY(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w); 222 boxBlurXY(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w);
223 } 223 }
224 return true; 224 return true;
225 } 225 }
226 226
227
228 void SkBlurImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
229 if (getInput(0)) {
230 getInput(0)->computeFastBounds(src, dst);
231 } else {
232 *dst = src;
233 }
234
235 dst->outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)),
236 SkScalarMul(fSigma.height(), SkIntToScalar(3)));
237 }
227 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm, 238 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
228 SkBitmap* result, SkIPoint* offset) { 239 SkBitmap* result, SkIPoint* offset) {
229 #if SK_SUPPORT_GPU 240 #if SK_SUPPORT_GPU
230 SkBitmap input; 241 SkBitmap input;
231 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in put, offset)) { 242 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in put, offset)) {
232 return false; 243 return false;
233 } 244 }
234 GrTexture* source = input.getTexture(); 245 GrTexture* source = input.getTexture();
235 SkIRect rect; 246 SkIRect rect;
236 src.getBounds(&rect); 247 src.getBounds(&rect);
(...skipping 10 matching lines...) Expand all
247 sigma.x(), 258 sigma.x(),
248 sigma.y())); 259 sigma.y()));
249 offset->fX = rect.fLeft; 260 offset->fX = rect.fLeft;
250 offset->fY = rect.fTop; 261 offset->fY = rect.fTop;
251 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult); 262 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult);
252 #else 263 #else
253 SkDEBUGFAIL("Should not call in GPU-less build"); 264 SkDEBUGFAIL("Should not call in GPU-less build");
254 return false; 265 return false;
255 #endif 266 #endif
256 } 267 }
OLDNEW
« no previous file with comments | « src/effects/SkBitmapSource.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698