Skip to content

rust: Port the scene bounds placement in obs-scene.c to obs-scene #1637

Closed

Description

@nathan-v

Unit

calculate_bounds_data, add_alignment, and the crop_to_bounds predicate in libobs/obs-scene.c.h, to obs-scene.

Phase and position

Phase 6, tracked by #444. After the scale half (obs_bounds_fit_scale, #1468) and the scene blend lookups (#1520). #1616 folded those into one obs-scene crate, one module per extracted file.

Dependencies and existing tests

Depends on obs_bounds_fit_scale. test_scene_bounds_fit covers that scale half. test_group_empty_bounds covers an empty group through a real scene. Nothing pins alignment inside the box, the bounds crop, or the flip adjustment.

The first PR is the characterization. Move the placement math into obs_bounds_place (behavior-neutral, no Rust) and pin the current C behavior with cmocka. Absolute-versus-relative bounds stay in calculate_bounds_data, because that calls size_to_absolute and needs the scene. The Rust port is a later PR, after this one merges.

Notes

add_alignment stays a non-EXPORT symbol declared in obs-internal.h. Item alignment and transitions keep calling it. No public header change, and no intended behavior change. Odd cases (the width axis wins when both sides overflow, integer division toward zero, roundf half away from zero, a non-flipped crop discarding that axis of alignment) are pinned as characterized, not endorsed.

Activity

  1. nathan-v commented on Oct 21, 2026

    @nathan-v
    ContributorAuthor

    Claiming: scene bounds placement (calculate_bounds_data, add_alignment, and the crop_to_bounds predicate in libobs/obs-scene.c.h)

    1. This PR moves that math into obs_bounds_place and adds a cmocka test that pins the current C behavior. No Rust. Absolute-versus-relative bounds stay in calculate_bounds_data, because that still calls size_to_absolute.
    2. After it merges, a second PR ports obs_bounds_place to obs-scene (Tier 1 through Tier 3) and moves the file into a ported group.

    The first PR opens today.

  2. added
    claimed
    on Oct 21, 2026
  3. nathan-v commented on Oct 21, 2026

    @nathan-v
    ContributorAuthor

    Characterization is up: #1640

    It moves the placement math into obs_bounds_place and pins the current C with cmocka. No Rust. The port is the next PR, after this one merges.

  4. nathan-v commented on Oct 21, 2026

    @nathan-v
    ContributorAuthor

    Rust port draft: #1661

    RED 3b9c0ae73: all 16 safe-core mirrors fail on stubs. GREEN is local: focused Tier 1/layout/differential coverage passes, native workspace tests pass, and Clippy/Dylint pass. Linux Tier 2 is running locally before GREEN is pushed. No C test or public header edits; internal symbols stay hidden. No differences on C-defined conversions; out-of-range/nonfinite float-to-integer conversions are excluded from parity because C is undefined there (Rust saturates). The PR stays draft through current-head CI verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions