remove code associated with legacy affine imageshaders
requires https://skia-review.googlesource.com/c/33180 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Bug: skia: Change-Id: I226e120cc5aebe393bda8bc069e7927fdc981a0e Reviewed-on: https://skia-review.googlesource.com/36800 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
This commit is contained in:
parent
5141d215e0
commit
dc03ddeb7e
@ -79,11 +79,7 @@ static bool valid_for_filtering(unsigned dimension) {
|
||||
}
|
||||
|
||||
bool SkBitmapProcInfo::init(const SkMatrix& inv, const SkPaint& paint) {
|
||||
#ifdef SK_SUPPORT_LEGACY_LOCAL_ROTATE_SHADER
|
||||
SkASSERT(!inv.hasPerspective());
|
||||
#else
|
||||
SkASSERT(inv.isScaleTranslate());
|
||||
#endif
|
||||
|
||||
fPixmap.reset();
|
||||
fInvMatrix = inv;
|
||||
@ -547,34 +543,6 @@ static void check_scale_filter(uint32_t bitmapXY[], int count,
|
||||
}
|
||||
}
|
||||
|
||||
static void check_affine_nofilter(uint32_t bitmapXY[], int count,
|
||||
unsigned mx, unsigned my) {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
uint32_t XY = bitmapXY[i];
|
||||
unsigned x = XY & 0xFFFF;
|
||||
unsigned y = XY >> 16;
|
||||
SkASSERT(x < mx);
|
||||
SkASSERT(y < my);
|
||||
}
|
||||
}
|
||||
|
||||
static void check_affine_filter(uint32_t bitmapXY[], int count,
|
||||
unsigned mx, unsigned my) {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
uint32_t YY = *bitmapXY++;
|
||||
unsigned y0 = YY >> 18;
|
||||
unsigned y1 = YY & 0x3FFF;
|
||||
SkASSERT(y0 < my);
|
||||
SkASSERT(y1 < my);
|
||||
|
||||
uint32_t XX = *bitmapXY++;
|
||||
unsigned x0 = XX >> 18;
|
||||
unsigned x1 = XX & 0x3FFF;
|
||||
SkASSERT(x0 < mx);
|
||||
SkASSERT(x1 < mx);
|
||||
}
|
||||
}
|
||||
|
||||
void SkBitmapProcState::DebugMatrixProc(const SkBitmapProcState& state,
|
||||
uint32_t bitmapXY[], int count,
|
||||
int x, int y) {
|
||||
@ -585,16 +553,11 @@ void SkBitmapProcState::DebugMatrixProc(const SkBitmapProcState& state,
|
||||
|
||||
void (*proc)(uint32_t bitmapXY[], int count, unsigned mx, unsigned my);
|
||||
|
||||
// There are four formats possible:
|
||||
// scale -vs- affine
|
||||
// There are two formats possible:
|
||||
// filter -vs- nofilter
|
||||
if (state.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) {
|
||||
proc = state.fFilterQuality != kNone_SkFilterQuality ?
|
||||
check_scale_filter : check_scale_nofilter;
|
||||
} else {
|
||||
proc = state.fFilterQuality != kNone_SkFilterQuality ?
|
||||
check_affine_filter : check_affine_nofilter;
|
||||
}
|
||||
SkASSERT(state.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
|
||||
proc = state.fFilterQuality != kNone_SkFilterQuality ?
|
||||
check_scale_filter : check_scale_nofilter;
|
||||
proc(bitmapXY, count, state.fPixmap.width(), state.fPixmap.height());
|
||||
}
|
||||
|
||||
|
@ -182,18 +182,10 @@ void S32_opaque_D32_filter_DX(const SkBitmapProcState& s, const uint32_t xy[],
|
||||
int count, SkPMColor colors[]);
|
||||
void S32_alpha_D32_filter_DX(const SkBitmapProcState& s, const uint32_t xy[],
|
||||
int count, SkPMColor colors[]);
|
||||
void S32_opaque_D32_filter_DXDY(const SkBitmapProcState& s,
|
||||
const uint32_t xy[], int count, SkPMColor colors[]);
|
||||
void S32_alpha_D32_filter_DXDY(const SkBitmapProcState& s,
|
||||
const uint32_t xy[], int count, SkPMColor colors[]);
|
||||
void ClampX_ClampY_filter_scale(const SkBitmapProcState& s, uint32_t xy[],
|
||||
int count, int x, int y);
|
||||
void ClampX_ClampY_nofilter_scale(const SkBitmapProcState& s, uint32_t xy[],
|
||||
int count, int x, int y);
|
||||
void ClampX_ClampY_filter_affine(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y);
|
||||
void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y);
|
||||
|
||||
// Helper class for mapping the middle of pixel (x, y) into SkFractionalInt bitmap space.
|
||||
// Discussion:
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "SkMathPriv.h"
|
||||
|
||||
#define SCALE_FILTER_NAME MAKENAME(_filter_scale)
|
||||
#define AFFINE_FILTER_NAME MAKENAME(_filter_affine)
|
||||
|
||||
#define PACK_FILTER_X_NAME MAKENAME(_pack_filter_x)
|
||||
#define PACK_FILTER_Y_NAME MAKENAME(_pack_filter_y)
|
||||
@ -25,8 +24,6 @@
|
||||
// declare functions externally to suppress warnings.
|
||||
void SCALE_FILTER_NAME(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y);
|
||||
void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y);
|
||||
|
||||
static inline uint32_t PACK_FILTER_Y_NAME(SkFixed f, unsigned max,
|
||||
SkFixed one PREAMBLE_PARAM_Y) {
|
||||
@ -81,33 +78,6 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s,
|
||||
}
|
||||
}
|
||||
|
||||
void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y) {
|
||||
SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
|
||||
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
|
||||
SkMatrix::kScale_Mask |
|
||||
SkMatrix::kAffine_Mask)) == 0);
|
||||
|
||||
PREAMBLE(s);
|
||||
const SkBitmapProcStateAutoMapper mapper(s, x, y);
|
||||
|
||||
SkFixed oneX = s.fFilterOneX;
|
||||
SkFixed oneY = s.fFilterOneY;
|
||||
SkFixed fx = mapper.fixedX();
|
||||
SkFixed fy = mapper.fixedY();
|
||||
SkFixed dx = s.fInvSx;
|
||||
SkFixed dy = s.fInvKy;
|
||||
unsigned maxX = s.fPixmap.width() - 1;
|
||||
unsigned maxY = s.fPixmap.height() - 1;
|
||||
|
||||
do {
|
||||
*xy++ = PACK_FILTER_Y_NAME(fy, maxY, oneY PREAMBLE_ARG_Y);
|
||||
fy += dy;
|
||||
*xy++ = PACK_FILTER_X_NAME(fx, maxX, oneX PREAMBLE_ARG_X);
|
||||
fx += dx;
|
||||
} while (--count != 0);
|
||||
}
|
||||
|
||||
#undef MAKENAME
|
||||
#undef TILEX_PROCF
|
||||
#undef TILEY_PROCF
|
||||
@ -116,7 +86,6 @@ void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
|
||||
#endif
|
||||
|
||||
#undef SCALE_FILTER_NAME
|
||||
#undef AFFINE_FILTER_NAME
|
||||
|
||||
#undef PREAMBLE
|
||||
#undef PREAMBLE_PARAM_X
|
||||
|
@ -77,17 +77,11 @@ 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);
|
||||
}
|
||||
|
||||
static SkBitmapProcState::MatrixProc ClampX_ClampY_Procs[] = {
|
||||
// only clamp lives in the right coord space to check for decal
|
||||
ClampX_ClampY_nofilter_scale,
|
||||
ClampX_ClampY_filter_scale,
|
||||
ClampX_ClampY_nofilter_affine,
|
||||
ClampX_ClampY_filter_affine,
|
||||
};
|
||||
|
||||
#define MAKENAME(suffix) RepeatX_RepeatY ## suffix
|
||||
@ -110,8 +104,6 @@ struct RepeatTileProcs {
|
||||
static SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs[] = {
|
||||
NoFilterProc_Scale<RepeatTileProcs, false>,
|
||||
RepeatX_RepeatY_filter_scale,
|
||||
NoFilterProc_Affine<RepeatTileProcs>,
|
||||
RepeatX_RepeatY_filter_affine,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -139,8 +131,6 @@ struct GeneralTileProcs {
|
||||
static SkBitmapProcState::MatrixProc GeneralXY_Procs[] = {
|
||||
NoFilterProc_Scale<GeneralTileProcs, false>,
|
||||
GeneralXY_filter_scale,
|
||||
NoFilterProc_Affine<GeneralTileProcs>,
|
||||
GeneralXY_filter_affine,
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -442,7 +432,7 @@ static void mirrorx_nofilter_trans(const SkBitmapProcState& s,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc(bool trivial_matrix) {
|
||||
SkASSERT((fInvType & SkMatrix::kPerspective_Mask) == 0);
|
||||
SkASSERT((fInvType & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)) == 0);
|
||||
|
||||
// test_int_tileprocs();
|
||||
// check for our special case when there is no scale/affine/perspective
|
||||
@ -462,9 +452,6 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc(bool trivial_m
|
||||
if (fFilterQuality != kNone_SkFilterQuality) {
|
||||
index = 1;
|
||||
}
|
||||
if (fInvType & SkMatrix::kAffine_Mask) {
|
||||
index += 2;
|
||||
}
|
||||
|
||||
if (SkShader::kClamp_TileMode == fTileModeX && SkShader::kClamp_TileMode == fTileModeY) {
|
||||
// clamp gets special version of filterOne
|
||||
|
@ -70,32 +70,4 @@ void NoFilterProc_Scale(const SkBitmapProcState& s, uint32_t xy[],
|
||||
}
|
||||
}
|
||||
|
||||
// note: we could special-case on a matrix which is skewed in X but not Y.
|
||||
// this would require a more general setup thatn SCALE does, but could use
|
||||
// SCALE's inner loop that only looks at dx
|
||||
|
||||
template <typename TileProc>
|
||||
void NoFilterProc_Affine(const SkBitmapProcState& s, uint32_t xy[],
|
||||
int count, int x, int y) {
|
||||
SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
|
||||
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
|
||||
SkMatrix::kScale_Mask |
|
||||
SkMatrix::kAffine_Mask)) == 0);
|
||||
|
||||
const SkBitmapProcStateAutoMapper mapper(s, x, y);
|
||||
|
||||
SkFractionalInt fx = mapper.fractionalIntX();
|
||||
SkFractionalInt fy = mapper.fractionalIntY();
|
||||
SkFractionalInt dx = s.fInvSxFractionalInt;
|
||||
SkFractionalInt dy = s.fInvKyFractionalInt;
|
||||
int maxX = s.fPixmap.width() - 1;
|
||||
int maxY = s.fPixmap.height() - 1;
|
||||
|
||||
for (int i = count; i > 0; --i) {
|
||||
*xy++ = (TileProc::Y(s, SkFractionalIntToFixed(fy), maxY) << 16) |
|
||||
TileProc::X(s, SkFractionalIntToFixed(fx), maxX);
|
||||
fx += dx; fy += dy;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
#define SCALE_NOFILTER_NAME MAKENAME(_nofilter_scale)
|
||||
#define SCALE_FILTER_NAME MAKENAME(_filter_scale)
|
||||
#define AFFINE_NOFILTER_NAME MAKENAME(_nofilter_affine)
|
||||
#define AFFINE_FILTER_NAME MAKENAME(_filter_affine)
|
||||
|
||||
#define PACK_FILTER_X_NAME MAKENAME(_pack_filter_x)
|
||||
#define PACK_FILTER_Y_NAME MAKENAME(_pack_filter_y)
|
||||
@ -106,78 +104,6 @@ static void SCALE_NOFILTER_NAME(const SkBitmapProcState& s,
|
||||
}
|
||||
}
|
||||
|
||||
static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y) {
|
||||
SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
|
||||
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
|
||||
SkMatrix::kScale_Mask |
|
||||
SkMatrix::kAffine_Mask)) == 0);
|
||||
|
||||
PREAMBLE(s);
|
||||
const SkBitmapProcStateAutoMapper mapper(s, x, y);
|
||||
|
||||
SkFractionalInt fx = mapper.fractionalIntX();
|
||||
SkFractionalInt fy = mapper.fractionalIntY();
|
||||
SkFractionalInt dx = s.fInvSxFractionalInt;
|
||||
SkFractionalInt dy = s.fInvKyFractionalInt;
|
||||
int maxX = s.fPixmap.width() - 1;
|
||||
int maxY = s.fPixmap.height() - 1;
|
||||
|
||||
if (count >= 8) {
|
||||
SkFractionalInt dx4 = dx * 4;
|
||||
SkFractionalInt dy4 = dy * 4;
|
||||
SkFractionalInt dx8 = dx * 8;
|
||||
SkFractionalInt dy8 = dy * 8;
|
||||
|
||||
int32x4_t xbase, ybase;
|
||||
int32x4_t x2base, y2base;
|
||||
int16_t *dst16 = (int16_t *) xy;
|
||||
|
||||
// now build fx, fx+dx, fx+2dx, fx+3dx
|
||||
xbase = vdupq_n_s32(SkFractionalIntToFixed(fx));
|
||||
xbase = vsetq_lane_s32(SkFractionalIntToFixed(fx+dx), xbase, 1);
|
||||
xbase = vsetq_lane_s32(SkFractionalIntToFixed(fx+dx+dx), xbase, 2);
|
||||
xbase = vsetq_lane_s32(SkFractionalIntToFixed(fx+dx+dx+dx), xbase, 3);
|
||||
|
||||
// same for fy
|
||||
ybase = vdupq_n_s32(SkFractionalIntToFixed(fy));
|
||||
ybase = vsetq_lane_s32(SkFractionalIntToFixed(fy+dy), ybase, 1);
|
||||
ybase = vsetq_lane_s32(SkFractionalIntToFixed(fy+dy+dy), ybase, 2);
|
||||
ybase = vsetq_lane_s32(SkFractionalIntToFixed(fy+dy+dy+dy), ybase, 3);
|
||||
|
||||
x2base = vaddq_s32(xbase, vdupq_n_s32(SkFractionalIntToFixed(dx4)));
|
||||
y2base = vaddq_s32(ybase, vdupq_n_s32(SkFractionalIntToFixed(dy4)));
|
||||
|
||||
// store & bump
|
||||
do {
|
||||
int16x8x2_t hi16;
|
||||
|
||||
hi16.val[0] = TILEX_PROCF_NEON8(xbase, x2base, maxX);
|
||||
hi16.val[1] = TILEY_PROCF_NEON8(ybase, y2base, maxY);
|
||||
|
||||
vst2q_s16(dst16, hi16);
|
||||
|
||||
// moving base and on to the next
|
||||
xbase = vaddq_s32(xbase, vdupq_n_s32(SkFractionalIntToFixed(dx8)));
|
||||
ybase = vaddq_s32(ybase, vdupq_n_s32(SkFractionalIntToFixed(dy8)));
|
||||
x2base = vaddq_s32(x2base, vdupq_n_s32(SkFractionalIntToFixed(dx8)));
|
||||
y2base = vaddq_s32(y2base, vdupq_n_s32(SkFractionalIntToFixed(dy8)));
|
||||
|
||||
dst16 += 16; // 8x32 aka 16x16
|
||||
count -= 8;
|
||||
fx += dx8;
|
||||
fy += dy8;
|
||||
} while (count >= 8);
|
||||
xy = (uint32_t *) dst16;
|
||||
}
|
||||
|
||||
for (int i = count; i > 0; --i) {
|
||||
*xy++ = (TILEY_PROCF(SkFractionalIntToFixed(fy), maxY) << 16) |
|
||||
TILEX_PROCF(SkFractionalIntToFixed(fx), maxX);
|
||||
fx += dx; fy += dy;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t PACK_FILTER_Y_NAME(SkFixed f, unsigned max,
|
||||
SkFixed one PREAMBLE_PARAM_Y) {
|
||||
unsigned i = TILEY_PROCF(f, max);
|
||||
@ -298,72 +224,9 @@ static void SCALE_FILTER_NAME(const SkBitmapProcState& s,
|
||||
}
|
||||
}
|
||||
|
||||
static void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y) {
|
||||
SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
|
||||
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
|
||||
SkMatrix::kScale_Mask |
|
||||
SkMatrix::kAffine_Mask)) == 0);
|
||||
|
||||
PREAMBLE(s);
|
||||
const SkBitmapProcStateAutoMapper mapper(s, x, y);
|
||||
|
||||
SkFixed oneX = s.fFilterOneX;
|
||||
SkFixed oneY = s.fFilterOneY;
|
||||
SkFixed fx = mapper.fixedX();
|
||||
SkFixed fy = mapper.fixedY();
|
||||
SkFixed dx = s.fInvSx;
|
||||
SkFixed dy = s.fInvKy;
|
||||
unsigned maxX = s.fPixmap.width() - 1;
|
||||
unsigned maxY = s.fPixmap.height() - 1;
|
||||
|
||||
if (count >= 4) {
|
||||
int32x4_t wide_fy, wide_fx;
|
||||
|
||||
wide_fx = vdupq_n_s32(fx);
|
||||
wide_fx = vsetq_lane_s32(fx+dx, wide_fx, 1);
|
||||
wide_fx = vsetq_lane_s32(fx+dx+dx, wide_fx, 2);
|
||||
wide_fx = vsetq_lane_s32(fx+dx+dx+dx, wide_fx, 3);
|
||||
|
||||
wide_fy = vdupq_n_s32(fy);
|
||||
wide_fy = vsetq_lane_s32(fy+dy, wide_fy, 1);
|
||||
wide_fy = vsetq_lane_s32(fy+dy+dy, wide_fy, 2);
|
||||
wide_fy = vsetq_lane_s32(fy+dy+dy+dy, wide_fy, 3);
|
||||
|
||||
while (count >= 4) {
|
||||
int32x4x2_t vxy;
|
||||
|
||||
// do the X side, then the Y side, then interleave them
|
||||
vxy.val[0] = PACK_FILTER_Y4_NAME(wide_fy, maxY, oneY PREAMBLE_ARG_Y);
|
||||
vxy.val[1] = PACK_FILTER_X4_NAME(wide_fx, maxX, oneX PREAMBLE_ARG_X);
|
||||
|
||||
// interleave as YXYXYXYX as part of the storing
|
||||
vst2q_s32((int32_t*)xy, vxy);
|
||||
|
||||
// prepare next iteration
|
||||
wide_fx += vdupq_n_s32(dx+dx+dx+dx);
|
||||
fx += dx + dx + dx + dx;
|
||||
wide_fy += vdupq_n_s32(dy+dy+dy+dy);
|
||||
fy += dy+dy+dy+dy;
|
||||
xy += 8; // 4 x's, 4 y's
|
||||
count -= 4;
|
||||
}
|
||||
}
|
||||
|
||||
while (--count >= 0) {
|
||||
// NB: writing Y/X
|
||||
*xy++ = PACK_FILTER_Y_NAME(fy, maxY, oneY PREAMBLE_ARG_Y);
|
||||
fy += dy;
|
||||
*xy++ = PACK_FILTER_X_NAME(fx, maxX, oneX PREAMBLE_ARG_X);
|
||||
fx += dx;
|
||||
}
|
||||
}
|
||||
|
||||
const SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
|
||||
SCALE_NOFILTER_NAME,
|
||||
SCALE_FILTER_NAME,
|
||||
AFFINE_NOFILTER_NAME,
|
||||
AFFINE_FILTER_NAME,
|
||||
};
|
||||
|
||||
#undef TILEX_PROCF_NEON8
|
||||
@ -381,8 +244,6 @@ const SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
|
||||
|
||||
#undef SCALE_NOFILTER_NAME
|
||||
#undef SCALE_FILTER_NAME
|
||||
#undef AFFINE_NOFILTER_NAME
|
||||
#undef AFFINE_FILTER_NAME
|
||||
|
||||
#undef PREAMBLE
|
||||
#undef PREAMBLE_PARAM_X
|
||||
|
@ -476,146 +476,3 @@ void ClampX_ClampY_nofilter_scale_SSE2(const SkBitmapProcState& s,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* SSE version of ClampX_ClampY_filter_affine()
|
||||
* portable version is in core/SkBitmapProcState_matrix.h
|
||||
*/
|
||||
void ClampX_ClampY_filter_affine_SSE2(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y) {
|
||||
const SkBitmapProcStateAutoMapper mapper(s, x, y);
|
||||
|
||||
SkFixed oneX = s.fFilterOneX;
|
||||
SkFixed oneY = s.fFilterOneY;
|
||||
SkFixed fx = mapper.fixedX();
|
||||
SkFixed fy = mapper.fixedY();
|
||||
SkFixed dx = s.fInvSx;
|
||||
SkFixed dy = s.fInvKy;
|
||||
unsigned maxX = s.fPixmap.width() - 1;
|
||||
unsigned maxY = s.fPixmap.height() - 1;
|
||||
|
||||
if (count >= 2 && (maxX <= 0xFFFF)) {
|
||||
SkFixed dx2 = dx + dx;
|
||||
SkFixed dy2 = dy + dy;
|
||||
|
||||
__m128i wide_f = _mm_set_epi32(fx + dx, fy + dy, fx, fy);
|
||||
__m128i wide_d2 = _mm_set_epi32(dx2, dy2, dx2, dy2);
|
||||
__m128i wide_one = _mm_set_epi32(oneX, oneY, oneX, oneY);
|
||||
__m128i wide_max = _mm_set_epi32(maxX, maxY, maxX, maxY);
|
||||
__m128i wide_mask = _mm_set1_epi32(0xF);
|
||||
|
||||
while (count >= 2) {
|
||||
// i = SkClampMax(f>>16,maxX)
|
||||
__m128i wide_i = _mm_max_epi16(_mm_srli_epi32(wide_f, 16),
|
||||
_mm_setzero_si128());
|
||||
wide_i = _mm_min_epi16(wide_i, wide_max);
|
||||
|
||||
// i<<4 | EXTRACT_LOW_BITS(f)
|
||||
__m128i wide_lo = _mm_srli_epi32(wide_f, 12);
|
||||
wide_lo = _mm_and_si128(wide_lo, wide_mask);
|
||||
wide_i = _mm_slli_epi32(wide_i, 4);
|
||||
wide_i = _mm_or_si128(wide_i, wide_lo);
|
||||
|
||||
// i<<14
|
||||
wide_i = _mm_slli_epi32(wide_i, 14);
|
||||
|
||||
// SkClampMax(((f+one))>>16,max)
|
||||
__m128i wide_f1 = _mm_add_epi32(wide_f, wide_one);
|
||||
wide_f1 = _mm_max_epi16(_mm_srli_epi32(wide_f1, 16),
|
||||
_mm_setzero_si128());
|
||||
wide_f1 = _mm_min_epi16(wide_f1, wide_max);
|
||||
|
||||
// final combination
|
||||
wide_i = _mm_or_si128(wide_i, wide_f1);
|
||||
_mm_storeu_si128(reinterpret_cast<__m128i*>(xy), wide_i);
|
||||
|
||||
wide_f = _mm_add_epi32(wide_f, wide_d2);
|
||||
|
||||
fx += dx2;
|
||||
fy += dy2;
|
||||
xy += 4;
|
||||
count -= 2;
|
||||
} // while count >= 2
|
||||
} // if count >= 2
|
||||
|
||||
while (count-- > 0) {
|
||||
*xy++ = ClampX_ClampY_pack_filter(fy, maxY, oneY);
|
||||
fy += dy;
|
||||
*xy++ = ClampX_ClampY_pack_filter(fx, maxX, oneX);
|
||||
fx += dx;
|
||||
}
|
||||
}
|
||||
|
||||
/* SSE version of ClampX_ClampY_nofilter_affine()
|
||||
* portable version is in core/SkBitmapProcState_matrix.h
|
||||
*/
|
||||
void ClampX_ClampY_nofilter_affine_SSE2(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y) {
|
||||
SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
|
||||
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
|
||||
SkMatrix::kScale_Mask |
|
||||
SkMatrix::kAffine_Mask)) == 0);
|
||||
|
||||
const SkBitmapProcStateAutoMapper mapper(s, x, y);
|
||||
|
||||
SkFixed fx = mapper.fixedX();
|
||||
SkFixed fy = mapper.fixedY();
|
||||
SkFixed dx = s.fInvSx;
|
||||
SkFixed dy = s.fInvKy;
|
||||
int maxX = s.fPixmap.width() - 1;
|
||||
int maxY = s.fPixmap.height() - 1;
|
||||
|
||||
if (count >= 4 && (maxX <= 0xFFFF)) {
|
||||
while (((size_t)xy & 0x0F) != 0) {
|
||||
*xy++ = (SkClampMax(fy >> 16, maxY) << 16) |
|
||||
SkClampMax(fx >> 16, maxX);
|
||||
fx += dx;
|
||||
fy += dy;
|
||||
count--;
|
||||
}
|
||||
|
||||
SkFixed dx4 = dx * 4;
|
||||
SkFixed dy4 = dy * 4;
|
||||
|
||||
__m128i wide_fx = _mm_set_epi32(fx + dx * 3, fx + dx * 2,
|
||||
fx + dx, fx);
|
||||
__m128i wide_fy = _mm_set_epi32(fy + dy * 3, fy + dy * 2,
|
||||
fy + dy, fy);
|
||||
__m128i wide_dx4 = _mm_set1_epi32(dx4);
|
||||
__m128i wide_dy4 = _mm_set1_epi32(dy4);
|
||||
|
||||
__m128i wide_maxX = _mm_set1_epi32(maxX);
|
||||
__m128i wide_maxY = _mm_set1_epi32(maxY);
|
||||
|
||||
while (count >= 4) {
|
||||
// SkClampMax(fx>>16,maxX)
|
||||
__m128i wide_lo = _mm_max_epi16(_mm_srli_epi32(wide_fx, 16),
|
||||
_mm_setzero_si128());
|
||||
wide_lo = _mm_min_epi16(wide_lo, wide_maxX);
|
||||
|
||||
// SkClampMax(fy>>16,maxY)
|
||||
__m128i wide_hi = _mm_max_epi16(_mm_srli_epi32(wide_fy, 16),
|
||||
_mm_setzero_si128());
|
||||
wide_hi = _mm_min_epi16(wide_hi, wide_maxY);
|
||||
|
||||
// final combination
|
||||
__m128i wide_i = _mm_or_si128(_mm_slli_epi32(wide_hi, 16),
|
||||
wide_lo);
|
||||
_mm_store_si128(reinterpret_cast<__m128i*>(xy), wide_i);
|
||||
|
||||
wide_fx = _mm_add_epi32(wide_fx, wide_dx4);
|
||||
wide_fy = _mm_add_epi32(wide_fy, wide_dy4);
|
||||
|
||||
fx += dx4;
|
||||
fy += dy4;
|
||||
xy += 4;
|
||||
count -= 4;
|
||||
} // while count >= 4
|
||||
} // if count >= 4
|
||||
|
||||
while (count-- > 0) {
|
||||
*xy++ = (SkClampMax(fy >> 16, maxY) << 16) |
|
||||
SkClampMax(fx >> 16, maxX);
|
||||
fx += dx;
|
||||
fy += dy;
|
||||
}
|
||||
}
|
||||
|
@ -20,9 +20,5 @@ void ClampX_ClampY_filter_scale_SSE2(const SkBitmapProcState& s, uint32_t xy[],
|
||||
int count, int x, int y);
|
||||
void ClampX_ClampY_nofilter_scale_SSE2(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y);
|
||||
void ClampX_ClampY_filter_affine_SSE2(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y);
|
||||
void ClampX_ClampY_nofilter_affine_SSE2(const SkBitmapProcState& s,
|
||||
uint32_t xy[], int count, int x, int y);
|
||||
|
||||
#endif
|
||||
|
@ -47,20 +47,12 @@ void SkBitmapProcState::platformProcs() {
|
||||
} else {
|
||||
fSampleProc32 = S32_opaque_D32_filter_DX_SSE2;
|
||||
}
|
||||
} else if (fSampleProc32 == S32_opaque_D32_filter_DXDY) {
|
||||
if (ssse3) {
|
||||
fSampleProc32 = S32_opaque_D32_filter_DXDY_SSSE3;
|
||||
}
|
||||
} else if (fSampleProc32 == S32_alpha_D32_filter_DX) {
|
||||
if (ssse3) {
|
||||
fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3;
|
||||
} else {
|
||||
fSampleProc32 = S32_alpha_D32_filter_DX_SSE2;
|
||||
}
|
||||
} else if (fSampleProc32 == S32_alpha_D32_filter_DXDY) {
|
||||
if (ssse3) {
|
||||
fSampleProc32 = S32_alpha_D32_filter_DXDY_SSSE3;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check fMatrixProc */
|
||||
@ -68,10 +60,6 @@ void SkBitmapProcState::platformProcs() {
|
||||
fMatrixProc = ClampX_ClampY_filter_scale_SSE2;
|
||||
} else if (fMatrixProc == ClampX_ClampY_nofilter_scale) {
|
||||
fMatrixProc = ClampX_ClampY_nofilter_scale_SSE2;
|
||||
} else if (fMatrixProc == ClampX_ClampY_filter_affine) {
|
||||
fMatrixProc = ClampX_ClampY_filter_affine_SSE2;
|
||||
} else if (fMatrixProc == ClampX_ClampY_nofilter_affine) {
|
||||
fMatrixProc = ClampX_ClampY_nofilter_affine_SSE2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,11 +78,9 @@ bool SkImageShader::IsRasterPipelineOnly(const SkMatrix& ctm, SkColorType ct, Sk
|
||||
if (!ctm.isScaleTranslate()) {
|
||||
return true;
|
||||
}
|
||||
#ifndef SK_SUPPORT_LEGACY_LOCAL_ROTATE_SHADER
|
||||
if (!localM.isScaleTranslate()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -63,12 +63,8 @@ protected:
|
||||
#endif
|
||||
|
||||
bool onIsRasterPipelineOnly(const SkMatrix& ctm) const override {
|
||||
#ifdef SK_SUPPORT_LEGACY_LOCAL_ROTATE_SHADER
|
||||
return as_SB(fProxyShader)->isRasterPipelineOnly(ctm);
|
||||
#else
|
||||
return as_SB(fProxyShader)->isRasterPipelineOnly(SkMatrix::Concat(ctm,
|
||||
this->getLocalMatrix()));
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user