diff options
author | bsalomon <bsalomon@google.com> | 2014-12-09 10:51:07 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-09 10:51:07 -0800 |
commit | 9f876a37d8b80ef04ccbc7755cf4572aecc33981 (patch) | |
tree | f5754a1b3a5f830783831a4e4b8a5444ceef1d09 /src/gpu/GrCoordTransform.cpp | |
parent | 54a57f5cf1e702107fd5daf106eca3b2bedac173 (diff) |
Use threshold of 1 texture coord value per pixel w/ nearest neighbor.
Review URL: https://codereview.chromium.org/787873002
Diffstat (limited to 'src/gpu/GrCoordTransform.cpp')
-rw-r--r-- | src/gpu/GrCoordTransform.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gpu/GrCoordTransform.cpp b/src/gpu/GrCoordTransform.cpp index 5bb36fcf76..a08d454bad 100644 --- a/src/gpu/GrCoordTransform.cpp +++ b/src/gpu/GrCoordTransform.cpp @@ -10,7 +10,8 @@ #include "GrDrawTargetCaps.h" #include "GrGpu.h" -void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const GrTexture* texture) { +void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const GrTexture* texture, + GrTextureParams::FilterMode filter) { SkASSERT(texture); SkASSERT(!fInProcessor); @@ -20,8 +21,10 @@ void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const G // Always start at kDefault. Then if precisions differ we see if the precision needs to be // increased. Our rule is that we want at least 4 subpixel values in the representation for - // coords between 0 to 1. Note that this still might not be enough when drawing with repeat - // or mirror-repeat modes but that case can be arbitrarily bad. + // coords between 0 to 1 when bi- or tri-lerping and 1 value when nearest filtering. Note that + // this still might not be enough when drawing with repeat or mirror-repeat modes but that case + // can be arbitrarily bad. + int subPixelThresh = filter > GrTextureParams::kNone_FilterMode ? 4 : 1; fPrecision = kDefault_GrSLPrecision; if (texture->getContext()) { const GrDrawTargetCaps* caps = texture->getContext()->getGpu()->caps(); @@ -33,7 +36,7 @@ void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const G SkASSERT(info->supported()); // Make sure there is at least 2 bits of subpixel precision in the range of // texture coords from 0.5 to 1.0. - if ((2 << info->fBits) / maxD > 4) { + if ((2 << info->fBits) / maxD > subPixelThresh) { break; } if (kHigh_GrSLPrecision == fPrecision) { |