mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
Create an EmptyDisplay of a decent size
(The mock display is just 16x16 and nt representative of screen we want to draw on)
This commit is contained in:
parent
d7911f1443
commit
cc2a06dc07
1 changed files with 18 additions and 3 deletions
|
@ -244,9 +244,24 @@ where
|
||||||
|
|
||||||
#[cfg(not(feature = "simulator"))]
|
#[cfg(not(feature = "simulator"))]
|
||||||
pub fn init_with_mock_display() {
|
pub fn init_with_mock_display() {
|
||||||
init_with_display(embedded_graphics::mock_display::MockDisplay::<
|
struct EmptyDisplay;
|
||||||
embedded_graphics::pixelcolor::Rgb888,
|
impl embedded_graphics::draw_target::DrawTarget for EmptyDisplay {
|
||||||
>::new());
|
type Color = embedded_graphics::pixelcolor::Rgb888;
|
||||||
|
type Error = ();
|
||||||
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
|
where
|
||||||
|
I: IntoIterator<Item = embedded_graphics::Pixel<Self::Color>>,
|
||||||
|
{
|
||||||
|
let _ = pixels.into_iter().count();
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl embedded_graphics::geometry::OriginDimensions for EmptyDisplay {
|
||||||
|
fn size(&self) -> embedded_graphics::geometry::Size {
|
||||||
|
embedded_graphics::geometry::Size::new(320, 240)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init_with_display(EmptyDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "pico-st7789")]
|
#[cfg(feature = "pico-st7789")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue