| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkAtomics.h" | 8 #include "SkAtomics.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 } | 799 } |
| 800 | 800 |
| 801 // if we have a texture, first get those pixels | 801 // if we have a texture, first get those pixels |
| 802 SkBitmap tmpSrc; | 802 SkBitmap tmpSrc; |
| 803 const SkBitmap* src = this; | 803 const SkBitmap* src = this; |
| 804 | 804 |
| 805 if (fPixelRef) { | 805 if (fPixelRef) { |
| 806 SkIRect subset; | 806 SkIRect subset; |
| 807 subset.setXYWH(fPixelRefOrigin.fX, fPixelRefOrigin.fY, | 807 subset.setXYWH(fPixelRefOrigin.fX, fPixelRefOrigin.fY, |
| 808 fInfo.width(), fInfo.height()); | 808 fInfo.width(), fInfo.height()); |
| 809 if (fPixelRef->readPixels(&tmpSrc, &subset)) { | 809 if (fPixelRef->readPixels(&tmpSrc, dstColorType, &subset)) { |
| 810 if (fPixelRef->info().alphaType() == kUnpremul_SkAlphaType) { | 810 if (fPixelRef->info().alphaType() == kUnpremul_SkAlphaType) { |
| 811 // FIXME: The only meaningful implementation of readPixels | 811 // FIXME: The only meaningful implementation of readPixels |
| 812 // (GrPixelRef) assumes premultiplied pixels. | 812 // (GrPixelRef) assumes premultiplied pixels. |
| 813 return false; | 813 return false; |
| 814 } | 814 } |
| 815 SkASSERT(tmpSrc.width() == this->width()); | 815 SkASSERT(tmpSrc.width() == this->width()); |
| 816 SkASSERT(tmpSrc.height() == this->height()); | 816 SkASSERT(tmpSrc.height() == this->height()); |
| 817 | 817 |
| 818 // did we get lucky and we can just return tmpSrc? | 818 // did we get lucky and we can just return tmpSrc? |
| 819 if (tmpSrc.colorType() == dstColorType && nullptr == alloc) { | 819 if (tmpSrc.colorType() == dstColorType && nullptr == alloc) { |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 /////////////////////////////////////////////////////////////////////////////// | 1316 /////////////////////////////////////////////////////////////////////////////// |
| 1317 | 1317 |
| 1318 #ifdef SK_DEBUG | 1318 #ifdef SK_DEBUG |
| 1319 void SkImageInfo::validate() const { | 1319 void SkImageInfo::validate() const { |
| 1320 SkASSERT(fWidth >= 0); | 1320 SkASSERT(fWidth >= 0); |
| 1321 SkASSERT(fHeight >= 0); | 1321 SkASSERT(fHeight >= 0); |
| 1322 SkASSERT(SkColorTypeIsValid(fColorType)); | 1322 SkASSERT(SkColorTypeIsValid(fColorType)); |
| 1323 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1323 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
| 1324 } | 1324 } |
| 1325 #endif | 1325 #endif |
| OLD | NEW |