Index: src/gpu/GrCoordTransform.cpp |
diff --git a/src/gpu/GrCoordTransform.cpp b/src/gpu/GrCoordTransform.cpp |
index 5bb36fcf76a6fbf8f908398efcf8890a03179b17..a08d454badbfb912d80feb01cda53120ef3dc522 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) { |