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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 } | 565 } |
566 case kRGB_565_SkColorType: { | 566 case kRGB_565_SkColorType: { |
567 uint16_t* addr = this->getAddr16(x, y); | 567 uint16_t* addr = this->getAddr16(x, y); |
568 return SkPixel16ToColor(addr[0]); | 568 return SkPixel16ToColor(addr[0]); |
569 } | 569 } |
570 case kARGB_4444_SkColorType: { | 570 case kARGB_4444_SkColorType: { |
571 uint16_t* addr = this->getAddr16(x, y); | 571 uint16_t* addr = this->getAddr16(x, y); |
572 SkPMColor c = SkPixel4444ToPixel32(addr[0]); | 572 SkPMColor c = SkPixel4444ToPixel32(addr[0]); |
573 return SkUnPreMultiply::PMColorToColor(c); | 573 return SkUnPreMultiply::PMColorToColor(c); |
574 } | 574 } |
575 case kBGRA_8888_SkColorType: | 575 case kBGRA_8888_SkColorType: { |
| 576 uint32_t* addr = this->getAddr32(x, y); |
| 577 SkPMColor c = SkSwizzle_BGRA_to_PMColor(addr[0]); |
| 578 return SkUnPreMultiply::PMColorToColor(c); |
| 579 } |
576 case kRGBA_8888_SkColorType: { | 580 case kRGBA_8888_SkColorType: { |
577 uint32_t* addr = this->getAddr32(x, y); | 581 uint32_t* addr = this->getAddr32(x, y); |
578 return SkUnPreMultiply::PMColorToColor(addr[0]); | 582 SkPMColor c = SkSwizzle_RGBA_to_PMColor(addr[0]); |
| 583 return SkUnPreMultiply::PMColorToColor(c); |
579 } | 584 } |
580 default: | 585 default: |
581 SkASSERT(false); | 586 SkASSERT(false); |
582 return 0; | 587 return 0; |
583 } | 588 } |
584 SkASSERT(false); // Not reached. | 589 SkASSERT(false); // Not reached. |
585 return 0; | 590 return 0; |
586 } | 591 } |
587 | 592 |
588 static bool compute_is_opaque(const SkPixmap& pmap) { | 593 static bool compute_is_opaque(const SkPixmap& pmap) { |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 /////////////////////////////////////////////////////////////////////////////// | 1321 /////////////////////////////////////////////////////////////////////////////// |
1317 | 1322 |
1318 #ifdef SK_DEBUG | 1323 #ifdef SK_DEBUG |
1319 void SkImageInfo::validate() const { | 1324 void SkImageInfo::validate() const { |
1320 SkASSERT(fWidth >= 0); | 1325 SkASSERT(fWidth >= 0); |
1321 SkASSERT(fHeight >= 0); | 1326 SkASSERT(fHeight >= 0); |
1322 SkASSERT(SkColorTypeIsValid(fColorType)); | 1327 SkASSERT(SkColorTypeIsValid(fColorType)); |
1323 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1328 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
1324 } | 1329 } |
1325 #endif | 1330 #endif |
OLD | NEW |