mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-28 20:16:52 -06:00
Refactor export for strict Clippy checks
This commit is contained in:
@@ -270,7 +270,7 @@ async fn sequence(cx: &Cx<'_>, comp: &Comp, w: u32, h: u32, st: &mut State<'_>)
|
||||
let path = sequence_path(cx.path, f0 + k as i64);
|
||||
// Encode in memory first: the storage hook decides where it fits.
|
||||
let mut buf = std::io::Cursor::new(Vec::new());
|
||||
write_still(cx, &mut buf, fmt, &img, comp, channels, w, h, cx.output.quality)?;
|
||||
write_still(cx, &mut buf, &img, comp, StillOutput { format: fmt, channels, size: (w, h), quality: cx.output.quality })?;
|
||||
let data = buf.into_inner();
|
||||
let path = cx.place(&path, data.len() as u64);
|
||||
let mut f = cx.create(&path)?;
|
||||
@@ -287,18 +287,15 @@ async fn sequence(cx: &Cx<'_>, comp: &Comp, w: u32, h: u32, st: &mut State<'_>)
|
||||
Ok(Report { path: sequence_path(cx.path, f0), frames: 0, width: w, height: h, seconds: 0.0, bytes, audio: false, log: None, overflow: vec![] })
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn write_still<W: std::io::Write + std::io::Seek>(
|
||||
cx: &Cx,
|
||||
file: &mut W,
|
||||
fmt: OutputFormat,
|
||||
img: &Image,
|
||||
comp: &Comp,
|
||||
struct StillOutput {
|
||||
format: OutputFormat,
|
||||
channels: Channels,
|
||||
w: u32,
|
||||
h: u32,
|
||||
size: (u32, u32),
|
||||
quality: u8,
|
||||
) -> Result<()> {
|
||||
}
|
||||
|
||||
fn write_still<W: std::io::Write + std::io::Seek>(cx: &Cx, file: &mut W, img: &Image, comp: &Comp, output: StillOutput) -> Result<()> {
|
||||
let StillOutput { format: fmt, channels, size: (w, h), quality } = output;
|
||||
use image::{ExtendedColorType, ImageEncoder, ImageFormat};
|
||||
match fmt {
|
||||
OutputFormat::ExrSequence => {
|
||||
|
||||
@@ -45,7 +45,7 @@ fn custom(start: f64, end: f64) -> RenderSettings {
|
||||
}
|
||||
|
||||
fn run_with(p: &Project, cid: ItemId, s: &RenderSettings, om: &OutputModule, path: &str, options: JobOptions, cancel: bool) -> (Result<Report, String>, Files) {
|
||||
run_on(p, cid, s, om, path, options, None, cancel)
|
||||
run_on(p, cid, s, om, path, options, (None, cancel))
|
||||
}
|
||||
|
||||
/// [`run_with`] with an accelerator.
|
||||
@@ -56,9 +56,9 @@ fn run_on(
|
||||
om: &OutputModule,
|
||||
path: &str,
|
||||
options: JobOptions,
|
||||
accel: Option<&dyn Accelerator>,
|
||||
cancel: bool,
|
||||
execution: (Option<&dyn Accelerator>, bool),
|
||||
) -> (Result<Report, String>, Files) {
|
||||
let (accel, cancel) = execution;
|
||||
let files: Files = Default::default();
|
||||
let f = files.clone();
|
||||
let sink: Box<Sink> = Box::new(move |path: &str, data: Vec<u8>| f.lock().unwrap().push((path.to_string(), data)));
|
||||
@@ -456,7 +456,7 @@ fn a_job_renders_on_one_compositor() {
|
||||
let om = OutputModule::for_format(OutputFormat::PngSequence);
|
||||
let s = custom(0.0, 0.4);
|
||||
let render = |p: &Project, accel: &GreenAccel, path: &str| {
|
||||
let (r, files) = run_on(p, cid, &s, &om, path, JobOptions::default(), Some(accel), false);
|
||||
let (r, files) = run_on(p, cid, &s, &om, path, JobOptions::default(), (Some(accel), false));
|
||||
r.expect("export");
|
||||
(0..10).map(|i| png(&files, i)).collect::<Vec<_>>()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user