diff options
author | Florin Malita <fmalita@chromium.org> | 2016-12-16 17:20:54 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-19 02:42:24 +0000 |
commit | 57845a7264ef5183258ec23ffe77c25ec967c755 (patch) | |
tree | 249ba0dcada07a70e7113e18d81a8fd036c7a2d7 /src | |
parent | d4b9c35d9d8c9f325a69516df5c9f81e5ba17e50 (diff) |
Fix clamp lowbits extraction when combined with non-clamp
R=reed@google.com
Change-Id: I1dc17c827077e968d4dbcd0f9ea8da8e1732b253
Reviewed-on: https://skia-review.googlesource.com/6231
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBitmapProcState.h | 3 | ||||
-rw-r--r-- | src/core/SkBitmapProcState_matrixProcs.cpp | 37 |
2 files changed, 7 insertions, 33 deletions
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h index 88e5193b2a..73eaf4fb7c 100644 --- a/src/core/SkBitmapProcState.h +++ b/src/core/SkBitmapProcState.h @@ -76,7 +76,6 @@ struct SkBitmapProcState : public SkBitmapProcInfo { SkPMColor colors[]); typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF - typedef U16CPU (*FixedTileLowBitsProc)(SkFixed, int); // returns 0..0xF typedef U16CPU (*IntTileProc)(int value, int count); // returns 0..count-1 SkMatrix::MapXYProc fInvProc; // chooseProcs @@ -85,8 +84,6 @@ struct SkBitmapProcState : public SkBitmapProcInfo { FixedTileProc fTileProcX; // chooseProcs FixedTileProc fTileProcY; // chooseProcs - FixedTileLowBitsProc fTileLowBitsProcX; // chooseProcs - FixedTileLowBitsProc fTileLowBitsProcY; // chooseProcs IntTileProc fIntTileProcY; // chooseProcs SkFixed fFilterOneX; SkFixed fFilterOneY; diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp index 1b747de280..073e594f1b 100644 --- a/src/core/SkBitmapProcState_matrixProcs.cpp +++ b/src/core/SkBitmapProcState_matrixProcs.cpp @@ -124,17 +124,15 @@ static SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs[] = { #define MAKENAME(suffix) GeneralXY ## suffix #define PREAMBLE(state) SkBitmapProcState::FixedTileProc tileProcX = (state).fTileProcX; (void) tileProcX; \ - SkBitmapProcState::FixedTileProc tileProcY = (state).fTileProcY; (void) tileProcY; \ - SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcX = (state).fTileLowBitsProcX; (void) tileLowBitsProcX; \ - SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcY = (state).fTileLowBitsProcY; (void) tileLowBitsProcY -#define PREAMBLE_PARAM_X , SkBitmapProcState::FixedTileProc tileProcX, SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcX -#define PREAMBLE_PARAM_Y , SkBitmapProcState::FixedTileProc tileProcY, SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcY -#define PREAMBLE_ARG_X , tileProcX, tileLowBitsProcX -#define PREAMBLE_ARG_Y , tileProcY, tileLowBitsProcY + SkBitmapProcState::FixedTileProc tileProcY = (state).fTileProcY; (void) tileProcY; +#define PREAMBLE_PARAM_X , SkBitmapProcState::FixedTileProc tileProcX +#define PREAMBLE_PARAM_Y , SkBitmapProcState::FixedTileProc tileProcY +#define PREAMBLE_ARG_X , tileProcX +#define PREAMBLE_ARG_Y , tileProcY #define TILEX_PROCF(fx, max) SK_USHIFT16(tileProcX(fx) * ((max) + 1)) #define TILEY_PROCF(fy, max) SK_USHIFT16(tileProcY(fy) * ((max) + 1)) -#define TILEX_LOW_BITS(fx, max) tileLowBitsProcX(fx, (max) + 1) -#define TILEY_LOW_BITS(fy, max) tileLowBitsProcY(fy, (max) + 1) +#define TILEX_LOW_BITS(fx, max) (((fx * (max + 1)) >> 12) & 0xF) +#define TILEY_LOW_BITS(fy, max) (((fy * (max + 1)) >> 12) & 0xF) #include "SkBitmapProcState_matrix.h" struct GeneralTileProcs { @@ -188,25 +186,6 @@ static SkBitmapProcState::FixedTileProc choose_tile_proc(unsigned m) { return fixed_mirror; } -static inline U16CPU fixed_clamp_lowbits(SkFixed x, int) { - return (x >> 12) & 0xF; -} - -static inline U16CPU fixed_repeat_or_mirrow_lowbits(SkFixed x, int scale) { - return ((x * scale) >> 12) & 0xF; -} - -static SkBitmapProcState::FixedTileLowBitsProc choose_tile_lowbits_proc(unsigned m) { - if (SkShader::kClamp_TileMode == m) { - return fixed_clamp_lowbits; - } else { - SkASSERT(SkShader::kMirror_TileMode == m || - SkShader::kRepeat_TileMode == m); - // mirror and repeat have the same behavior for the low bits. - return fixed_repeat_or_mirrow_lowbits; - } -} - static inline U16CPU int_clamp(int x, int n) { if (x >= n) { x = n - 1; @@ -514,7 +493,5 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc(bool trivial_m fTileProcX = choose_tile_proc(fTileModeX); fTileProcY = choose_tile_proc(fTileModeY); - fTileLowBitsProcX = choose_tile_lowbits_proc(fTileModeX); - fTileLowBitsProcY = choose_tile_lowbits_proc(fTileModeY); return GeneralXY_Procs[index]; } |