aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmapProcState_matrix_template.h
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2015-12-18 09:36:18 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-18 09:36:18 -0800
commit3e6be16e6d4dda6a27f0e1dbfe7c87fecfbf5577 (patch)
treedc05783873039d000e7f126e1c5d7fc328907ecf /src/core/SkBitmapProcState_matrix_template.h
parent14d8fa0f58bf7f814901d2ae068af8814d6ed1a4 (diff)
Revert of Repeating SkBitmapProcState rounding bias (patchset #6 id:100001 of https://codereview.chromium.org/1529833003/ )
Reason for revert: We need a SkFractionalInt auto mapper flavor, otherwise we're losing precision for some procs => seaming artifacs (https://gold.skia.org/diff?test=giantbitmap_mirror_point_rotate&left=0dd7a412fce81586e6a142e039ec2de9&top=a706d4bb2b8e994b936445b87115b07e) Original issue's description: > 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 > > Committed: https://skia.googlesource.com/skia/+/5ae7fdcc3d7712da3193c39a751e88b092aa82db TBR=reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4680,skia:4649 Review URL: https://codereview.chromium.org/1531423003
Diffstat (limited to 'src/core/SkBitmapProcState_matrix_template.h')
-rw-r--r--src/core/SkBitmapProcState_matrix_template.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/core/SkBitmapProcState_matrix_template.h b/src/core/SkBitmapProcState_matrix_template.h
index 9d639b8a04..468013c30d 100644
--- a/src/core/SkBitmapProcState_matrix_template.h
+++ b/src/core/SkBitmapProcState_matrix_template.h
@@ -22,10 +22,13 @@ void NoFilterProc_Scale(const SkBitmapProcState& s, uint32_t xy[],
const unsigned maxX = s.fPixmap.width() - 1;
SkFractionalInt fx;
{
- const SkBitmapProcStateAutoMapper mapper(s, x ,y);
+ SkPoint pt;
+ s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf,
+ SkIntToScalar(y) + SK_ScalarHalf, &pt);
+ fx = SkScalarToFractionalInt(pt.fY);
const unsigned maxY = s.fPixmap.height() - 1;
- *xy++ = TileProc::Y(s, mapper.y(), maxY);
- fx = SkFixedToFractionalInt(mapper.x());
+ *xy++ = TileProc::Y(s, SkFractionalIntToFixed(fx), maxY);
+ fx = SkScalarToFractionalInt(pt.fX);
}
if (0 == maxX) {
@@ -77,9 +80,13 @@ void NoFilterProc_Affine(const SkBitmapProcState& s, uint32_t xy[],
SkMatrix::kScale_Mask |
SkMatrix::kAffine_Mask)) == 0);
- const SkBitmapProcStateAutoMapper mapper(s, x ,y);
- SkFractionalInt fx = SkFixedToFractionalInt(mapper.x());
- SkFractionalInt fy = SkFixedToFractionalInt(mapper.y());
+ 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);
SkFractionalInt dx = s.fInvSxFractionalInt;
SkFractionalInt dy = s.fInvKyFractionalInt;
int maxX = s.fPixmap.width() - 1;
@@ -100,7 +107,6 @@ 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);