Make sure to convert to sRGB in filter get_input

parent 97f118e6
Pipeline #45918 passed with stages
in 26 minutes and 59 seconds
......@@ -551,30 +551,30 @@ impl FilterContext {
) -> Result<FilterInput, FilterError> {
let raw = self.get_input_raw(draw_ctx, in_)?;
// Linearize the returned surface if needed.
if self.processing_linear_rgb {
let (surface, bounds) = match raw {
FilterInput::StandardInput(ref surface) => {
(surface, self.effects_region().rect.unwrap().into())
}
FilterInput::PrimitiveOutput(FilterOutput {
ref surface,
ref bounds,
}) => (surface, *bounds),
};
surface
.to_linear_rgb(bounds)
.map_err(FilterError::CairoError)
.map(|surface| match raw {
FilterInput::StandardInput(_) => FilterInput::StandardInput(surface),
FilterInput::PrimitiveOutput(ref output) => {
FilterInput::PrimitiveOutput(FilterOutput { surface, ..*output })
}
})
// Convert the input surface to the desired format.
let (surface, bounds) = match raw {
FilterInput::StandardInput(ref surface) => {
(surface, self.effects_region().rect.unwrap().into())
}
FilterInput::PrimitiveOutput(FilterOutput {
ref surface,
ref bounds,
}) => (surface, *bounds),
};
let surface = if self.processing_linear_rgb {
surface.to_linear_rgb(bounds)
} else {
Ok(raw)
}
surface.to_srgb(bounds)
};
surface
.map_err(FilterError::CairoError)
.map(|surface| match raw {
FilterInput::StandardInput(_) => FilterInput::StandardInput(surface),
FilterInput::PrimitiveOutput(ref output) => {
FilterInput::PrimitiveOutput(FilterOutput { surface, ..*output })
}
})
}
/// Calls the given closure with linear RGB processing enabled.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment