Only look at gamut_transform if we wrote to it.
If we're already in sRGB gamut, we will not write to the 3x4 matrix, but we still analyze it to see if we need clamping. So we might (harmlessly) re-clamp some already clamped colors unnecessarily. Found by this Chromium MSAN bot. Bug: chromium:789767 Change-Id: I5d76e59b541a03ee8efbd4352262b4f650e1ec01 Reviewed-on: https://skia-review.googlesource.com/79762 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
parent
8d1e67ed6b
commit
364c4c87c1
@ -40,15 +40,15 @@ void SkToSRGBColorFilter::onAppendStages(SkRasterPipeline* p,
|
||||
|
||||
// Step 2: Transform to sRGB gamut, without clamping.
|
||||
float* gamut_transform = alloc->makeArrayDefault<float>(12);
|
||||
(void)append_gamut_transform_noclamp(p,
|
||||
gamut_transform,
|
||||
fSrcColorSpace.get(),
|
||||
SkColorSpace::MakeSRGB().get());
|
||||
|
||||
bool needs_clamp_0, needs_clamp_1;
|
||||
analyze_3x4_matrix(gamut_transform, &needs_clamp_0, &needs_clamp_1);
|
||||
if (needs_clamp_0 || needs_clamp_1) {
|
||||
p->set_clamped(false);
|
||||
if (append_gamut_transform_noclamp(p,
|
||||
gamut_transform,
|
||||
fSrcColorSpace.get(),
|
||||
SkColorSpace::MakeSRGB().get())) {
|
||||
bool needs_clamp_0, needs_clamp_1;
|
||||
analyze_3x4_matrix(gamut_transform, &needs_clamp_0, &needs_clamp_1);
|
||||
if (needs_clamp_0 || needs_clamp_1) {
|
||||
p->set_clamped(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Step 3: Back to sRGB encoding.
|
||||
|
Loading…
Reference in New Issue
Block a user