Skip to content

Commit fedbc93

Browse files
author
Glenn Watson
committed
Bug 1942959 - Fix clip rect that is applied to external swap chains with layer compositor enabled r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D235096
1 parent 2627ce9 commit fedbc93

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

webrender/src/composite.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,8 +1363,10 @@ pub trait Compositor {
13631363
// implemention should prepare
13641364
#[derive(Debug)]
13651365
pub struct CompositorInputLayer {
1366-
// Device space location and size of the layer
1367-
pub rect: DeviceIntRect,
1366+
// Device space location of the layer (pre-clip)
1367+
pub offset: DeviceIntPoint,
1368+
// Device space clip-rect of the layer
1369+
pub clip_rect: DeviceIntRect,
13681370
// Whether a content or external surface
13691371
pub usage: CompositorSurfaceUsage,
13701372
// If true, layer is opaque, blend can be disabled

webrender/src/renderer/mod.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3588,24 +3588,27 @@ impl Renderer {
35883588
};
35893589

35903590
if let Some(new_layer_kind) = new_layer_kind {
3591-
let (rect, is_opaque) = match usage {
3591+
let (offset, clip_rect, is_opaque) = match usage {
35923592
CompositorSurfaceUsage::Content => {
3593-
(device_size.into(), input_layers.is_empty())
3593+
(DeviceIntPoint::zero(), device_size.into(), input_layers.is_empty())
35943594
}
35953595
CompositorSurfaceUsage::External { .. } => {
35963596
let rect = composite_state.get_device_rect(
35973597
&tile.local_rect,
35983598
tile.transform_index
35993599
);
36003600

3601-
(rect.to_i32(), is_opaque)
3601+
let clip_rect = tile.device_clip_rect.to_i32();
3602+
3603+
(rect.min.to_i32(), clip_rect, is_opaque)
36023604
}
36033605
};
36043606

36053607
input_layers.push(CompositorInputLayer {
36063608
usage: new_layer_kind,
36073609
is_opaque,
3608-
rect,
3610+
offset,
3611+
clip_rect,
36093612
});
36103613

36113614
swapchain_layers.push(SwapChainLayer {
@@ -3635,7 +3638,8 @@ impl Renderer {
36353638
input_layers.push(CompositorInputLayer {
36363639
usage: CompositorSurfaceUsage::Content,
36373640
is_opaque: true,
3638-
rect: device_size.into(),
3641+
offset: DeviceIntPoint::zero(),
3642+
clip_rect: device_size.into(),
36393643
});
36403644

36413645
swapchain_layers.push(SwapChainLayer {
@@ -3675,7 +3679,7 @@ impl Renderer {
36753679
compositor.bind_layer(layer_index);
36763680

36773681
DrawTarget::NativeSurface {
3678-
offset: -layer.rect.min,
3682+
offset: -layer.offset,
36793683
external_fbo_id: 0,
36803684
dimensions: fb_draw_target.dimensions(),
36813685
}
@@ -3718,7 +3722,7 @@ impl Renderer {
37183722
compositor.add_surface(
37193723
layer_index,
37203724
transform,
3721-
layer.rect,
3725+
layer.clip_rect,
37223726
ImageRendering::Auto,
37233727
);
37243728
}

0 commit comments

Comments
 (0)