| 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 SkPMColor c = SkSwizzle_BGRA_to_PMColor(addr[0]); | 593 SkPMColor c = SkSwizzle_BGRA_to_PMColor(addr[0]); |
| 594 return SkUnPreMultiply::PMColorToColor(c); | 594 return SkUnPreMultiply::PMColorToColor(c); |
| 595 } | 595 } |
| 596 case kRGBA_8888_SkColorType: { | 596 case kRGBA_8888_SkColorType: { |
| 597 uint32_t* addr = this->getAddr32(x, y); | 597 uint32_t* addr = this->getAddr32(x, y); |
| 598 SkPMColor c = SkSwizzle_RGBA_to_PMColor(addr[0]); | 598 SkPMColor c = SkSwizzle_RGBA_to_PMColor(addr[0]); |
| 599 return SkUnPreMultiply::PMColorToColor(c); | 599 return SkUnPreMultiply::PMColorToColor(c); |
| 600 } | 600 } |
| 601 case kRGBA_F16_SkColorType: { | 601 case kRGBA_F16_SkColorType: { |
| 602 const uint64_t* addr = (const uint64_t*)fPixels + y * (fRowBytes >>
3) + x; | 602 const uint64_t* addr = (const uint64_t*)fPixels + y * (fRowBytes >>
3) + x; |
| 603 Sk4f p4 = SkHalfToFloat_finite(addr[0]); | 603 Sk4f p4 = SkHalfToFloat_ordinary(addr[0]); |
| 604 if (p4[3]) { | 604 if (p4[3]) { |
| 605 float inva = 1 / p4[3]; | 605 float inva = 1 / p4[3]; |
| 606 p4 = p4 * Sk4f(inva, inva, inva, 1); | 606 p4 = p4 * Sk4f(inva, inva, inva, 1); |
| 607 } | 607 } |
| 608 SkColor c; | 608 SkColor c; |
| 609 SkNx_cast<uint8_t>(p4 * Sk4f(255) + Sk4f(0.5f)).store(&c); | 609 SkNx_cast<uint8_t>(p4 * Sk4f(255) + Sk4f(0.5f)).store(&c); |
| 610 // p4 is RGBA, but we want BGRA, so we need to swap next | 610 // p4 is RGBA, but we want BGRA, so we need to swap next |
| 611 return SkSwizzle_RB(c); | 611 return SkSwizzle_RB(c); |
| 612 } | 612 } |
| 613 default: | 613 default: |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 /////////////////////////////////////////////////////////////////////////////// | 1302 /////////////////////////////////////////////////////////////////////////////// |
| 1303 | 1303 |
| 1304 #ifdef SK_DEBUG | 1304 #ifdef SK_DEBUG |
| 1305 void SkImageInfo::validate() const { | 1305 void SkImageInfo::validate() const { |
| 1306 SkASSERT(fWidth >= 0); | 1306 SkASSERT(fWidth >= 0); |
| 1307 SkASSERT(fHeight >= 0); | 1307 SkASSERT(fHeight >= 0); |
| 1308 SkASSERT(SkColorTypeIsValid(fColorType)); | 1308 SkASSERT(SkColorTypeIsValid(fColorType)); |
| 1309 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1309 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
| 1310 } | 1310 } |
| 1311 #endif | 1311 #endif |
| OLD | NEW |