You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rust: Port the scene item crop arithmetic in obs-scene.c to obs-scene #1937
Port the scene item crop arithmetic in libobs/obs-scene.c.h / obs-scene.h to rust/obs-scene, in a new module crop, next to extent (#1922). The helpers #1840 made defined on every input are:
obs_scene_cropped_size(): the 64-bit crop sum against the source size;
obs_scene_scale_crop(): the nested-scene rescale, saturating with NaN mapped to 0;
obs_scene_crop_offset();
the negative-crop clamp in obs_sceneitem_set_crop().
These stay in C: calc_cx/calc_cy, update_nested_scene_crop (it computes the factors and writes the item), update_item_transform, render_item, the load clamp in scene_load_item, and crop_equal and the change check in the setter.
Plan (one PR)
A behaviour-neutral move of the helpers into libobs/obs-scene-crop.c.h (with its header), with hidden entry points and no EXPORT.
Characterization test_scene_item_crop, with these cases:
sums equal to and over the size, and sums past the int range;
negative crops through obs_sceneitem_set_crop (clamped);
a nested scene that grows and shrinks, through the exported setter and getter;
factors that are NaN, ±inf or huge, and crops at INT_MIN/INT_MAX.
RED, then GREEN: the safe Rust core plus shims in a libobs.ported-scene-crop group. The exported symbols are unchanged.
Tier 3 parity against the original C: a proptest over full i32 crops, u32 sizes and any-bit f32 factors, bit-equal. Also a deliberate-break check and port_comparison numbers.
These real-libobs tests must stay green on every lane: test_transform_clipboard, the group tests (test_group_child_drift, test_group_empty_bounds), and the crop tests from #1840.
Activity
rdoupe commentedon Oct 23, 2026
Claiming: #1937.
libobs: Move the scene item crop arithmetic out
test: Characterize the scene item crop arithmetic
obs-scene: Add the scene item crop arithmetic tests
obs-scene: Port the scene item crop arithmetic
obs-scene: Check the scene item crop port against the C
docs: Record the scene item crop port
libobs: Move the scene item crop arithmetic out
test: Characterize the scene item crop arithmetic
obs-scene: Add the scene item crop arithmetic tests
obs-scene: Port the scene item crop arithmetic
obs-scene: Check the scene item crop port against the C
docs: Record the scene item crop port
obs-scene: Port the scene item crop arithmetic (obs-rust#1947)