Remove sRGB overrides on GrTextureParams. Use GrPaint flags instead.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2002253002

Review-Url: https://codereview.chromium.org/2002253002
diff --git a/include/gpu/GrTextureParams.h b/include/gpu/GrTextureParams.h
index 40d9ac5..3186b1b 100644
--- a/include/gpu/GrTextureParams.h
+++ b/include/gpu/GrTextureParams.h
@@ -24,11 +24,6 @@
         static const GrTextureParams gParams(SkShader::kClamp_TileMode, kBilerp_FilterMode);
         return gParams;
     }
-    static const GrTextureParams& ClampNoFilterForceAllowSRGB() {
-        static const GrTextureParams gParams(SkShader::kClamp_TileMode, kNone_FilterMode,
-                                             kForceAllowSRGB_SRGBMode);
-        return gParams;
-    }
 
     GrTextureParams() {
         this->reset();
@@ -40,19 +35,10 @@
         kMipMap_FilterMode
     };
 
-    enum SRGBMode {
-        kRespectDestination_SRGBMode,
-        kForceAllowSRGB_SRGBMode,
-    };
-
     GrTextureParams(SkShader::TileMode tileXAndY, FilterMode filterMode) {
         this->reset(tileXAndY, filterMode);
     }
 
-    GrTextureParams(SkShader::TileMode tileXandY, FilterMode filterMode, SRGBMode srgbMode) {
-        this->reset(tileXandY, filterMode, srgbMode);
-    }
-
     GrTextureParams(const SkShader::TileMode tileModes[2], FilterMode filterMode) {
         this->reset(tileModes, filterMode);
     }
@@ -65,7 +51,6 @@
         fTileModes[0] = params.fTileModes[0];
         fTileModes[1] = params.fTileModes[1];
         fFilterMode = params.fFilterMode;
-        fSRGBMode = params.fSRGBMode;
         return *this;
     }
 
@@ -76,20 +61,12 @@
     void reset(SkShader::TileMode tileXAndY, FilterMode filterMode) {
         fTileModes[0] = fTileModes[1] = tileXAndY;
         fFilterMode = filterMode;
-        fSRGBMode = kRespectDestination_SRGBMode;
-    }
-
-    void reset(SkShader::TileMode tileXandY, FilterMode filterMode, SRGBMode srgbMode) {
-        fTileModes[0] = fTileModes[1] = tileXandY;
-        fFilterMode = filterMode;
-        fSRGBMode = srgbMode;
     }
 
     void reset(const SkShader::TileMode tileModes[2], FilterMode filterMode) {
         fTileModes[0] = tileModes[0];
         fTileModes[1] = tileModes[1];
         fFilterMode = filterMode;
-        fSRGBMode = kRespectDestination_SRGBMode;
     }
 
     void setClampNoFilter() {
@@ -107,8 +84,6 @@
     void setTileModeY(const SkShader::TileMode tm) { fTileModes[1] = tm; }
     void setTileModeXAndY(const SkShader::TileMode tm) { fTileModes[0] = fTileModes[1] = tm; }
 
-    void setSRGBMode(SRGBMode srgbMode) { fSRGBMode = srgbMode; }
-
     SkShader::TileMode getTileModeX() const { return fTileModes[0]; }
 
     SkShader::TileMode getTileModeY() const { return fTileModes[1]; }
@@ -120,13 +95,10 @@
 
     FilterMode filterMode() const { return fFilterMode; }
 
-    SRGBMode srgbMode() const { return fSRGBMode; }
-
     bool operator== (const GrTextureParams& other) const {
         return fTileModes[0] == other.fTileModes[0] &&
                fTileModes[1] == other.fTileModes[1] &&
-               fFilterMode == other.fFilterMode &&
-               fSRGBMode == other.fSRGBMode;
+               fFilterMode == other.fFilterMode;
     }
 
     bool operator!= (const GrTextureParams& other) const { return !(*this == other); }
@@ -134,6 +106,5 @@
 private:
     SkShader::TileMode fTileModes[2];
     FilterMode         fFilterMode;
-    SRGBMode           fSRGBMode;
 };
 #endif
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 04fabaa..51ab64d 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -367,11 +367,10 @@
             if (!drawContext) {
                 return false;
             }
-            // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we don't need the
-            // per-texture override in config conversion effect?)
             GrPaint paint;
             paint.addColorFragmentProcessor(fp);
             paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
+            paint.setAllowSRGBInputs(true);
             SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
             drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr);
 
@@ -479,11 +478,10 @@
                     GrConfigConversionEffect::kNone_PMConversion, textureMatrix));
             }
             if (fp) {
-                // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we don't need the
-                // per-texture override in config conversion effect?)
                 GrPaint paint;
                 paint.addColorFragmentProcessor(fp);
                 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
+                paint.setAllowSRGBInputs(true);
                 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
                 sk_sp<GrDrawContext> drawContext(
                                             this->drawContext(sk_ref_sp(temp->asRenderTarget())));
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 99a4884..9791cb4 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -98,7 +98,7 @@
                                                    const GrSwizzle& swizzle,
                                                    PMConversion pmConversion,
                                                    const SkMatrix& matrix)
-    : INHERITED(texture, matrix, GrTextureParams::ClampNoFilterForceAllowSRGB())
+    : INHERITED(texture, matrix)
     , fSwizzle(swizzle)
     , fPMConversion(pmConversion) {
     this->initClassID<GrConfigConversionEffect>();
@@ -296,8 +296,7 @@
         // If we returned a GrConfigConversionEffect that was equivalent to a GrSimpleTextureEffect
         // then we may pollute our texture cache with redundant shaders. So in the case that no
         // conversions were requested we instead return a GrSimpleTextureEffect.
-        return GrSimpleTextureEffect::Create(texture, matrix,
-                                             GrTextureParams::ClampNoFilterForceAllowSRGB());
+        return GrSimpleTextureEffect::Create(texture, matrix);
     } else {
         if (kRGBA_8888_GrPixelConfig != texture->config() &&
             kBGRA_8888_GrPixelConfig != texture->config() &&
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 6b03df3..6daf955 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -3101,7 +3101,7 @@
     }
 }
 
-void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool dstConfigAllowsSRGB,
+void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBInputs,
                           GrGLTexture* texture) {
     SkASSERT(texture);
 
@@ -3141,9 +3141,7 @@
     if (this->caps()->srgbSupport()) {
         // By default, the decision to allow SRGB decode is based on the destination config.
         // A texture can override that by specifying a value in GrTextureParams.
-        newTexParams.fSRGBDecode =
-            (dstConfigAllowsSRGB || GrTextureParams::kForceAllowSRGB_SRGBMode == params.srgbMode())
-            ? GR_GL_DECODE_EXT : GR_GL_SKIP_DECODE_EXT;
+        newTexParams.fSRGBDecode = allowSRGBInputs ? GR_GL_DECODE_EXT : GR_GL_SKIP_DECODE_EXT;
 
         if (setAll || newTexParams.fSRGBDecode != oldTexParams.fSRGBDecode) {
             this->setTextureUnit(unitIdx);
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index d6af679..0b2198a 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -57,7 +57,7 @@
     void discard(GrRenderTarget*) override;
 
     // Used by GrGLProgram to configure OpenGL state.
-    void bindTexture(int unitIdx, const GrTextureParams& params, bool dstConfigAllowsSRGB,
+    void bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBInputs,
                      GrGLTexture* texture);
 
     void bindTexelBuffer(int unitIdx, intptr_t offsetInBytes, GrPixelConfig, GrGLBuffer*);