// 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;
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) {
// 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;
}
{
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);
}
}
- 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;
{
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
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;
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,
{
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) {
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;
{
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);
row0 = (const SRCTYPE*)(srcAddr + y0 * rb);
row1 = (const SRCTYPE*)(srcAddr + y1 * rb);
// now initialize fx
- fx = SkFractionalIntToFixed(mapper.x());
+ fx = mapper.fixedX();
}
#ifdef PREAMBLE
{
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) {
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;
{
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
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;
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 &&
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
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;
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;