MCPcopy Index your code
hub / github.com/endbasic/endbasic / put_pixels

Method put_pixels

std/src/gfx/lcd/buffered/mod.rs:404–431  ·  view source on GitHub ↗
(&mut self, xy: PixelsXY, (pixels, size): &Self::ID)

Source from the content-addressed store, hash-verified

402 }
403
404 fn put_pixels(&mut self, xy: PixelsXY, (pixels, size): &Self::ID) -> io::Result<()> {
405 debug_assert_eq!(
406 usize::from(size.width) * usize::from(size.height) * self.stride,
407 pixels.len()
408 );
409
410 self.assert_xy_in_range(xy);
411 let x1y1 = self.clip_xy(xy).expect("Internal ops must receive valid coordinates");
412 let x2y2 = self.clip_x2y2(xy, *size).expect("Internal ops must receive valid coordinates");
413
414 let mut p = 0;
415 for y in x1y1.y..(x2y2.y + 1) {
416 for x in x1y1.x..(x2y2.x + 1) {
417 let offset = self.fb_addr(x, y);
418 self.fb[offset..(offset + self.stride)]
419 .copy_from_slice(&pixels[p..(p + self.stride)]);
420 p += self.stride;
421 }
422 }
423
424 if self.sync {
425 self.lcd.set_data(x1y1, x2y2, pixels)?;
426 } else {
427 self.damage(x1y1, x2y2);
428 }
429
430 Ok(())
431 }
432
433 fn move_pixels(
434 &mut self,

Calls 6

assert_xy_in_rangeMethod · 0.80
clip_xyMethod · 0.80
clip_x2y2Method · 0.80
fb_addrMethod · 0.80
damageMethod · 0.80
set_dataMethod · 0.45