diff --git a/internal/backends/linuxkms/renderer/sw.rs b/internal/backends/linuxkms/renderer/sw.rs index 8b680e31e16..da271fcb59d 100644 --- a/internal/backends/linuxkms/renderer/sw.rs +++ b/internal/backends/linuxkms/renderer/sw.rs @@ -61,10 +61,6 @@ const SOFTWARE_RENDER_SUPPORTED_DRM_FOURCC_FORMATS: &[drm::buffer::DrmFourcc] = #[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)] struct DumbBufferPixelXrgb888(pub u32); -#[repr(transparent)] -#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)] -struct DumbBufferPixelBgra8888(pub u32); - impl From for PremultipliedRgbaColor { #[inline] fn from(pixel: DumbBufferPixelXrgb888) -> Self { @@ -90,31 +86,6 @@ impl From for DumbBufferPixelXrgb888 { } } -impl From for PremultipliedRgbaColor { - #[inline] - fn from(pixel: DumbBufferPixelBgra8888) -> Self { - let v = pixel.0; - PremultipliedRgbaColor { - red: (v >> 0) as u8, - green: (v >> 8) as u8, - blue: (v >> 16) as u8, - alpha: (v >> 24) as u8, - } - } -} - -impl From for DumbBufferPixelBgra8888 { - #[inline] - fn from(pixel: PremultipliedRgbaColor) -> Self { - Self( - (pixel.alpha as u32) << 24 - | ((pixel.blue as u32) << 16) // B and R swapped - | ((pixel.green as u32) << 8) - | (pixel.red as u32), - ) - } -} - impl TargetPixel for DumbBufferPixelXrgb888 { fn blend(&mut self, color: PremultipliedRgbaColor) { let mut x = PremultipliedRgbaColor::from(*self); @@ -131,20 +102,6 @@ impl TargetPixel for DumbBufferPixelXrgb888 { } } -impl TargetPixel for DumbBufferPixelBgra8888 { - fn blend(&mut self, color: PremultipliedRgbaColor) { - let mut x = PremultipliedRgbaColor::from(*self); - x.blend(color); - *self = x.into(); - } - fn from_rgb(r: u8, g: u8, b: u8) -> Self { - Self(0xff000000 | ((b as u32) << 16) | ((g as u32) << 8) | (r as u32)) - } - fn background() -> Self { - Self(0) - } -} - impl SoftwareRendererAdapter { pub fn new( device_opener: &crate::DeviceOpener, @@ -203,17 +160,14 @@ impl crate::fullscreenwindowadapter::FullscreenRenderer for SoftwareRendererAdap }); match format { - drm::buffer::DrmFourcc::Xrgb8888 | drm::buffer::DrmFourcc::Argb8888 => { + drm::buffer::DrmFourcc::Xrgb8888 + | drm::buffer::DrmFourcc::Argb8888 + | drm::buffer::DrmFourcc::Bgra8888 => { let buffer: &mut [DumbBufferPixelXrgb888] = bytemuck::cast_slice_mut(pixels.as_mut()); self.renderer.render(buffer, self.size.width as usize); } - drm::buffer::DrmFourcc::Bgra8888 => { - let buffer: &mut [DumbBufferPixelBgra8888] = - bytemuck::cast_slice_mut(pixels.as_mut()); - self.renderer.render(buffer, self.size.width as usize); - } drm::buffer::DrmFourcc::Rgb565 => { let buffer: &mut [i_slint_renderer_software::Rgb565Pixel] = bytemuck::cast_slice_mut(pixels.as_mut());