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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 } |
OLD | NEW |