OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 "SkMatrixConvolutionImageFilter.h" | 8 #include "SkMatrixConvolutionImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 if (!fConvolveAlpha && !src.isOpaque()) { | 276 if (!fConvolveAlpha && !src.isOpaque()) { |
277 src = unpremultiplyBitmap(src); | 277 src = unpremultiplyBitmap(src); |
278 } | 278 } |
279 | 279 |
280 SkAutoLockPixels alp(src); | 280 SkAutoLockPixels alp(src); |
281 if (!src.getPixels()) { | 281 if (!src.getPixels()) { |
282 return false; | 282 return false; |
283 } | 283 } |
284 | 284 |
285 result->setConfig(src.config(), bounds.width(), bounds.height()); | 285 if (!result->allocPixels(src.info().makeWH(bounds.width(), bounds.height()))
) { |
286 result->allocPixels(); | |
287 if (!result->getPixels()) { | |
288 return false; | 286 return false; |
289 } | 287 } |
290 | 288 |
291 offset->fX = bounds.fLeft; | 289 offset->fX = bounds.fLeft; |
292 offset->fY = bounds.fTop; | 290 offset->fY = bounds.fTop; |
293 bounds.offset(-srcOffset); | 291 bounds.offset(-srcOffset); |
294 SkIRect interior = SkIRect::MakeXYWH(bounds.left() + fKernelOffset.fX, | 292 SkIRect interior = SkIRect::MakeXYWH(bounds.left() + fKernelOffset.fX, |
295 bounds.top() + fKernelOffset.fY, | 293 bounds.top() + fKernelOffset.fY, |
296 bounds.width() - fKernelSize.fWidth + 1
, | 294 bounds.width() - fKernelSize.fWidth + 1
, |
297 bounds.height() - fKernelSize.fHeight +
1); | 295 bounds.height() - fKernelSize.fHeight +
1); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 fBias, | 677 fBias, |
680 fKernelOffset, | 678 fKernelOffset, |
681 fTileMode, | 679 fTileMode, |
682 fConvolveAlpha); | 680 fConvolveAlpha); |
683 return true; | 681 return true; |
684 } | 682 } |
685 | 683 |
686 /////////////////////////////////////////////////////////////////////////////// | 684 /////////////////////////////////////////////////////////////////////////////// |
687 | 685 |
688 #endif | 686 #endif |
OLD | NEW |