diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 21:01:41 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 21:01:41 +0000 |
commit | 52e935d04c59135739c3a68fb6e19d313dc6d5ad (patch) | |
tree | 95f7ab178b045bef4456cbf92c6aa7e476becd99 /skia/sgl/SkBitmapProcState_matrixProcs.cpp | |
parent | 30fab79877b4bb067944b74d98346ac9bb6bfc7e (diff) | |
download | chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.zip chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.tar.gz chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.tar.bz2 |
New drop of Skia. This is up to CL 121320.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/sgl/SkBitmapProcState_matrixProcs.cpp')
-rw-r--r-- | skia/sgl/SkBitmapProcState_matrixProcs.cpp | 71 |
1 files changed, 11 insertions, 60 deletions
diff --git a/skia/sgl/SkBitmapProcState_matrixProcs.cpp b/skia/sgl/SkBitmapProcState_matrixProcs.cpp index 369f9ff..beb21c8 100644 --- a/skia/sgl/SkBitmapProcState_matrixProcs.cpp +++ b/skia/sgl/SkBitmapProcState_matrixProcs.cpp @@ -28,8 +28,6 @@ void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count); #define TILEX_LOW_BITS(fx, max) (((fx) >> 12) & 0xF) #define TILEY_LOW_BITS(fy, max) (((fy) >> 12) & 0xF) #define CHECK_FOR_DECAL -#define TILEX_TRANS(x, max) SkClampMax(x, max) -#define TILEY_TRANS(y, max) SkClampMax(y, max) #include "SkBitmapProcState_matrix.h" #define MAKENAME(suffix) RepeatX_RepeatY ## suffix @@ -37,9 +35,6 @@ void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count); #define TILEY_PROCF(fy, max) (((fy) & 0xFFFF) * ((max) + 1) >> 16) #define TILEX_LOW_BITS(fx, max) ((((fx) & 0xFFFF) * ((max) + 1) >> 12) & 0xF) #define TILEY_LOW_BITS(fy, max) ((((fy) & 0xFFFF) * ((max) + 1) >> 12) & 0xF) -#define REAL_MOD(val, modulus) (((val)%(modulus)) + (modulus)*( (val)<0 )) -#define TILEX_TRANS(x, max) (REAL_MOD((x), ((max) + 1))) -#define TILEY_TRANS(y, max) (REAL_MOD((y), ((max) + 1))) #include "SkBitmapProcState_matrix.h" #define MAKENAME(suffix) GeneralXY ## suffix @@ -49,17 +44,13 @@ void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count); #define PREAMBLE_PARAM_Y , SkBitmapProcState::FixedTileProc tileProcY #define PREAMBLE_ARG_X , tileProcX #define PREAMBLE_ARG_Y , tileProcY -#define TILEX_PROCF(fx, max) (tileProcX(fx, max) >> 16) -#define TILEY_PROCF(fy, max) (tileProcY(fy, max) >> 16) -#define TILEX_LOW_BITS(fx, max) ((tileProcX(fx, max) >> 14) & 0x3) -#define TILEY_LOW_BITS(fy, max) ((tileProcY(fy, max) >> 14) & 0x3) -#define PREAMBLE_TRANS(state) SkBitmapProcState::IntTileProc tileProcX = (state).iTileProcX; \ - SkBitmapProcState::IntTileProc tileProcY = (state).iTileProcY -#define TILEX_TRANS(x, max) tileProcX(x, max) -#define TILEY_TRANS(y, max) tileProcY(y, max) +#define TILEX_PROCF(fx, max) (tileProcX(fx) * ((max) + 1) >> 16) +#define TILEY_PROCF(fy, max) (tileProcY(fy) * ((max) + 1) >> 16) +#define TILEX_LOW_BITS(fx, max) ((tileProcX(fx) * ((max) + 1) >> 12) & 0xF) +#define TILEY_LOW_BITS(fy, max) ((tileProcY(fy) * ((max) + 1) >> 12) & 0xF) #include "SkBitmapProcState_matrix.h" -static inline SkFixed fixed_clamp(SkFixed x, int max) +static inline U16CPU fixed_clamp(SkFixed x) { #ifdef SK_CPU_HAS_CONDITIONAL_INSTR if (x >> 16) @@ -75,20 +66,19 @@ static inline SkFixed fixed_clamp(SkFixed x, int max) x = 0xFFFF; } #endif - return x * (max + 1); + return x; } -static inline SkFixed fixed_repeat(SkFixed x, int max) +static inline U16CPU fixed_repeat(SkFixed x) { - return (x & 0xFFFF) * (max + 1); + return x & 0xFFFF; } -static inline SkFixed fixed_mirror(SkFixed x, int max) +static inline U16CPU fixed_mirror(SkFixed x) { SkFixed s = x << 15 >> 31; // s is FFFFFFFF if we're on an odd interval, or 0 if an even interval - x = ((x ^ s) & 0xFFFF) * (max + 1); - return s ? (x ^ 0xFFFF) : x; + return (x ^ s) & 0xFFFF; } static SkBitmapProcState::FixedTileProc choose_tile_proc(unsigned m) @@ -100,41 +90,6 @@ static SkBitmapProcState::FixedTileProc choose_tile_proc(unsigned m) SkASSERT(SkShader::kMirror_TileMode == m); return fixed_mirror; } - -static inline int int_clamp(int x, int max) -{ - SkASSERT(max >= 0); - - return SkClampMax(x, max); -} - -static inline int int_repeat(int x, int max) -{ - SkASSERT(max >= 0); - - return x % (max + 1); -} - -static inline int int_mirror(int x, int max) -{ - SkASSERT(max >= 0); - - int dx = x % (max + 1); - if (dx < 0) - dx = -dx - 1; - - return (x / (max + 1) % 2) ? max - dx : dx; -} - -static SkBitmapProcState::IntTileProc choose_int_tile_proc(unsigned m) -{ - if (SkShader::kClamp_TileMode == m) - return int_clamp; - if (SkShader::kRepeat_TileMode == m) - return int_repeat; - SkASSERT(SkShader::kMirror_TileMode == m); - return int_mirror; -} SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc() { @@ -142,10 +97,8 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc() if (fDoFilter) index = 1; if (fInvType & SkMatrix::kPerspective_Mask) - index |= 6; - else if (fInvType & SkMatrix::kAffine_Mask) index |= 4; - else if (fInvType & SkMatrix::kScale_Mask) + else if (fInvType & SkMatrix::kAffine_Mask) index |= 2; if (SkShader::kClamp_TileMode == fTileModeX && @@ -170,8 +123,6 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc() // only general needs these procs fTileProcX = choose_tile_proc(fTileModeX); fTileProcY = choose_tile_proc(fTileModeY); - iTileProcX = choose_int_tile_proc(fTileModeX); - iTileProcY = choose_int_tile_proc(fTileModeY); return GeneralXY_Procs[index]; } |