Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Unified Diff: src/core/SkBitmapProcState.cpp

Issue 1656833002: Sampler bias for all nofilter flavors (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkBitmapProcState_matrixProcs.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcState.cpp
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 163bc88aff80907c490f171ecc3a3cecd547bfa1..f62f4f0c6d7e4a24247643b9ff03888643f866fc 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -492,21 +492,17 @@ static void S32_D32_constX_shaderproc(const void* sIn,
int yTemp;
if (s.fInvType > SkMatrix::kTranslate_Mask) {
- // TODO(fmalita): looks like another SkBitmapProcStateAutoMapper customer
- SkPoint pt;
- s.fInvProc(s.fInvMatrix,
- SkIntToScalar(x) + SK_ScalarHalf,
- SkIntToScalar(y) + SK_ScalarHalf,
- &pt);
+ const SkBitmapProcStateAutoMapper mapper(s, x, y);
+
// When the matrix has a scale component the setup code in
// chooseProcs multiples the inverse matrix by the inverse of the
// bitmap's width and height. Since this method is going to do
// its own tiling and sampling we need to undo that here.
if (SkShader::kClamp_TileMode != s.fTileModeX ||
SkShader::kClamp_TileMode != s.fTileModeY) {
- yTemp = SkScalarFloorToInt(pt.fY * s.fPixmap.height());
+ yTemp = SkFractionalIntToInt(mapper.y() * s.fPixmap.height());
} else {
- yTemp = SkScalarFloorToInt(pt.fY);
+ yTemp = SkFractionalIntToInt(mapper.y());
}
} else {
yTemp = s.fFilterOneY + y;
@@ -528,20 +524,14 @@ static void S32_D32_constX_shaderproc(const void* sIn,
#ifdef SK_DEBUG
{
+ const SkBitmapProcStateAutoMapper mapper(s, x, y);
int iY2;
- if (s.fInvType > SkMatrix::kTranslate_Mask) {
- SkPoint pt;
- s.fInvProc(s.fInvMatrix,
- SkIntToScalar(x) + SK_ScalarHalf,
- SkIntToScalar(y) + SK_ScalarHalf,
- &pt);
- if (SkShader::kClamp_TileMode != s.fTileModeX ||
- SkShader::kClamp_TileMode != s.fTileModeY) {
- pt.fY *= s.fPixmap.height();
- }
- iY2 = SkScalarFloorToInt(pt.fY);
+
+ if (s.fInvType > SkMatrix::kTranslate_Mask &&
+ (SkShader::kClamp_TileMode != s.fTileModeX ||
+ SkShader::kClamp_TileMode != s.fTileModeY)) {
+ iY2 = SkFractionalIntToInt(mapper.y() * s.fPixmap.height());
} else {
- const SkBitmapProcStateAutoMapper mapper(s, x, y);
iY2 = SkFractionalIntToInt(mapper.y());
}
« no previous file with comments | « no previous file | src/core/SkBitmapProcState_matrixProcs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698