Rename TargetPixelBuffer::Pixel to ::TargetPixel

This commit is contained in:
Simon Hausmann 2025-02-21 21:03:39 +01:00 committed by Simon Hausmann
parent 910d45a01f
commit f114ff28dd
3 changed files with 12 additions and 10 deletions

View file

@ -423,9 +423,9 @@ mod software_renderer {
#[cfg(feature = "experimental")]
impl TargetPixelBuffer for CppRgb8TargetPixelBuffer {
type Pixel = Rgb8Pixel;
type TargetPixel = Rgb8Pixel;
fn line_slice(&mut self, line_number: usize) -> &mut [Self::Pixel] {
fn line_slice(&mut self, line_number: usize) -> &mut [Self::TargetPixel] {
unsafe {
let mut data = core::ptr::null_mut();
let mut len = 0;
@ -542,9 +542,9 @@ mod software_renderer {
#[cfg(feature = "experimental")]
impl TargetPixelBuffer for CppRgb565TargetPixelBuffer {
type Pixel = Rgb565Pixel;
type TargetPixel = Rgb565Pixel;
fn line_slice(&mut self, line_number: usize) -> &mut [Self::Pixel] {
fn line_slice(&mut self, line_number: usize) -> &mut [Self::TargetPixel] {
unsafe {
let mut data = core::ptr::null_mut();
let mut len = 0;

View file

@ -377,9 +377,9 @@ struct TargetPixelSlice<'a, T> {
}
impl<'a, T: TargetPixel> target_pixel_buffer::TargetPixelBuffer for TargetPixelSlice<'a, T> {
type Pixel = T;
type TargetPixel = T;
fn line_slice(&mut self, line_number: usize) -> &mut [Self::Pixel] {
fn line_slice(&mut self, line_number: usize) -> &mut [Self::TargetPixel] {
let offset = line_number * self.pixel_stride;
&mut self.data[offset..offset + self.pixel_stride]
}
@ -1124,7 +1124,9 @@ struct RenderToBuffer<'a, TargetPixelBuffer> {
dirty_region: PhysicalRegion,
}
impl<T: TargetPixel, B: target_pixel_buffer::TargetPixelBuffer<Pixel = T>> RenderToBuffer<'_, B> {
impl<T: TargetPixel, B: target_pixel_buffer::TargetPixelBuffer<TargetPixel = T>>
RenderToBuffer<'_, B>
{
fn foreach_ranges(
&mut self,
geometry: &PhysicalRect,
@ -1274,7 +1276,7 @@ impl<T: TargetPixel, B: target_pixel_buffer::TargetPixelBuffer<Pixel = T>> Rende
}
}
impl<T: TargetPixel, B: target_pixel_buffer::TargetPixelBuffer<Pixel = T>> ProcessScene
impl<T: TargetPixel, B: target_pixel_buffer::TargetPixelBuffer<TargetPixel = T>> ProcessScene
for RenderToBuffer<'_, B>
{
fn process_texture(&mut self, geometry: PhysicalRect, texture: SceneTexture<'static>) {

View file

@ -38,10 +38,10 @@ pub struct Texture<'a> {
/// to delegate rendering further to hardware-provided 2D acceleration units, such as DMA2D or PXP.
pub trait TargetPixelBuffer {
/// The pixel type the buffer represents.
type Pixel: TargetPixel;
type TargetPixel: TargetPixel;
/// Returns a slice of pixels for the given line.
fn line_slice(&mut self, line_numer: usize) -> &mut [Self::Pixel];
fn line_slice(&mut self, line_numer: usize) -> &mut [Self::TargetPixel];
/// Returns the number of lines the buffer has. This is typically the height in pixels.
fn num_lines(&self) -> usize;