| Index: src/opts/SkPMFloat_neon.h
|
| diff --git a/src/opts/SkPMFloat_neon.h b/src/opts/SkPMFloat_neon.h
|
| index 8bee5b551aebb708c09b7557ae74ea6a8618f083..ecb151f1fdb70dad1b18190281150ba29c4549d4 100644
|
| --- a/src/opts/SkPMFloat_neon.h
|
| +++ b/src/opts/SkPMFloat_neon.h
|
| @@ -7,6 +7,8 @@
|
|
|
| namespace { // See SkPMFloat.h
|
|
|
| +static_assert(SK_A32_SHIFT == 24, "This file assumes little-endian.");
|
| +
|
| inline SkPMFloat::SkPMFloat(SkPMColor c) {
|
| SkPMColorAssert(c);
|
| uint8x8_t fix8 = (uint8x8_t)vdup_n_u32(c);
|
| @@ -28,8 +30,21 @@ inline SkPMColor SkPMFloat::round() const {
|
| }
|
|
|
| inline Sk4f SkPMFloat::alphas() const {
|
| - static_assert(SK_A32_SHIFT == 24, "Assuming little-endian.");
|
| return vdupq_lane_f32(vget_high_f32(fVec), 1); // Duplicate high lane of high half i.e. lane 3.
|
| }
|
|
|
| +inline SkPMFloat SkPMFloat::FromBGRx(SkColor c) {
|
| + uint8x8_t fix8 = (uint8x8_t)vdup_n_u32(c);
|
| +#if defined(SK_PMCOLOR_IS_RGBA)
|
| + fix8 = vtbl1_u8(fix8, vcreate_u8(0x0300010203000102ULL)); // 03 00 01 02, 2x, i.e. swap R&B.
|
| +#endif
|
| + uint16x8_t fix8_16 = vmovl_u8(fix8);
|
| + uint32x4_t fix8_32 = vmovl_u16(vget_low_u16(fix8_16));
|
| + fix8_32 = vsetq_lane_u32(0xFF, fix8_32, 3); // Force alpha to 1.
|
| +
|
| + SkPMFloat pmf = Sk4f(vmulq_f32(vcvtq_f32_u32(fix8_32), vdupq_n_f32(1.0f/255)));
|
| + SkASSERT(pmf.isValid());
|
| + return pmf;
|
| +}
|
| +
|
| } // namespace
|
|
|