diff options
author | brianosman <brianosman@google.com> | 2016-06-06 13:10:58 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-06 13:10:58 -0700 |
commit | 982eb7f377a0c771345276558072deb2fcea0d3e (patch) | |
tree | 02ae878610160d6b6c91629424aaf895e5f17497 /src/effects/gradients | |
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/effects/gradients')
-rw-r--r-- | src/effects/gradients/SkGradientShader.cpp | 3 | ||||
-rw-r--r-- | src/effects/gradients/SkLinearGradient.cpp | 6 | ||||
-rw-r--r-- | src/effects/gradients/SkLinearGradient.h | 3 | ||||
-rw-r--r-- | src/effects/gradients/SkRadialGradient.cpp | 6 | ||||
-rw-r--r-- | src/effects/gradients/SkRadialGradient.h | 3 | ||||
-rw-r--r-- | src/effects/gradients/SkSweepGradient.cpp | 6 | ||||
-rw-r--r-- | src/effects/gradients/SkSweepGradient.h | 3 | ||||
-rw-r--r-- | src/effects/gradients/SkTwoPointConicalGradient.cpp | 3 | ||||
-rw-r--r-- | src/effects/gradients/SkTwoPointConicalGradient.h | 3 | ||||
-rw-r--r-- | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp | 15 |
10 files changed, 34 insertions, 17 deletions
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index 3c4784702a..c64085c86a 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -1131,7 +1131,8 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx, fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), params.filterMode()); fTextureAccess.reset(fAtlas->getTexture(), params); } else { - SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap, params)); + SkAutoTUnref<GrTexture> texture( + GrRefCachedBitmapTexture(ctx, bitmap, params, SkSourceGammaTreatment::kRespect)); if (!texture) { return; } diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index 7752aac51d..cd55673dc9 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -418,7 +418,8 @@ const GrFragmentProcessor* GrLinearGradient::TestCreate(GrProcessorTestData* d) int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); auto shader = SkGradientShader::MakeLinear(points, colors, stops, colorCount, tm); const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, - GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); + GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, + SkSourceGammaTreatment::kRespect); GrAlwaysAssert(fp); return fp; } @@ -445,7 +446,8 @@ const GrFragmentProcessor* SkLinearGradient::asFragmentProcessor( GrContext* context, const SkMatrix& viewm, const SkMatrix* localMatrix, - SkFilterQuality) const { + SkFilterQuality, + SkSourceGammaTreatment) const { SkASSERT(context); SkMatrix matrix; diff --git a/src/effects/gradients/SkLinearGradient.h b/src/effects/gradients/SkLinearGradient.h index f0ce49b8b3..8edcb9d639 100644 --- a/src/effects/gradients/SkLinearGradient.h +++ b/src/effects/gradients/SkLinearGradient.h @@ -60,7 +60,8 @@ public: const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM, const SkMatrix*, - SkFilterQuality) const override; + SkFilterQuality, + SkSourceGammaTreatment) const override; #endif SK_TO_STRING_OVERRIDE() diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp index abd1f9e6cf..a0fee273d7 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -313,7 +313,8 @@ const GrFragmentProcessor* GrRadialGradient::TestCreate(GrProcessorTestData* d) int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); auto shader = SkGradientShader::MakeRadial(center, radius, colors, stops, colorCount, tm); const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, - GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); + GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, + SkSourceGammaTreatment::kRespect); GrAlwaysAssert(fp); return fp; } @@ -341,7 +342,8 @@ const GrFragmentProcessor* SkRadialGradient::asFragmentProcessor( GrContext* context, const SkMatrix& viewM, const SkMatrix* localMatrix, - SkFilterQuality) const { + SkFilterQuality, + SkSourceGammaTreatment) const { SkASSERT(context); SkMatrix matrix; diff --git a/src/effects/gradients/SkRadialGradient.h b/src/effects/gradients/SkRadialGradient.h index 6e41e7982e..8eb1f76832 100644 --- a/src/effects/gradients/SkRadialGradient.h +++ b/src/effects/gradients/SkRadialGradient.h @@ -29,7 +29,8 @@ public: const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM, const SkMatrix*, - SkFilterQuality) const override; + SkFilterQuality, + SkSourceGammaTreatment) const override; #endif SK_TO_STRING_OVERRIDE() diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp index 4d210ed41b..08232bccb3 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -193,7 +193,8 @@ const GrFragmentProcessor* GrSweepGradient::TestCreate(GrProcessorTestData* d) { colorCount)); const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, GrTest::TestMatrix(d->fRandom), - NULL, kNone_SkFilterQuality); + NULL, kNone_SkFilterQuality, + SkSourceGammaTreatment::kRespect); GrAlwaysAssert(fp); return fp; } @@ -230,7 +231,8 @@ const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor( GrContext* context, const SkMatrix& viewM, const SkMatrix* localMatrix, - SkFilterQuality) const { + SkFilterQuality, + SkSourceGammaTreatment) const { SkMatrix matrix; if (!this->getLocalMatrix().invert(&matrix)) { diff --git a/src/effects/gradients/SkSweepGradient.h b/src/effects/gradients/SkSweepGradient.h index de57335f4f..d0807daf23 100644 --- a/src/effects/gradients/SkSweepGradient.h +++ b/src/effects/gradients/SkSweepGradient.h @@ -30,7 +30,8 @@ public: const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM, const SkMatrix*, - SkFilterQuality) const override; + SkFilterQuality, + SkSourceGammaTreatment) const override; #endif SK_TO_STRING_OVERRIDE() diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp index f33dcc5a75..a7cdc7e1b4 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp @@ -360,7 +360,8 @@ const GrFragmentProcessor* SkTwoPointConicalGradient::asFragmentProcessor( GrContext* context, const SkMatrix& viewM, const SkMatrix* localMatrix, - SkFilterQuality) const { + SkFilterQuality, + SkSourceGammaTreatment) const { SkASSERT(context); SkASSERT(fPtsToUnit.isIdentity()); SkAutoTUnref<const GrFragmentProcessor> inner( diff --git a/src/effects/gradients/SkTwoPointConicalGradient.h b/src/effects/gradients/SkTwoPointConicalGradient.h index 309b66626f..b50a5e3a4e 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient.h +++ b/src/effects/gradients/SkTwoPointConicalGradient.h @@ -60,7 +60,8 @@ public: const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix&, const SkMatrix*, - SkFilterQuality) const override; + SkFilterQuality, + SkSourceGammaTreatment) const override; #endif bool isOpaque() const override; diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp index eb4fe0a5ed..e638982d0c 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp @@ -209,7 +209,8 @@ const GrFragmentProcessor* Edge2PtConicalEffect::TestCreate(GrProcessorTestData* auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2, colors, stops, colorCount, tm); const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, - GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); + GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, + SkSourceGammaTreatment::kRespect); GrAlwaysAssert(fp); return fp; } @@ -484,7 +485,8 @@ const GrFragmentProcessor* FocalOutside2PtConicalEffect::TestCreate(GrProcessorT auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2, colors, stops, colorCount, tm); const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, - GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); + GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, + SkSourceGammaTreatment::kRespect); GrAlwaysAssert(fp); return fp; } @@ -690,7 +692,8 @@ const GrFragmentProcessor* FocalInside2PtConicalEffect::TestCreate(GrProcessorTe auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2, colors, stops, colorCount, tm); const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, - GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); + GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, + SkSourceGammaTreatment::kRespect); GrAlwaysAssert(fp); return fp; } @@ -936,7 +939,8 @@ const GrFragmentProcessor* CircleInside2PtConicalEffect::TestCreate(GrProcessorT auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2, colors, stops, colorCount, tm); const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, - GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); + GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, + SkSourceGammaTreatment::kRespect); GrAlwaysAssert(fp); return fp; } @@ -1167,7 +1171,8 @@ const GrFragmentProcessor* CircleOutside2PtConicalEffect::TestCreate(GrProcessor auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2, colors, stops, colorCount, tm); const GrFragmentProcessor* fp = shader->asFragmentProcessor( - d->fContext,GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); + d->fContext,GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, + SkSourceGammaTreatment::kRespect); GrAlwaysAssert(fp); return fp; } |