Index: src/opts/SkColor_opts_neon.h |
diff --git a/src/opts/SkColor_opts_neon.h b/src/opts/SkColor_opts_neon.h |
index f81239712ab5bba90fb21b6896f7edbb4e658044..85752f5558cd8263bdf6f4108c5c88d55e6ee9a2 100644 |
--- a/src/opts/SkColor_opts_neon.h |
+++ b/src/opts/SkColor_opts_neon.h |
@@ -2,6 +2,7 @@ |
#define SkColor_opts_neon_DEFINED |
#include "SkTypes.h" |
+#include "SkColorPriv.h" |
#include <arm_neon.h> |
@@ -65,4 +66,20 @@ static inline uint16x8_t SkPixel32ToPixel16_neon8(uint8x8x4_t vsrc) { |
return ret; |
} |
+/* This function blends 8 pixels of the same channel in the exact same way as |
+ * SkBlend32. |
+ */ |
+static inline uint8x8_t SkBlend32_neon8(uint8x8_t src, uint8x8_t dst, uint16x8_t scale) { |
+ int16x8_t src_wide, dst_wide; |
+ |
+ src_wide = vreinterpretq_s16_u16(vmovl_u8(src)); |
+ dst_wide = vreinterpretq_s16_u16(vmovl_u8(dst)); |
+ |
+ src_wide = (src_wide - dst_wide) * vreinterpretq_s16_u16(scale); |
+ |
+ dst_wide += vshrq_n_s16(src_wide, 5); |
+ |
+ return vmovn_u16(vreinterpretq_u16_s16(dst_wide)); |
+} |
+ |
#endif /* #ifndef SkColor_opts_neon_DEFINED */ |