diff --git a/anvil/src/udev.rs b/anvil/src/udev.rs index 7c8bc86fa6d4..3bcc9f2e0534 100644 --- a/anvil/src/udev.rs +++ b/anvil/src/udev.rs @@ -158,6 +158,12 @@ impl Renderers { } } +#[derive(Clone)] +enum Texture { + Pixman(PixmanTexture), + Multi(MultiTexture), +} + pub struct UdevData { pub session: LibSeatSession, dh: DisplayHandle, @@ -169,7 +175,7 @@ pub struct UdevData { pointer_images: Vec<(xcursor::parser::Image, MemoryRenderBuffer)>, pointer_element: PointerElement, #[cfg(feature = "debug")] - fps_texture: Option, + fps_texture: Option, pointer_image: crate::cursor::Cursor, debug_flags: DebugFlags, keyboards: Vec, @@ -431,34 +437,28 @@ pub fn run_udev() { image::ImageReader::with_format(std::io::Cursor::new(FPS_NUMBERS_PNG), image::ImageFormat::Png) .decode() .unwrap(); - let res = match &mut renderer { - RendererRef::Multi(renderer) => renderer - .import_memory( - &fps_image.to_rgba8(), - Fourcc::Abgr8888, - (fps_image.width() as i32, fps_image.height() as i32).into(), - false, - ) - .expect("Unable to upload FPS texture"), - RendererRef::Pixman(renderer) => renderer - .import_memory( - &fps_image.to_rgba8(), - Fourcc::Abgr8888, - (fps_image.width() as i32, fps_image.height() as i32).into(), - false, - ) - .expect("Unable to upload FPS texture"), + let fps_texture = match &mut renderer { + RendererRef::Multi(renderer) => Texture::Multi( + renderer + .import_memory( + &fps_image.to_rgba8(), + Fourcc::Abgr8888, + (fps_image.width() as i32, fps_image.height() as i32).into(), + false, + ) + .expect("Unable to upload FPS texture"), + ), + RendererRef::Pixman(renderer) => Texture::Pixman( + renderer + .import_memory( + &fps_image.to_rgba8(), + Fourcc::Abgr8888, + (fps_image.width() as i32, fps_image.height() as i32).into(), + false, + ) + .expect("Unable to upload FPS texture"), + ), }; - let fps_texture = state - .backend_data - .renderer - .import_memory( - &fps_image.to_rgba8(), - Fourcc::Abgr8888, - (fps_image.width() as i32, fps_image.height() as i32).into(), - false, - ) - .expect("Unable to upload FPS texture"); for backend in state.backend_data.backends.values_mut() { for surface in backend.surfaces.values_mut() {