aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Hans Wennborg <hans@chromium.org>2017-12-08 18:56:23 -0800
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-09 04:28:39 +0000
commitc63ec5ca64074dcc264a43bd1c1fdfb26e009410 (patch)
tree8a3993a3c9356f949a35d5ea9901a530417b5399 /src/gpu
parent25eef6b342a007f76802950a683b4a339761c42e (diff)
Fix tautological comparison in GrTextureDomain.cpp
-1 is not a valid value for the GrTextureDomain::Mode enum, so certain versions of Clang warn that the comparison is a no-op: ../../third_party/skia/src/gpu/effects/GrTextureDomain.cpp:70:23: warning: comparison of constant -1 with expression of type 'GrTextureDomain::Mode' is always false [-Wtautological-constant-out-of-range-compare] SkASSERT((Mode)-1 == fMode || textureDomain.mode() == fMode); ~~~~~~~~ ^ ~~~~~ Bug: chromium:793189 Change-Id: Iba49ae15622285a62ad218dbdd78b0846338b7cb Reviewed-on: https://skia-review.googlesource.com/82962 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/effects/GrTextureDomain.cpp5
-rw-r--r--src/gpu/effects/GrTextureDomain.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index e1da72135d..02746cfd45 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -67,8 +67,9 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
const SkString& inCoords,
GrGLSLFragmentProcessor::SamplerHandle sampler,
const char* inModulateColor) {
- SkASSERT((Mode)-1 == fMode || textureDomain.mode() == fMode);
+ SkASSERT(!fHasMode || textureDomain.mode() == fMode);
SkDEBUGCODE(fMode = textureDomain.mode();)
+ SkDEBUGCODE(fHasMode = true;)
if (textureDomain.mode() != kIgnore_Mode && !fDomainUni.isValid()) {
const char* name;
@@ -160,7 +161,7 @@ void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
const GrTextureDomain& textureDomain,
GrSurfaceProxy* proxy) {
GrTexture* tex = proxy->priv().peekTexture();
- SkASSERT(textureDomain.mode() == fMode);
+ SkASSERT(fHasMode && textureDomain.mode() == fMode);
if (kIgnore_Mode != textureDomain.mode()) {
SkScalar wInv = SK_Scalar1 / tex->width();
SkScalar hInv = SK_Scalar1 / tex->height();
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index 166ae2b2b7..048c8dc3f2 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -89,7 +89,6 @@ public:
for (int i = 0; i < kPrevDomainCount; i++) {
fPrevDomain[i] = SK_FloatNaN;
}
- SkDEBUGCODE(fMode = (Mode) -1;)
}
/**
@@ -134,6 +133,7 @@ public:
private:
static const int kPrevDomainCount = 4;
SkDEBUGCODE(Mode fMode;)
+ SkDEBUGCODE(bool fHasMode = false;)
GrGLSLProgramDataManager::UniformHandle fDomainUni;
SkString fDomainName;
float fPrevDomain[kPrevDomainCount];