tessera_ui_basic_components/pipelines/image/
command.rs1use std::{
2 hash::{Hash, Hasher},
3 sync::Arc,
4};
5
6use tessera_ui::DrawCommand;
7
8#[derive(Debug, Clone)]
16pub struct ImageData {
17 pub data: Arc<Vec<u8>>,
19 pub width: u32,
21 pub height: u32,
23}
24
25impl Hash for ImageData {
26 fn hash<H: Hasher>(&self, state: &mut H) {
27 self.data.as_ref().hash(state);
28 self.width.hash(state);
29 self.height.hash(state);
30 }
31}
32
33impl PartialEq for ImageData {
34 fn eq(&self, other: &Self) -> bool {
35 self.width == other.width
36 && self.height == other.height
37 && self.data.as_ref() == other.data.as_ref()
38 }
39}
40
41impl Eq for ImageData {}
42
43#[derive(Debug, Clone, Hash, PartialEq, Eq)]
45pub struct ImageCommand {
46 pub data: Arc<ImageData>,
48}
49
50impl DrawCommand for ImageCommand {
51 fn barrier(&self) -> Option<tessera_ui::BarrierRequirement> {
52 None
54 }
55}