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

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

Issue 23011012: Implement correct clipping for image filters. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add morphology to the list of ignored tests 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/SkComposeImageFilter.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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 void SkBlurImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const { 229 void SkBlurImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
230 if (getInput(0)) { 230 if (getInput(0)) {
231 getInput(0)->computeFastBounds(src, dst); 231 getInput(0)->computeFastBounds(src, dst);
232 } else { 232 } else {
233 *dst = src; 233 *dst = src;
234 } 234 }
235 235
236 dst->outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)), 236 dst->outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)),
237 SkScalarMul(fSigma.height(), SkIntToScalar(3))); 237 SkScalarMul(fSigma.height(), SkIntToScalar(3)));
238 } 238 }
239
240 bool SkBlurImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
241 SkIRect* dst) const {
242 SkIRect bounds = src;
243 if (getInput(0) && !getInput(0)->filterBounds(src, ctm, &bounds)) {
244 return false;
245 }
246 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height()) ;
247 ctm.mapVectors(&sigma, &localSigma, 1);
248 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))),
249 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3))));
250 *dst = bounds;
251 return true;
252 }
253
239 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm, 254 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
240 SkBitmap* result, SkIPoint* offset) { 255 SkBitmap* result, SkIPoint* offset) {
241 #if SK_SUPPORT_GPU 256 #if SK_SUPPORT_GPU
242 SkBitmap input; 257 SkBitmap input;
243 SkIPoint srcOffset = SkIPoint::Make(0, 0); 258 SkIPoint srcOffset = SkIPoint::Make(0, 0);
244 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in put, &srcOffset)) { 259 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in put, &srcOffset)) {
245 return false; 260 return false;
246 } 261 }
247 GrTexture* source = input.getTexture(); 262 GrTexture* source = input.getTexture();
248 SkIRect rect; 263 SkIRect rect;
(...skipping 13 matching lines...) Expand all
262 SkRect::Make(rect), 277 SkRect::Make(rect),
263 true, 278 true,
264 sigma.x(), 279 sigma.x(),
265 sigma.y())); 280 sigma.y()));
266 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult); 281 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult);
267 #else 282 #else
268 SkDEBUGFAIL("Should not call in GPU-less build"); 283 SkDEBUGFAIL("Should not call in GPU-less build");
269 return false; 284 return false;
270 #endif 285 #endif
271 } 286 }
OLDNEW
« no previous file with comments | « src/effects/SkBitmapSource.cpp ('k') | src/effects/SkComposeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698