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

Unified Diff: include/gpu/GrTextureParams.h

Issue 1789663002: sRGB support in Ganesh. Several pieces: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Squelch assert when blurring sRGB Created 4 years, 9 months 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 | « include/gpu/GrColor.h ('k') | include/gpu/GrTypes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « include/gpu/GrColor.h ('k') | include/gpu/GrTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698