summaryrefslogtreecommitdiffstats
path: root/wgpu/src/primitive.rs
blob: 8dbf3008a770f30dfa8e1a69cb61678c0036fab2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//! Draw using different graphical primitives.
use crate::core::Rectangle;
use crate::graphics::{Damage, Mesh};

/// The graphical primitives supported by `iced_wgpu`.
pub type Primitive = crate::graphics::Primitive<Custom>;

/// The custom primitives supported by `iced_wgpu`.
#[derive(Debug, Clone, PartialEq)]
pub enum Custom {
    /// A mesh primitive.
    Mesh(Mesh),
}

impl Damage for Custom {
    fn bounds(&self) -> Rectangle {
        match self {
            Self::Mesh(mesh) => mesh.bounds(),
        }
    }
}