| 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" |
| 11 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
| 12 #include "SkDither.h" | 12 #include "SkDither.h" |
| 13 #include "SkFlattenable.h" | 13 #include "SkFlattenable.h" |
| 14 #include "SkImagePriv.h" |
| 14 #include "SkMallocPixelRef.h" | 15 #include "SkMallocPixelRef.h" |
| 15 #include "SkMask.h" | 16 #include "SkMask.h" |
| 16 #include "SkOrderedReadBuffer.h" | 17 #include "SkOrderedReadBuffer.h" |
| 17 #include "SkOrderedWriteBuffer.h" | 18 #include "SkOrderedWriteBuffer.h" |
| 18 #include "SkPixelRef.h" | 19 #include "SkPixelRef.h" |
| 19 #include "SkThread.h" | 20 #include "SkThread.h" |
| 20 #include "SkUnPreMultiply.h" | 21 #include "SkUnPreMultiply.h" |
| 21 #include "SkUtils.h" | 22 #include "SkUtils.h" |
| 22 #include "SkValidationUtils.h" | 23 #include "SkValidationUtils.h" |
| 23 #include "SkPackBits.h" | 24 #include "SkPackBits.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 326 |
| 326 SkDEBUGCODE(this->validate();) | 327 SkDEBUGCODE(this->validate();) |
| 327 return true; | 328 return true; |
| 328 | 329 |
| 329 // if we got here, we had an error, so we reset the bitmap to empty | 330 // if we got here, we had an error, so we reset the bitmap to empty |
| 330 BAD_CONFIG: | 331 BAD_CONFIG: |
| 331 this->reset(); | 332 this->reset(); |
| 332 return false; | 333 return false; |
| 333 } | 334 } |
| 334 | 335 |
| 336 bool SkBitmap::setConfig(const SkImageInfo& info, size_t rowBytes) { |
| 337 return this->setConfig(SkImageInfoToBitmapConfig(info), info.fWidth, |
| 338 info.fHeight, rowBytes, info.fAlphaType); |
| 339 } |
| 340 |
| 335 bool SkBitmap::setAlphaType(SkAlphaType alphaType) { | 341 bool SkBitmap::setAlphaType(SkAlphaType alphaType) { |
| 336 if (!validate_alphaType(this->config(), alphaType, &alphaType)) { | 342 if (!validate_alphaType(this->config(), alphaType, &alphaType)) { |
| 337 return false; | 343 return false; |
| 338 } | 344 } |
| 339 fAlphaType = SkToU8(alphaType); | 345 fAlphaType = SkToU8(alphaType); |
| 340 return true; | 346 return true; |
| 341 } | 347 } |
| 342 | 348 |
| 343 void SkBitmap::updatePixelsFromRef() const { | 349 void SkBitmap::updatePixelsFromRef() const { |
| 344 if (NULL != fPixelRef) { | 350 if (NULL != fPixelRef) { |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 if (NULL != uri) { | 1709 if (NULL != uri) { |
| 1704 str->appendf(" uri:\"%s\"", uri); | 1710 str->appendf(" uri:\"%s\"", uri); |
| 1705 } else { | 1711 } else { |
| 1706 str->appendf(" pixelref:%p", pr); | 1712 str->appendf(" pixelref:%p", pr); |
| 1707 } | 1713 } |
| 1708 } | 1714 } |
| 1709 | 1715 |
| 1710 str->append(")"); | 1716 str->append(")"); |
| 1711 } | 1717 } |
| 1712 #endif | 1718 #endif |
| OLD | NEW |