diff --git a/assets/backgrounds/default.png b/assets/backgrounds/default.png index 296b04e860a4bde5b6b4746719b582432a30f36f..5f9a315e97a717f80d38c425c5c75ea6167f2947 100644 GIT binary patch literal 11402 zcmeAS@N?(olHy`uVBq!ia0y~yU~gbxV6os}V_;x-arvM#1A|VWr;B4q#jQ6tH}Wzl z3b1T^z29)s`%ZC2U!H9)%xm;!MZUiM{9;l0*7da;^}ik6cSHR5t?T~` zmh-%6z%KXJJNf=cQ3eR$Wio&;99kH7AS?kz24)D$h2sE(!5}!Q3=|Th0RjpIhS3xP z4u;Vz0}ciPg~OSs`*!`)cCW5|+YK$OuJ8M{6+iVAYr%uk@Si0G|X@_4?Yk*`T5iQs`aZ=kiT9o)O}}3kstp z8Uq8vXnKVthtbLm91f$E88{fIQkflD^Y!iLjGeo0U5A!q-JsG4S~7vky7zCi8LSiD zK#Ra{NDa57_}@Y|!x_pB+<=yQZ?of(G=5Xvw4MQXQ!Zt+DM!6n9Bl%F!*aBI1P8-t z`3MdMr1EjJDL0xX(9^`|5CJGekTS_=fDG*b8Ewjq_7g!Vn1R5!#?Z{?2ky_4z0DxN ztAD9E=hWmVy%lXjGbkfuTd70Xmv8stg=9 z!!$rTOg|4)Pxh%cIA9qVq(&1WC?tky3L7n4K#@CI+JZx2fa;Y9IK4eP=g{r5kpUXO@geCy#)nBjx literal 8938 zcmeAS@N?(olHy`uVBq!ia0y~yU~gbxV6os}V_;x-arvM#1B22=PZ!6Kid%1PZscTe zF?yqjhFS73G6dYV3eQ7LJ!MF?Er^>Sm@W;8#~Xe zLv)jWA;!ZNy`Q^J?f{-V*M`N~js06GM|di_4= z==UQ1U$4A9@M+u1NehpRnmHN*qagqafd<#mziBy2n^(iLB+AHk_44)X8<^c7gX8hY zxjj7I=~oqlbpmwc{AzeSv@*XaUi(#b2|jJNM%!VapdZDfAwZK5IIw6{ow3=(o1yS5 ziPDPRdzsvMEIiX+xlAbP0l+XkK*WQ<; diff --git a/crates/hearthspace-compositor/src/compositor/rendering.rs b/crates/hearthspace-compositor/src/compositor/rendering.rs index 5d85a0c..1e91543 100644 --- a/crates/hearthspace-compositor/src/compositor/rendering.rs +++ b/crates/hearthspace-compositor/src/compositor/rendering.rs @@ -31,7 +31,8 @@ use crate::config::DEFAULT_BACKGROUND_MOVES_WITH_CANVAS; type GlesTexture = ::TextureId; const MAX_BACKGROUND_TILE_ELEMENTS: usize = 512; -const DEFAULT_BACKGROUND_IMAGE_PNG: &[u8] = include_bytes!("../../../../assets/backgrounds/default.png"); +const DEFAULT_BACKGROUND_IMAGE_PNG: &[u8] = + include_bytes!("../../../../assets/backgrounds/default.png"); pub(super) struct BackgroundImageTile { context_id: ContextId, @@ -116,8 +117,8 @@ impl App { framebuffer, age, &elements, - // White canvas; the repeated background image is drawn on top of it. - Color32F::new(1.0, 1.0, 1.0, 1.0), + // The repeated background image is opaque and covers the output. + Color32F::new(0.0, 0.0, 0.0, 0.0), )?; Ok(result.damage.cloned()) } @@ -601,7 +602,9 @@ pub(super) fn send_frames_surface_tree(surface: &wl_surface::WlSurface, time: u3 mod tests { use smithay::utils::{Logical, Point, Rectangle, Size}; - use super::{background_tile_axis_bounds, default_background_image_data, point_in_logical_rect}; + use super::{ + background_tile_axis_bounds, default_background_image_data, point_in_logical_rect, + }; #[test] fn point_in_logical_rect_excludes_other_outputs() { @@ -634,13 +637,22 @@ mod tests { let image = default_background_image_data(); assert_eq!(image.size, Size::::from((1920, 1080))); - assert_eq!(pixel_alpha(&image.pixels, image.size, 0, 0), 255); - assert_eq!(pixel_alpha(&image.pixels, image.size, 1919, 0), 255); - assert_eq!(pixel_alpha(&image.pixels, image.size, 60, 60), 0); + assert_eq!( + pixel_rgba(&image.pixels, image.size, 0, 0), + [199, 199, 204, 255] + ); + assert_eq!( + pixel_rgba(&image.pixels, image.size, 1919, 0), + [199, 199, 204, 255] + ); + assert_eq!( + pixel_rgba(&image.pixels, image.size, 60, 60), + [255, 255, 255, 255] + ); } - fn pixel_alpha(pixels: &[u8], size: Size, x: i32, y: i32) -> u8 { - let offset = ((y * size.w + x) * 4 + 3) as usize; - pixels[offset] + fn pixel_rgba(pixels: &[u8], size: Size, x: i32, y: i32) -> [u8; 4] { + let offset = ((y * size.w + x) * 4) as usize; + pixels[offset..offset + 4].try_into().unwrap() } }