Index: src/core/Sk4px.h |
diff --git a/src/core/Sk4px.h b/src/core/Sk4px.h |
index e1d4dc1244b0804b4146d491415d7a7d43e5ff92..24a21c66c1c40ff02a1fada344cf5dd4a713ed01 100644 |
--- a/src/core/Sk4px.h |
+++ b/src/core/Sk4px.h |
@@ -10,6 +10,7 @@ |
#include "SkNx.h" |
#include "SkColor.h" |
+#include "SkColorPriv.h" |
// This file may be included multiple times by .cpp files with different flags, leading |
// to different definitions. Usually that doesn't matter because it's all inlined, but |
@@ -47,6 +48,14 @@ public: |
void store2(SkPMColor[2]) const; |
void store1(SkPMColor[1]) const; |
+ // Same as above for 565. |
+ static Sk4px Load4(const SkPMColor16 src[4]); |
+ static Sk4px Load2(const SkPMColor16 src[2]); |
+ static Sk4px Load1(const SkPMColor16 src[1]); |
+ void store4(SkPMColor16 dst[4]) const; |
+ void store2(SkPMColor16 dst[2]) const; |
+ void store1(SkPMColor16 dst[1]) const; |
+ |
// 1, 2, or 4 SkPMColors with 16-bit components. |
// This is most useful as the result of a multiply, e.g. from mulWiden(). |
class Wide : public Sk16h { |
@@ -99,8 +108,8 @@ public: |
// A generic driver that maps fn over a src array into a dst array. |
// fn should take an Sk4px (4 src pixels) and return an Sk4px (4 dst pixels). |
- template <typename Fn> |
- static void MapSrc(int n, SkPMColor* dst, const SkPMColor* src, const Fn& fn) { |
+ template <typename Fn, typename Dst> |
+ static void MapSrc(int n, Dst* dst, const SkPMColor* src, const Fn& fn) { |
// This looks a bit odd, but it helps loop-invariant hoisting across different calls to fn. |
// Basically, we need to make sure we keep things inside a single loop. |
while (n > 0) { |
@@ -129,8 +138,8 @@ public: |
} |
// As above, but with dst4' = fn(dst4, src4). |
- template <typename Fn> |
- static void MapDstSrc(int n, SkPMColor* dst, const SkPMColor* src, const Fn& fn) { |
+ template <typename Fn, typename Dst> |
+ static void MapDstSrc(int n, Dst* dst, const SkPMColor* src, const Fn& fn) { |
while (n > 0) { |
if (n >= 8) { |
Sk4px dst0 = fn(Load4(dst+0), Load4(src+0)), |
@@ -157,8 +166,8 @@ public: |
} |
// As above, but with dst4' = fn(dst4, src4, alpha4). |
- template <typename Fn> |
- static void MapDstSrcAlpha(int n, SkPMColor* dst, const SkPMColor* src, const SkAlpha* a, |
+ template <typename Fn, typename Dst> |
+ static void MapDstSrcAlpha(int n, Dst* dst, const SkPMColor* src, const SkAlpha* a, |
const Fn& fn) { |
while (n > 0) { |
if (n >= 8) { |