diff options
author | msarett <msarett@google.com> | 2016-07-19 09:07:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-19 09:07:55 -0700 |
commit | 6bdbf4412bd1a6fe26be1042ccf080174b13021f (patch) | |
tree | b25a250336c9de632cfc40a2e6204626620f099d /src/effects | |
parent | 9061aa4217cabc75aca24f929f370c9a82208e73 (diff) |
Improve naive SkColorXform to half floats
This should give us a good baseline to explore using SkRasterPipeline.
A particular colorxform to half float drops from 425us to 282us on my desktop.
Color Xform to Half Float (HP z620)
Original 425us
Trans16 (not 32) 355us
Vector Trans16 378us
Trans16 + Keep Halfs in Vector 335us
Vector Trans16 + Keep Halfs in Vector 282us
Final 282us
Color Xform to Half Float (Nexus 5X)
Original 556us
Final 472us
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2159993003
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Review-Url: https://codereview.chromium.org/2159993003
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/gradients/Sk4fGradientPriv.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/effects/gradients/Sk4fGradientPriv.h b/src/effects/gradients/Sk4fGradientPriv.h index 68e95a63d9..9745119fd4 100644 --- a/src/effects/gradients/Sk4fGradientPriv.h +++ b/src/effects/gradients/Sk4fGradientPriv.h @@ -143,11 +143,13 @@ struct DstTraits<DstType::F16, premul> { } static void store(const Sk4f& c, Type* dst) { - *dst = SkFloatToHalf_finite(PM::apply(c)); + SkFloatToHalf_finite(PM::apply(c)).store(dst); } static void store(const Sk4f& c, Type* dst, int n) { - sk_memset64(dst, SkFloatToHalf_finite(PM::apply(c)), n); + uint64_t color; + SkFloatToHalf_finite(PM::apply(c)).store(&color); + sk_memset64(dst, color, n); } static void store4x(const Sk4f& c0, const Sk4f& c1, |