Closed rfuest closed 4 months ago
This PR fixes the implementation of the fill_contiguous method in the DrawTarget trait if area overlaps the edge of the framebuffer.
fill_contiguous
DrawTarget
area
Here is an example that demonstrates the problem:
let logo = tinybmp::Bmp::from_slice(LOGO).unwrap(); for anchor in [ AnchorPoint::TopLeft, AnchorPoint::TopRight, AnchorPoint::Center, AnchorPoint::BottomLeft, AnchorPoint::BottomRight, ] { Image::with_center(&logo, tft.bounding_box().anchor_point(anchor)) .draw(&mut tft) .unwrap(); }
Current master version:
After this PR is applied:
I've updated the PR to also work on architectures with 16 bit usize by conditionally compiling a different implementation of nth and take in this case.
usize
nth
take
This PR fixes the implementation of the
fill_contiguous
method in theDrawTarget
trait ifarea
overlaps the edge of the framebuffer.Here is an example that demonstrates the problem:
Current master version:![Before](https://github.com/almindor/mipidsi/assets/226123/ed1a4ce0-bc8c-44ee-a80a-3bf71a74f027)
After this PR is applied:![After](https://github.com/almindor/mipidsi/assets/226123/38efabb4-bd20-44f1-9bf5-d6afa59007a5)