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

Unified Diff: src/gpu/GrCoordTransform.cpp

Issue 787873002: Use threshold of 1 texture coord value per pixel w/ nearest neighbor. (Closed) Base URL: https://skia.googlesource.com/skia.git@matrix_prec
Patch Set: update comments Created 6 years 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 | « src/effects/gradients/SkGradientShader.cpp ('k') | src/gpu/effects/GrSingleTextureEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | src/gpu/effects/GrSingleTextureEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698