Index: src/core/SkBitmapProcState_matrixProcs.cpp |
diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp |
index 57376d5699dfcb71f5ce6b308e7d9d9a89a84e15..7f143f0c6ebdc0b179293bcb2c71bcc96e211112 100644 |
--- a/src/core/SkBitmapProcState_matrixProcs.cpp |
+++ b/src/core/SkBitmapProcState_matrixProcs.cpp |
@@ -33,6 +33,10 @@ static inline int sk_int_mod(int x, int n) { |
void decal_nofilter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count); |
void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count); |
+#include "SkBitmapProcState_matrix_template.h" |
+ |
+/////////////////////////////////////////////////////////////////////////////// |
+ |
// Compile neon code paths if needed |
#if !SK_ARM_NEON_IS_NONE |
@@ -52,6 +56,35 @@ extern const SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs_neon[]; |
#define CHECK_FOR_DECAL |
#include "SkBitmapProcState_matrix.h" |
+class ClampTileProcs { |
mtklein
2014/01/03 15:49:57
I usually see these traity classes as structs, whi
reed1
2014/04/11 13:12:27
Done.
|
+public: |
+ static unsigned X(const SkBitmapProcState&, SkFixed fx, int max) { |
+ return SkClampMax(fx >> 16, max); |
+ } |
+ static unsigned Y(const SkBitmapProcState&, SkFixed fx, int max) { |
mtklein
2014/01/03 15:49:57
These Y methods take fy, no?
reed1
2014/04/11 13:12:27
Done.
|
+ return SkClampMax(fx >> 16, max); |
+ } |
+}; |
+ |
+static SkBitmapProcState::MatrixProc ClampX_ClampY_Procs[] = { |
+ NoFilterProc_Scale<ClampTileProcs, true>, |
+ ClampX_ClampY_filter_scale, |
+ NoFilterProc_Affine<ClampTileProcs>, |
+ ClampX_ClampY_filter_affine, |
+ NoFilterProc_Persp<ClampTileProcs>, |
+ ClampX_ClampY_filter_persp |
+}; |
+ |
+// Referenced in opts_check_SSE2.cpp |
+void ClampX_ClampY_nofilter_scale(const SkBitmapProcState& s, uint32_t xy[], |
+ int count, int x, int y) { |
+ return NoFilterProc_Scale<ClampTileProcs, true>(s, xy, count, x, y); |
+} |
+void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, uint32_t xy[], |
+ int count, int x, int y) { |
+ return NoFilterProc_Affine<ClampTileProcs>(s, xy, count, x, y); |
+} |
+ |
#define MAKENAME(suffix) RepeatX_RepeatY ## suffix |
#define TILEX_PROCF(fx, max) SK_USHIFT16(((fx) & 0xFFFF) * ((max) + 1)) |
#define TILEY_PROCF(fy, max) SK_USHIFT16(((fy) & 0xFFFF) * ((max) + 1)) |
@@ -60,6 +93,25 @@ extern const SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs_neon[]; |
#include "SkBitmapProcState_matrix.h" |
#endif |
+class RepeatTileProcs { |
+public: |
+ static unsigned X(const SkBitmapProcState&, SkFixed fx, int max) { |
+ return SK_USHIFT16(((fx) & 0xFFFF) * ((max) + 1)); |
+ } |
+ static unsigned Y(const SkBitmapProcState&, SkFixed fx, int max) { |
+ return SK_USHIFT16(((fx) & 0xFFFF) * ((max) + 1)); |
+ } |
+}; |
+ |
+static SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs[] = { |
+ NoFilterProc_Scale<RepeatTileProcs, true>, |
+ RepeatX_RepeatY_filter_scale, |
+ NoFilterProc_Affine<RepeatTileProcs>, |
+ RepeatX_RepeatY_filter_affine, |
+ NoFilterProc_Persp<RepeatTileProcs>, |
+ RepeatX_RepeatY_filter_persp |
+}; |
+ |
#define MAKENAME(suffix) GeneralXY ## suffix |
#define PREAMBLE(state) SkBitmapProcState::FixedTileProc tileProcX = (state).fTileProcX; (void) tileProcX; \ |
SkBitmapProcState::FixedTileProc tileProcY = (state).fTileProcY; (void) tileProcY; \ |
@@ -75,6 +127,27 @@ extern const SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs_neon[]; |
#define TILEY_LOW_BITS(fy, max) tileLowBitsProcY(fy, (max) + 1) |
#include "SkBitmapProcState_matrix.h" |
+class GeneralTileProcs { |
+public: |
+ static unsigned X(const SkBitmapProcState& s, SkFixed fx, int max) { |
+ return SK_USHIFT16(s.fTileProcX(fx) * ((max) + 1)); |
+ } |
+ static unsigned Y(const SkBitmapProcState& s, SkFixed fx, int max) { |
+ return SK_USHIFT16(s.fTileProcY(fx) * ((max) + 1)); |
+ } |
+}; |
+ |
+static SkBitmapProcState::MatrixProc GeneralXY_Procs[] = { |
+ NoFilterProc_Scale<GeneralTileProcs, true>, |
+ GeneralXY_filter_scale, |
+ NoFilterProc_Affine<GeneralTileProcs>, |
+ GeneralXY_filter_affine, |
+ NoFilterProc_Persp<GeneralTileProcs>, |
+ GeneralXY_filter_persp |
+}; |
+ |
+/////////////////////////////////////////////////////////////////////////////// |
+ |
static inline U16CPU fixed_clamp(SkFixed x) |
{ |
if (x < 0) { |