OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 SkTSwap(fFlags, other.fFlags); | 84 SkTSwap(fFlags, other.fFlags); |
85 | 85 |
86 SkDEBUGCODE(this->validate();) | 86 SkDEBUGCODE(this->validate();) |
87 } | 87 } |
88 | 88 |
89 void SkBitmap::reset() { | 89 void SkBitmap::reset() { |
90 this->freePixels(); | 90 this->freePixels(); |
91 sk_bzero(this, sizeof(*this)); | 91 sk_bzero(this, sizeof(*this)); |
92 } | 92 } |
93 | 93 |
| 94 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG |
94 SkBitmap::Config SkBitmap::config() const { | 95 SkBitmap::Config SkBitmap::config() const { |
95 return SkColorTypeToBitmapConfig(fInfo.colorType()); | 96 return SkColorTypeToBitmapConfig(fInfo.colorType()); |
96 } | 97 } |
| 98 #endif |
97 | 99 |
98 #ifdef SK_SUPPORT_LEGACY_COMPUTE_CONFIG_SIZE | 100 #ifdef SK_SUPPORT_LEGACY_COMPUTE_CONFIG_SIZE |
99 int SkBitmap::ComputeBytesPerPixel(SkBitmap::Config config) { | 101 int SkBitmap::ComputeBytesPerPixel(SkBitmap::Config config) { |
100 int bpp; | 102 int bpp; |
101 switch (config) { | 103 switch (config) { |
102 case kNo_Config: | 104 case kNo_Config: |
103 bpp = 0; // not applicable | 105 bpp = 0; // not applicable |
104 break; | 106 break; |
105 case kA8_Config: | 107 case kA8_Config: |
106 case kIndex8_Config: | 108 case kIndex8_Config: |
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 /////////////////////////////////////////////////////////////////////////////// | 1426 /////////////////////////////////////////////////////////////////////////////// |
1425 | 1427 |
1426 #ifdef SK_DEBUG | 1428 #ifdef SK_DEBUG |
1427 void SkImageInfo::validate() const { | 1429 void SkImageInfo::validate() const { |
1428 SkASSERT(fWidth >= 0); | 1430 SkASSERT(fWidth >= 0); |
1429 SkASSERT(fHeight >= 0); | 1431 SkASSERT(fHeight >= 0); |
1430 SkASSERT(SkColorTypeIsValid(fColorType)); | 1432 SkASSERT(SkColorTypeIsValid(fColorType)); |
1431 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1433 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
1432 } | 1434 } |
1433 #endif | 1435 #endif |
OLD | NEW |