Add new SkSourceGammaTreatment enum, used in situations like mipmap construction, where we need to know if we should respect (vs. ignore) the gamma encoding of sRGB tagged images. Plumb that extensively.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2037413002
Review-Url: https://codereview.chromium.org/2037413002
diff --git a/src/gpu/GrImageIDTextureAdjuster.cpp b/src/gpu/GrImageIDTextureAdjuster.cpp
index 21c2f33..4ff3ed5 100644
--- a/src/gpu/GrImageIDTextureAdjuster.cpp
+++ b/src/gpu/GrImageIDTextureAdjuster.cpp
@@ -81,7 +81,8 @@
}
}
-GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped) {
+GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped,
+ SkSourceGammaTreatment gammaTreatment) {
GrTexture* tex = nullptr;
if (fOriginalKey.isValid()) {
@@ -91,7 +92,7 @@
}
}
if (willBeMipped) {
- tex = GrGenerateMipMapsAndUploadToTexture(this->context(), fBitmap);
+ tex = GrGenerateMipMapsAndUploadToTexture(this->context(), fBitmap, gammaTreatment);
}
if (!tex) {
tex = GrUploadBitmapToTexture(this->context(), fBitmap);
@@ -130,8 +131,10 @@
}
}
-GrTexture* GrImageTextureMaker::refOriginalTexture(bool willBeMipped) {
- return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCachingHint, willBeMipped);
+GrTexture* GrImageTextureMaker::refOriginalTexture(bool willBeMipped,
+ SkSourceGammaTreatment gammaTreatment) {
+ return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCachingHint, willBeMipped,
+ gammaTreatment);
}
void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) {