change api name for resolutions to dimensions

This commit is contained in:
bunnie 2024-10-27 23:26:45 +08:00
parent c2c822e3a3
commit 4f85deaecb
3 changed files with 3 additions and 3 deletions

View file

@ -23,7 +23,7 @@ pub trait FrameBuffer {
/// Clears the drawable buffer
fn clear(&mut self);
/// Returns the size of the frame buffer as a Point
fn resolution(&self) -> Point;
fn dimensions(&self) -> Point;
}
/// Style properties for an object

View file

@ -362,7 +362,7 @@ impl<'a> FrameBuffer for Oled128x128<'a> {
}
}
fn resolution(&self) -> Point { Point::new(COLUMN, ROW) }
fn dimensions(&self) -> Point { Point::new(COLUMN, ROW) }
fn get_pixel(&mut self, p: Point) -> Option<ColorNative> {
if p.x > COLUMN || p.y > ROW || p.x < 0 || p.y < 0 {

View file

@ -110,7 +110,7 @@ pub fn line(fb: &mut dyn FrameBuffer, l: Line, clip: Option<Rectangle>, xor: boo
let sy = if y0 < y1 { 1 } else { -1 };
let mut err = dx + dy; // error value e_xy
loop {
if x0 >= 0 && y0 >= 0 && x0 < (fb.resolution().x as _) && y0 < (fb.resolution().y as _) {
if x0 >= 0 && y0 >= 0 && x0 < (fb.dimensions().x as _) && y0 < (fb.dimensions().y as _) {
if clip.is_none() || (clip.unwrap().intersects_point(Point::new(x0, y0))) {
if !xor {
fb.put_pixel(Point::new(x0 as _, y0 as _), color);