| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } else if (kernelSizeY > 0) { | 199 } else if (kernelSizeY > 0) { |
| 200 boxBlurY(src, dst, kernelSizeY, lowOffsetY, highOffsetY, srcBounds)
; | 200 boxBlurY(src, dst, kernelSizeY, lowOffsetY, highOffsetY, srcBounds)
; |
| 201 boxBlurY(*dst, &temp, kernelSizeY, highOffsetY, lowOffsetY, dstBounds); | 201 boxBlurY(*dst, &temp, kernelSizeY, highOffsetY, lowOffsetY, dstBounds); |
| 202 boxBlurY(temp, dst, kernelSizeY3, highOffsetY, highOffsetY, dstBounds)
; | 202 boxBlurY(temp, dst, kernelSizeY3, highOffsetY, highOffsetY, dstBounds)
; |
| 203 } | 203 } |
| 204 offset->fX += srcBounds.fLeft; | 204 offset->fX += srcBounds.fLeft; |
| 205 offset->fY += srcBounds.fTop; | 205 offset->fY += srcBounds.fTop; |
| 206 return true; | 206 return true; |
| 207 } | 207 } |
| 208 | 208 |
| 209 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBitm
ap* result, | 209 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
SkMatrix& ctm, |
| 210 SkIPoint* offset) { | 210 SkBitmap* result, SkIPoint* offset) { |
| 211 #if SK_SUPPORT_GPU | 211 #if SK_SUPPORT_GPU |
| 212 SkBitmap input; | 212 SkBitmap input; |
| 213 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &input,
offset)) { | 213 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in
put, offset)) { |
| 214 return false; | 214 return false; |
| 215 } | 215 } |
| 216 GrTexture* source = input.getTexture(); | 216 GrTexture* source = input.getTexture(); |
| 217 SkIRect rect; | 217 SkIRect rect; |
| 218 src.getBounds(&rect); | 218 src.getBounds(&rect); |
| 219 if (!this->applyCropRect(&rect)) { | 219 if (!this->applyCropRect(&rect)) { |
| 220 return false; | 220 return false; |
| 221 } | 221 } |
| 222 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext(
), | 222 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext(
), |
| 223 source, | 223 source, |
| 224 false, | 224 false, |
| 225 SkRect::Make(rect), | 225 SkRect::Make(rect), |
| 226 true, | 226 true, |
| 227 fSigma.width(), | 227 fSigma.width(), |
| 228 fSigma.height())); | 228 fSigma.height())); |
| 229 offset->fX += rect.fLeft; | 229 offset->fX += rect.fLeft; |
| 230 offset->fY += rect.fTop; | 230 offset->fY += rect.fTop; |
| 231 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); | 231 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); |
| 232 #else | 232 #else |
| 233 SkDEBUGFAIL("Should not call in GPU-less build"); | 233 SkDEBUGFAIL("Should not call in GPU-less build"); |
| 234 return false; | 234 return false; |
| 235 #endif | 235 #endif |
| 236 } | 236 } |
| OLD | NEW |