Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge main into perf-bpc

Brandon Thomas5c9038cbee10
diff --cc crates/render/src/lib.rs
index dc1845888,6aa7ebd05..1b65a0e24
--- a/crates/render/src/lib.rs
+++ b/crates/render/src/lib.rs
@@@ -744,12 -772,16 +786,16 @@@ impl<'a> Renderer<'a>
let s = self.opts.scale;
let (l2c, _) = ctx.layer_to_comp(layer);
let l2c = self.outer.map_or(l2c, |o| o * l2c);
- Mat3::scale(vec2(s, s)) * l2c * Mat3::scale(vec2(1.0 / buf.scale, 1.0 / buf.scale)) * Mat3::translate(vec2(-buf.offset[0], -buf.offset[1]))
+ self.out_matrix()
+ * Mat3::scale(vec2(s, s))
+ * l2c
+ * Mat3::scale(vec2(1.0 / buf.scale, 1.0 / buf.scale))
+ * Mat3::translate(vec2(-buf.offset[0], -buf.offset[1]))
}
- /// Draw a processed layer into `target` (transform, motion blur) with `mode`/`opacity`.
- fn place(&self, ctx: &EvalCtx, layer: &Layer, buf: &Buf, target: &mut Image, mode: BlendMode, opacity: f32) {
- let samples = if self.opts.motion_blur && ctx.comp.enable_motion_blur && layer.switches.motion_blur {
+ /// Motion-blur sub-samples for a layer (1 = no motion blur).
+ fn mb_samples(&self, ctx: &EvalCtx, layer: &Layer) -> usize {
+ if self.opts.motion_blur && ctx.comp.enable_motion_blur && layer.switches.motion_blur {
if self.opts.draft { 4 } else { ctx.comp.motion_blur_samples.clamp(2, 64) as usize }
} else {
1
@@@ -944,10 -928,11 +990,11 @@@
/// Adjustment layer: effects applied to the comp below, limited to the layer's footprint.
fn draw_adjustment(&self, ctx: &EvalCtx, layer: &Layer, canvas: &mut Image, opacity: f32) {
let Some(mut foot) = self.source(ctx, layer) else { return };
- masks::apply(ctx, layer, &mut foot);
+ let _ = masks::apply(ctx, layer, &mut foot);
let mut matte = Image::new(canvas.width, canvas.height);
self.place(ctx, layer, &foot, &mut matte, BlendMode::Normal, 1.0);
- let mut below = Buf { img: canvas.clone(), offset: [0.0; 2], scale: self.opts.scale };
+ let o = self.roi_offset().map(|(x, y, _, _)| [-x, -y]).unwrap_or([0.0; 2]);
+ let mut below = Buf { img: canvas.clone(), offset: o, scale: self.opts.scale };
// Effects run in the working space, not the linear blending space.
if let Some(c) = self.pipe.from_blend() {
color::convert(&mut below.img, &c);