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

Method read_pixels

std/src/gfx/lcd/buffered/mod.rs:383–402  ·  view source on GitHub ↗
(&mut self, xy: PixelsXY, size: SizeInPixels)

Source from the content-addressed store, hash-verified

381 }
382
383 fn read_pixels(&mut self, xy: PixelsXY, size: SizeInPixels) -> io::Result<Self::ID> {
384 self.assert_xy_size_in_range(xy, size);
385 let x1y1 = self.clip_xy(xy).expect("Internal ops must receive valid coordinates");
386 let x2y2 = self.clip_x2y2(xy, size).expect("Internal ops must receive valid coordinates");
387
388 let mut pixels = LcdSize::between(x1y1, x2y2).new_buffer(self.stride);
389
390 for y in x1y1.y..(x2y2.y + 1) {
391 for x in x1y1.x..(x2y2.x + 1) {
392 let offset = self.fb_addr(x, y);
393 pixels.extend_from_slice(&self.fb[offset..offset + self.stride]);
394 }
395 }
396
397 debug_assert_eq!(
398 usize::from(size.width) * usize::from(size.height) * self.stride,
399 pixels.len()
400 );
401 Ok((pixels, size))
402 }
403
404 fn put_pixels(&mut self, xy: PixelsXY, (pixels, size): &Self::ID) -> io::Result<()> {
405 debug_assert_eq!(

Callers 3

move_pixelsMethod · 0.45
test_read_pixels_syncFunction · 0.45
test_read_pixels_no_syncFunction · 0.45

Calls 5

clip_xyMethod · 0.80
clip_x2y2Method · 0.80
new_bufferMethod · 0.80
fb_addrMethod · 0.80

Tested by 2

test_read_pixels_syncFunction · 0.36
test_read_pixels_no_syncFunction · 0.36