aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-06-06 13:10:58 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-06 13:10:58 -0700
commit982eb7f377a0c771345276558072deb2fcea0d3e (patch)
tree02ae878610160d6b6c91629424aaf895e5f17497 /experimental
parentdc27a648d2ff23b2e96232c00c15976c46e1d48d (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.
Diffstat (limited to 'experimental')
-rw-r--r--experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp15
-rw-r--r--experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.h3
2 files changed, 10 insertions, 8 deletions
diff --git a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
index 42211e4d7b..ab0c46c350 100644
--- a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
+++ b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
@@ -729,7 +729,7 @@ const GrFragmentProcessor* GrPerlinNoise2Effect::TestCreate(GrProcessorTestData*
GrPaint grPaint;
return shader->asFragmentProcessor(d->fContext,
GrTest::TestMatrix(d->fRandom), nullptr,
- kNone_SkFilterQuality);
+ kNone_SkFilterQuality, SkSourceGammaTreatment::kRespect);
}
void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
@@ -1134,7 +1134,7 @@ const GrFragmentProcessor* GrImprovedPerlinNoiseEffect::TestCreate(GrProcessorTe
GrPaint grPaint;
return shader->asFragmentProcessor(d->fContext,
GrTest::TestMatrix(d->fRandom), nullptr,
- kNone_SkFilterQuality);
+ kNone_SkFilterQuality, SkSourceGammaTreatment::kRespect);
}
void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) {
@@ -1302,7 +1302,8 @@ const GrFragmentProcessor* SkPerlinNoiseShader2::asFragmentProcessor(
GrContext* context,
const SkMatrix& viewM,
const SkMatrix* externalLocalMatrix,
- SkFilterQuality) const {
+ SkFilterQuality,
+ SkSourceGammaTreatment gammaTreatment) const {
SkASSERT(context);
SkMatrix localMatrix = this->getLocalMatrix();
@@ -1328,10 +1329,10 @@ const GrFragmentProcessor* SkPerlinNoiseShader2::asFragmentProcessor(
GrTextureParams::FilterMode::kNone_FilterMode);
SkAutoTUnref<GrTexture> permutationsTexture(
GrRefCachedBitmapTexture(context, paintingData->getImprovedPermutationsBitmap(),
- textureParams));
+ textureParams, gammaTreatment));
SkAutoTUnref<GrTexture> gradientTexture(
GrRefCachedBitmapTexture(context, paintingData->getGradientBitmap(),
- textureParams));
+ textureParams, gammaTreatment));
return GrImprovedPerlinNoiseEffect::Create(fNumOctaves, fSeed, paintingData,
permutationsTexture, gradientTexture, m);
}
@@ -1350,10 +1351,10 @@ const GrFragmentProcessor* SkPerlinNoiseShader2::asFragmentProcessor(
SkAutoTUnref<GrTexture> permutationsTexture(
GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(),
- GrTextureParams::ClampNoFilter()));
+ GrTextureParams::ClampNoFilter(), gammaTreatment));
SkAutoTUnref<GrTexture> noiseTexture(
GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(),
- GrTextureParams::ClampNoFilter()));
+ GrTextureParams::ClampNoFilter(), gammaTreatment));
if ((permutationsTexture) && (noiseTexture)) {
SkAutoTUnref<GrFragmentProcessor> inner(
diff --git a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.h b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.h
index 8a51583673..e62458e88e 100644
--- a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.h
+++ b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.h
@@ -107,7 +107,8 @@ public:
#if SK_SUPPORT_GPU
const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkMatrix& viewM,
- const SkMatrix*, SkFilterQuality) const override;
+ const SkMatrix*, SkFilterQuality,
+ SkSourceGammaTreatment) const override;
#endif
SK_TO_STRING_OVERRIDE()