Revert "update SkToSRGBColorFilter color management"
This reverts commit 8b5092671b
.
Reason for revert: Test if this broke Android roll
Original change's description:
> update SkToSRGBColorFilter color management
>
> Change-Id: Ia4a8bbc9d983bb5cfa02ba62c922efa1fa879d9b
> Reviewed-on: https://skia-review.googlesource.com/141054
> Commit-Queue: Mike Klein <mtklein@chromium.org>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=mtklein@chromium.org,brianosman@google.com
Change-Id: Ib34bc4375447fe88a80d9b6d19dae87c4c41d0d5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/141180
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
ebd37e2af4
commit
bc8133b4ad
@ -5,7 +5,6 @@
|
|||||||
* found in the LICENSE file.
|
* found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SkColorSpaceXformSteps.h"
|
|
||||||
#include "SkPM4fPriv.h"
|
#include "SkPM4fPriv.h"
|
||||||
#include "SkRasterPipeline.h"
|
#include "SkRasterPipeline.h"
|
||||||
#include "SkReadBuffer.h"
|
#include "SkReadBuffer.h"
|
||||||
@ -21,9 +20,30 @@ void SkToSRGBColorFilter::onAppendStages(SkRasterPipeline* p,
|
|||||||
SkColorSpace* /*dst color space*/,
|
SkColorSpace* /*dst color space*/,
|
||||||
SkArenaAlloc* alloc,
|
SkArenaAlloc* alloc,
|
||||||
bool shaderIsOpaque) const {
|
bool shaderIsOpaque) const {
|
||||||
alloc->make<SkColorSpaceXformSteps>(fSrcColorSpace.get(), kPremul_SkAlphaType,
|
// Step 1: Linearize by undoing the src transfer function.
|
||||||
SkColorSpace::MakeSRGB().get())
|
// Linear and sRGB will return true to isNumericalTransferFn(), so we check them first.
|
||||||
->apply(p);
|
SkColorSpaceTransferFn srcFn;
|
||||||
|
if (fSrcColorSpace->gammaIsLinear()) {
|
||||||
|
// Nothing to do.
|
||||||
|
} else if (fSrcColorSpace->gammaCloseToSRGB()) {
|
||||||
|
p->append(SkRasterPipeline::from_srgb);
|
||||||
|
} else if (fSrcColorSpace->isNumericalTransferFn(&srcFn)) {
|
||||||
|
auto copy = alloc->make<SkColorSpaceTransferFn>(srcFn);
|
||||||
|
p->append(SkRasterPipeline::parametric, copy);
|
||||||
|
} else {
|
||||||
|
SkDEBUGFAIL("Looks like we got a table transfer function here, quite unexpectedly.");
|
||||||
|
// TODO: If we really need to handle this, we can, but I don't think Ganesh does.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: Transform to sRGB gamut (without clamping).
|
||||||
|
append_gamut_transform(p,
|
||||||
|
alloc,
|
||||||
|
fSrcColorSpace.get(),
|
||||||
|
SkColorSpace::MakeSRGB().get(),
|
||||||
|
kPremul_SkAlphaType);
|
||||||
|
|
||||||
|
// Step 3: Back to sRGB encoding.
|
||||||
|
p->append(SkRasterPipeline::to_srgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<SkColorFilter> SkToSRGBColorFilter::Make(sk_sp<SkColorSpace> srcColorSpace) {
|
sk_sp<SkColorFilter> SkToSRGBColorFilter::Make(sk_sp<SkColorSpace> srcColorSpace) {
|
||||||
|
Loading…
Reference in New Issue
Block a user