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 { ...@@ -551,30 +551,30 @@ impl FilterContext {
) -> Result<FilterInput, FilterError> { ) -> Result<FilterInput, FilterError> {
let raw = self.get_input_raw(draw_ctx, in_)?; let raw = self.get_input_raw(draw_ctx, in_)?;
// Linearize the returned surface if needed. // Convert the input surface to the desired format.
if self.processing_linear_rgb { let (surface, bounds) = match raw {
let (surface, bounds) = match raw { FilterInput::StandardInput(ref surface) => {
FilterInput::StandardInput(ref surface) => { (surface, self.effects_region().rect.unwrap().into())
(surface, self.effects_region().rect.unwrap().into()) }
} FilterInput::PrimitiveOutput(FilterOutput {
FilterInput::PrimitiveOutput(FilterOutput { ref surface,
ref surface, ref bounds,
ref bounds, }) => (surface, *bounds),
}) => (surface, *bounds), };
};
let surface = if self.processing_linear_rgb {
surface surface.to_linear_rgb(bounds)
.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 })
}
})
} else { } 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. /// 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