diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-08 20:13:46 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-08 20:13:46 +0000 |
commit | 411215ae2b9a36ff6e262f77d7fb5071cc084f00 (patch) | |
tree | a7c14985e5b6b3eacde19edcdcfcc4c686200676 | |
parent | 9183216a7c16a69759edad409c004fc167ca2bf5 (diff) |
apply FractionalInt improvement to rotated
git-svn-id: http://skia.googlecode.com/svn/trunk@3348 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/core/SkBitmapProcState.cpp | 1 | ||||
-rw-r--r-- | src/core/SkBitmapProcState.h | 3 | ||||
-rw-r--r-- | src/core/SkBitmapProcState_matrix.h | 15 |
3 files changed, 12 insertions, 7 deletions
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index 744a9e4076..75d2791b3b 100644 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -392,6 +392,7 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { fInvSx = SkScalarToFixed(m->getScaleX()); fInvSxFractionalInt = SkScalarToFractionalInt(m->getScaleX()); fInvKy = SkScalarToFixed(m->getSkewY()); + fInvKyFractionalInt = SkScalarToFractionalInt(m->getSkewY()); fAlphaScale = SkAlpha255To256(paint.getAlpha()); diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h index 97705becf9..ccbe0609e2 100644 --- a/src/core/SkBitmapProcState.h +++ b/src/core/SkBitmapProcState.h @@ -19,11 +19,13 @@ typedef SkFixed48 SkFractionalInt; #define SkScalarToFractionalInt(x) SkScalarToFixed48(x) #define SkFractionalIntToFixed(x) SkFixed48ToFixed(x) + #define SkFixedToFractionalInt(x) SkFixedToFixed48(x) #define SkFractionalIntToInt(x) SkFixed48ToInt(x) #else typedef SkFixed SkFractionalInt; #define SkScalarToFractionalInt(x) SkScalarToFixed(x) #define SkFractionalIntToFixed(x) (x) + #define SkFixedToFractionalInt(x) (x) #define SkFractionalIntToInt(x) ((x) >> 16) #endif @@ -69,6 +71,7 @@ struct SkBitmapProcState { SkMatrix::MapXYProc fInvProc; // chooseProcs SkFractionalInt fInvSxFractionalInt; + SkFractionalInt fInvKyFractionalInt; FixedTileProc fTileProcX; // chooseProcs FixedTileProc fTileProcY; // chooseProcs diff --git a/src/core/SkBitmapProcState_matrix.h b/src/core/SkBitmapProcState_matrix.h index 3d959dd379..0fe0c19459 100644 --- a/src/core/SkBitmapProcState_matrix.h +++ b/src/core/SkBitmapProcState_matrix.h @@ -108,13 +108,13 @@ void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s, SkFractionalInt fx = SkScalarToFractionalInt(srcPt.fX); SkFractionalInt fy = SkScalarToFractionalInt(srcPt.fY); - SkFractionalInt dx = s.fInvSx; - SkFractionalInt dy = s.fInvKy; + SkFractionalInt dx = s.fInvSxFractionalInt; + SkFractionalInt dy = s.fInvKyFractionalInt; int maxX = s.fBitmap->width() - 1; int maxY = s.fBitmap->height() - 1; for (int i = count; i > 0; --i) { - *xy++ = (TILEY_PROCF(SkFractionalIntToFixed(fx), maxY) << 16) | + *xy++ = (TILEY_PROCF(SkFractionalIntToFixed(fy), maxY) << 16) | TILEX_PROCF(SkFractionalIntToFixed(fx), maxX); fx += dx; fy += dy; } @@ -169,8 +169,8 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s, const unsigned maxX = s.fBitmap->width() - 1; const SkFixed one = s.fFilterOneX; - const SkFixed dx = s.fInvSx; - SkFixed fx; + const SkFractionalInt dx = s.fInvSxFractionalInt; + SkFractionalInt fx; { SkPoint pt; @@ -181,7 +181,7 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s, // compute our two Y values up front *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y); // now initialize fx - fx = SkScalarToFixed(pt.fX) - (one >> 1); + fx = SkScalarToFractionalInt(pt.fX) - (SkFixedToFractionalInt(one) >> 1); } #ifdef CHECK_FOR_DECAL @@ -194,7 +194,8 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s, #endif { do { - *xy++ = PACK_FILTER_X_NAME(fx, maxX, one PREAMBLE_ARG_X); + SkFixed fixedFx = SkFractionalIntToFixed(fx); + *xy++ = PACK_FILTER_X_NAME(fixedFx, maxX, one PREAMBLE_ARG_X); fx += dx; } while (--count != 0); } |