| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 return false; | 158 return false; |
| 159 } | 159 } |
| 160 | 160 |
| 161 dst->setConfig(src.config(), srcBounds.width(), srcBounds.height()); | 161 dst->setConfig(src.config(), srcBounds.width(), srcBounds.height()); |
| 162 dst->getBounds(&dstBounds); | 162 dst->getBounds(&dstBounds); |
| 163 dst->allocPixels(); | 163 dst->allocPixels(); |
| 164 if (!dst->getPixels()) { | 164 if (!dst->getPixels()) { |
| 165 return false; | 165 return false; |
| 166 } | 166 } |
| 167 | 167 |
| 168 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height())
; |
| 169 ctm.mapVectors(&sigma, &localSigma, 1); |
| 170 |
| 168 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; | 171 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; |
| 169 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; | 172 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; |
| 170 getBox3Params(fSigma.width(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &hig
hOffsetX); | 173 getBox3Params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOffs
etX); |
| 171 getBox3Params(fSigma.height(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &hi
ghOffsetY); | 174 getBox3Params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOffs
etY); |
| 172 | 175 |
| 173 if (kernelSizeX < 0 || kernelSizeY < 0) { | 176 if (kernelSizeX < 0 || kernelSizeY < 0) { |
| 174 return false; | 177 return false; |
| 175 } | 178 } |
| 176 | 179 |
| 177 if (kernelSizeX == 0 && kernelSizeY == 0) { | 180 if (kernelSizeX == 0 && kernelSizeY == 0) { |
| 178 src.copyTo(dst, dst->config()); | 181 src.copyTo(dst, dst->config()); |
| 179 offset->fX = srcBounds.fLeft; | 182 offset->fX = srcBounds.fLeft; |
| 180 offset->fY = srcBounds.fTop; | 183 offset->fY = srcBounds.fTop; |
| 181 return true; | 184 return true; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 SkBitmap input; | 231 SkBitmap input; |
| 229 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in
put, offset)) { | 232 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in
put, offset)) { |
| 230 return false; | 233 return false; |
| 231 } | 234 } |
| 232 GrTexture* source = input.getTexture(); | 235 GrTexture* source = input.getTexture(); |
| 233 SkIRect rect; | 236 SkIRect rect; |
| 234 src.getBounds(&rect); | 237 src.getBounds(&rect); |
| 235 if (!this->applyCropRect(&rect, ctm)) { | 238 if (!this->applyCropRect(&rect, ctm)) { |
| 236 return false; | 239 return false; |
| 237 } | 240 } |
| 241 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height())
; |
| 242 ctm.mapVectors(&sigma, &localSigma, 1); |
| 238 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext(
), | 243 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext(
), |
| 239 source, | 244 source, |
| 240 false, | 245 false, |
| 241 SkRect::Make(rect), | 246 SkRect::Make(rect), |
| 242 true, | 247 true, |
| 243 fSigma.width(), | 248 sigma.x(), |
| 244 fSigma.height())); | 249 sigma.y())); |
| 245 offset->fX = rect.fLeft; | 250 offset->fX = rect.fLeft; |
| 246 offset->fY = rect.fTop; | 251 offset->fY = rect.fTop; |
| 247 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); | 252 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); |
| 248 #else | 253 #else |
| 249 SkDEBUGFAIL("Should not call in GPU-less build"); | 254 SkDEBUGFAIL("Should not call in GPU-less build"); |
| 250 return false; | 255 return false; |
| 251 #endif | 256 #endif |
| 252 } | 257 } |
| OLD | NEW |