Skip to content

Commit

Permalink
Bug 1769492 - Don't assume that get_surface_rect returns a non-empty …
Browse files Browse the repository at this point in the history
…rect. r=gw

Differential Revision: https://phabricator.services.mozilla.com/D204228
  • Loading branch information
nical authored and web-flow committed Mar 15, 2024
1 parent 95d6dc5 commit 37f7722
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions webrender/src/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,10 +803,12 @@ fn prepare_interned_prim_for_render(
}
QuadRenderStrategy::Indirect => {
let surface = &frame_state.surfaces[pic_context.surface_index.0];
let clipped_surface_rect = surface.get_surface_rect(
let Some(clipped_surface_rect) = surface.get_surface_rect(
&prim_instance.vis.clip_chain.pic_coverage_rect,
frame_context.spatial_tree,
).expect("bug: what can cause this?");
) else {
return;
};

let p0 = clipped_surface_rect.min.to_f32();
let p1 = clipped_surface_rect.max.to_f32();
Expand Down Expand Up @@ -842,10 +844,12 @@ fn prepare_interned_prim_for_render(
QuadRenderStrategy::Tiled { x_tiles, y_tiles } => {
let surface = &frame_state.surfaces[pic_context.surface_index.0];

let clipped_surface_rect = surface.get_surface_rect(
let Some(clipped_surface_rect) = surface.get_surface_rect(
&prim_instance.vis.clip_chain.pic_coverage_rect,
frame_context.spatial_tree,
).expect("bug: what can cause this?");
) else {
return;
};

let unclipped_surface_rect = surface.map_to_device_rect(
&prim_instance.vis.clip_chain.pic_coverage_rect,
Expand Down Expand Up @@ -921,10 +925,12 @@ fn prepare_interned_prim_for_render(
}
QuadRenderStrategy::NinePatch { clip_rect, radius } => {
let surface = &frame_state.surfaces[pic_context.surface_index.0];
let clipped_surface_rect = surface.get_surface_rect(
let Some(clipped_surface_rect) = surface.get_surface_rect(
&prim_instance.vis.clip_chain.pic_coverage_rect,
frame_context.spatial_tree,
).expect("bug: what can cause this?");
) else {
return;
};

let unclipped_surface_rect = surface.map_to_device_rect(
&prim_instance.vis.clip_chain.pic_coverage_rect,
Expand Down Expand Up @@ -1355,10 +1361,12 @@ fn prepare_interned_prim_for_render(
let device_pixel_scale = surface.device_pixel_scale;
let raster_spatial_node_index = surface.raster_spatial_node_index;

let clipped_surface_rect = surface.get_surface_rect(
let Some(clipped_surface_rect) = surface.get_surface_rect(
&coverage_rect,
frame_context.spatial_tree,
).expect("bug: what can cause this?");
) else {
return;
};

// Draw a normal screens-space mask to an alpha target that
// can be sampled when compositing this picture.
Expand Down

0 comments on commit 37f7722

Please sign in to comment.