INNER CODE UNIT · Rust
blit_bitmap
plotters-rs/plotters · plotters-backend/src/lib.rs:295
fn blit_bitmap(
&mut self,
pos: BackendCoord,
(iw, ih): (u32, u32),
src: &[u8],
) -> Result<(), DrawingErrorKind<Self::ErrorType>> {
let (w, h) = self.get_size();
for dx in 0..iw {
if pos.0 + dx as i32 >= w as i32 {
break;
}
for dy in 0..ih {
if pos.1 + dy as i32 >= h as i32 {
break;
}
// FIXME: This assume we have RGB image buffer
let r = src[(dx + dy * iw) as usize * 3];