Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(compositor): make the frame the container in block layouts

EtienneLescot8e386ef24efe
diff --git a/crates/compositor/src/frame_geometry.rs b/crates/compositor/src/frame_geometry.rs
index 15101b20a..2976299bf 100644
--- a/crates/compositor/src/frame_geometry.rs
+++ b/crates/compositor/src/frame_geometry.rs
@@ -750,6 +750,20 @@ pub(crate) fn device_kind_id(kind: crate::scene::SceneFrame) -> f32 {
}
}
+/// Le verre noir de la face avant, tel que le mode 17 le rend de face : l'albédo `DEV_GLASS_*`
+/// des shaders sous leur lampe (`MODEL_AMBIENT + MODEL_DIFFUSE · n·l`, n = +z au repos). Le verre
+/// posé sous le métrage d'un bloc (`FrameGeometry::window_frame_cb`) prolonge ainsi la lunette
+/// sans couture. Miroir des trois shaders : teintes et coefficients.
+pub(crate) fn device_glass_rgba(dark: bool) -> [f32; 4] {
+ const GLASS_LIGHT: [f32; 3] = [0.031, 0.034, 0.040];
+ const GLASS_GRAPHITE: [f32; 3] = [0.043, 0.047, 0.055];
+ const MODEL_AMBIENT: f32 = 0.36;
+ const MODEL_DIFFUSE: f32 = 0.75;
+ let lit = MODEL_AMBIENT + MODEL_DIFFUSE * MODEL_LIGHT[2];
+ let [r, g, b] = if dark { GLASS_GRAPHITE } else { GLASS_LIGHT };
+ [r * lit, g * lit, b * lit, 1.0]
+}
+
/// Les huit coins d'une boîte alignée.
fn box_corners(lo: [f32; 3], hi: [f32; 3]) -> [[f32; 3]; 8] {
std::array::from_fn(|i| {
@@ -1284,7 +1298,8 @@ pub fn tilted_screen_cb(
}
if let Some(mask) = mask {
reframe_warped(&mut cb, mask.rect, render_px);
- cb.color[3] = mask.radius_px;
+ // Négatif : coins hauts carrés, sous la barre de la fenêtre (`slot_alpha`, shaders).
+ cb.color[3] = if mask.square_top { -mask.radius_px } else { mask.radius_px };
}
cb
}
@@ -1829,12 +1844,20 @@ pub struct FrameGeometry {
/// métrage — et seul son DESSIN est rogné au slot. Sans lui, la boîte zoomée débordait sur la
/// caméra et dans l'espace qui les sépare, et le bloc ne tenait plus. Le masque, lui, ne zoome
/// ni ne penche jamais : le layout garde son rect et ses coins, et son ombre est la sienne.
+///
+/// Sous un cadre, le cadre EST ce conteneur : fenêtre ou appareil, il reste au repos autour du
+/// slot, à plat, et le slot est son ouverture. Le métrage zoome et penche dedans. C'est l'inverse
+/// des autres layouts, où l'appareil zoome et penche avec l'écran (`FrameGeometry::frame_box`).
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ScreenMask {
/// Le slot, en fractions de la sortie : `layout.screenRect`, que le zoom ne touche pas.
pub rect: [f32; 4],
/// Le rayon de ses coins, en px du render target : celui de l'écran au repos.
pub radius_px: f32,
+ /// Coins HAUTS carrés : le slot est sous la barre de la fenêtre qui le contient. À plat, le
+ /// mode 0 le sait déjà (`screen_square_top`) ; incliné, le mode 8 le lit dans le signe de son
+ /// rayon (`tilted_screen_cb`).
+ pub square_top: bool,
}
impl ScreenMask {
@@ -1916,8 +1939,12 @@ impl FrameGeometry {
// bilinéaire s'en écarte de ~8 % de la largeur au milieu des bords (mesuré par
// `the_device_screen_face_lands_on_the_footage_plane`), soit une lunette à cent pixels
// du bord de l'image. Les quatre coins sont les mêmes des deux côtés, donc
- // l'homographie qu'ils définissent EST cette projection exacte.
- if self.window_frame.as_ref().is_some_and(|f| f.kind.is_device()) {
+ // l'homographie qu'ils définissent EST cette projection exacte. Pas sous le masque d'un
+ // bloc : l'appareil y reste au repos, le métrage penche seul dans son ouverture, au
+ // warp de l'écran sans cadre.
+ if self.window_frame.as_ref().is_some_and(|f| f.kind.is_device())
+ && self.screen_mask.is_none()
+ {
quad.projective = true;
}
quad
@@ -2093,16 +2120,49 @@ impl FrameGeometry {
/// sortirait. Le shader rogne alors ses coins hauts par ce même arc, pris au contour
/// intérieur du filet (`sd_screen_under_bar`) — l'écran suit le cadre, il ne s'arrondit pas
/// de son côté. Le mode 0 le lit dans `mb.z`, le mode 8 dans `color.z` (px du plan).
+ ///
+ /// Sous le masque d'un bloc, la fenêtre reste au repos autour du slot : la remontée est la
+ /// sienne, et le métrage droit, rogné au slot, épouse son contour. Incliné, il penche DANS la
+ /// fenêtre, arrondi de partout comme sans cadre : 0.
pub fn screen_top_lift_px(&self, render_px: [f32; 2]) -> f32 {
match self.window_frame.as_ref() {
+ Some(_) if self.screen_mask.is_some() && self.tilted() => 0.0,
Some(f) if f.kind == crate::scene::SceneFrame::Window => {
- let (s_w, s_h) = (self.s_dst[2] * render_px[0], self.s_dst[3] * render_px[1]);
+ let b = self.frame_box();
+ let (s_w, s_h) = (b[2] * render_px[0], b[3] * render_px[1]);
(f.margins[1] * s_h - f.margins[0] * s_w).max(0.0)
}
_ => 0.0,
}
}
+ /// La boîte autour de laquelle le cadre se construit. Sous le masque d'un bloc, le cadre EST
+ /// le conteneur (`ScreenMask`) : le slot au repos, ni zoomé ni incliné. Ailleurs, la boîte
+ /// écran : le cadre zoome avec elle (#179).
+ fn frame_box(&self) -> [f32; 4] {
+ self.screen_mask.map_or(self.s_dst, |m| m.rect)
+ }
+
+ /// Le plan du cadre : celui de l'écran, sauf sous le masque d'un bloc, où le cadre reste à
+ /// plat pendant que le métrage penche dedans.
+ fn frame_tilt(&self, render_px: [f32; 2]) -> Option<crate::regions::TiltedQuad> {
+ if self.screen_mask.is_some() {
+ return None;
+ }
+ self.screen_tilt_in(render_px)
+ }
+
+ /// Le rayon des coins du métrage autour duquel le cadre s'arrondit : celui du slot au repos
+ /// sous le masque d'un bloc, celui de la boîte écran ailleurs.
+ fn frame_screen_radius(&self) -> f32 {
+ self.screen_mask.map_or(self.s_radius, |m| m.radius_px)
+ }
+
+ fn frame_center_px(&self, render_px: [f32; 2]) -> [f32; 2] {
+ let b = self.frame_box();
+ [(b[0] + b[2] * 0.5) * render_px[0], (b[1] + b[3] * 0.5) * render_px[1]]
+ }
+
/// Le plan incliné de l'écran, `None` quand il est droit. Même appel que les backends : un
/// calcul déterministe, donc le même quadrilatère au bit près.
fn screen_tilt_in(&self, render_px: [f32; 2]) -> Option<crate::regions::TiltedQuad> {
@@ -2121,15 +2181,18 @@ impl FrameGeometry {
/// 0..1 : un warp bilinéaire est entièrement fixé par ses quatre coins, donc le prolonger
/// donne exactement le plan que le mode 8 dessine, et le cadre penche avec l'écran sans
/// aucune trigonométrie de plus. Sous la caméra réelle, le prolongement est celui de
- /// l'homographie, et le drapeau rendu (`TiltedQuad::warp_flag`) le dit au mode 14.
+ /// l'homographie, et le drapeau rendu (`TiltedQuad::warp_flag`) le dit au mode 14. Sous le
+ /// masque d'un bloc, le cadre est droit autour du slot (`frame_box`), coins relatifs au centre
+ /// de celui-ci.
fn window_frame_corners(
&self,
margins: [f32; 4],
render_px: [f32; 2],
) -> ([(f32, f32); 4], f32, f32) {
let [ml, mt, mr, mb] = margins;
- let quad = self.screen_tilt_in(render_px).unwrap_or_else(|| {
- let (hw, hh) = (self.s_dst[2] * render_px[0] * 0.5, self.s_dst[3] * render_px[1] * 0.5);
+ let quad = self.frame_tilt(render_px).unwrap_or_else(|| {
+ let b = self.frame_box();
+ let (hw, hh) = (b[2] * render_px[0] * 0.5, b[3] * render_px[1] * 0.5);
crate::regions::TiltedQuad {
corners: [(-hw, -hh), (hw, -hh), (hw, hh), (-hw, hh)],
scale: 1.0,
@@ -2156,47 +2219,55 @@ impl FrameGeometry {
/// APPAREIL ne passe pas par ici : son ombre suit la silhouette du modèle (`device_shadow_cb`),
/// qu'un quad plat ne sait pas porter.
pub fn shadow_caster(&self, render_px: [f32; 2]) -> ShadowCaster {
- let center_px = self.screen_center_px(render_px);
- let tilt = self.screen_tilt_in(render_px);
+ // Le cadre porte l'ombre, là où il est : au repos autour du slot sous le masque d'un bloc.
+ if let Some(frame) = &self.window_frame {
+ return match self.frame_tilt(render_px) {
+ None => {
+ let [ml, mt, mr, mb] = frame.margins;
+ let d = self.frame_box();
+ let dst = [
+ d[0] - ml * d[2],
+ d[1] - mt * d[3],
+ d[2] * (1.0 + ml + mr),
+ d[3] * (1.0 + mt + mb),
+ ];
+ ShadowCaster::Upright {
+ dst,
+ size_px: [dst[2] * render_px[0], dst[3] * render_px[1]],
+ radius: frame.radius[0],
+ }
+ }
+ Some(_) => {
+ let (corners, scale, _) = self.window_frame_corners(frame.margins, render_px);
+ ShadowCaster::Tilted {
+ corners,
+ center_px: self.frame_center_px(render_px),
+ radius: frame.radius[0] * scale,
+ mask: None,
+ }
+ }
+ };
+ }
// Sous le masque d'un layout en bloc, l'ombre est celle de ce qu'on voit. Droite, la boîte
// zoomée couvre tout le slot : c'est le slot, qui ne zoome pas. Inclinée, le plan rogné
- // par le slot (`mask` du quad, plus bas).
- if let (Some(mask), None) = (self.screen_mask, &tilt) {
- let dst = mask.rect;
- let size_px = [dst[2] * render_px[0], dst[3] * render_px[1]];
- return ShadowCaster::Upright { dst, size_px, radius: mask.radius_px };
- }
- match (&self.window_frame, tilt) {
+ // par le slot (`mask` du quad).
+ match (self.screen_mask, self.screen_tilt_in(render_px)) {
+ (Some(mask), None) => ShadowCaster::Upright {
+ dst: mask.rect,
+ size_px: [mask.rect[2] * render_px[0], mask.rect[3] * render_px[1]],
+ radius: mask.radius_px,
+ },
(None, None) => ShadowCaster::Upright {
dst: self.s_dst,
size_px: [self.s_dst[2] * render_px[0], self.s_dst[3] * render_px[1]],
radius: self.s_radius,
},
- (None, Some(quad)) => ShadowCaster::Tilted {
+ (mask, Some(quad)) => ShadowCaster::Tilted {
corners: quad.corners,
- center_px,
+ center_px: self.screen_center_px(render_px),
radius: self.s_radius * quad.scale,
- mask: self.screen_mask,
+ mask,
},
- (Some(frame), None) => {
- let [ml, mt, mr, mb] = frame.margins;
- let d = self.s_dst;
- let dst = [
- d[0] - ml * d[2],
- d[1] - mt * d[3],
- d[2] * (1.0 + ml + mr),
- d[3] * (1.0 + mt + mb),
- ];
- ShadowCaster::Upright {
- dst,
- size_px: [dst[2] * render_px[0], dst[3] * render_px[1]],
- radius: frame.radius[0],
- }
- }
- (Some(frame), Some(_)) => {
- let (corners, scale, _) = self.window_frame_corners(frame.margins, render_px);
- ShadowCaster::Tilted { corners, center_px, radius: frame.radius[0] * scale, mask: None }
- }
}
}
@@ -2244,16 +2315,32 @@ impl FrameGeometry {
[off * dir[0] / len, off * dir[1] / len]
}
- /// Le calque du cadre (mode 14), à dessiner après l'ombre et AVANT l'écran. `None` sans cadre.
+ /// Le calque du cadre qui passe SOUS l'écran, à dessiner après l'ombre et AVANT lui : le
+ /// chrome de fenêtre (mode 14). `None` sans cadre.
///
/// Une seule forme pour le cas droit et le cas incliné : le mode 14 fait toujours le warp
/// inverse du mode 8, et sur un rect ce warp est l'identité exacte (le terme quadratique est
/// nul). Le calque se construit donc ici, une fois, pour les trois backends.
+ ///
+ /// Sous le masque d'un bloc, un APPAREIL y pose le verre de son écran (mode 1, le slot et ses
+ /// coins) : là où le métrage incliné ne couvre plus l'ouverture, on voit l'écran éteint, pas
+ /// un trou vers le fond d'écran. Ailleurs, l'appareil n'a rien sous l'écran.
pub fn window_frame_cb(&self, render_px: [f32; 2]) -> Option<LayerCB> {
- let frame = self.window_frame.as_ref().filter(|f| !f.kind.is_device())?;
+ let frame = self.window_frame.as_ref()?;
let [rw, rh] = render_px;
+ if frame.kind.is_device() {
+ let mask = self.screen_mask?;
+ return Some(LayerCB {
+ dst: mask.rect,
+ quad_px: [mask.rect[2] * rw, mask.rect[3] * rh],
+ radius_px: mask.radius_px,
+ mode: 1.0,
+ color: device_glass_rgba(frame.dark),
+ ..Default::default()
+ });
+ }
let (corners, scale, warp) = self.window_frame_corners(frame.margins, render_px);
- let center = self.screen_center_px(render_px);
+ let center = self.frame_center_px(render_px);
let (min_x, max_x) =
corners.iter().fold((f32::MAX, f32::MIN), |(mn, mx), &(x, _)| (mn.min(x), mx.max(x)));
let (min_y, max_y) =
@@ -2262,7 +2349,8 @@ impl FrameGeometry {
let local = |(x, y): (f32, f32)| [x - min_x, y - min_y];
let [tl, tr, br, bl] = corners.map(local);
let [ml, mt, mr, mb] = frame.margins;
- let (s_w, s_h) = (self.s_dst[2] * rw, self.s_dst[3] * rh);
+ let b = self.frame_box();
+ let (s_w, s_h) = (b[2] * rw, b[3] * rh);
// Dimensions dans le repère du plan, avant projection, comme `plane_px` au mode 8.
let plane_px = [s_w * (1.0 + ml + mr) * scale, s_h * (1.0 + mt + mb) * scale];
let (bar_px, line_px) = (mt * s_h * scale, ml * s_w * scale);
@@ -2290,14 +2378,16 @@ impl FrameGeometry {
/// La caméra qui voit le plan de l'écran, reconstruite pour les calques lancés de rayons
/// (mode 17). Sous un angle fixe ou la caméra réelle c'est celle du plan ; à plat, l'identité
/// avec la MÊME distance de fuite que les présets. Le relief du modèle, lui, est vu d'un œil
- /// reculé sur la même droite (`DEV_EYE_MIN`, `DeviceView::project`).
+ /// reculé sur la même droite (`DEV_EYE_MIN`, `DeviceView::project`). Sous le masque d'un bloc,
+ /// l'appareil au repos autour du slot (`frame_box`).
fn device_view(&self, render_px: [f32; 2]) -> Option<DeviceView> {
let [rw, rh] = render_px;
- let (s_w, s_h) = (self.s_dst[2] * rw, self.s_dst[3] * rh);
+ let b = self.frame_box();
+ let (s_w, s_h) = (b[2] * rw, b[3] * rh);
if !(s_w > 1.0) || !(s_h > 1.0) {
return None;
}
- let quad = self.screen_tilt_in(render_px);
+ let quad = self.frame_tilt(render_px);
let perspective = quad
.as_ref()
.map(|q| q.perspective)
@@ -2314,15 +2404,17 @@ impl FrameGeometry {
perspective,
offset: quad.as_ref().map(|q| q.offset).unwrap_or([0.0; 2]),
unit,
- center: self.screen_center_px(render_px),
+ center: self.frame_center_px(render_px),
half: [0.5 * s_w / u, 0.5 * s_h / u],
})
}
- /// L'unité du cadre (`frame_unit_px`) de CETTE boîte écran, zoom compris, en px de la boîte
+ /// L'unité du cadre (`frame_unit_px`) de la boîte autour de laquelle il se construit — la boîte
+ /// écran, zoom compris, ou le slot au repos sous le masque d'un bloc —, en px de la boîte
/// droite : ce que mesurent les marges, les rayons et le modèle d'un appareil.
pub fn frame_unit_px(&self, render_px: [f32; 2]) -> f32 {
- frame_unit_px([self.s_dst[2] * render_px[0], self.s_dst[3] * render_px[1]], render_px)
+ let b = self.frame_box();
+ frame_unit_px([b[2] * render_px[0], b[3] * render_px[1]], render_px)
}
/// Le calque de l'appareil modelé (mode 17), à dessiner APRÈS l'écran. `None` sans cadre ou
@@ -2370,8 +2462,9 @@ impl FrameGeometry {
// shader lit l'angle dans `dst_prev.x`, jamais une constante.
let deck_angle = device_deck_angle(view.half, bb, thick);
let u = self.frame_unit_px(render_px);
- // UNE forme de coin pour le métrage et l'ouverture : le rayon du métrage, en unités.
- let aperture_radius = self.s_radius / u;
+ // UNE forme de coin pour le métrage et l'ouverture : le rayon du métrage, en unités (celui
+ // du slot au repos sous le masque d'un bloc, qui rogne le métrage à cette ouverture).
+ let aperture_radius = self.frame_screen_radius() / u;
// Le recouvrement se compte en PIXELS : exprimé en unités, il fondait à 1,2 px sur un petit
// écran, sous la somme des deux antialiasings (celui du métrage, celui de la lunette).
let overlap = DEV_OVERLAP_PX / view.unit.max(1.0);
@@ -3183,30 +3276,36 @@ pub fn plan_frame(input: &FrameGeometryInput) -> FrameGeometry {
let s_radius = screen_corner_radius_px(outer_radius_of(s_px), s_px);
// Layouts en bloc : le slot masque l'écran (`ScreenMask`), avec les coins de l'écran AU
// REPOS — la boîte, elle, grandit avec le zoom. `screen_cover` est le drapeau du slot :
- // l'app ne le lève que pour ces deux layouts, et seulement sur un clip qui a une caméra.
- // Pas sous un cadre : il déborde du slot au repos, le masque le couperait.
- let screen_mask = (scene.is_some_and(|s| s.layout.screen_cover)
- && frame_kind == crate::scene::SceneFrame::None)
- .then(|| {
- let slot_px = [s_base[2] * rw, s_base[3] * rh];
- ScreenMask {
- rect: s_base,
- radius_px: screen_corner_radius_px(outer_radius_of(slot_px), slot_px),
- }
- });
+ // l'app le lève pour ces deux layouts, sur un clip qui a une caméra, et pour le
+ // remplissage du format, qui exclut les cadres (`formatFillAvailability`). Un cadre sous
+ // un slot est donc toujours dans un bloc : il y devient le conteneur, au repos autour.
+ let screen_mask = scene.is_some_and(|s| s.layout.screen_cover).then(|| {
+ let slot_px = [s_base[2] * rw, s_base[3] * rh];
+ ScreenMask {
+ rect: s_base,
+ radius_px: screen_corner_radius_px(outer_radius_of(slot_px), slot_px),
+ square_top: frame_kind == crate::scene::SceneFrame::Window,
+ }
+ });
+ // Le cadre se construit autour de la boîte écran, zoom compris ; sous le masque d'un bloc,
+ // autour du slot au repos et de ses coins, qui ne zooment pas.
+ let (f_px, f_radius) = match screen_mask {
+ Some(m) => ([m.rect[2] * rw, m.rect[3] * rh], m.radius_px),
+ None => (s_px, s_radius),
+ };
let window_frame = frame_margins.map(|margins| {
- let (l, t, b) = (margins[0] * s_px[0], margins[1] * s_px[1], margins[3] * s_px[1]);
+ let (l, t, b) = (margins[0] * f_px[0], margins[1] * f_px[1], margins[3] * f_px[1]);
// La fenêtre n'a qu'un rayon (mode 14) : celui de ses coins BAS, où le métrage s'arrondit
// sous le filet. En haut, le contour intérieur du chrome a le rayon du métrage, remonté
// sous la barre (`sd_screen_under_bar`) : le même arc, rentré du filet.
let top = match frame_kind {
- crate::scene::SceneFrame::Window => concentric_radius(s_radius, l, b),
- _ => concentric_radius(s_radius, l, t),
+ crate::scene::SceneFrame::Window => concentric_radius(f_radius, l, b),
+ _ => concentric_radius(f_radius, l, t),
};
// Portable et moniteur : la coque garde ses rayons, seule l'ouverture suit le slider.
let radius = match device_shell_radius(frame_kind) {
- Some(shell) => shell.map(|r| r * frame_unit_px(s_px, [rw, rh])),
- None => [top, concentric_radius(s_radius, l, b)],
+ Some(shell) => shell.map(|r| r * frame_unit_px(f_px, [rw, rh])),
+ None => [top, concentric_radius(f_radius, l, b)],
};
WindowFrame { kind: frame_kind, dark: frame_dark, margins, radius }
});
@@ -4462,7 +4561,7 @@ mod tests {
g.mb_amount = 0.0;
assert!(!g.screen_trail(RENDER), "{frame}: flou coupé");
g.mb_amount = 1.0;
- g.screen_mask = Some(ScreenMask { rect: [0.0, 0.0, 0.5, 1.0], radius_px: 0.0 });
+ g.screen_mask = Some(ScreenMask { rect: [0.0, 0.0, 0.5, 1.0], radius_px: 0.0, square_top: false });
assert!(!g.screen_trail(RENDER), "{frame}: la case d'un bloc ne bouge pas");
assert_eq!(g.screen_pixel_taps(RENDER), 16.0);
}
@@ -4517,7 +4616,7 @@ mod tests {
// Sous un masque de bloc, la case ne bouge pas : retour au flou par pixel.
let mut masked = g;
- masked.screen_mask = Some(ScreenMask { rect: [0.0, 0.0, 0.5, 1.0], radius_px: 0.0 });
+ masked.screen_mask = Some(ScreenMask { rect: [0.0, 0.0, 0.5, 1.0], radius_px: 0.0, square_top: false });
assert!(!masked.screen_trail(RENDER), "{case}: la case d'un bloc ne bouge pas");
assert_eq!(masked.tilt_pixel_trail(RENDER), Some(trail));
}
@@ -4845,6 +4944,38 @@ mod tests {
assert!(w.device_shadow_cb(RENDER, 40.0, [0.0, 16.0], 0.3).is_none());
}
+ /// L'emprise d'un appareil AU REPOS, en unités du cadre autour d'un écran 16:9 dans une sortie
+ /// 16:9 : gauche, haut, droite, bas, socle et pied compris. `src/lib/frameFootprint.ts` en est
+ /// le miroir — le layout en bloc écarte la caméra de cette emprise — et son test épingle les
+ /// MÊMES nombres : un modèle qui change doit changer des deux côtés.
+ #[test]
+ fn the_device_footprint_at_rest_is_pinned_for_the_block_layout() {
+ for (name, want) in [
+ ("laptop", [0.18596f32, 0.0409, 0.18596, 0.09983]),
+ ("phone", [0.0193; 4]),
+ ("monitor", [0.0231, 0.0231, 0.0231, 0.2446]),
+ ] {
+ let g = device_plan(name, "null", 1.0);
+ let frame = g.window_frame.expect("un cadre");
+ let view = g.device_view(RENDER).expect("caméra");
+ let (c, h) = view.body_rect(frame.margins);
+ let thick = device_thickness(frame.kind);
+ let deck = device_deck_angle(view.half, view.body_margins(frame.margins)[3], thick);
+ let mut b = [f32::MAX, f32::MAX, f32::MIN, f32::MIN];
+ for p in view.model_points(frame.kind, c, h, thick, deck) {
+ let q = view.project(p).expect("point projeté");
+ b = [b[0].min(q[0]), b[1].min(q[1]), b[2].max(q[0]), b[3].max(q[1])];
+ }
+ let (o, u) = (g.screen_center_px(RENDER), g.frame_unit_px(RENDER));
+ let half = [g.s_dst[2] * RENDER[0] * 0.5, g.s_dst[3] * RENDER[1] * 0.5];
+ let got = [o[0] - b[0] - half[0], o[1] - b[1] - half[1], b[2] - o[0] - half[0], b[3] - o[1] - half[1]]
+ .map(|v| v / u);
+ for k in 0..4 {
+ assert!((got[k] - want[k]).abs() < 1e-4, "{name}: emprise {got:?} au lieu de {want:?}");
+ }
+ }
+ }
+
/// Le métrage a EXACTEMENT la même boîte et la même coupe sans cadre, sous la fenêtre et sous
/// chacun des appareils : le cadre pousse vers l'extérieur, jamais vers l'intérieur. Ombre,
/// masques, annotations et curseurs, ancrés sur cette boîte, n'ont donc rien à rattraper. (Son
@@ -5664,6 +5795,11 @@ mod tests {
/// au ratio de la capture, la caméra à côté, `screenCover`. Zoom `zoom` sous `rotation`, focus
/// décentré (0.3, 0.6). `cover: false` rend le même bloc sans slot, comme les autres layouts.
fn slot_scene(rotation: &str, zoom: f32, cover: bool) -> Scene {
+ slot_scene_with(rotation, zoom, cover, "")
+ }
+
+ /// `slot_scene`, `effects_extra` inséré tel quel dans `effects` (un cadre, par exemple).
+ fn slot_scene_with(rotation: &str, zoom: f32, cover: bool, effects_extra: &str) -> Scene {
Scene::from_json(&format!(
r##"{{
"clips":[{{"screenPath":"/s.mp4","webcamPath":"/w.mp4","sourceStartSec":0,"sourceEndSec":10,"webcamOffsetSec":0,"hasAudio":false}}],
@@ -5671,7 +5807,7 @@ mod tests {
"webcamReactiveZoom":false,"screenRect":{{"x":0.1,"y":0.25,"width":0.55,"height":0.55}},
"webcamRect":{{"x":0.666,"y":0.25,"width":0.234,"height":0.55}},
"screenRadiusFrac":0.04,"webcamRadiusFrac":0.04,"screenCover":{cover}}},
- "effects":{{"padding":0.5,"blur":false,"shadow":0.5,"roundnessFrac":0.03,"motionBlur":0}},
+ "effects":{{"padding":0.5,"blur":false,"shadow":0.5,"roundnessFrac":0.03,"motionBlur":0{effects_extra}}},
"background":{{"kind":"color","color":"#1e1e2e"}},
"zoomRegions":[{{"clipIndex":0,"startSec":0.0,"endSec":5.0,"scale":{zoom},"focusX":0.3,"focusY":0.6,"rotation":{rotation}}}],
"cursor":{{"show":true,"size":1,"smoothing":0,"motionBlur":0,"clickBounce":1,"clipToBounds":false,"theme":"default"}},
@@ -5853,7 +5989,7 @@ mod tests {
}
}
// Le slot passé à l'ombre, en px locaux à sa boîte : décalé de l'origine de celle-ci.
- let mask = ScreenMask { rect: SLOT, radius_px: 12.0 };
+ let mask = ScreenMask { rect: SLOT, radius_px: 12.0, square_top: false };
let (rect, r) = shadow_mask_fields(Some(mask), [100.0, 50.0], RENDER);
let want = [0.1 * 1920.0 - 100.0, 0.25 * 1080.0 - 50.0, 0.65 * 1920.0 - 100.0, 0.8 * 1080.0 - 50.0];
for k in 0..4 {
@@ -5863,6 +5999,110 @@ mod tests {
assert_eq!(shadow_mask_fields(None, [100.0, 50.0], RENDER), ([0.0; 4], 0.0));
}
+ /// Un calque au bit près : `LayerCB` n'a pas de `PartialEq`, et c'est l'octet qu'on compare.
+ fn cb_bits(cb: Option<LayerCB>) -> Option<Vec<u32>> {
+ cb.map(|c| {
+ [c.dst, c.src, c.color, c.fx, c.src_prev, c.dst_prev, c.mb, c.trail_a, c.trail_b, c.trail_mb]
+ .concat()
+ .into_iter()
+ .chain(c.quad_px)
+ .chain([c.radius_px, c.mode])
+ .map(f32::to_bits)
+ .collect()
+ })
+ }
+
+ /// Sous un cadre, dans un bloc, le cadre EST le conteneur : fenêtre ou appareil reste au repos
+ /// autour du slot — mêmes calques et même ombre qu'au repos, sous un zoom à plat, un angle fixe
+ /// ou la caméra en orbite —, et le métrage zoome et penche dedans, rogné au slot, avec la
+ /// géométrie qu'il aurait sans cadre. C'est l'inverse des autres layouts, où l'appareil zoome
+ /// et penche avec l'écran.
+ #[test]
+ fn a_block_frame_stays_at_rest_while_the_footage_zooms_inside() {
+ let pointer = Some((0.8, 0.3));
+ for frame in ["window", "laptop", "phone", "monitor"] {
+ let extra = format!(r#","frame":"{frame}""#);
+ let rest = slot_plan(&slot_scene_with("null", 1.0, true, &extra), pointer);
+ let rest_mask = rest.screen_mask.expect("un bloc masque son écran, sous un cadre aussi");
+ let rest_off = rest.screen_shadow_offset();
+ for rotation in ["null", r#""iso""#, r#""follow-cursor""#] {
+ let case = format!("{frame} {rotation}");
+ let g = slot_plan(&slot_scene_with(rotation, 2.0, true, &extra), pointer);
+ let bare = slot_plan(&slot_scene(rotation, 2.0, true), pointer);
+ let mask = g.screen_mask.expect("masque");
+ assert_eq!(mask, rest_mask, "{case}: le slot a bougé");
+ assert_eq!(mask.rect, SLOT, "{case}");
+
+ // Le métrage : la géométrie du même bloc sans cadre, zoom et plan compris.
+ assert_eq!(g.s_dst.map(f32::to_bits), bare.s_dst.map(f32::to_bits), "{case}: boîte");
+ assert!(!contains(SLOT, g.s_dst, 1e-3), "{case}: garde, la boîte zoomée déborde");
+ assert_eq!(g.tilted(), rotation != "null", "{case}");
+ let s_px = [g.s_dst[2] * RENDER[0], g.s_dst[3] * RENDER[1]];
+ let plane = |g: &FrameGeometry| g.screen_tilt(s_px).map(|q| (q.corners, q.projective));
+ assert_eq!(plane(&g), plane(&bare), "{case}: le métrage ne penche pas comme sans cadre");
+
+ // Le cadre : au repos, à l'octet — calque sous l'écran, appareil, ombre.
+ assert_eq!(g.window_frame, rest.window_frame, "{case}: corps du cadre");
+ assert_eq!(cb_bits(g.window_frame_cb(RENDER)), cb_bits(rest.window_frame_cb(RENDER)), "{case}: sous l'écran");
+ assert_eq!(cb_bits(g.device_frame_cb(RENDER)), cb_bits(rest.device_frame_cb(RENDER)), "{case}: appareil");
+ assert_eq!(g.shadow_caster(RENDER), rest.shadow_caster(RENDER), "{case}: ombre");
+ assert_eq!(g.screen_shadow_offset(), rest_off, "{case}: décalage de l'ombre");
+ assert_eq!(
+ cb_bits(g.device_shadow_cb(RENDER, 40.0, rest_off, 0.3)),
+ cb_bits(rest.device_shadow_cb(RENDER, 40.0, rest_off, 0.3)),
+ "{case}: ombre de l'appareil"
+ );
+ if let Some(cb) = g.device_frame_cb(RENDER) {
+ assert_eq!(&cb.fx[..3], &[0.0; 3], "{case}: l'appareil penche");
+ let u = g.frame_unit_px(RENDER);
+ assert!((cb.dst_prev[1] * u - mask.radius_px).abs() < 1e-3, "{case}: ouverture ≠ coins du slot");
+ }
+
+ // Le métrage est dessiné dans le slot, à plat comme incliné.
+ match g.screen_tilt(s_px) {
+ None => {
+ let (dst, ..) = g.mask_flat_screen(g.s_dst, g.cut, s_px, g.s_radius, RENDER);
+ assert_eq!(dst, SLOT, "{case}");
+ assert_eq!(g.screen_top_lift_px(RENDER), rest.screen_top_lift_px(RENDER), "{case}: remontée");
+ }
+ Some(quad) => {
+ let centre = g.screen_center_px(RENDER);
+ let lift = g.screen_top_lift_px(RENDER);
+ assert_eq!(lift, 0.0, "{case}: le plan incliné n'est pas sous la barre");
+ let cb = tilted_screen_cb(&quad, s_px, centre, g.cut, g.focus_plane, g.s_radius, lift, false, RENDER, g.screen_mask, None);
+ assert_eq!(cb.dst, SLOT, "{case}");
+ // Sous la barre de la fenêtre, le slot garde ses coins hauts carrés : le
+ // mode 8 le lit dans le signe du rayon (`slot_alpha`).
+ assert_eq!(mask.square_top, frame == "window", "{case}");
+ assert!(mask.radius_px > 0.0, "{case}: garde, un rayon à signer");
+ let want = if mask.square_top { -mask.radius_px } else { mask.radius_px };
+ assert_eq!(cb.color[3], want, "{case}: coins du slot");
+ }
+ }
+ }
+ }
+ }
+
+ /// Sous un appareil, dans un bloc, le verre de son écran passe SOUS le métrage, au slot et à
+ /// ses coins, de la teinte que le mode 17 rend de face : ce que le plan incliné découvre est
+ /// l'écran éteint, pas le fond d'écran. Hors d'un bloc, rien sous l'écran, comme avant.
+ #[test]
+ fn a_block_device_puts_its_glass_under_the_footage() {
+ for (name, _) in DEVICES {
+ for (theme, dark) in [("", false), (r#","frameTheme":"dark""#, true)] {
+ let g = slot_plan(&slot_scene_with(r#""iso""#, 2.0, true, &format!(r#","frame":"{name}"{theme}"#)), None);
+ let mask = g.screen_mask.expect("masque");
+ let cb = g.window_frame_cb(RENDER).expect("verre");
+ assert_eq!((cb.mode, cb.dst, cb.radius_px), (1.0, SLOT, mask.radius_px), "{name}");
+ assert_eq!(cb.quad_px, [SLOT[2] * RENDER[0], SLOT[3] * RENDER[1]], "{name}");
+ assert_eq!(cb.color, device_glass_rgba(dark), "{name} {dark}");
+ assert!(cb.color[3] == 1.0 && cb.color[..3].iter().all(|c| *c < 0.06), "{name}: pas du verre noir");
+ }
+ assert!(device_plan(name, r#""iso""#, 2.0).window_frame_cb(RENDER).is_none(), "{name}: hors bloc");
+ }
+ assert_ne!(device_glass_rgba(true), device_glass_rgba(false), "deux thèmes, deux verres");
+ }
+
/// Le flou de confidentialité suit le métrage comme ailleurs, et le slot le rogne : ce qui en
/// sort n'est pas dessiné, rien à y cacher, et un masque y flouterait la caméra.
#[test]
@@ -6080,7 +6320,7 @@ mod tests {
fn the_tilted_screen_cb_carries_its_trail_in_its_own_frame() {
let quad = crate::regions::rotated_quad_corners_px(800.0, 450.0, [-12.0, -18.0, -2.0], [0.0; 3]);
let moved = TiltTrail { corners: quad.corners.map(|(x, y)| (x * 0.9 + 3.0, y * 0.9 - 2.0)), mb: [6.0, 0.35] };
- let mask = ScreenMask { rect: [0.1, 0.1, 0.6, 0.6], radius_px: 8.0 };
+ let mask = ScreenMask { rect: [0.1, 0.1, 0.6, 0.6], radius_px: 8.0, square_top: false };
let cb = |mask, trail| {
tilted_screen_cb(&quad, [800.0, 450.0], [600.0, 400.0], [0.0, 0.0, 1.0, 1.0], [0.5, 0.5], 12.0, 0.0, false, [1200.0, 800.0], mask, trail)
};
diff --git a/crates/compositor/src/shaders.hlsl b/crates/compositor/src/shaders.hlsl
index e23fcde2c..9c32e2886 100644
--- a/crates/compositor/src/shaders.hlsl
+++ b/crates/compositor/src/shaders.hlsl
@@ -149,6 +149,20 @@ float quad_round_alpha(float2 local, float2 quad_px, float radius_px)
return 1.0 - smoothstep(0.0, 1.5, d); // même feather ~1.5px que la queue
}
+// Le slot d'un layout en bloc, qui rogne le plan incliné (mode 8, `r` = `color.w`, rayon de ses
+// coins en px, 0 sans slot). Négatif : coins HAUTS carrés, à ras de la barre de la fenêtre qui
+// le contient (`ScreenMask::square_top`), coins bas arrondis de `-r`.
+float slot_alpha(float2 local, float2 quad_px, float r)
+{
+ if (r >= 0.0)
+ {
+ return quad_round_alpha(local, quad_px, r);
+ }
+ float2 halfsz = quad_px * 0.5;
+ float2 p = local - halfsz;
+ return 1.0 - smoothstep(0.0, 1.5, sd_round_rect(p, halfsz, (p.y < 0.0) ? 0.0 : -r));
+}
+
// Intersection de deux droites données par (normale, offset) : n·x = d. Cramer.
float2 line_cross(float2 n1, float d1, float2 n2, float d2)
{
@@ -2405,8 +2419,8 @@ float4 ps_main(VSOut i) : SV_Target
float tilt_a = 1.0 - smoothstep(0.0, 1.5, d);
// Slot d'un layout en bloc (`color.w` = rayon de ses coins, px ; 0 ailleurs, sans effet) :
// `dst` EST le slot, dont le rect arrondi rogne le plan. Le conteneur masque, le métrage
- // penche dedans (`ScreenMask`).
- tilt_a *= quad_round_alpha(i.local, quad_px, color.w);
+ // penche dedans (`ScreenMask`). Négatif sous une fenêtre : coins hauts carrés.
+ tilt_a *= slot_alpha(i.local, quad_px, color.w);
// Profondeur de champ : cercle de confusion en texels source, nul au focus du zoom.
// Sous un demi-texel, l'échantillon net d'avant, à l'octet : le texte net ne passe
// jamais par le RGBA de la pyramide, et `k = 0` (réglage coupé) ne quitte jamais cette
diff --git a/crates/compositor/src/shaders.metal b/crates/compositor/src/shaders.metal
index 0472066c7..07d86bd51 100644
--- a/crates/compositor/src/shaders.metal
+++ b/crates/compositor/src/shaders.metal
@@ -212,6 +212,19 @@ inline float quad_round_alpha(float2 local, float2 quad_px, float radius_px)
return 1.0 - smoothstep(0.0, 1.5, d); // même feather ~1.5px que la queue
}
+// Le slot d'un layout en bloc, qui rogne le plan incliné (mode 8, cf. HLSL). Négatif : coins
+// HAUTS carrés, sous la barre de la fenêtre qui le contient.
+inline float slot_alpha(float2 local, float2 quad_px, float r)
+{
+ if (r >= 0.0)
+ {
+ return quad_round_alpha(local, quad_px, r);
+ }
+ float2 halfsz = quad_px * 0.5;
+ float2 p = local - halfsz;
+ return 1.0 - smoothstep(0.0, 1.5, sd_round_rect(p, halfsz, (p.y < 0.0) ? 0.0 : -r));
+}
+
// Intersection de deux droites données par (normale, offset) : n·x = d. Cramer.
inline float2 line_cross(float2 n1, float d1, float2 n2, float d2)
{
@@ -2177,7 +2190,7 @@ fragment float4 ps_main(VSOut i [[stage_in]],
float tilt_a = 1.0 - smoothstep(0.0, 1.5, d);
// Slot d'un layout en bloc (`color.w` = rayon de ses coins, px ; 0 ailleurs, sans effet) :
// `dst` EST le slot, dont le rect arrondi rogne le plan (`ScreenMask`, cf. HLSL).
- tilt_a *= quad_round_alpha(i.local, layer.quad_px, layer.color.w);
+ tilt_a *= slot_alpha(i.local, layer.quad_px, layer.color.w);
// Profondeur de champ : net sous un demi-texel de flou (l'échantillon d'avant, à
// l'octet), fondu au-delà vers la pyramide au niveau `log2(coc) - 1`, plafonné.
// `level(lod)` exige `mip_filter::linear` sur `samp` : sans lui, niveau 0 partout.
diff --git a/crates/compositor/src/vk_shaders/layer.wgsl b/crates/compositor/src/vk_shaders/layer.wgsl
index dfeed6ea7..c7131acde 100644
--- a/crates/compositor/src/vk_shaders/layer.wgsl
+++ b/crates/compositor/src/vk_shaders/layer.wgsl
@@ -198,6 +198,17 @@ fn quad_round_alpha(local: vec2<f32>, quad_px: vec2<f32>, radius_px: f32) -> f32
return 1.0 - smoothstep(0.0, 1.5, d); // meme feather ~1.5px que la queue
}
+// Le slot d'un layout en bloc, qui rogne le plan incline (mode 8, cf. HLSL). Negatif : coins
+// HAUTS carres, sous la barre de la fenetre qui le contient.
+fn slot_alpha(local: vec2<f32>, quad_px: vec2<f32>, r: f32) -> f32 {
+ if r >= 0.0 {
+ return quad_round_alpha(local, quad_px, r);
+ }
+ let halfsz = quad_px * 0.5;
+ let p = local - halfsz;
+ return 1.0 - smoothstep(0.0, 1.5, sd_round_rect(p, halfsz, select(-r, 0.0, p.y < 0.0)));
+}
+
// ---- Primitives du tilt 3D (modes 8 et 12), portees de `shaders.metal` ----
// SDF segment a bouts ronds.
@@ -2032,7 +2043,7 @@ fn fs_main(i: VsOut) -> @location(0) vec4<f32> {
// Slot d'un layout en bloc (`color.w` = rayon de ses coins, px ; 0 ailleurs, sans effet) :
// `dst` EST le slot, dont le rect arrondi rogne le plan (`ScreenMask`, cf. HLSL).
let tilt_a = (1.0 - smoothstep(0.0, 1.5, d))
- * quad_round_alpha(i.local, layer.quad_px, layer.color.w);
+ * slot_alpha(i.local, layer.quad_px, layer.color.w);
// Profondeur de champ (cf. HLSL) : net sous un demi-texel de flou, l'echantillon
// d'avant a l'octet ; au-dela, fondu vers la pyramide demi-resolution liee en binding 4
// (a la place du masque webcam, que ce mode ne lit pas), au niveau `log2(coc) - 1`,
diff --git a/src/components/ai-edition/PreviewCanvas.tsx b/src/components/ai-edition/PreviewCanvas.tsx
index 04e150991..b5b72167b 100644
--- a/src/components/ai-edition/PreviewCanvas.tsx
+++ b/src/components/ai-edition/PreviewCanvas.tsx
@@ -280,6 +280,7 @@ export function PreviewCanvas(props: PreviewCanvasProps) {
webcamAnchor: settings.webcamAnchor,
webcamMaskShape: mask,
webcamRoundness: settings.webcamRoundness,
+ frame: settings.frame,
});
}, [
frameSize,
@@ -294,6 +295,7 @@ export function PreviewCanvas(props: PreviewCanvasProps) {
settings.padding,
settings.aspectRatio,
formatFill,
+ settings.frame,
]);
// Full Camera: during a cameraFullscreen region the webcam takes the whole
@@ -320,9 +322,9 @@ export function PreviewCanvas(props: PreviewCanvasProps) {
};
}, [layout, cameraFullscreenProgress, frameSize]);
- // The stage hosting the interactive overlays is the CONTENT rect, and a frame never changes
- // it: the compositor keeps the footage the same size with or without a frame and grows the
- // frame outward, so every handle (annotations, privacy blur, zoom focus) sits on `layout`.
+ // The stage hosting the interactive overlays is the CONTENT rect: the compositor draws the
+ // frame around it (grown outward, or laid out beside the camera in a block layout), so every
+ // handle (annotations, privacy blur, zoom focus) sits on `layout`.
const frameStyle = useMemo(() => wallpaperStyle(settings.wallpaper), [settings.wallpaper]);
const screenStyle = useMemo(
() => buildScreenStyle(layout, settings, frameSize),
diff --git a/src/lib/compositeLayout.test.ts b/src/lib/compositeLayout.test.ts
index 0d6d6ce0b..d0500b829 100644
--- a/src/lib/compositeLayout.test.ts
+++ b/src/lib/compositeLayout.test.ts
@@ -6,12 +6,14 @@ import {
isWebcamBlockLayout,
paddedContentSize,
paddingFit,
+ type RenderRect,
resolveWebcamReactiveZoom,
restingCompositionAspect,
type Size,
type StyledRenderRect,
type WebcamLayoutPreset,
} from "./compositeLayout";
+import { frameFootprint, frameUnit, type Insets } from "./frameFootprint";
import type { WebcamAnchor } from "./projectDefaults";
describe("resolveWebcamReactiveZoom", () => {
@@ -428,6 +430,104 @@ describe("computeCompositeLayout", () => {
expect(cover("dual-frame", null)).toBe(false);
});
+ // ─── block layouts: the frame is the screen's container ────────────────────
+
+ // There the frame stays at rest around the screen while the footage zooms inside it (`ScreenMask`),
+ // so the block lays out the frame, not just the screen: the camera lines up with the frame's
+ // body, and keeps the gap to everything the frame draws, a laptop's deck or a monitor's stand.
+ const expand = (r: RenderRect, [left, top, right, bottom]: Insets): RenderRect => ({
+ x: r.x - left,
+ y: r.y - top,
+ width: r.width + left + right,
+ height: r.height + top + bottom,
+ });
+ // Two pixels: every edge is snapped to a whole pixel, the frame measured on the snapped screen.
+ const near = (actual: number, expected: number, tolerance = 2) =>
+ expect(Math.abs(actual - expected)).toBeLessThanOrEqual(tolerance);
+
+ for (const layoutPreset of ["dual-frame", "vertical-stack"] as const) {
+ for (const frame of ["window", "laptop", "phone", "monitor"] as const) {
+ for (const scene of SCENES) {
+ it(`${layoutPreset} under a ${frame} in scene ${scene.label}: the camera lines up with the frame and clears it`, () => {
+ const padded = paddedContentSize(scene.size, 50, false);
+ const layout = computeCompositeLayout({
+ canvasSize: scene.size,
+ maxContentSize: padded,
+ screenSize: { width: 1920, height: 1080 },
+ webcamSize: CAM,
+ layoutPreset,
+ frame,
+ })!;
+ const screen = layout.screenRect;
+ const cam = layout.webcamRect!;
+ const { body, outer } = frameFootprint(frame, screen, frameUnit(screen, scene.size));
+ const shell = expand(screen, body);
+ const drawn = expand(screen, outer);
+
+ expect(screen.width / screen.height).toBeCloseTo(16 / 9, 1);
+ expect(layout.screenCover).toBe(true);
+ const gap = 0.02 * screen.width;
+ if (layoutPreset === "dual-frame") {
+ near(cam.y, shell.y);
+ near(cam.height, shell.height);
+ near(cam.x - (drawn.x + drawn.width), gap);
+ } else {
+ near(cam.x, shell.x);
+ near(cam.width, shell.width);
+ near(cam.y - (drawn.y + drawn.height), gap);
+ }
+
+ // Frame and camera together: contained in the padded area, touching it on one
+ // axis, and centred in the scene.
+ const left = Math.min(drawn.x, cam.x);
+ const top = Math.min(drawn.y, cam.y);
+ const right = Math.max(drawn.x + drawn.width, cam.x + cam.width);
+ const bottom = Math.max(drawn.y + drawn.height, cam.y + cam.height);
+ expect(right - left).toBeLessThanOrEqual(padded.width + 2);
+ expect(bottom - top).toBeLessThanOrEqual(padded.height + 2);
+ expect(
+ Math.min(padded.width - (right - left), padded.height - (bottom - top)),
+ ).toBeLessThanOrEqual(2);
+ near(left, scene.size.width - right, 2);
+ near(top, scene.size.height - bottom, 2);
+ });
+ }
+ }
+ }
+
+ it("lays a block out exactly as before without a frame", () => {
+ for (const layoutPreset of ["dual-frame", "vertical-stack"] as const) {
+ for (const scene of SCENES) {
+ const args = {
+ canvasSize: scene.size,
+ maxContentSize: paddedContentSize(scene.size, 50, false),
+ screenSize: { width: 1920, height: 1080 },
+ webcamSize: CAM,
+ layoutPreset,
+ };
+ expect(computeCompositeLayout({ ...args, frame: "none" })).toEqual(
+ computeCompositeLayout(args),
+ );
+ }
+ }
+ });
+
+ it.each([
+ "picture-in-picture",
+ "no-webcam",
+ ] as const)("leaves %s alone under a frame: the frame grows into the padding there", (layoutPreset) => {
+ const args = {
+ canvasSize: { width: 1920, height: 1080 },
+ maxContentSize: { width: 1536, height: 864 },
+ screenSize: { width: 1920, height: 1080 },
+ webcamSize: CAM,
+ layoutPreset,
+ };
+ for (const frame of ["window", "laptop", "phone", "monitor"] as const) {
+ expect(computeCompositeLayout({ ...args, frame })).toEqual(computeCompositeLayout(args));
+ }
+ });
+
it("forces circular and square masks to use square dimensions", () => {
const circularLayout = computeCompositeLayout({
canvasSize: { width: 1920, height: 1080 },
diff --git a/src/lib/compositeLayout.ts b/src/lib/compositeLayout.ts
index 4c5099cfd..5e165f54f 100644
--- a/src/lib/compositeLayout.ts
+++ b/src/lib/compositeLayout.ts
@@ -1,5 +1,7 @@
+import { frameFootprint, frameUnit } from "@/lib/frameFootprint";
import {
DEFAULT_WEBCAM_ROUNDNESS,
+ type RecordingFrame,
WEBCAM_SIZE_MAX,
WEBCAM_SIZE_MIN,
type WebcamAnchor,
@@ -291,15 +293,15 @@ export function getWebcamLayoutCssBoxShadow(
}
/**
- * A block's footprint in UNIT space, where the screen is exactly 1 wide: the screen, the
- * gap, and a camera `cameraAlong` long on the split axis. One definition for the layout
- * below and for the resting shape Auto frames, so the two cannot disagree on it.
+ * A block's footprint in UNIT space, where the screen is exactly 1 wide: the screen's element
+ * (the screen, or the frame around it), the gap, and a camera `cameraAlong` long on the split
+ * axis. One definition for the layout below and for the resting shape Auto frames, so the two
+ * cannot disagree on it.
*/
-function blockUnitSize(screenAspect: number, block: BlockTransform, cameraAlong: number): Size {
- const unitScreenHeight = 1 / screenAspect;
+function blockUnitSize(element: Size, block: BlockTransform, cameraAlong: number): Size {
return block.direction === "row"
- ? { width: 1 + block.gapFraction + cameraAlong, height: unitScreenHeight }
- : { width: 1, height: unitScreenHeight + block.gapFraction + cameraAlong };
+ ? { width: element.width + block.gapFraction + cameraAlong, height: element.height }
+ : { width: element.width, height: element.height + block.gapFraction + cameraAlong };
}
/**
@@ -313,7 +315,7 @@ export function restingCompositionAspect(screenSize: Size, preset: WebcamLayoutP
const transform = getWebcamLayoutPresetDefinition(preset).transform;
if (transform.type !== "block") return screenAspect;
const cameraCross = transform.direction === "row" ? 1 / screenAspect : 1;
- const block = blockUnitSize(screenAspect, transform, cameraCross);
+ const block = blockUnitSize({ width: 1, height: 1 / screenAspect }, transform, cameraCross);
return block.width / block.height;
}
@@ -368,6 +370,11 @@ export function computeCompositeLayout(params: {
webcamMaskShape?: import("@/components/video-editor/types").WebcamMaskShape;
/** Picture-in-picture only: 0 square corners to 1 fully round. */
webcamRoundness?: number;
+ /**
+ * Block layouts only: the frame around the screen. There it is the screen's fixed container,
+ * so the block makes room for it; everywhere else it grows into the padding.
+ */
+ frame?: RecordingFrame;
}): WebcamCompositeLayout | null {
const {
canvasSize,
@@ -379,6 +386,7 @@ export function computeCompositeLayout(params: {
webcamAnchor = "bottom-right",
webcamMaskShape = "rectangle",
webcamRoundness = DEFAULT_WEBCAM_ROUNDNESS,
+ frame = "none",
} = params;
const { width: canvasWidth, height: canvasHeight } = canvasSize;
const { width: screenWidth, height: screenHeight } = screenSize;
@@ -429,10 +437,22 @@ export function computeCompositeLayout(params: {
const gap = block.gapFraction;
const isRow = block.direction === "row";
+ // The frame, at rest, in the same unit space. Here it is the screen's container: it
+ // neither zooms nor tilts (the footage does, inside it), so the block lays it out like
+ // the screen itself. Its BODY is what the camera lines up with; what sticks out of the
+ // body (a laptop's deck, a monitor's stand) keeps the gap to the camera. Without a frame
+ // every inset is 0 and the arithmetic below is the frameless one, term for term.
+ const unitScreen = { width: 1, height: unitScreenHeight };
+ const { body, outer } = frameFootprint(frame, unitScreen, frameUnit(unitScreen, canvasSize));
+ const element = {
+ width: outer[0] + 1 + outer[2],
+ height: outer[1] + unitScreenHeight + outer[3],
+ };
+
// The camera shares the screen's cross-edge (same height beside it, same
// width under it — the aligned edge that makes them one solid block), so its
- // size ALONG the split axis is the one free dimension. Three constraints fix
- // it, in order:
+ // size ALONG the split axis is the one free dimension. Under a frame, the cross-edge
+ // is the frame's body. Three constraints fix it, in order:
// 1. screen keeps its own aspect ratio → screen is 1 × h, untouched;
// 2. the block contain-fits the padded area → pick `along` so the block's
// aspect equals that area's (fills it, no bars) — see `alongForFill`;
@@ -447,23 +467,19 @@ export function computeCompositeLayout(params: {
// the block at rest, so the camera comes out square there by construction.
const contentWidth = Math.min(canvasWidth, Math.max(1, maxContentSize.width));
const contentHeight = Math.min(canvasHeight, Math.max(1, maxContentSize.height));
- const cameraCross = isRow ? unitScreenHeight : 1;
+ const cameraCross = isRow ? body[1] + unitScreenHeight + body[3] : body[0] + 1 + body[2];
const contentAspect = contentWidth / contentHeight;
const alongForFill = isRow
- ? contentAspect * unitScreenHeight - 1 - gap // block width = 1 + gap + along
- : 1 / contentAspect - unitScreenHeight - gap; // block height = h + gap + along
+ ? contentAspect * element.height - element.width - gap // block width = w + gap + along
+ : element.width / contentAspect - element.height - gap; // block height = h + gap + along
const cameraAlong = Math.min(
cameraCross * BLOCK_CAMERA_ASPECT_TOLERANCE,
Math.max(cameraCross / BLOCK_CAMERA_ASPECT_TOLERANCE, alongForFill),
);
- const unitCameraWidth = isRow ? cameraAlong : 1;
- const unitCameraHeight = isRow ? unitScreenHeight : cameraAlong;
- const { width: blockWidth, height: blockHeight } = blockUnitSize(
- screenAspect,
- block,
- cameraAlong,
- );
+ const unitCameraWidth = isRow ? cameraAlong : cameraCross;
+ const unitCameraHeight = isRow ? cameraCross : cameraAlong;
+ const { width: blockWidth, height: blockHeight } = blockUnitSize(element, block, cameraAlong);
// Contain-fit the whole block into the padded content area, so padding
// shrinks the BLOCK (not just the screen) and padding 0 leaves it flush
@@ -474,10 +490,16 @@ export function computeCompositeLayout(params: {
const originX = (canvasWidth - blockWidth * scale) / 2;
const originY = (canvasHeight - blockHeight * scale) / 2;
- const screenRect = snapRect(originX, originY, scale, unitScreenHeight * scale);
+ const screenRect = snapRect(
+ originX + outer[0] * scale,
+ originY + outer[1] * scale,
+ scale,
+ unitScreenHeight * scale,
+ );
+ // Beside or under the whole frame, lined up with its body.
const cameraRect = snapRect(
- isRow ? originX + (1 + gap) * scale : originX,
- isRow ? originY : originY + (unitScreenHeight + gap) * scale,
+ isRow ? originX + (element.width + gap) * scale : originX + (outer[0] - body[0]) * scale,
+ isRow ? originY + (outer[1] - body[1]) * scale : originY + (element.height + gap) * scale,
unitCameraWidth * scale,
unitCameraHeight * scale,
);
diff --git a/src/lib/frameFootprint.test.ts b/src/lib/frameFootprint.test.ts
new file mode 100644
index 000000000..5dc1aa556
--- /dev/null
+++ b/src/lib/frameFootprint.test.ts
@@ -0,0 +1,37 @@
+import { describe, expect, it } from "vitest";
+import { frameFootprint, frameUnit } from "./frameFootprint";
+
+describe("frameFootprint", () => {
+ // A 16:9 screen filling 80% of a 16:9 output: the case the compositor's
+ // `the_device_footprint_at_rest_is_pinned_for_the_block_layout` measures with its own model.
+ const screen = { width: 1536, height: 864 };
+ const unit = frameUnit(screen, { width: 1920, height: 1080 });
+
+ it("measures the frame unit off the output's short side", () => {
+ expect(unit).toBe(864);
+ // Same unit around a portrait clip that touches the same padded area.
+ expect(frameUnit({ width: 486, height: 864 }, { width: 1920, height: 1080 })).toBe(864);
+ });
+
+ it.each([
+ ["laptop", [0.18596, 0.0409, 0.18596, 0.09983]],
+ ["phone", [0.0193, 0.0193, 0.0193, 0.0193]],
+ ["monitor", [0.0231, 0.0231, 0.0231, 0.2446]],
+ ] as const)("measures the %s at rest exactly as the compositor draws it", (frame, want) => {
+ const { body, outer } = frameFootprint(frame, screen, unit);
+ outer.forEach((inset, k) => expect(inset / unit).toBeCloseTo(want[k], 4));
+ // The body is the front face; the deck and the stand only ever add to it.
+ body.forEach((inset, k) => expect(outer[k]).toBeGreaterThanOrEqual(inset - 1e-9));
+ });
+
+ it("draws nothing without a frame, and the window chrome flat around the screen", () => {
+ expect(frameFootprint("none", screen, unit)).toEqual({
+ body: [0, 0, 0, 0],
+ outer: [0, 0, 0, 0],
+ });
+ const window = frameFootprint("window", screen, unit);
+ expect(window.outer).toEqual(window.body);
+ expect(window.body[1] / unit).toBeCloseTo(0.04, 6); // the title bar
+ expect(window.body[0] / unit).toBeCloseTo(0.0012, 6); // the line around the rest
+ });
+});
diff --git a/src/lib/frameFootprint.ts b/src/lib/frameFootprint.ts
new file mode 100644
index 000000000..e625f6514
--- /dev/null
+++ b/src/lib/frameFootprint.ts
@@ -0,0 +1,143 @@
+import type { RecordingFrame } from "@/lib/projectDefaults";
+
+interface Size {
+ width: number;
+ height: number;
+}
+
+/** Insets around the screen box: `[left, top, right, bottom]`. */
+export type Insets = [number, number, number, number];
+
+/**
+ * What a frame draws around the screen AT REST (flat, unzoomed), as insets from the screen box.
+ *
+ * The native compositor draws the frames (`frame_geometry.rs`); this only measures them, for the
+ * one layout family that must keep them clear of something: the block layouts, where the frame
+ * is the screen's fixed container and sits next to the camera (`ScreenMask`). Everywhere else a
+ * frame grows outward into the padding and zooms with the screen, and nothing lays out around it.
+ */
+export interface FrameFootprint {
+ /** The frame's body: the window chrome, or a device's front face around its screen. */
+ body: Insets;
+ /** Everything it draws: the body, plus what sticks out of it, the laptop's deck or the monitor's stand. */
+ outer: Insets;
+}
+
+// Mirror of `frame_geometry.rs`, every length in frame units (`frameUnit`).
+const WINDOW_FRAME_BAR = 0.04;
+const WINDOW_FRAME_LINE = 0.0012;
+const DEV_RIM = 0.0053;
+/** Black glass of each device's bezel: sides and top, then bottom. */
+const DEV_BEZEL = { laptop: [0.0356, 0.0409], phone: [0.014, 0.014], monitor: [0.0178, 0.0178] };
+const DEV_THICKNESS = { laptop: 0.0284, phone: 0.05, monitor: 0.0284 };
+const DEV_EYE_MIN = 9.6;
+const PERSPECTIVE_FACTOR = 1.6;
+const DEV_DECK_LEN = 1.3;
+const DEV_DECK_GAP = 0.0093;
+const DEV_DECK_THICK = 0.0446;
+const DEV_DECK_EYE_CLEARANCE = 0.0178;
+const DEV_HINGE_MIN_RAD = 1.047198;
+const DEV_HINGE_MAX_RAD = 2.356194;
+const DEV_NECK_W = 0.255;
+const DEV_NECK_LEN = 0.177;
+const DEV_FOOT_W = 0.456;
+const DEV_FOOT_H = 0.0456;
+const DEV_STAND_Z = 0.0219;
+const DEV_FOOT_Z = 0.195;
+
+const NO_INSETS: Insets = [0, 0, 0, 0];
+
+/**
+ * The frame unit (`frame_unit_px`): the output's short side, scaled by the share of the output
+ * the screen box fills in its fuller dimension. Same unit on x and y, in the unit of `screen`
+ * once `canvas` shares it.
+ */
+export function frameUnit(screen: Size, canvas: Size): number {
+ return (
+ Math.max(screen.width / canvas.width, screen.height / canvas.height) *
+ Math.min(canvas.width, canvas.height)
+ );
+}
+
+/** `device_deck_angle`: the laptop's deck, seen edge-on from the flat camera. */
+function deckAngle(half: [number, number], chin: number, thick: number): number {
+ const eye = Math.max(2 * Math.min(half[0], half[1]) * PERSPECTIVE_FACTOR, DEV_EYE_MIN);
+ const h = half[1] + chin;
+ const opening = Math.atan((eye + thick * 0.5) / Math.max(h - DEV_DECK_EYE_CLEARANCE, 1e-3));
+ return Math.PI - Math.min(DEV_HINGE_MAX_RAD, Math.max(DEV_HINGE_MIN_RAD, opening));
+}
+
+/** The eight corners of an axis-aligned box. */
+function boxCorners(lo: number[], hi: number[]): number[][] {
+ return Array.from({ length: 8 }, (_, i) => [
+ i & 1 ? hi[0] : lo[0],
+ i & 2 ? hi[1] : lo[1],
+ i & 4 ? hi[2] : lo[2],
+ ]);
+}
+
+/**
+ * The footprint of `frame` around a screen box of size `screen`, for a frame unit `unit` in the
+ * same unit; the insets come back in it too.
+ *
+ * A device's body is its front face, whose projection at rest IS its rect. What sticks out of it
+ * goes through `DeviceView::project` at rest: the camera looks straight at the screen, the relief
+ * from the model eye `DEV_EYE_MIN` units away, so a point `(x, y, z)` of the model (screen centre
+ * at the origin, z toward the viewer) lands on `(x, y) · E / (E − z)`.
+ */
+export function frameFootprint(frame: RecordingFrame, screen: Size, unit: number): FrameFootprint {
+ if (frame === "none" || !(unit > 0)) return { body: NO_INSETS, outer: NO_INSETS };
+ if (frame === "window") {
+ const line = WINDOW_FRAME_LINE * unit;
+ const body: Insets = [line, WINDOW_FRAME_BAR * unit, line, line];
+ return { body, outer: body };
+ }
+ const [side, bottom] = DEV_BEZEL[frame];
+ const margins = [side + DEV_RIM, side + DEV_RIM, side + DEV_RIM, bottom + DEV_RIM];
+ const half: [number, number] = [screen.width / (2 * unit), screen.height / (2 * unit)];
+ const thick = DEV_THICKNESS[frame];
+ // The body, centred on the screen: its bottom edge is where the deck hinges and the stand hangs.
+ const lo = [-half[0] - margins[0], -half[1] - margins[1]];
+ const hi = [half[0] + margins[2], half[1] + margins[3]];
+ const extra: number[][] = [];
+ if (frame === "laptop") {
+ const angle = deckAngle(half, margins[3], thick);
+ const [ca, sa] = [Math.cos(angle), Math.sin(angle)];
+ const hinge = [hi[1], -thick * 0.5];
+ for (const [x, y, z] of boxCorners(
+ [lo[0], DEV_DECK_GAP, -DEV_DECK_THICK],
+ [hi[0], DEV_DECK_GAP + DEV_DECK_LEN, 0],
+ )) {
+ extra.push([x, hinge[0] + y * ca - z * sa, hinge[1] + y * sa + z * ca]);
+ }
+ } else if (frame === "monitor") {
+ const [y0, z0] = [hi[1], -thick * 0.5];
+ extra.push(
+ ...boxCorners(
+ [-DEV_NECK_W, y0 - 0.01, z0 - DEV_STAND_Z],
+ [DEV_NECK_W, y0 + DEV_NECK_LEN, z0],
+ ),
+ ...boxCorners(
+ [-DEV_FOOT_W, y0 + DEV_NECK_LEN - 0.01, z0 - DEV_FOOT_Z],
+ [DEV_FOOT_W, y0 + DEV_NECK_LEN + DEV_FOOT_H, z0],
+ ),
+ );
+ }
+ const outer = [...lo, ...hi];
+ for (const [x, y, z] of extra) {
+ const k = DEV_EYE_MIN / (DEV_EYE_MIN - z);
+ outer[0] = Math.min(outer[0], x * k);
+ outer[1] = Math.min(outer[1], y * k);
+ outer[2] = Math.max(outer[2], x * k);
+ outer[3] = Math.max(outer[3], y * k);
+ }
+ return {
+ body: margins.map((m) => m * unit) as Insets,
+ outer: [
+ (-outer[0] - half[0]) * unit,
+ (-outer[1] - half[1]) * unit,
+ (outer[2] - half[0]) * unit,
+ (outer[3] - half[1]) * unit,
+ ],
+ };
+}
diff --git a/src/native/sceneDescription.ts b/src/native/sceneDescription.ts
index b81e7f416..323a46029 100644
--- a/src/native/sceneDescription.ts
+++ b/src/native/sceneDescription.ts
@@ -1121,6 +1121,7 @@ export function buildSceneDescription(
webcamAnchor: settings.webcamAnchor,
webcamMaskShape: settings.webcamMaskShape,
webcamRoundness: settings.webcamRoundness,
+ frame: settings.frame,
});
};
const toFrameFractions = (r: RenderRect) => ({
diff --git a/technical-documentation/architecture/native-compositor.md b/technical-documentation/architecture/native-compositor.md
index 1de664dfe..90ef193ab 100644
--- a/technical-documentation/architecture/native-compositor.md
+++ b/technical-documentation/architecture/native-compositor.md
@@ -97,6 +97,13 @@ what `shaders.hlsl` actually implements:
[`compositor.rs:1950`](../../crates/compositor/src/compositor_windows.rs)). Motion blur
uses the previous frame's UV delta as a per-pixel velocity vector and samples
along it (the "blur by velocity" optimisation — early-outs on still frames).
+ In the block layouts (Side by side, Top / bottom) the screen's slot is a fixed
+ container that masks it (`ScreenMask` in
+ [`frame_geometry.rs`](../../crates/compositor/src/frame_geometry.rs)): the zoom
+ and the 3D tilt act on the footage and are cropped to the slot. Under a window
+ or device frame, the frame is that container, drawn at rest around the slot and
+ never zoomed or tilted, and `computeCompositeLayout` makes room for it beside the
+ camera. Everywhere else the frame zooms and tilts with the screen.
4. **Cursor.** A sprite picked from `cursor.cursorSprites` by the OS cursor state
recorded in the `.cursor.json` track (`arrow`, `text`, `pointer`, the resize
handles…), anchored so the sprite's hotspot — a 0..1 fraction of its own image,
diff --git a/technical-documentation/testing/manual-e2e-checklist.md b/technical-documentation/testing/manual-e2e-checklist.md
index 313f12ed1..37a5ebc9d 100644
--- a/technical-documentation/testing/manual-e2e-checklist.md
+++ b/technical-documentation/testing/manual-e2e-checklist.md
@@ -640,3 +640,4 @@ The mask comes from the native compositor (ONNX Runtime + the vendored selfie-se
| 2026-09-26 | worktree `motion-blur-padding-issue-11befb`, `claude/motion-blur-padding-issue-11befb` on `1a669c22` (#794); `compositor_view.node` built from this tree (`cargo build -p compositor-view-napi --release`), baseline addon built the same way from `218bdbb0` (`main`); ffmpeg DLLs hash-identical to the vendored SDK; renderer rebuilt with `npm run build-vite`, plus a local, uncommitted pass-through of `editor.frame` in `normalizeProjectEditor` (the v2 CLI path drops it) | Windows 11 26200, NVENC export | Partial — one defect found and fixed | **Motion blur of the framed screen, through the app's real export (`electron . export <project> -o <mp4>`).** Legacy 16:9 project: phone frame, padding 50, motion blur 1, shadow 0.6, a depth-3 zoom on [3 s, 8 s]; sources: synthetic 1920×1080 `testsrc2`, then solid red and solid green to isolate the footage (red/green difference). Static frames: only encoder noise between the two addons. Ramps (60 fps frames 132 and 501): the baseline keeps the shell's rim and bezel razor-sharp around a smeared picture; the new addon smears them with it (87–109k px of shell and shadow change that are never footage). Footage outside the union of the sharp apertures at n−1 and n, +2 px: **1,185 px** on one frame at first (a ~20 % tint over the bezel in the four output corners, where the phone overflows the output), fixed in `1a669c22`, then **0 px over all 55 moving frames**. **Not covered:** the GUI editor preview (same compositor path, not driven), window chrome and laptop/monitor frames on this machine (window chrome covered by the Linux lavapipe test), macOS (Metal not compiled here). |
| 2026-09-26 | worktree `motion-blur-padding-issue-11befb`, branch `claude/cli-export-documents` on `218bdbb0` + this change; renderer rebuilt with `npm run build-vite`; `compositor_view.node` the one in the worktree's `electron/native/bin/win32-x64` (loading, not rendering, was under test) | Windows 11 26200, NVENC export | Partial — no defect | **`openscreen export` on a project saved by the editor, through the app's real CLI (`electron . export <project> -o <mp4> --json`).** Before: a copy of a real schema-7 editor project (`%APPDATA%/openscreen/projects/proj_741d2d06…`, monitor frame, 2 zooms with a 3D camera, 2 trims, speed regions ×5 and ×2 in `legacyEditor`) failed at once with `Project file is not a valid .openscreen project`. After: exported in 34 s, 1920×1080 60 fps, **21.62 s against 21.58 s expected** (38.25 s − 4.60 s of trims − 9.44 s and 2.63 s taken by the two speed regions); the frame at 2 s shows the zoomed, tilted screen inside the monitor bezel. `info` on the same copy: version 8 after the load-time upgrade, the recording found, 2 zooms, 2 trims (its speed count, read from `legacyEditor.speedRegions`, was fixed after this run and is covered by `projectCommands.test.ts`). `pack` refuses it with `pack does not support projects saved by the editor yet`. A legacy v2 project (synthetic 4 s `testsrc2`, one zoom) still exports: 4.00 s. The original project file was only copied, hash-identical afterwards. **Not covered:** `pack` for documents (refused, not implemented), `captions` (its runner still reads v2 only), a document whose media moved (relink is the editor's own, unit-tested there), macOS and Linux. |
| 2026-09-26 | worktree `fix-3d-cameras-left-right-02603d`, `claude/fix-3d-cameras-left-right-02603d` on `cbf85dc7` + this change; `compositor_view.node` rebuilt from this tree by `npm run build:native:compositor`, the rest of `bin/win32-x64` copied from the installed `v1.13.0-rc.6` (ffmpeg DLLs hash-identical to the vendored SDK); renderer rebuilt with `npm run build-vite`. Reference: installed `v1.13.0-rc.6` (= v1.13.0) through its own CLI | Windows 11 26200, NVENC export | Partial — no defect | **3D cameras against v1.13.0, `openscreen export` on both builds**, same synthetic 14 s 1080p grid and cursor sidecar (three held positions), zoom depth 2, `hideCursor`, motion blur 0. During the hold (2.5, 3.5, 7.5, 11.5 s), `left` here and `iso` in v1.13.0 differ only in a ~50×65 px box around the cursor sprite (0.05–0.09 % of pixels > 24; the cursor size changed since); same for `follow-cursor`. `iso` here renders byte-identical to `left`. `right` is the mirror of `left`: screen edge 1–2 px apart, row by row. With motion blur 0.35 the orbit differs while the camera moves (mean abs diff 9, 9 % of pixels): the mode-8 trail added on 25/09, kept on purpose. Not covered: editor preview, GUI, macOS and Linux, zoom ramps (their pacing changed with #683). |
+| 2026-09-26 | worktree `openscreen-screen-mask-zoom-e21ce9`, `claude/openscreen-screen-mask-zoom-e21ce9` on `1d67754c` (`integration/demo-never-ugly`) + the frame-container change; `compositor_view.node` rebuilt from this tree by `npm run build:native:compositor`, baseline addon and renderer built from `1d67754c` in a scratch worktree; ffmpeg DLLs hash-identical to the vendored SDK; renderer rebuilt with `vite build` | Windows 11 26200, h264 export | Partial — no defect | **Block layouts under a window or device frame: the frame is the fixed container, the footage zooms and tilts inside it, and the block lays the frame out beside the camera. Through the app's real export (`electron . export <project> -o <mp4>`).** Source: synthetic 1920×1080 `testsrc2` screen and 1280×720 `mandelbrot` webcam, 8 s. Legacy projects, default padding, a depth-4 zoom at focus (0.3, 0.6) on [1.5 s, 3.5 s] and a depth-3 `iso` zoom on [5.5 s, 7.8 s], frames at 0.2, 2.8 and 7.0 s. `dual-frame` (16:9) and `vertical-stack` (9:16) under window, laptop, phone and monitor. Baseline: the whole frame zooms and tilts over the camera, and at rest the laptop's deck and the monitor's stand run under it. New: the frame stays at rest, lined up with the camera on its body, deck and stand clear of it; the flat zoom and the `iso` tilt stay inside the aperture, over the device's black glass or the window chrome's fill, with square top corners under the title bar. `picture-in-picture` with and without a laptop, `no-webcam` with a laptop, and both block layouts without a frame: every decoded frame identical to the baseline (framemd5, 480 video frames plus audio). **Not covered:** the GUI editor preview (same `plan_frame` and `computeCompositeLayout`, not driven), `follow-cursor` inside a frame (unit-tested only), the Auto format with a frame in a block layout (its resting shape ignores the frame, so the camera is not exactly square there), macOS and Linux rendering (WGSL validated with naga, Metal not compiled). |