mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-07 00:19:27 +00:00
LibPDF: Fix decoding of IndexedColorSpace for palette sizes != 255
Previously, we were scaling palette indices from 0..(palette_size - 1) to 0..255 before using them as index into the palette. Instead, do not scale palette indices before using them as indices. (Renderer::load_image() uses `component_value_decoders.empend( .0f, 255.0f, dmin, dmax)`, so to get an identity mapping, we have to return `0, 255` from IndexedColorSpace::default_decode()). Fixes rendering of the gradient on page 5 of 0000277.pdf.
This commit is contained in:
parent
e8960cf754
commit
8733ba2734
|
@ -701,7 +701,7 @@ PDFErrorOr<Color> IndexedColorSpace::color(ReadonlySpan<Value> arguments) const
|
|||
|
||||
Vector<float> IndexedColorSpace::default_decode() const
|
||||
{
|
||||
return { 0.0, static_cast<float>(m_hival) };
|
||||
return { 0.0, 255.0 };
|
||||
}
|
||||
|
||||
PDFErrorOr<NonnullRefPtr<SeparationColorSpace>> SeparationColorSpace::create(Document* document, Vector<Value>&& parameters)
|
||||
|
|
Loading…
Reference in a new issue