Rename draw methods

- Rename `draw_iter` to `draw_raw_iter` to avoid conflict with
`embedded_graphics_core::DrawTarget::draw_iter`

- Rename `draw_raw` to `draw_raw_slice` for consistency
This commit is contained in:
Grant Miller 2021-05-10 18:01:42 -05:00
parent 510d0c9a03
commit c93637abfd
2 changed files with 7 additions and 9 deletions

View file

@ -31,7 +31,7 @@ where
return Ok(());
}
self.draw_raw(
self.draw_raw_slice(
pos.x as u16,
pos.y as u16,
pos.x as u16,
@ -64,7 +64,7 @@ where
let y0 = clamp(y0, h - 1);
let x1 = clamp(x1, w - 1);
let y1 = clamp(y1, h - 1);
self.draw_iter(
self.draw_raw_iter(
x0,
y0,
x1,
@ -81,7 +81,7 @@ where
fn clear(&mut self, color: Rgb565) -> Result<(), Self::Error> {
let color = RawU16::from(color).into_inner();
self.draw_iter(
self.draw_raw_iter(
0,
0,
(self.width - 1) as u16,

View file

@ -49,8 +49,7 @@ pub enum Orientation {
}
/// There are two method for drawing to the screen:
/// [draw_raw](struct.Ili9341.html#method.draw_raw) and
/// [draw_iter](struct.Ili9341.html#method.draw_iter).
/// [Ili9341::draw_raw_iter] and [Ili9341::draw_raw_slice]
///
/// In both cases the expected pixel format is rgb565.
///
@ -219,7 +218,7 @@ where
///
/// The iterator is useful to avoid wasting memory by holding a buffer for
/// the whole screen when it is not necessary.
pub fn draw_iter<I: IntoIterator<Item = u16>>(
pub fn draw_raw_iter<I: IntoIterator<Item = u16>>(
&mut self,
x0: u16,
y0: u16,
@ -240,9 +239,8 @@ where
/// video memory.
///
/// The expected format is rgb565.
pub fn draw_raw(&mut self, x0: u16, y0: u16, x1: u16, y1: u16, data: &[u16]) -> Result {
self.set_window(x0, y0, x1, y1)?;
self.write_iter(data.iter().cloned())
pub fn draw_raw_slice(&mut self, x0: u16, y0: u16, x1: u16, y1: u16, data: &[u16]) -> Result {
self.draw_raw_iter(x0, y0, x1, y1, data.iter().copied())
}
/// Change the orientation of the screen