Revert "remove bicubic clamp in SkImageShader"

This reverts commit bc9f3499c3.

Reason for revert: gotta be the reason for layout test issues.

Original change's description:
> remove bicubic clamp in SkImageShader
> 
> We ought to be able to handle out-of-gamut colors now, whatever
> their provenance.  Should be we can just not clamp here.
> 
> Bug: skia:5733
> 
> Change-Id: Icd9851543638fd81755afee2eac2347702b88e9f
> Reviewed-on: https://skia-review.googlesource.com/87000
> Commit-Queue: Mike Klein <mtklein@chromium.org>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=mtklein@chromium.org,brianosman@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: skia:5733
Change-Id: I3bccf494479b845210ee2a6824dcc32b89a93312
Reviewed-on: https://skia-review.googlesource.com/88423
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-12-21 14:53:13 +00:00
parent 9838b49b2e
commit 6685555efc
2 changed files with 4 additions and 2 deletions

View File

@ -251,6 +251,10 @@ bool SkPixmap::scalePixels(const SkPixmap& dst, SkFilterQuality quality) const {
// Trick: if src and dst are both unpremul, we can give the correct result if we change both
// to premul (or opaque), since the draw will not try to blend or otherwise interpret
// the pixels' alpha.
//
// Today this works except in kHigh_SkFilterQuality, where we incorrectly clamp assuming the
// colors are premul. TODO: fix the HQ mode.
//
if (srcPtr->alphaType() == kUnpremul_SkAlphaType &&
dstPtr->alphaType() == kUnpremul_SkAlphaType)
{

View File

@ -407,13 +407,11 @@ bool SkImageShader::onAppendStages(const StageRec& rec) const {
if (info.colorType() == kAlpha_8_SkColorType || info.alphaType() == kUnpremul_SkAlphaType) {
p->append(SkRasterPipeline::premul);
}
#if defined(SK_LEGACY_HIGH_QUALITY_SCALING_CLAMP)
if (quality > kLow_SkFilterQuality) {
// Bicubic filtering naturally produces out of range values on both sides.
p->append(SkRasterPipeline::clamp_0);
p->append(SkRasterPipeline::clamp_a);
}
#endif
append_gamut_transform(p, alloc, info.colorSpace(), rec.fDstCS, kPremul_SkAlphaType);
return true;
}