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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 } | 821 } |
822 | 822 |
823 // if we have a texture, first get those pixels | 823 // if we have a texture, first get those pixels |
824 SkBitmap tmpSrc; | 824 SkBitmap tmpSrc; |
825 const SkBitmap* src = this; | 825 const SkBitmap* src = this; |
826 | 826 |
827 if (fPixelRef) { | 827 if (fPixelRef) { |
828 SkIRect subset; | 828 SkIRect subset; |
829 subset.setXYWH(fPixelRefOrigin.fX, fPixelRefOrigin.fY, | 829 subset.setXYWH(fPixelRefOrigin.fX, fPixelRefOrigin.fY, |
830 fInfo.width(), fInfo.height()); | 830 fInfo.width(), fInfo.height()); |
831 if (fPixelRef->readPixels(&tmpSrc, &subset)) { | 831 if (fPixelRef->readPixels(&tmpSrc, dstColorType, &subset)) { |
832 if (fPixelRef->info().alphaType() == kUnpremul_SkAlphaType) { | 832 if (fPixelRef->info().alphaType() == kUnpremul_SkAlphaType) { |
833 // FIXME: The only meaningful implementation of readPixels | 833 // FIXME: The only meaningful implementation of readPixels |
834 // (GrPixelRef) assumes premultiplied pixels. | 834 // (GrPixelRef) assumes premultiplied pixels. |
835 return false; | 835 return false; |
836 } | 836 } |
837 SkASSERT(tmpSrc.width() == this->width()); | 837 SkASSERT(tmpSrc.width() == this->width()); |
838 SkASSERT(tmpSrc.height() == this->height()); | 838 SkASSERT(tmpSrc.height() == this->height()); |
839 | 839 |
840 // did we get lucky and we can just return tmpSrc? | 840 // did we get lucky and we can just return tmpSrc? |
841 if (tmpSrc.colorType() == dstColorType && nullptr == alloc) { | 841 if (tmpSrc.colorType() == dstColorType && nullptr == alloc) { |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 /////////////////////////////////////////////////////////////////////////////// | 1337 /////////////////////////////////////////////////////////////////////////////// |
1338 | 1338 |
1339 #ifdef SK_DEBUG | 1339 #ifdef SK_DEBUG |
1340 void SkImageInfo::validate() const { | 1340 void SkImageInfo::validate() const { |
1341 SkASSERT(fWidth >= 0); | 1341 SkASSERT(fWidth >= 0); |
1342 SkASSERT(fHeight >= 0); | 1342 SkASSERT(fHeight >= 0); |
1343 SkASSERT(SkColorTypeIsValid(fColorType)); | 1343 SkASSERT(SkColorTypeIsValid(fColorType)); |
1344 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1344 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
1345 } | 1345 } |
1346 #endif | 1346 #endif |
OLD | NEW |