Skip to content

Commit

Permalink
drm/output: Add constructors for DrmOutputRenderElements
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Dec 16, 2024
1 parent 243fe88 commit 0f2e89f
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/backend/drm/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,19 +840,41 @@ where
_renderer: PhantomData<R>,
}

impl<R, E> Default for DrmOutputRenderElements<R, E>
impl<R, E> DrmOutputRenderElements<R, E>
where
E: RenderElement<R>,
R: Renderer + Bind<Dmabuf>,
<R as Renderer>::TextureId: Texture + 'static,
<R as Renderer>::Error: Send + Sync + 'static,
{
fn default() -> Self {
/// Construct a new empty set of render elements
pub fn new() -> Self {
DrmOutputRenderElements {
render_elements: HashMap::new(),
_renderer: PhantomData,
}
}

/// Construct a new empty set of render elements with pre-allocated capacity
/// for a number of crtcs.
pub fn with_capacity(cap: usize) -> Self {
DrmOutputRenderElements {
render_elements: HashMap::with_capacity(cap),
_renderer: PhantomData,
}
}
}

impl<R, E> Default for DrmOutputRenderElements<R, E>
where
E: RenderElement<R>,
R: Renderer + Bind<Dmabuf>,
<R as Renderer>::TextureId: Texture + 'static,
<R as Renderer>::Error: Send + Sync + 'static,
{
fn default() -> Self {
Self::new()
}
}

impl<R, E> DrmOutputRenderElements<R, E>
Expand Down

0 comments on commit 0f2e89f

Please sign in to comment.