aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2016-02-03 10:21:33 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-03 10:21:33 -0800
commitbe5cfa9a9e1cfb77beba27727df7149ab5e7d422 (patch)
tree60f0cea20012e6137b29a762ff50ba29403a99a3
parent513d30726373909fbb1cd4b3734348494638abcd (diff)
Rename SkBitmapProcStateAutoMapper methods
x(),y() -> fractionalIntX(), fractionalIntY() (to clarify the return type) Also add fixed & int helpers. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1666433003 CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review URL: https://codereview.chromium.org/1666433003
-rw-r--r--src/core/SkBitmapProcState.cpp16
-rw-r--r--src/core/SkBitmapProcState.h10
-rw-r--r--src/core/SkBitmapProcState_matrix.h8
-rw-r--r--src/core/SkBitmapProcState_matrixProcs.cpp4
-rw-r--r--src/core/SkBitmapProcState_matrix_template.h8
-rw-r--r--src/core/SkBitmapProcState_shaderproc.h4
-rw-r--r--src/opts/SkBitmapProcState_matrix_neon.h16
-rw-r--r--src/opts/SkBitmapProcState_opts_SSE2.cpp16
8 files changed, 44 insertions, 38 deletions
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 7128242331..7c37a154d2 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -500,9 +500,9 @@ static void S32_D32_constX_shaderproc(const void* sIn,
// its own tiling and sampling we need to undo that here.
if (SkShader::kClamp_TileMode != s.fTileModeX ||
SkShader::kClamp_TileMode != s.fTileModeY) {
- yTemp = SkFractionalIntToInt(mapper.y() * s.fPixmap.height());
+ yTemp = SkFractionalIntToInt(mapper.fractionalIntY() * s.fPixmap.height());
} else {
- yTemp = SkFractionalIntToInt(mapper.y());
+ yTemp = mapper.intY();
}
} else {
yTemp = s.fFilterOneY + y;
@@ -530,9 +530,9 @@ static void S32_D32_constX_shaderproc(const void* sIn,
if (s.fInvType > SkMatrix::kTranslate_Mask &&
(SkShader::kClamp_TileMode != s.fTileModeX ||
SkShader::kClamp_TileMode != s.fTileModeY)) {
- iY2 = SkFractionalIntToInt(mapper.y() * s.fPixmap.height());
+ iY2 = SkFractionalIntToInt(mapper.fractionalIntY() * s.fPixmap.height());
} else {
- iY2 = SkFractionalIntToInt(mapper.y());
+ iY2 = mapper.intY();
}
switch (s.fTileModeY) {
@@ -598,8 +598,8 @@ bool SkBitmapProcState::setupForTranslate() {
// Since we know we're not filtered, we re-purpose these fields allow
// us to go from device -> src coordinates w/ just an integer add,
// rather than running through the inverse-matrix
- fFilterOneX = SkFractionalIntToInt(mapper.x());
- fFilterOneY = SkFractionalIntToInt(mapper.y());
+ fFilterOneX = mapper.intX();
+ fFilterOneY = mapper.intY();
return true;
}
@@ -781,8 +781,8 @@ void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const void* sIn, int x, int y,
{
const SkBitmapProcStateAutoMapper mapper(s, x, y);
const unsigned maxY = s.fPixmap.height() - 1;
- dstY = SkClampMax(SkFractionalIntToInt(mapper.y()), maxY);
- fx = mapper.x();
+ dstY = SkClampMax(mapper.intY(), maxY);
+ fx = mapper.fractionalIntX();
}
const SkPMColor* SK_RESTRICT src = s.fPixmap.addr32(0, dstY);
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h
index fca7dc0a3e..a006e090b5 100644
--- a/src/core/SkBitmapProcState.h
+++ b/src/core/SkBitmapProcState.h
@@ -220,8 +220,14 @@ public:
}
}
- SkFractionalInt x() const { return fX; }
- SkFractionalInt y() const { return fY; }
+ SkFractionalInt fractionalIntX() const { return fX; }
+ SkFractionalInt fractionalIntY() const { return fY; }
+
+ SkFixed fixedX() const { return SkFractionalIntToFixed(fX); }
+ SkFixed fixedY() const { return SkFractionalIntToFixed(fY); }
+
+ int intX() const { return SkFractionalIntToInt(fX); }
+ int intY() const { return SkFractionalIntToInt(fY); }
private:
SkFractionalInt fX, fY;
diff --git a/src/core/SkBitmapProcState_matrix.h b/src/core/SkBitmapProcState_matrix.h
index 273a35ba89..860e27ac7d 100644
--- a/src/core/SkBitmapProcState_matrix.h
+++ b/src/core/SkBitmapProcState_matrix.h
@@ -62,12 +62,12 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s,
{
const SkBitmapProcStateAutoMapper mapper(s, x, y);
- const SkFixed fy = SkFractionalIntToFixed(mapper.y());
+ const SkFixed fy = mapper.fixedY();
const unsigned maxY = s.fPixmap.height() - 1;
// compute our two Y values up front
*xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y);
// now initialize fx
- fx = mapper.x();
+ fx = mapper.fractionalIntX();
}
#ifdef CHECK_FOR_DECAL
@@ -97,8 +97,8 @@ void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
SkFixed oneX = s.fFilterOneX;
SkFixed oneY = s.fFilterOneY;
- SkFixed fx = SkFractionalIntToFixed(mapper.x());
- SkFixed fy = SkFractionalIntToFixed(mapper.y());
+ SkFixed fx = mapper.fixedX();
+ SkFixed fy = mapper.fixedY();
SkFixed dx = s.fInvSx;
SkFixed dy = s.fInvKy;
unsigned maxX = s.fPixmap.width() - 1;
diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp
index d7457ec53b..be0e371f7f 100644
--- a/src/core/SkBitmapProcState_matrixProcs.cpp
+++ b/src/core/SkBitmapProcState_matrixProcs.cpp
@@ -329,10 +329,10 @@ static void fill_sequential(uint16_t xptr[], int start, int count) {
static int nofilter_trans_preamble(const SkBitmapProcState& s, uint32_t** xy,
int x, int y) {
const SkBitmapProcStateAutoMapper mapper(s, x, y);
- **xy = s.fIntTileProcY(SkFractionalIntToInt(mapper.y()), s.fPixmap.height());
+ **xy = s.fIntTileProcY(mapper.intY(), s.fPixmap.height());
*xy += 1; // bump the ptr
// return our starting X position
- return SkFractionalIntToInt(mapper.x());
+ return mapper.intX();
}
static void clampx_nofilter_trans(const SkBitmapProcState& s,
diff --git a/src/core/SkBitmapProcState_matrix_template.h b/src/core/SkBitmapProcState_matrix_template.h
index 82fdddbece..0c9371851c 100644
--- a/src/core/SkBitmapProcState_matrix_template.h
+++ b/src/core/SkBitmapProcState_matrix_template.h
@@ -24,8 +24,8 @@ void NoFilterProc_Scale(const SkBitmapProcState& s, uint32_t xy[],
{
const SkBitmapProcStateAutoMapper mapper(s, x, y);
const unsigned maxY = s.fPixmap.height() - 1;
- *xy++ = TileProc::Y(s, SkFractionalIntToFixed(mapper.y()), maxY);
- fx = mapper.x();
+ *xy++ = TileProc::Y(s, mapper.fixedY(), maxY);
+ fx = mapper.fractionalIntX();
}
if (0 == maxX) {
@@ -79,8 +79,8 @@ void NoFilterProc_Affine(const SkBitmapProcState& s, uint32_t xy[],
const SkBitmapProcStateAutoMapper mapper(s, x, y);
- SkFractionalInt fx = mapper.x();
- SkFractionalInt fy = mapper.y();
+ SkFractionalInt fx = mapper.fractionalIntX();
+ SkFractionalInt fy = mapper.fractionalIntY();
SkFractionalInt dx = s.fInvSxFractionalInt;
SkFractionalInt dy = s.fInvKyFractionalInt;
int maxX = s.fPixmap.width() - 1;
diff --git a/src/core/SkBitmapProcState_shaderproc.h b/src/core/SkBitmapProcState_shaderproc.h
index 1ff2e6bf24..5324456145 100644
--- a/src/core/SkBitmapProcState_shaderproc.h
+++ b/src/core/SkBitmapProcState_shaderproc.h
@@ -32,7 +32,7 @@ void SCALE_FILTER_NAME(const void* sIn, int x, int y, SkPMColor* SK_RESTRICT col
{
const SkBitmapProcStateAutoMapper mapper(s, x, y);
- SkFixed fy = SkFractionalIntToFixed(mapper.y());
+ SkFixed fy = mapper.fixedY();
const unsigned maxY = s.fPixmap.height() - 1;
// compute our two Y values up front
subY = TILEY_LOW_BITS(fy, maxY);
@@ -44,7 +44,7 @@ void SCALE_FILTER_NAME(const void* sIn, int x, int y, SkPMColor* SK_RESTRICT col
row0 = (const SRCTYPE*)(srcAddr + y0 * rb);
row1 = (const SRCTYPE*)(srcAddr + y1 * rb);
// now initialize fx
- fx = SkFractionalIntToFixed(mapper.x());
+ fx = mapper.fixedX();
}
#ifdef PREAMBLE
diff --git a/src/opts/SkBitmapProcState_matrix_neon.h b/src/opts/SkBitmapProcState_matrix_neon.h
index df151b275c..45691b90ce 100644
--- a/src/opts/SkBitmapProcState_matrix_neon.h
+++ b/src/opts/SkBitmapProcState_matrix_neon.h
@@ -40,8 +40,8 @@ static void SCALE_NOFILTER_NAME(const SkBitmapProcState& s,
{
const SkBitmapProcStateAutoMapper mapper(s, x, y);
const unsigned maxY = s.fPixmap.height() - 1;
- *xy++ = TILEY_PROCF(SkFractionalIntToFixed(mapper.y()), maxY);
- fx = mapper.x();
+ *xy++ = TILEY_PROCF(mapper.fixedY(), maxY);
+ fx = mapper.fractionalIntX();
}
if (0 == maxX) {
@@ -117,8 +117,8 @@ static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s,
PREAMBLE(s);
const SkBitmapProcStateAutoMapper mapper(s, x, y);
- SkFractionalInt fx = mapper.x();
- SkFractionalInt fy = mapper.y();
+ SkFractionalInt fx = mapper.fractionalIntX();
+ SkFractionalInt fy = mapper.fractionalIntY();
SkFractionalInt dx = s.fInvSxFractionalInt;
SkFractionalInt dy = s.fInvKyFractionalInt;
int maxX = s.fPixmap.width() - 1;
@@ -299,12 +299,12 @@ static void SCALE_FILTER_NAME(const SkBitmapProcState& s,
{
const SkBitmapProcStateAutoMapper mapper(s, x, y);
- const SkFixed fy = SkFractionalIntToFixed(mapper.y());
+ const SkFixed fy = mapper.fixedY();
const unsigned maxY = s.fPixmap.height() - 1;
// compute our two Y values up front
*xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y);
// now initialize fx
- fx = mapper.x();
+ fx = mapper.fractionalIntX();
}
#ifdef CHECK_FOR_DECAL
@@ -359,8 +359,8 @@ static void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
SkFixed oneX = s.fFilterOneX;
SkFixed oneY = s.fFilterOneY;
- SkFixed fx = SkFractionalIntToFixed(mapper.x());
- SkFixed fy = SkFractionalIntToFixed(mapper.y());
+ SkFixed fx = mapper.fixedX();
+ SkFixed fy = mapper.fixedY();
SkFixed dx = s.fInvSx;
SkFixed dy = s.fInvKy;
unsigned maxX = s.fPixmap.width() - 1;
diff --git a/src/opts/SkBitmapProcState_opts_SSE2.cpp b/src/opts/SkBitmapProcState_opts_SSE2.cpp
index cb9a2dbb14..8247d8796f 100644
--- a/src/opts/SkBitmapProcState_opts_SSE2.cpp
+++ b/src/opts/SkBitmapProcState_opts_SSE2.cpp
@@ -254,12 +254,12 @@ void ClampX_ClampY_filter_scale_SSE2(const SkBitmapProcState& s, uint32_t xy[],
const SkFixed dx = s.fInvSx;
const SkBitmapProcStateAutoMapper mapper(s, x, y);
- const SkFixed fy = SkFractionalIntToFixed(mapper.y());
+ const SkFixed fy = mapper.fixedY();
const unsigned maxY = s.fPixmap.height() - 1;
// compute our two Y values up front
*xy++ = ClampX_ClampY_pack_filter(fy, maxY, s.fFilterOneY);
// now initialize fx
- SkFixed fx = SkFractionalIntToFixed(mapper.x());
+ SkFixed fx = mapper.fixedX();
// test if we don't need to apply the tile proc
if (dx > 0 && (unsigned)(fx >> 16) <= maxX &&
@@ -373,8 +373,8 @@ void ClampX_ClampY_nofilter_scale_SSE2(const SkBitmapProcState& s,
const unsigned maxX = s.fPixmap.width() - 1;
const SkBitmapProcStateAutoMapper mapper(s, x, y);
const unsigned maxY = s.fPixmap.height() - 1;
- *xy++ = SkClampMax(SkFractionalIntToInt(mapper.y()), maxY);
- SkFixed fx = SkFractionalIntToFixed(mapper.x());
+ *xy++ = SkClampMax(mapper.intY(), maxY);
+ SkFixed fx = mapper.fixedX();
if (0 == maxX) {
// all of the following X values must be 0
@@ -486,8 +486,8 @@ void ClampX_ClampY_filter_affine_SSE2(const SkBitmapProcState& s,
SkFixed oneX = s.fFilterOneX;
SkFixed oneY = s.fFilterOneY;
- SkFixed fx = SkFractionalIntToFixed(mapper.x());
- SkFixed fy = SkFractionalIntToFixed(mapper.y());
+ SkFixed fx = mapper.fixedX();
+ SkFixed fy = mapper.fixedY();
SkFixed dx = s.fInvSx;
SkFixed dy = s.fInvKy;
unsigned maxX = s.fPixmap.width() - 1;
@@ -557,8 +557,8 @@ void ClampX_ClampY_nofilter_affine_SSE2(const SkBitmapProcState& s,
const SkBitmapProcStateAutoMapper mapper(s, x, y);
- SkFixed fx = SkFractionalIntToFixed(mapper.x());
- SkFixed fy = SkFractionalIntToFixed(mapper.y());
+ SkFixed fx = mapper.fixedX();
+ SkFixed fy = mapper.fixedY();
SkFixed dx = s.fInvSx;
SkFixed dy = s.fInvKy;
int maxX = s.fPixmap.width() - 1;