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
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 7128242..7c37a15 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -500,9 +500,9 @@
// 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 @@
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 @@
// 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 @@
{
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 fca7dc0..a006e09 100644
--- a/src/core/SkBitmapProcState.h
+++ b/src/core/SkBitmapProcState.h
@@ -220,8 +220,14 @@
}
}
- 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 273a35b..860e27a 100644
--- a/src/core/SkBitmapProcState_matrix.h
+++ b/src/core/SkBitmapProcState_matrix.h
@@ -62,12 +62,12 @@
{
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 @@
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 d7457ec..be0e371 100644
--- a/src/core/SkBitmapProcState_matrixProcs.cpp
+++ b/src/core/SkBitmapProcState_matrixProcs.cpp
@@ -329,10 +329,10 @@
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 82fdddb..0c93718 100644
--- a/src/core/SkBitmapProcState_matrix_template.h
+++ b/src/core/SkBitmapProcState_matrix_template.h
@@ -24,8 +24,8 @@
{
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 @@
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 1ff2e6b..5324456 100644
--- a/src/core/SkBitmapProcState_shaderproc.h
+++ b/src/core/SkBitmapProcState_shaderproc.h
@@ -32,7 +32,7 @@
{
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 @@
row0 = (const SRCTYPE*)(srcAddr + y0 * rb);
row1 = (const SRCTYPE*)(srcAddr + y1 * rb);
// now initialize fx
- fx = SkFractionalIntToFixed(mapper.x());
+ fx = mapper.fixedX();
}
#ifdef PREAMBLE