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 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 | 1733 |
1734 #include "Sk4px.h" | 1734 #include "Sk4px.h" |
1735 | 1735 |
1736 void sk_blitrow_color32_arm_neon(SkPMColor* dst, const SkPMColor* src, int count
, SkPMColor color) { | 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, | 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. | 1738 // we copy our Sk4px implementation of SkBlitRow::Color32 here so it picks u
p NEON at runtime. |
1739 unsigned invA = 255 - SkGetPackedA32(color); | 1739 unsigned invA = 255 - SkGetPackedA32(color); |
1740 invA += invA >> 7; | 1740 invA += invA >> 7; |
1741 SkASSERT(invA < 256); // Our caller has already handled the alpha == 0 case
. | 1741 SkASSERT(invA < 256); // Our caller has already handled the alpha == 0 case
. |
1742 | 1742 |
1743 Sk16h colorHighAndRound = Sk4px(color).widenHi() + Sk16h(128); | 1743 Sk16h colorHighAndRound = Sk4px::DupPMColor(color).widenHi() + Sk16h(128); |
1744 Sk16b invA_16x(invA); | 1744 Sk16b invA_16x(invA); |
1745 | 1745 |
1746 Sk4px::MapSrc(count, dst, src, [&](const Sk4px& src4) -> Sk4px { | 1746 Sk4px::MapSrc(count, dst, src, [&](const Sk4px& src4) -> Sk4px { |
1747 return src4.mulWiden(invA_16x).addNarrowHi(colorHighAndRound); | 1747 return (src4 * invA_16x).addNarrowHi(colorHighAndRound); |
1748 }); | 1748 }); |
1749 } | 1749 } |
OLD | NEW |