Skip to content

Commit

Permalink
😁(icu_lib): update lvgl get info
Browse files Browse the repository at this point in the history
  • Loading branch information
W-Mai committed Mar 5, 2024
1 parent 72fb850 commit 6d7b8b7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 10 additions & 1 deletion icu_lib/src/endecoder/lvgl_v9/lvgl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,21 @@ impl EnDecoder for LVGL {

let header = ImageHeader::decode(Vec::from(header_data));

let mut other_info = std::collections::HashMap::new();
other_info.insert(
"LVGL Version".to_string(),
format!("{:?}", header.version()),
);
other_info.insert("Color Format".to_string(), format!("{:?}", header.cf()));
other_info.insert("Flags".to_string(), format!("{:?}", header.flags()));
other_info.insert("Stride".to_string(), format!("{:?}", header.stride()));

ImageInfo {
width: header.w() as u32,
height: header.h() as u32,
data_size: data.len() as u32,
format: format!("LVGL.{:?}({:?})", header.version(), header.cf()),
other_info: Default::default(),
other_info,
}
}
}
9 changes: 8 additions & 1 deletion icu_lib/src/endecoder/lvgl_v9/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ pub struct ImageHeaderV9 {
// Color format: See `lv_color_format_t`
cf: ColorFormat,
// Image flags, see `lv_image_flags_t`
#[allow(unused)]
flags: Flags,

// Width of the image in pixels
Expand Down Expand Up @@ -181,6 +180,14 @@ impl ImageHeader {
}
}

pub fn flags(&self) -> Flags {
match self {
ImageHeader::Unknown => Flags::NONE,
ImageHeader::V8(_) => Flags::NONE,
ImageHeader::V9(header) => header.flags(),
}
}

pub fn cf(&self) -> ColorFormat {
match self {
ImageHeader::Unknown => ColorFormat::UNKNOWN,
Expand Down

0 comments on commit 6d7b8b7

Please sign in to comment.