Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/renderer/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,8 @@ fn resolve_capture_region_to_viewport(
let overlap_right = capture_right.min(physical_size.0 as i32);
let overlap_bottom = capture_bottom.min(physical_size.1 as i32);

let overlap_width = overlap_right.saturating_sub(overlap_left) as u32;
let overlap_height = overlap_bottom.saturating_sub(overlap_top) as u32;
let overlap_width = overlap_right.saturating_sub(overlap_left).max(0) as u32;
let overlap_height = overlap_bottom.saturating_sub(overlap_top).max(0) as u32;
let has_overlap = overlap_width > 0 && overlap_height > 0;

BackdropCaptureRegion {
Expand Down Expand Up @@ -1918,6 +1918,17 @@ mod tests {
assert_eq!(region.copy_size, (30, 20));
}

#[test]
fn capture_region_skips_copy_when_fully_offscreen() {
let offscreen_right = resolve_capture_region_to_viewport((110, 5, 20, 20), (100, 100));
let offscreen_bottom = resolve_capture_region_to_viewport((5, 110, 20, 20), (100, 100));

assert_eq!(offscreen_right.copy_source_origin, None);
assert_eq!(offscreen_right.copy_size, (0, 20));
assert_eq!(offscreen_bottom.copy_source_origin, None);
assert_eq!(offscreen_bottom.copy_size, (20, 0));
}

#[test]
fn inflate_logical_rect_expands_symmetrically() {
let rect = inflate_logical_rect([(10.0, 20.0), (30.0, 40.0)], 5.0);
Expand Down
2 changes: 1 addition & 1 deletion src/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ fn normalized_float_bits(value: f32) -> u32 {
fn build_boundary_data(vertices: &[CustomVertex], indices: &[u16], scratch: &mut AaFringeScratch) {
scratch.clear();

for (triangle_index, tri) in indices.chunks_exact(3).enumerate() {
for (triangle_index, tri) in indices.as_chunks::<3>().0.iter().enumerate() {
let a = tri[0];
let b = tri[1];
let c = tri[2];
Expand Down
Loading