diff options
author | 2016-06-06 13:10:58 -0700 | |
---|---|---|
committer | 2016-06-06 13:10:58 -0700 | |
commit | 982eb7f377a0c771345276558072deb2fcea0d3e (patch) | |
tree | 02ae878610160d6b6c91629424aaf895e5f17497 /src/core/SkLightingShader.cpp | |
parent | dc27a648d2ff23b2e96232c00c15976c46e1d48d (diff) |
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
Diffstat (limited to 'src/core/SkLightingShader.cpp')
-rw-r--r-- | src/core/SkLightingShader.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp index d011712fea..542d0f3e67 100644 --- a/src/core/SkLightingShader.cpp +++ b/src/core/SkLightingShader.cpp @@ -75,7 +75,8 @@ public: const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM, const SkMatrix* localMatrix, - SkFilterQuality) const override; + SkFilterQuality, + SkSourceGammaTreatment) const override; #endif class LightingShaderContext : public SkShader::Context { @@ -350,10 +351,11 @@ static bool make_mat(const SkBitmap& bm, } const GrFragmentProcessor* SkLightingShaderImpl::asFragmentProcessor( - GrContext* context, - const SkMatrix& viewM, - const SkMatrix* localMatrix, - SkFilterQuality filterQuality) const { + GrContext* context, + const SkMatrix& viewM, + const SkMatrix* localMatrix, + SkFilterQuality filterQuality, + SkSourceGammaTreatment gammaTreatment) const { // we assume diffuse and normal maps have same width and height // TODO: support different sizes SkASSERT(fDiffuseMap.width() == fNormalMap.width() && @@ -386,7 +388,8 @@ const GrFragmentProcessor* SkLightingShaderImpl::asFragmentProcessor( // TODO: support other tile modes GrTextureParams diffParams(kClamp_TileMode, diffFilterMode); SkAutoTUnref<GrTexture> diffuseTexture(GrRefCachedBitmapTexture(context, - fDiffuseMap, diffParams)); + fDiffuseMap, diffParams, + gammaTreatment)); if (!diffuseTexture) { SkErrorInternals::SetError(kInternalError_SkError, "Couldn't convert bitmap to texture."); return nullptr; @@ -394,7 +397,8 @@ const GrFragmentProcessor* SkLightingShaderImpl::asFragmentProcessor( GrTextureParams normParams(kClamp_TileMode, normFilterMode); SkAutoTUnref<GrTexture> normalTexture(GrRefCachedBitmapTexture(context, - fNormalMap, normParams)); + fNormalMap, normParams, + gammaTreatment)); if (!normalTexture) { SkErrorInternals::SetError(kInternalError_SkError, "Couldn't convert bitmap to texture."); return nullptr; |