Chromium Code Reviews| Index: src/opts/SkColorXform_opts.h |
| diff --git a/src/opts/SkColorXform_opts.h b/src/opts/SkColorXform_opts.h |
| index e7a2b4594682176740f15afa6a123760109f9d25..68d13fc127272bec50a64557227327ce5c207a14 100644 |
| --- a/src/opts/SkColorXform_opts.h |
| +++ b/src/opts/SkColorXform_opts.h |
| @@ -126,16 +126,12 @@ static void color_xform_RGB1(void* dst, const uint32_t* src, int len, |
| dst = SkTAddOffset<void>(dst, 4 * sizeof(uint32_t)); |
| } else { |
| - // FIXME (msarett): |
| - // Can we do better here? Should we store half floats as planar? |
| - // Should we write Intel/Arm specific code? Should we add a transpose |
| - // function to SkNx? Should we rewrite the algorithm to be interleaved? |
| - uint64_t* dst64 = (uint64_t*) dst; |
| - dst64[0] = SkFloatToHalf_finite(Sk4f(dstReds[0], dstGreens[0], dstBlues[0], 1.0f)); |
| - dst64[1] = SkFloatToHalf_finite(Sk4f(dstReds[1], dstGreens[1], dstBlues[1], 1.0f)); |
| - dst64[2] = SkFloatToHalf_finite(Sk4f(dstReds[2], dstGreens[2], dstBlues[2], 1.0f)); |
| - dst64[3] = SkFloatToHalf_finite(Sk4f(dstReds[3], dstGreens[3], dstBlues[3], 1.0f)); |
| + Sk4h halfReds = SkFloatToHalf_finite(dstReds); |
|
mtklein
2016/07/19 15:37:47
Might wanna just inline these instead of naming th
msarett
2016/07/19 15:47:20
Woo cool.
|
| + Sk4h halfGreens = SkFloatToHalf_finite(dstGreens); |
| + Sk4h halfBlues = SkFloatToHalf_finite(dstBlues); |
| + Sk4h halfAlphas = Sk4h(SK_Half1); |
| + Sk4h_store4(dst, halfReds, halfGreens, halfBlues, halfAlphas); |
| dst = SkTAddOffset<void>(dst, 4 * sizeof(uint64_t)); |
| } |
| }; |
| @@ -185,10 +181,9 @@ static void color_xform_RGB1(void* dst, const uint32_t* src, int len, |
| dst = SkTAddOffset<void>(dst, sizeof(uint32_t)); |
| } else { |
| - uint64_t rgba = SkFloatToHalf_finite(dstPixel); |
| - |
| - // Set alpha to 1.0 |
| - rgba |= 0x3C00000000000000; |
| + uint64_t rgba; |
| + SkFloatToHalf_finite(dstPixel).store(&rgba); |
| + rgba |= static_cast<uint64_t>(SK_Half1) << 48; |
| *((uint64_t*) dst) = rgba; |
| dst = SkTAddOffset<void>(dst, sizeof(uint64_t)); |
| } |