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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 bool SkBitmap::setConfig(const SkImageInfo& info, size_t rowBytes) { | 315 bool SkBitmap::setConfig(const SkImageInfo& info, size_t rowBytes) { |
316 return this->setConfig(SkImageInfoToBitmapConfig(info), info.fWidth, | 316 return this->setConfig(SkImageInfoToBitmapConfig(info), info.fWidth, |
317 info.fHeight, rowBytes, info.fAlphaType); | 317 info.fHeight, rowBytes, info.fAlphaType); |
318 } | 318 } |
319 | 319 |
320 bool SkBitmap::setAlphaType(SkAlphaType alphaType) { | 320 bool SkBitmap::setAlphaType(SkAlphaType alphaType) { |
321 if (!validate_alphaType(this->config(), alphaType, &alphaType)) { | 321 if (!validate_alphaType(this->config(), alphaType, &alphaType)) { |
322 return false; | 322 return false; |
323 } | 323 } |
324 fAlphaType = SkToU8(alphaType); | 324 fAlphaType = SkToU8(alphaType); |
325 if (fPixelRef) { | |
326 fPixelRef->notifyAlphaTypeChanged(alphaType); | |
scroggo
2014/01/24 20:50:52
One downside is that if a bitmap representing an o
reed1
2014/01/27 13:46:14
Done.
| |
327 } | |
325 return true; | 328 return true; |
326 } | 329 } |
327 | 330 |
328 void SkBitmap::updatePixelsFromRef() const { | 331 void SkBitmap::updatePixelsFromRef() const { |
329 if (NULL != fPixelRef) { | 332 if (NULL != fPixelRef) { |
330 if (fPixelLockCount > 0) { | 333 if (fPixelLockCount > 0) { |
331 SkASSERT(fPixelRef->isLocked()); | 334 SkASSERT(fPixelRef->isLocked()); |
332 | 335 |
333 void* p = fPixelRef->pixels(); | 336 void* p = fPixelRef->pixels(); |
334 if (NULL != p) { | 337 if (NULL != p) { |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1703 if (NULL != uri) { | 1706 if (NULL != uri) { |
1704 str->appendf(" uri:\"%s\"", uri); | 1707 str->appendf(" uri:\"%s\"", uri); |
1705 } else { | 1708 } else { |
1706 str->appendf(" pixelref:%p", pr); | 1709 str->appendf(" pixelref:%p", pr); |
1707 } | 1710 } |
1708 } | 1711 } |
1709 | 1712 |
1710 str->append(")"); | 1713 str->append(")"); |
1711 } | 1714 } |
1712 #endif | 1715 #endif |
OLD | NEW |