image-copy: Use damage_output() for additional damage
The important change here is that we now apply the additional damage first, instead of using `.extend()` to add it after other elements. This is important since `OutputDamageTracker` will ignore our damage elements if there are behind an element with an opaque region. This also makes things a bit simpler, especially `take_screencopy_frames()`, which no longer needs a mutable references to extend then truncate. The implementation of `OutputDamageTracker` isn't entirely clear, but as far as I can tell this is intended to work, and it seems to work in some testing.
This commit is contained in:
parent
cac7a5aca6
commit
9bc1b6e1ee
4 changed files with 74 additions and 113 deletions
|
|
@ -1393,21 +1393,20 @@ where
|
|||
)?;
|
||||
|
||||
let old_len = elements.len();
|
||||
elements.extend(
|
||||
additional_damage
|
||||
.into_iter()
|
||||
.map(|rect| {
|
||||
rect.to_f64()
|
||||
.to_logical(
|
||||
output.current_scale().fractional_scale(),
|
||||
output.current_transform(),
|
||||
&area,
|
||||
)
|
||||
.to_i32_round()
|
||||
})
|
||||
.map(DamageElement::new)
|
||||
.map(Into::into),
|
||||
);
|
||||
let additional_damage_elements: Vec<_> = additional_damage
|
||||
.into_iter()
|
||||
.map(|rect| {
|
||||
rect.to_f64()
|
||||
.to_logical(
|
||||
output.current_scale().fractional_scale(),
|
||||
output.current_transform(),
|
||||
&area,
|
||||
)
|
||||
.to_i32_round()
|
||||
})
|
||||
.map(DamageElement::new)
|
||||
.collect();
|
||||
dt.damage_output(age, &additional_damage_elements)?;
|
||||
|
||||
Some(old_len)
|
||||
} else {
|
||||
|
|
@ -1513,7 +1512,7 @@ where
|
|||
CosmicMappedRenderElement<R>: RenderElement<R>,
|
||||
WorkspaceRenderElement<R>: RenderElement<R>,
|
||||
{
|
||||
let mut elements: Vec<CosmicElement<R>> = workspace_elements(
|
||||
let elements: Vec<CosmicElement<R>> = workspace_elements(
|
||||
gpu,
|
||||
renderer,
|
||||
shell,
|
||||
|
|
@ -1528,13 +1527,12 @@ where
|
|||
|
||||
if let Some(additional_damage) = additional_damage {
|
||||
let output_geo = output.geometry().to_local(output).as_logical();
|
||||
elements.extend(
|
||||
additional_damage
|
||||
.into_iter()
|
||||
.filter_map(|rect| rect.intersection(output_geo))
|
||||
.map(DamageElement::new)
|
||||
.map(Into::<CosmicElement<R>>::into),
|
||||
);
|
||||
let additional_damage_elements: Vec<_> = additional_damage
|
||||
.into_iter()
|
||||
.filter_map(|rect| rect.intersection(output_geo))
|
||||
.map(DamageElement::new)
|
||||
.collect();
|
||||
damage_tracker.damage_output(age, &additional_damage_elements)?;
|
||||
}
|
||||
|
||||
let res = damage_tracker.render_output(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue