aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmapProcState_matrix_template.h
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2015-12-18 07:59:47 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-18 07:59:47 -0800
commit5ae7fdcc3d7712da3193c39a751e88b092aa82db (patch)
tree85ac81312e756d57b45759feacc33e390ae7666c /src/core/SkBitmapProcState_matrix_template.h
parenta11e5fce33f8d6f38c3324d639ca76ddf12598ba (diff)
Repeating SkBitmapProcState rounding bias
Observe the bias in repeat matrix procs also. Introduce a utility class to handle device space -> bitmap space mapping. BUG=skia:4680,skia:4649 R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1529833003 Review URL: https://codereview.chromium.org/1529833003
Diffstat (limited to 'src/core/SkBitmapProcState_matrix_template.h')
-rw-r--r--src/core/SkBitmapProcState_matrix_template.h20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/core/SkBitmapProcState_matrix_template.h b/src/core/SkBitmapProcState_matrix_template.h
index 468013c30d..9d639b8a04 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, mapper.y(), maxY);
+ fx = SkFixedToFractionalInt(mapper.x());
}
if (0 == maxX) {
@@ -80,13 +77,9 @@ 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);
-
- SkFractionalInt fx = SkScalarToFractionalInt(srcPt.fX);
- SkFractionalInt fy = SkScalarToFractionalInt(srcPt.fY);
+ const SkBitmapProcStateAutoMapper mapper(s, x ,y);
+ SkFractionalInt fx = SkFixedToFractionalInt(mapper.x());
+ SkFractionalInt fy = SkFixedToFractionalInt(mapper.y());
SkFractionalInt dx = s.fInvSxFractionalInt;
SkFractionalInt dy = s.fInvKyFractionalInt;
int maxX = s.fPixmap.width() - 1;
@@ -107,6 +100,7 @@ void NoFilterProc_Persp(const SkBitmapProcState& s, uint32_t* SK_RESTRICT xy,
int maxX = s.fPixmap.width() - 1;
int maxY = s.fPixmap.height() - 1;
+ // TODO: inv bias support
SkPerspIter iter(s.fInvMatrix,
SkIntToScalar(x) + SK_ScalarHalf,
SkIntToScalar(y) + SK_ScalarHalf, count);