add const VIRTGPU_XRES, VIRTGPU_YRES in boards/qemu.rs for X*Y resolution in virtio_gpu

This commit is contained in:
Yu Chen 2022-06-22 23:55:15 +08:00
parent 35c4055dd0
commit eddb2d345d
4 changed files with 13 additions and 7 deletions

View file

@ -10,11 +10,13 @@ use crate::{
sync::UPIntrFreeCell,
};
use crate::board::{VIRTGPU_XRES, VIRTGPU_YRES};
static DT: &[u8] = include_bytes!("../assert/desktop.bmp");
lazy_static::lazy_static!(
pub static ref DESKTOP:UPIntrFreeCell<Arc<dyn Component>> = unsafe {
UPIntrFreeCell::new(Arc::new(Panel::new(Size::new(1280, 800), Point::new(0, 0))))
UPIntrFreeCell::new(Arc::new(Panel::new(Size::new(VIRTGPU_XRES, VIRTGPU_YRES), Point::new(0, 0))))
};
pub static ref PAD:UPIntrFreeCell<Option<Arc<Terminal>>> = unsafe {
UPIntrFreeCell::new(None)
@ -23,8 +25,8 @@ lazy_static::lazy_static!(
pub fn create_desktop() -> isize {
let mut p: Arc<dyn Component + 'static> =
Arc::new(Panel::new(Size::new(1280, 800), Point::new(0, 0)));
let image = ImageComp::new(Size::new(1280, 800), Point::new(0, 0), DT, Some(p.clone()));
Arc::new(Panel::new(Size::new(VIRTGPU_XRES, VIRTGPU_YRES), Point::new(0, 0)));
let image = ImageComp::new(Size::new(VIRTGPU_XRES, VIRTGPU_YRES), Point::new(0, 0), DT, Some(p.clone()));
let icon = IconController::new(ROOT_INODE.ls(), Some(p.clone()));
p.add(Arc::new(image));
p.add(Arc::new(icon));