| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 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 "SkAtomics.h" | 8 #include "SkAtomics.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 | 1026 |
| 1027 srcM.fBounds.set(0, 0, this->width(), this->height()); | 1027 srcM.fBounds.set(0, 0, this->width(), this->height()); |
| 1028 srcM.fRowBytes = SkAlign4(this->width()); | 1028 srcM.fRowBytes = SkAlign4(this->width()); |
| 1029 srcM.fFormat = SkMask::kA8_Format; | 1029 srcM.fFormat = SkMask::kA8_Format; |
| 1030 | 1030 |
| 1031 SkMaskFilter* filter = paint ? paint->getMaskFilter() : nullptr; | 1031 SkMaskFilter* filter = paint ? paint->getMaskFilter() : nullptr; |
| 1032 | 1032 |
| 1033 // compute our (larger?) dst bounds if we have a filter | 1033 // compute our (larger?) dst bounds if we have a filter |
| 1034 if (filter) { | 1034 if (filter) { |
| 1035 identity.reset(); | 1035 identity.reset(); |
| 1036 srcM.fImage = nullptr; | |
| 1037 if (!filter->filterMask(&dstM, srcM, identity, nullptr)) { | 1036 if (!filter->filterMask(&dstM, srcM, identity, nullptr)) { |
| 1038 goto NO_FILTER_CASE; | 1037 goto NO_FILTER_CASE; |
| 1039 } | 1038 } |
| 1040 dstM.fRowBytes = SkAlign4(dstM.fBounds.width()); | 1039 dstM.fRowBytes = SkAlign4(dstM.fBounds.width()); |
| 1041 } else { | 1040 } else { |
| 1042 NO_FILTER_CASE: | 1041 NO_FILTER_CASE: |
| 1043 tmpBitmap.setInfo(SkImageInfo::MakeA8(this->width(), this->height()), sr
cM.fRowBytes); | 1042 tmpBitmap.setInfo(SkImageInfo::MakeA8(this->width(), this->height()), sr
cM.fRowBytes); |
| 1044 if (!tmpBitmap.tryAllocPixels(allocator, nullptr)) { | 1043 if (!tmpBitmap.tryAllocPixels(allocator, nullptr)) { |
| 1045 // Allocation of pixels for alpha bitmap failed. | 1044 // Allocation of pixels for alpha bitmap failed. |
| 1046 SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", | 1045 SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 /////////////////////////////////////////////////////////////////////////////// | 1337 /////////////////////////////////////////////////////////////////////////////// |
| 1339 | 1338 |
| 1340 #ifdef SK_DEBUG | 1339 #ifdef SK_DEBUG |
| 1341 void SkImageInfo::validate() const { | 1340 void SkImageInfo::validate() const { |
| 1342 SkASSERT(fWidth >= 0); | 1341 SkASSERT(fWidth >= 0); |
| 1343 SkASSERT(fHeight >= 0); | 1342 SkASSERT(fHeight >= 0); |
| 1344 SkASSERT(SkColorTypeIsValid(fColorType)); | 1343 SkASSERT(SkColorTypeIsValid(fColorType)); |
| 1345 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1344 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
| 1346 } | 1345 } |
| 1347 #endif | 1346 #endif |
| OLD | NEW |