diff options
author | fmalita <fmalita@chromium.org> | 2016-01-04 10:28:11 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-04 10:28:11 -0800 |
commit | b3a835891cf221bdf4c6eeb4cf404b374955015f (patch) | |
tree | 13a52c1b1e6268330790b2e70c46cf991ac5f031 /src/core/SkBitmapProcState_matrix.h | |
parent | 0152cc3819291841298013d2b5515a61e974e41f (diff) |
[Reland] Repeating SkBitmapProcState rounding bias
1) observe the bias in repeat matrix procs also.
2) add utility for device space -> bitmap space mapping.
3) remove unneeded filter bias
This is a reland of https://codereview.chromium.org/1529833003/. The
main difference (and the fix) vs. the prev version is increased
precision: the mapper now operates with SkFractionalInts.
R=reed@google.com
BUG=skia:4680, skia:4649
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1539083002
Review URL: https://codereview.chromium.org/1539083002
Diffstat (limited to 'src/core/SkBitmapProcState_matrix.h')
-rw-r--r-- | src/core/SkBitmapProcState_matrix.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/core/SkBitmapProcState_matrix.h b/src/core/SkBitmapProcState_matrix.h index 42a5ab6e22..bdab846496 100644 --- a/src/core/SkBitmapProcState_matrix.h +++ b/src/core/SkBitmapProcState_matrix.h @@ -64,14 +64,12 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s, SkPoint pt; s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, SkIntToScalar(y) + SK_ScalarHalf, &pt); - const SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1) - + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleY()); + const SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1); 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 = SkScalarToFractionalInt(pt.fX) - (SkFixedToFractionalInt(one) >> 1) - + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleX()); + fx = SkScalarToFractionalInt(pt.fX) - (SkFixedToFractionalInt(one) >> 1); } #ifdef CHECK_FOR_DECAL @@ -104,10 +102,8 @@ void AFFINE_FILTER_NAME(const SkBitmapProcState& s, SkFixed oneX = s.fFilterOneX; SkFixed oneY = s.fFilterOneY; - SkFixed fx = SkScalarToFixed(srcPt.fX) - (oneX >> 1) - + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleX()); - SkFixed fy = SkScalarToFixed(srcPt.fY) - (oneY >> 1) - + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleY()); + SkFixed fx = SkScalarToFixed(srcPt.fX) - (oneX >> 1); + SkFixed fy = SkScalarToFixed(srcPt.fY) - (oneY >> 1); SkFixed dx = s.fInvSx; SkFixed dy = s.fInvKy; unsigned maxX = s.fPixmap.width() - 1; |