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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 SkIRect srcBounds, dstBounds; | 153 SkIRect srcBounds, dstBounds; |
154 src.getBounds(&srcBounds); | 154 src.getBounds(&srcBounds); |
155 if (!this->applyCropRect(&srcBounds, ctm)) { | 155 if (!this->applyCropRect(&srcBounds, ctm)) { |
156 return false; | 156 return false; |
157 } | 157 } |
158 | 158 |
159 dst->setConfig(src.config(), srcBounds.width(), srcBounds.height()); | 159 dst->setConfig(src.config(), srcBounds.width(), srcBounds.height()); |
160 dst->getBounds(&dstBounds); | 160 dst->getBounds(&dstBounds); |
161 dst->allocPixels(); | 161 dst->allocPixels(); |
| 162 if (!dst->getPixels()) { |
| 163 return false; |
| 164 } |
| 165 |
162 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; | 166 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; |
163 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; | 167 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; |
164 getBox3Params(fSigma.width(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &hig
hOffsetX); | 168 getBox3Params(fSigma.width(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &hig
hOffsetX); |
165 getBox3Params(fSigma.height(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &hi
ghOffsetY); | 169 getBox3Params(fSigma.height(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &hi
ghOffsetY); |
166 | 170 |
167 if (kernelSizeX < 0 || kernelSizeY < 0) { | 171 if (kernelSizeX < 0 || kernelSizeY < 0) { |
168 return false; | 172 return false; |
169 } | 173 } |
170 | 174 |
171 if (kernelSizeX == 0 && kernelSizeY == 0) { | 175 if (kernelSizeX == 0 && kernelSizeY == 0) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 fSigma.width(), | 238 fSigma.width(), |
235 fSigma.height())); | 239 fSigma.height())); |
236 offset->fX += rect.fLeft; | 240 offset->fX += rect.fLeft; |
237 offset->fY += rect.fTop; | 241 offset->fY += rect.fTop; |
238 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); | 242 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); |
239 #else | 243 #else |
240 SkDEBUGFAIL("Should not call in GPU-less build"); | 244 SkDEBUGFAIL("Should not call in GPU-less build"); |
241 return false; | 245 return false; |
242 #endif | 246 #endif |
243 } | 247 } |
OLD | NEW |