aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmapProcState_matrix_template.h
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2016-01-04 10:28:11 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-04 10:28:11 -0800
commitb3a835891cf221bdf4c6eeb4cf404b374955015f (patch)
tree13a52c1b1e6268330790b2e70c46cf991ac5f031 /src/core/SkBitmapProcState_matrix_template.h
parent0152cc3819291841298013d2b5515a61e974e41f (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_template.h')
-rw-r--r--src/core/SkBitmapProcState_matrix_template.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/core/SkBitmapProcState_matrix_template.h b/src/core/SkBitmapProcState_matrix_template.h
index 468013c30d..82fdddbece 100644
--- a/src/core/SkBitmapProcState_matrix_template.h
+++ b/src/core/SkBitmapProcState_matrix_template.h
@@ -22,13 +22,10 @@ void NoFilterProc_Scale(const SkBitmapProcState& s, uint32_t xy[],
const unsigned maxX = s.fPixmap.width() - 1;
SkFractionalInt fx;
{
- SkPoint pt;
- s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf,
- SkIntToScalar(y) + SK_ScalarHalf, &pt);
- fx = SkScalarToFractionalInt(pt.fY);
+ const SkBitmapProcStateAutoMapper mapper(s, x, y);
const unsigned maxY = s.fPixmap.height() - 1;
- *xy++ = TileProc::Y(s, SkFractionalIntToFixed(fx), maxY);
- fx = SkScalarToFractionalInt(pt.fX);
+ *xy++ = TileProc::Y(s, SkFractionalIntToFixed(mapper.y()), maxY);
+ fx = mapper.x();
}
if (0 == maxX) {
@@ -80,13 +77,10 @@ void NoFilterProc_Affine(const SkBitmapProcState& s, uint32_t xy[],
SkMatrix::kScale_Mask |
SkMatrix::kAffine_Mask)) == 0);
- SkPoint srcPt;
- s.fInvProc(s.fInvMatrix,
- SkIntToScalar(x) + SK_ScalarHalf,
- SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
+ const SkBitmapProcStateAutoMapper mapper(s, x, y);
- SkFractionalInt fx = SkScalarToFractionalInt(srcPt.fX);
- SkFractionalInt fy = SkScalarToFractionalInt(srcPt.fY);
+ SkFractionalInt fx = mapper.x();
+ SkFractionalInt fy = mapper.y();
SkFractionalInt dx = s.fInvSxFractionalInt;
SkFractionalInt dy = s.fInvKyFractionalInt;
int maxX = s.fPixmap.width() - 1;