| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 return reset_return_false(this); | 210 return reset_return_false(this); |
| 211 } | 211 } |
| 212 | 212 |
| 213 this->freePixels(); | 213 this->freePixels(); |
| 214 | 214 |
| 215 fInfo = info; | 215 fInfo = info; |
| 216 fRowBytes = SkToU32(rowBytes); | 216 fRowBytes = SkToU32(rowBytes); |
| 217 return true; | 217 return true; |
| 218 } | 218 } |
| 219 | 219 |
| 220 #ifdef SK_SUPPORT_LEGACY_SETCONFIG |
| 220 bool SkBitmap::setConfig(Config config, int width, int height, size_t rowBytes, | 221 bool SkBitmap::setConfig(Config config, int width, int height, size_t rowBytes, |
| 221 SkAlphaType alphaType) { | 222 SkAlphaType alphaType) { |
| 222 SkColorType ct = SkBitmapConfigToColorType(config); | 223 SkColorType ct = SkBitmapConfigToColorType(config); |
| 223 return this->setInfo(SkImageInfo::Make(width, height, ct, alphaType), rowByt
es); | 224 return this->setInfo(SkImageInfo::Make(width, height, ct, alphaType), rowByt
es); |
| 224 } | 225 } |
| 226 #endif |
| 225 | 227 |
| 226 bool SkBitmap::setAlphaType(SkAlphaType alphaType) { | 228 bool SkBitmap::setAlphaType(SkAlphaType alphaType) { |
| 227 if (!validate_alphaType(fInfo.fColorType, alphaType, &alphaType)) { | 229 if (!validate_alphaType(fInfo.fColorType, alphaType, &alphaType)) { |
| 228 return false; | 230 return false; |
| 229 } | 231 } |
| 230 if (fInfo.fAlphaType != alphaType) { | 232 if (fInfo.fAlphaType != alphaType) { |
| 231 fInfo.fAlphaType = alphaType; | 233 fInfo.fAlphaType = alphaType; |
| 232 if (fPixelRef) { | 234 if (fPixelRef) { |
| 233 fPixelRef->changeAlphaType(alphaType); | 235 fPixelRef->changeAlphaType(alphaType); |
| 234 } | 236 } |
| (...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 /////////////////////////////////////////////////////////////////////////////// | 1427 /////////////////////////////////////////////////////////////////////////////// |
| 1426 | 1428 |
| 1427 #ifdef SK_DEBUG | 1429 #ifdef SK_DEBUG |
| 1428 void SkImageInfo::validate() const { | 1430 void SkImageInfo::validate() const { |
| 1429 SkASSERT(fWidth >= 0); | 1431 SkASSERT(fWidth >= 0); |
| 1430 SkASSERT(fHeight >= 0); | 1432 SkASSERT(fHeight >= 0); |
| 1431 SkASSERT(SkColorTypeIsValid(fColorType)); | 1433 SkASSERT(SkColorTypeIsValid(fColorType)); |
| 1432 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1434 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
| 1433 } | 1435 } |
| 1434 #endif | 1436 #endif |
| OLD | NEW |