OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 "SkBlitRow_opts_arm_neon.h" | 8 #include "SkBlitRow_opts_arm_neon.h" |
9 | 9 |
10 #include "SkBlitMask.h" | 10 #include "SkBlitMask.h" |
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 S32A_Opaque_BlitRow32_neon_src_alpha, // S32A_Opaque, | 1723 S32A_Opaque_BlitRow32_neon_src_alpha, // S32A_Opaque, |
1724 #else | 1724 #else |
1725 S32A_Opaque_BlitRow32_neon, // S32A_Opaque, | 1725 S32A_Opaque_BlitRow32_neon, // S32A_Opaque, |
1726 #endif | 1726 #endif |
1727 #ifdef SK_CPU_ARM32 | 1727 #ifdef SK_CPU_ARM32 |
1728 S32A_Blend_BlitRow32_neon // S32A_Blend | 1728 S32A_Blend_BlitRow32_neon // S32A_Blend |
1729 #else | 1729 #else |
1730 NULL | 1730 NULL |
1731 #endif | 1731 #endif |
1732 }; | 1732 }; |
1733 | |
1734 #include "Sk4px.h" | |
1735 | |
1736 void sk_blitrow_color32_arm_neon(SkPMColor* dst, const SkPMColor* src, int count
, SkPMColor color) { | |
1737 // Until it becomes a little more reasonable to assume we'll be built with N
EON, | |
1738 // we copy our Sk4px implementation of SkBlitRow::Color32 here so it picks u
p NEON at runtime. | |
1739 unsigned invA = 255 - SkGetPackedA32(color); | |
1740 invA += invA >> 7; | |
1741 SkASSERT(invA < 256); // Our caller has already handled the alpha == 0 case
. | |
1742 | |
1743 Sk16h colorHighAndRound = Sk4px(color).widenHi() + Sk16h(128); | |
1744 Sk16b invA_16x(invA); | |
1745 | |
1746 Sk4px::MapSrc(count, dst, src, [&](const Sk4px& src4) -> Sk4px { | |
1747 return src4.mulWiden(invA_16x).addNarrowHi(colorHighAndRound); | |
1748 }); | |
1749 } | |
OLD | NEW |