| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 151         return false; | 151         return false; | 
| 152     } | 152     } | 
| 153 | 153 | 
| 154     SkAutoLockPixels alp(src); | 154     SkAutoLockPixels alp(src); | 
| 155     if (!src.getPixels()) { | 155     if (!src.getPixels()) { | 
| 156         return false; | 156         return false; | 
| 157     } | 157     } | 
| 158 | 158 | 
| 159     SkIRect srcBounds, dstBounds; | 159     SkIRect srcBounds, dstBounds; | 
| 160     src.getBounds(&srcBounds); | 160     src.getBounds(&srcBounds); | 
| 161     if (!this->applyCropRect(&srcBounds)) { | 161     if (!this->applyCropRect(&srcBounds, ctm)) { | 
| 162         return false; | 162         return false; | 
| 163     } | 163     } | 
| 164 | 164 | 
| 165     dst->setConfig(src.config(), srcBounds.width(), srcBounds.height()); | 165     dst->setConfig(src.config(), srcBounds.width(), srcBounds.height()); | 
| 166     dst->getBounds(&dstBounds); | 166     dst->getBounds(&dstBounds); | 
| 167     dst->allocPixels(); | 167     dst->allocPixels(); | 
| 168     int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; | 168     int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; | 
| 169     int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; | 169     int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; | 
| 170     getBox3Params(fSigma.width(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &hig
     hOffsetX); | 170     getBox3Params(fSigma.width(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &hig
     hOffsetX); | 
| 171     getBox3Params(fSigma.height(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &hi
     ghOffsetY); | 171     getBox3Params(fSigma.height(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &hi
     ghOffsetY); | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 209 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const 
     SkMatrix& ctm, | 209 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const 
     SkMatrix& ctm, | 
| 210                                        SkBitmap* result, 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, ctm, &in
     put, 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, ctm)) { | 
| 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 | 
|---|