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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 SkIRect srcBounds, dstBounds; | 154 SkIRect srcBounds, dstBounds; |
155 src.getBounds(&srcBounds); | 155 src.getBounds(&srcBounds); |
156 srcBounds.offset(srcOffset); | 156 srcBounds.offset(srcOffset); |
157 if (!this->applyCropRect(&srcBounds, ctm)) { | 157 if (!this->applyCropRect(&srcBounds, ctm)) { |
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 if (!dst->allocPixels()) { |
164 if (!dst->getPixels()) { | |
165 return false; | 164 return false; |
166 } | 165 } |
167 | 166 |
168 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height())
; | 167 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height())
; |
169 ctm.mapVectors(&sigma, &localSigma, 1); | 168 ctm.mapVectors(&sigma, &localSigma, 1); |
170 | 169 |
171 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; | 170 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; |
172 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; | 171 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; |
173 getBox3Params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOffs
etX); | 172 getBox3Params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOffs
etX); |
174 getBox3Params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOffs
etY); | 173 getBox3Params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOffs
etY); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 sigma.x(), | 247 sigma.x(), |
249 sigma.y())); | 248 sigma.y())); |
250 offset->fX = rect.fLeft; | 249 offset->fX = rect.fLeft; |
251 offset->fY = rect.fTop; | 250 offset->fY = rect.fTop; |
252 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); | 251 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); |
253 #else | 252 #else |
254 SkDEBUGFAIL("Should not call in GPU-less build"); | 253 SkDEBUGFAIL("Should not call in GPU-less build"); |
255 return false; | 254 return false; |
256 #endif | 255 #endif |
257 } | 256 } |
OLD | NEW |