Index: include/gpu/GrTextureParams.h |
diff --git a/include/gpu/GrTextureParams.h b/include/gpu/GrTextureParams.h |
index 3186b1b027186b29df31361e7fd80eb6055d52f8..40d9ac5375049327d66f5513c9a3927de4aaeb8e 100644 |
--- a/include/gpu/GrTextureParams.h |
+++ b/include/gpu/GrTextureParams.h |
@@ -24,6 +24,11 @@ public: |
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(); |
@@ -35,10 +40,19 @@ public: |
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); |
} |
@@ -51,6 +65,7 @@ public: |
fTileModes[0] = params.fTileModes[0]; |
fTileModes[1] = params.fTileModes[1]; |
fFilterMode = params.fFilterMode; |
+ fSRGBMode = params.fSRGBMode; |
return *this; |
} |
@@ -61,12 +76,20 @@ public: |
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() { |
@@ -84,6 +107,8 @@ public: |
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]; } |
@@ -95,10 +120,13 @@ public: |
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; |
+ fFilterMode == other.fFilterMode && |
+ fSRGBMode == other.fSRGBMode; |
} |
bool operator!= (const GrTextureParams& other) const { return !(*this == other); } |
@@ -106,5 +134,6 @@ public: |
private: |
SkShader::TileMode fTileModes[2]; |
FilterMode fFilterMode; |
+ SRGBMode fSRGBMode; |
}; |
#endif |