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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 count -= 8; | 707 count -= 8; |
708 } while (count >= 8); | 708 } while (count >= 8); |
709 } | 709 } |
710 | 710 |
711 // leftovers | 711 // leftovers |
712 while (count-- > 0) { | 712 while (count-- > 0) { |
713 SkPMColor sc = *src++; | 713 SkPMColor sc = *src++; |
714 if (sc) { | 714 if (sc) { |
715 uint16_t dc = *dst; | 715 uint16_t dc = *dst; |
716 unsigned dst_scale = 255 - SkMulDiv255Round(SkGetPackedA32(sc), alph
a); | 716 unsigned dst_scale = 255 - SkMulDiv255Round(SkGetPackedA32(sc), alph
a); |
717 unsigned dr = SkMulS16(SkPacked32ToR16(sc), alpha) + SkMulS16(SkGetP
ackedR16(dc), dst_scale); | 717 unsigned dr = (SkPacked32ToR16(sc) * alpha) + (SkGetPackedR16(dc) *
dst_scale); |
718 unsigned dg = SkMulS16(SkPacked32ToG16(sc), alpha) + SkMulS16(SkGetP
ackedG16(dc), dst_scale); | 718 unsigned dg = (SkPacked32ToG16(sc) * alpha) + (SkGetPackedG16(dc) *
dst_scale); |
719 unsigned db = SkMulS16(SkPacked32ToB16(sc), alpha) + SkMulS16(SkGetP
ackedB16(dc), dst_scale); | 719 unsigned db = (SkPacked32ToB16(sc) * alpha) + (SkGetPackedB16(dc) *
dst_scale); |
720 *dst = SkPackRGB16(SkDiv255Round(dr), SkDiv255Round(dg), SkDiv255Rou
nd(db)); | 720 *dst = SkPackRGB16(SkDiv255Round(dr), SkDiv255Round(dg), SkDiv255Rou
nd(db)); |
721 } | 721 } |
722 dst += 1; | 722 dst += 1; |
723 } | 723 } |
724 } | 724 } |
725 | 725 |
726 /* dither matrix for Neon, derived from gDitherMatrix_3Bit_16. | 726 /* dither matrix for Neon, derived from gDitherMatrix_3Bit_16. |
727 * each dither value is spaced out into byte lanes, and repeated | 727 * each dither value is spaced out into byte lanes, and repeated |
728 * to allow an 8-byte load from offsets 0, 1, 2 or 3 from the | 728 * to allow an 8-byte load from offsets 0, 1, 2 or 3 from the |
729 * start of each row. | 729 * start of each row. |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 invA += invA >> 7; | 1592 invA += invA >> 7; |
1593 SkASSERT(invA < 256); // Our caller has already handled the alpha == 0 case
. | 1593 SkASSERT(invA < 256); // Our caller has already handled the alpha == 0 case
. |
1594 | 1594 |
1595 Sk16h colorHighAndRound = Sk4px::DupPMColor(color).widenHi() + Sk16h(128); | 1595 Sk16h colorHighAndRound = Sk4px::DupPMColor(color).widenHi() + Sk16h(128); |
1596 Sk16b invA_16x(invA); | 1596 Sk16b invA_16x(invA); |
1597 | 1597 |
1598 Sk4px::MapSrc(count, dst, src, [&](const Sk4px& src4) -> Sk4px { | 1598 Sk4px::MapSrc(count, dst, src, [&](const Sk4px& src4) -> Sk4px { |
1599 return (src4 * invA_16x).addNarrowHi(colorHighAndRound); | 1599 return (src4 * invA_16x).addNarrowHi(colorHighAndRound); |
1600 }); | 1600 }); |
1601 } | 1601 } |
OLD | NEW |