mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +00:00
LibPDF: For multi-output SampledFunctions, fix output colors
For N outputs, the outputs aren't stored in N independent planes. Instead, N output values are stored right next to each other in the stream data.
This commit is contained in:
parent
ec739460e0
commit
a9ef65e64a
2 changed files with 4 additions and 4 deletions
|
@ -178,10 +178,10 @@ PDFErrorOr<ReadonlySpan<float>> SampledFunction::evaluate(ReadonlySpan<float> x)
|
|||
else
|
||||
e0 = e1 - 1.0f;
|
||||
}
|
||||
size_t plane_size = m_sizes[0];
|
||||
size_t plane_size = m_range.size();
|
||||
for (size_t i = 0; i < m_range.size(); ++i) {
|
||||
float s0 = m_sample_data[(size_t)e0 + i * plane_size];
|
||||
float s1 = m_sample_data[(size_t)e1 + i * plane_size];
|
||||
float s0 = m_sample_data[(size_t)e0 * plane_size + i];
|
||||
float s1 = m_sample_data[(size_t)e1 * plane_size + i];
|
||||
float r0 = interpolate(ec, e0, e1, s0, s1);
|
||||
r0 = interpolate(r0, 0.0f, 255.0f, m_decode[i].lower, m_decode[i].upper);
|
||||
m_outputs[i] = clamp(r0, m_range[i].lower, m_range[i].upper);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue