| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 SkOpts::box_blur_xx(t, w, dstBounds, d, kernelSizeX3, highOffsetX, hi
ghOffsetX, w, h); | 172 SkOpts::box_blur_xx(t, w, dstBounds, d, kernelSizeX3, highOffsetX, hi
ghOffsetX, w, h); |
| 173 } else if (kernelSizeY > 0) { | 173 } else if (kernelSizeY > 0) { |
| 174 SkOpts::box_blur_yx(s, sw, srcBoundsT, d, kernelSizeY, lowOffsetY, hi
ghOffsetY, h, w); | 174 SkOpts::box_blur_yx(s, sw, srcBoundsT, d, kernelSizeY, lowOffsetY, hi
ghOffsetY, h, w); |
| 175 SkOpts::box_blur_xx(d, h, dstBoundsT, t, kernelSizeY, highOffsetY, lo
wOffsetY, h, w); | 175 SkOpts::box_blur_xx(d, h, dstBoundsT, t, kernelSizeY, highOffsetY, lo
wOffsetY, h, w); |
| 176 SkOpts::box_blur_xy(t, h, dstBoundsT, d, kernelSizeY3, highOffsetY, hi
ghOffsetY, h, w); | 176 SkOpts::box_blur_xy(t, h, dstBoundsT, d, kernelSizeY3, highOffsetY, hi
ghOffsetY, h, w); |
| 177 } | 177 } |
| 178 return true; | 178 return true; |
| 179 } | 179 } |
| 180 | 180 |
| 181 | 181 |
| 182 void SkBlurImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const
{ | 182 SkRect SkBlurImageFilter::computeFastBounds(const SkRect& src) const { |
| 183 if (this->getInput(0)) { | 183 SkRect bounds = this->getInput(0) ? this->getInput(0)->computeFastBounds(src
) : src; |
| 184 this->getInput(0)->computeFastBounds(src, dst); | 184 bounds.outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)), |
| 185 } else { | 185 SkScalarMul(fSigma.height(), SkIntToScalar(3))); |
| 186 *dst = src; | 186 return bounds; |
| 187 } | |
| 188 | |
| 189 dst->outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)), | |
| 190 SkScalarMul(fSigma.height(), SkIntToScalar(3))); | |
| 191 } | 187 } |
| 192 | 188 |
| 193 void SkBlurImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& c
tm, | 189 SkIRect SkBlurImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix
& ctm, |
| 194 SkIRect* dst, MapDirection) const { | 190 MapDirection) const { |
| 195 *dst = src; | |
| 196 SkVector sigma = map_sigma(fSigma, ctm); | 191 SkVector sigma = map_sigma(fSigma, ctm); |
| 197 dst->outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), | 192 return src.makeOutset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar
(3))), |
| 198 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); | 193 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar
(3)))); |
| 199 } | 194 } |
| 200 | 195 |
| 201 bool SkBlurImageFilter::filterImageGPUDeprecated(Proxy* proxy, const SkBitmap& s
rc, | 196 bool SkBlurImageFilter::filterImageGPUDeprecated(Proxy* proxy, const SkBitmap& s
rc, |
| 202 const Context& ctx, | 197 const Context& ctx, |
| 203 SkBitmap* result, SkIPoint* off
set) const { | 198 SkBitmap* result, SkIPoint* off
set) const { |
| 204 #if SK_SUPPORT_GPU | 199 #if SK_SUPPORT_GPU |
| 205 SkBitmap input = src; | 200 SkBitmap input = src; |
| 206 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 201 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
| 207 if (!this->filterInputGPUDeprecated(0, proxy, src, ctx, &input, &srcOffset))
{ | 202 if (!this->filterInputGPUDeprecated(0, proxy, src, ctx, &input, &srcOffset))
{ |
| 208 return false; | 203 return false; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 str->appendf("SkBlurImageFilter: ("); | 247 str->appendf("SkBlurImageFilter: ("); |
| 253 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); | 248 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); |
| 254 | 249 |
| 255 if (this->getInput(0)) { | 250 if (this->getInput(0)) { |
| 256 this->getInput(0)->toString(str); | 251 this->getInput(0)->toString(str); |
| 257 } | 252 } |
| 258 | 253 |
| 259 str->append("))"); | 254 str->append("))"); |
| 260 } | 255 } |
| 261 #endif | 256 #endif |
| OLD | NEW |