add const VIRTGPU_XRES, VIRTGPU_YRES in boards/qemu.rs for X*Y resolution in virtio_gpu
This commit is contained in:
parent
35c4055dd0
commit
eddb2d345d
4 changed files with 13 additions and 7 deletions
|
@ -5,7 +5,8 @@ use embedded_graphics::{
|
|||
prelude::{OriginDimensions, Point, RgbColor, Size},
|
||||
};
|
||||
|
||||
use crate::drivers::{GPUDevice, GPU_DEVICE};
|
||||
use crate::drivers::{GPUDevice, GPU_DEVICE,};
|
||||
use crate::board::{VIRTGPU_XRES, VIRTGPU_YRES};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Graphics {
|
||||
|
@ -42,7 +43,7 @@ impl DrawTarget for Graphics {
|
|||
let fb = self.drv.getfreambuffer();
|
||||
|
||||
pixels.into_iter().for_each(|px| {
|
||||
let idx = ((self.point.y + px.0.y) * 1280 + self.point.x + px.0.x) as usize * 4;
|
||||
let idx = ((self.point.y + px.0.y) * VIRTGPU_XRES as i32 + self.point.x + px.0.x) as usize * 4;
|
||||
if idx + 2 >= fb.len() {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ use embedded_graphics::{
|
|||
use tinybmp::Bmp;
|
||||
|
||||
use crate::{drivers::GPU_DEVICE, sync::UPIntrFreeCell};
|
||||
|
||||
use crate::board::{VIRTGPU_XRES, VIRTGPU_YRES};
|
||||
use super::{Component, Graphics, ImageComp};
|
||||
|
||||
static FILEICON: &[u8] = include_bytes!("../assert/file.bmp");
|
||||
|
@ -32,7 +32,7 @@ impl IconController {
|
|||
UPIntrFreeCell::new(IconControllerInner {
|
||||
files,
|
||||
graphic: Graphics {
|
||||
size: Size::new(1280, 800),
|
||||
size: Size::new(VIRTGPU_XRES, VIRTGPU_YRES),
|
||||
point: Point::new(0, 0),
|
||||
drv: GPU_DEVICE.clone(),
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue