Render an export into the colour space its file will claim
The colour-managed export branch left one call site deliberately unfixed, and this is it. `render_for_export` composed with the default sRGB shader, so a Display P3 export failed with an accurate error rather than producing a mislabelled file — the right way to leave a half-finished path, and no way to leave it. The space is chosen at render time because that is the only time it can be: the conversion happens in the shader, before the clip to 0..1, so by the time pixels reach an encoder they are in exactly one space and the only honest thing left is to label them. `Frame::in_space` carries which, and a mismatch between what was rendered and what was asked for stays a typed error. Also regenerates the traceability matrix over the four merged branches. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+13
-3
@@ -617,17 +617,27 @@ impl DevelopSession {
|
||||
/// Leaves the pass holding a full-resolution target, so the caller should
|
||||
/// expect the next display render to reallocate. Cheaper than keeping a
|
||||
/// second pass alive for the exports a session rarely performs.
|
||||
pub fn render_for_export(&mut self) -> Result<dr_export::Frame, String> {
|
||||
///
|
||||
/// `space` is the output colour space the file will claim. It is chosen
|
||||
/// here rather than at encode time because the conversion happens in the
|
||||
/// shader, before the clip to 0..1 — by the time pixels reach the encoder
|
||||
/// they are in exactly one space, and the only honest thing left to do is
|
||||
/// label them. Asking for the wrong one is a typed error rather than a
|
||||
/// mislabelled file (FR-EXP-2).
|
||||
pub fn render_for_export(
|
||||
&mut self,
|
||||
space: dr_types::ColourSpace,
|
||||
) -> Result<dr_export::Frame, String> {
|
||||
let (sw, sh) = self.demosaiced.size();
|
||||
let (w, h) = self.graph.output_size(sw, sh);
|
||||
|
||||
let shader = self.graph.compose();
|
||||
let shader = self.graph.compose_for(space);
|
||||
self.adjust
|
||||
.render(&self.demosaiced, &shader, w, h)
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let (pixels, rw, rh) = self.adjust.export_pixels().map_err(|e| e.to_string())?;
|
||||
dr_export::Frame::new(rw, rh, pixels).map_err(|e| e.to_string())
|
||||
dr_export::Frame::in_space(rw, rh, pixels, space).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// The sensor's own dimensions, before framing.
|
||||
|
||||
Reference in New Issue
Block a user