Unify Animation- and RenderSnapshot

This commit is contained in:
Ivan Molodetskikh
2024-04-13 14:16:07 +04:00
parent 71be19b234
commit 9d5f1c7ef7
10 changed files with 188 additions and 187 deletions
+1 -24
View File
@@ -1,7 +1,6 @@
use std::ptr;
use anyhow::{ensure, Context};
use niri_config::BlockOutFrom;
use smithay::backend::allocator::Fourcc;
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
use smithay::backend::renderer::element::texture::{TextureBuffer, TextureRenderElement};
@@ -27,6 +26,7 @@ pub mod render_elements;
pub mod renderer;
pub mod resources;
pub mod shaders;
pub mod snapshot;
pub mod surface;
/// What we're rendering for.
@@ -49,19 +49,6 @@ pub struct BakedBuffer<B> {
pub dst: Option<Size<i32, Logical>>,
}
/// Snapshot of a render.
#[derive(Debug)]
pub struct RenderSnapshot<C, B> {
/// Contents for a normal render.
pub contents: Vec<C>,
/// Blocked-out contents.
pub blocked_out_contents: Vec<B>,
/// Where the contents were blocked out from at the time of the snapshot.
pub block_out_from: Option<BlockOutFrom>,
}
pub trait ToRenderElement {
type RenderElement;
@@ -118,16 +105,6 @@ impl ToRenderElement for BakedBuffer<SolidColorBuffer> {
}
}
impl<C, B> Default for RenderSnapshot<C, B> {
fn default() -> Self {
Self {
contents: Default::default(),
blocked_out_contents: Default::default(),
block_out_from: Default::default(),
}
}
}
pub fn render_to_encompassing_texture(
renderer: &mut GlesRenderer,
scale: Scale<f64>,