Rename SkBitmapProcStateAutoMapper methods
authorfmalita <fmalita@chromium.org>
Wed, 3 Feb 2016 18:21:33 +0000 (10:21 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 3 Feb 2016 18:21:33 +0000 (10:21 -0800)
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

src/core/SkBitmapProcState.cpp
src/core/SkBitmapProcState.h
src/core/SkBitmapProcState_matrix.h
src/core/SkBitmapProcState_matrixProcs.cpp
src/core/SkBitmapProcState_matrix_template.h
src/core/SkBitmapProcState_shaderproc.h
src/opts/SkBitmapProcState_matrix_neon.h
src/opts/SkBitmapProcState_opts_SSE2.cpp

index 7128242..7c37a15 100644 (file)
@@ -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);
index fca7dc0..a006e09 100644 (file)
@@ -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;
index 273a35b..860e27a 100644 (file)
@@ -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;
index d7457ec..be0e371 100644 (file)
@@ -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,
index 82fdddb..0c93718 100644 (file)
@@ -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;
index 1ff2e6b..5324456 100644 (file)
@@ -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
index df151b2..45691b9 100644 (file)
@@ -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;
index cb9a2db..8247d87 100644 (file)
@@ -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;