| 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 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 S32A_Opaque_BlitRow32_neon_src_alpha, // S32A_Opaque, | 1575 S32A_Opaque_BlitRow32_neon_src_alpha, // S32A_Opaque, |
| 1576 #else | 1576 #else |
| 1577 S32A_Opaque_BlitRow32_neon, // S32A_Opaque, | 1577 S32A_Opaque_BlitRow32_neon, // S32A_Opaque, |
| 1578 #endif | 1578 #endif |
| 1579 #ifdef SK_CPU_ARM32 | 1579 #ifdef SK_CPU_ARM32 |
| 1580 S32A_Blend_BlitRow32_neon // S32A_Blend | 1580 S32A_Blend_BlitRow32_neon // S32A_Blend |
| 1581 #else | 1581 #else |
| 1582 nullptr | 1582 nullptr |
| 1583 #endif | 1583 #endif |
| 1584 }; | 1584 }; |
| 1585 | |
| 1586 #include "Sk4px.h" | |
| 1587 | |
| 1588 void sk_blitrow_color32_arm_neon(SkPMColor* dst, const SkPMColor* src, int count
, SkPMColor color) { | |
| 1589 // Until it becomes a little more reasonable to assume we'll be built with N
EON, | |
| 1590 // we copy our Sk4px implementation of SkBlitRow::Color32 here so it picks u
p NEON at runtime. | |
| 1591 unsigned invA = 255 - SkGetPackedA32(color); | |
| 1592 invA += invA >> 7; | |
| 1593 SkASSERT(invA < 256); // Our caller has already handled the alpha == 0 case
. | |
| 1594 | |
| 1595 Sk16h colorHighAndRound = Sk4px::DupPMColor(color).widenHi() + Sk16h(128); | |
| 1596 Sk16b invA_16x(invA); | |
| 1597 | |
| 1598 Sk4px::MapSrc(count, dst, src, [&](const Sk4px& src4) -> Sk4px { | |
| 1599 return (src4 * invA_16x).addNarrowHi(colorHighAndRound); | |
| 1600 }); | |
| 1601 } | |
| OLD | NEW |