OLD | NEW |
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 *dst = src; | 246 *dst = src; |
247 } | 247 } |
248 | 248 |
249 dst->outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)), | 249 dst->outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)), |
250 SkScalarMul(fSigma.height(), SkIntToScalar(3))); | 250 SkScalarMul(fSigma.height(), SkIntToScalar(3))); |
251 } | 251 } |
252 | 252 |
253 bool SkBlurImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, | 253 bool SkBlurImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, |
254 SkIRect* dst) const { | 254 SkIRect* dst) const { |
255 SkIRect bounds = src; | 255 SkIRect bounds = src; |
256 if (getInput(0) && !getInput(0)->filterBounds(src, ctm, &bounds)) { | |
257 return false; | |
258 } | |
259 SkVector sigma = SkVector::Make(fSigma.width(), fSigma.height()); | 256 SkVector sigma = SkVector::Make(fSigma.width(), fSigma.height()); |
260 ctm.mapVectors(&sigma, 1); | 257 ctm.mapVectors(&sigma, 1); |
261 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), | 258 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), |
262 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); | 259 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); |
| 260 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { |
| 261 return false; |
| 262 } |
263 *dst = bounds; | 263 *dst = bounds; |
264 return true; | 264 return true; |
265 } | 265 } |
266 | 266 |
267 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 267 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
268 SkBitmap* result, SkIPoint* offset) const
{ | 268 SkBitmap* result, SkIPoint* offset) const
{ |
269 #if SK_SUPPORT_GPU | 269 #if SK_SUPPORT_GPU |
270 SkBitmap input = src; | 270 SkBitmap input = src; |
271 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 271 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
272 if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &input,
&srcOffset)) { | 272 if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &input,
&srcOffset)) { |
(...skipping 18 matching lines...) Expand all Loading... |
291 true, | 291 true, |
292 sigma.x(), | 292 sigma.x(), |
293 sigma.y())); | 293 sigma.y())); |
294 WrapTexture(tex, rect.width(), rect.height(), result); | 294 WrapTexture(tex, rect.width(), rect.height(), result); |
295 return true; | 295 return true; |
296 #else | 296 #else |
297 SkDEBUGFAIL("Should not call in GPU-less build"); | 297 SkDEBUGFAIL("Should not call in GPU-less build"); |
298 return false; | 298 return false; |
299 #endif | 299 #endif |
300 } | 300 } |
OLD | NEW |