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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
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 if (fAlphaType != alphaType) { |
| 325 fAlphaType = SkToU8(alphaType); |
| 326 if (fPixelRef) { |
| 327 fPixelRef->notifyPixelsChanged(alphaType); |
| 328 } |
| 329 } |
325 return true; | 330 return true; |
326 } | 331 } |
327 | 332 |
328 void SkBitmap::updatePixelsFromRef() const { | 333 void SkBitmap::updatePixelsFromRef() const { |
329 if (NULL != fPixelRef) { | 334 if (NULL != fPixelRef) { |
330 if (fPixelLockCount > 0) { | 335 if (fPixelLockCount > 0) { |
331 SkASSERT(fPixelRef->isLocked()); | 336 SkASSERT(fPixelRef->isLocked()); |
332 | 337 |
333 void* p = fPixelRef->pixels(); | 338 void* p = fPixelRef->pixels(); |
334 if (NULL != p) { | 339 if (NULL != p) { |
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 if (NULL != uri) { | 1725 if (NULL != uri) { |
1721 str->appendf(" uri:\"%s\"", uri); | 1726 str->appendf(" uri:\"%s\"", uri); |
1722 } else { | 1727 } else { |
1723 str->appendf(" pixelref:%p", pr); | 1728 str->appendf(" pixelref:%p", pr); |
1724 } | 1729 } |
1725 } | 1730 } |
1726 | 1731 |
1727 str->append(")"); | 1732 str->append(")"); |
1728 } | 1733 } |
1729 #endif | 1734 #endif |
OLD | NEW |