1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibPDF: Use mix() in SampledFunction::evaluate()

No behavior change.
This commit is contained in:
Nico Weber 2023-11-23 21:09:44 -05:00 committed by Jelle Raaijmakers
parent 5d14691149
commit f157cd50a1

View file

@ -185,7 +185,7 @@ PDFErrorOr<ReadonlySpan<float>> SampledFunction::evaluate(ReadonlySpan<float> xs
return Error { Error::Type::RenderingUnsupported, "Sample function with bits per sample != 8 not yet implemented" }; return Error { Error::Type::RenderingUnsupported, "Sample function with bits per sample != 8 not yet implemented" };
auto interpolate = [](float x, float x_min, float x_max, float y_min, float y_max) { auto interpolate = [](float x, float x_min, float x_max, float y_min, float y_max) {
return y_min + (x - x_min) * (y_max - y_min) / (x_max - x_min); return mix(y_min, y_max, (x - x_min) / (x_max - x_min));
}; };
for (size_t i = 0; i < m_domain.size(); ++i) { for (size_t i = 0; i < m_domain.size(); ++i) {