rust-embedded-community / ssd1306

SSD1306 OLED driver
Apache License 2.0
300 stars 68 forks source link

Incomplete bounds check in set_pixel #151

Closed rfuest closed 3 years ago

rfuest commented 3 years ago

Description of the problem

The bounds check in GraphicsMode::set_pixel is incomplete, which causes overdraw on the right side of the display to be wrapped around to the left side.

Test case (if applicable)

 let style = PrimitiveStyleBuilder::new()
    .stroke_width(1)
    .stroke_color(BinaryColor::On)
    .build();

Circle::new(Point::new(128, 16), 8)
    .into_styled(style)
    .draw(&mut disp)
    .unwrap();

grafik

jamwaffles commented 3 years ago

This now uses the bounding_box().contains() method from e-g 0.7. Untested, but closed by #154 nonetheless.