srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/wayland
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2026-08-30 21:15:00 +0200
committersrdusr <[email protected]>2026-08-30 21:15:00 +0200
commit9a7f30050f8efc52340e698031a7a55a105e72c4 (patch)
tree16e9becf63a51e706034bcd014320cdaafbe8b52 /crates/wayland
parentf2f9ed1b3f9c49b323ce591eb72a406058d324a4 (diff)
downloadsrdwm-9a7f30050f8efc52340e698031a7a55a105e72c4.tar.gz
srdwm-9a7f30050f8efc52340e698031a7a55a105e72c4.zip
Use as_chunks for fixed-size pixel iterationHEADmain
Diffstat (limited to 'crates/wayland')
-rw-r--r--crates/wayland/src/cursor.rs2
-rw-r--r--crates/wayland/src/decoration.rs2
-rw-r--r--crates/wayland/src/decoration/border.rs4
-rw-r--r--crates/wayland/src/decoration/titlebar.rs2
-rw-r--r--crates/wayland/src/icon_theme.rs2
-rw-r--r--crates/wayland/src/native_lock.rs2
-rw-r--r--crates/wayland/src/udev/render.rs2
7 files changed, 8 insertions, 8 deletions
diff --git a/crates/wayland/src/cursor.rs b/crates/wayland/src/cursor.rs
index 0ad5248..3a35f05 100644
--- a/crates/wayland/src/cursor.rs
+++ b/crates/wayland/src/cursor.rs
@@ -661,7 +661,7 @@ fn load_theme_cursor(theme: &xcursor::CursorTheme, size: u32, names: &[&str]) ->
/// bitmap built here.
fn rgba_to_bgra(pixels_rgba: &[u8]) -> Vec<u8> {
let mut bgra = Vec::with_capacity(pixels_rgba.len());
- for px in pixels_rgba.chunks_exact(4) {
+ for px in pixels_rgba.as_chunks::<4>().0 {
bgra.push(px[2]);
bgra.push(px[1]);
bgra.push(px[0]);
diff --git a/crates/wayland/src/decoration.rs b/crates/wayland/src/decoration.rs
index 21002f7..1e4f1e5 100644
--- a/crates/wayland/src/decoration.rs
+++ b/crates/wayland/src/decoration.rs
@@ -235,7 +235,7 @@ pub fn render_snap_flyout(columns: u32, cell_width: u32, cell_height: u32, label
let mut buf = vec![0u8; width * height * 4];
let bg_px = rgb_to_bgra(bg, 255);
- for px in buf.chunks_exact_mut(4) {
+ for px in buf.as_chunks_mut::<4>().0 {
px.copy_from_slice(&bg_px);
}
diff --git a/crates/wayland/src/decoration/border.rs b/crates/wayland/src/decoration/border.rs
index 0d7443d..fba5ce2 100644
--- a/crates/wayland/src/decoration/border.rs
+++ b/crates/wayland/src/decoration/border.rs
@@ -75,7 +75,7 @@ pub fn render_border_top(width: u32, thickness: u32, color: (u8, u8, u8), radius
let height = thickness.max(radius as usize).max(1);
let bg = rgb_to_bgra(color, 255);
let mut buf = vec![0u8; width * height * 4];
- for px in buf.chunks_exact_mut(4) {
+ for px in buf.as_chunks_mut::<4>().0 {
px.copy_from_slice(&bg);
}
// Without an inner ring at all, the corner stayed a solid filled disk
@@ -145,7 +145,7 @@ pub fn render_border_bottom(width: u32, thickness: u32, color: (u8, u8, u8), rad
let height = thickness.max(radius as usize).max(1);
let bg = rgb_to_bgra(color, 255);
let mut buf = vec![0u8; width * height * 4];
- for px in buf.chunks_exact_mut(4) {
+ for px in buf.as_chunks_mut::<4>().0 {
px.copy_from_slice(&bg);
}
// Plain `radius`, not `radius + thickness` (what this line passed
diff --git a/crates/wayland/src/decoration/titlebar.rs b/crates/wayland/src/decoration/titlebar.rs
index cc861ab..6ea2190 100644
--- a/crates/wayland/src/decoration/titlebar.rs
+++ b/crates/wayland/src/decoration/titlebar.rs
@@ -151,7 +151,7 @@ pub fn render_titlebar(
let traffic_lights = traffic_lights && !is_dialog;
let bg = rgb_to_bgra(background, 255);
let mut buf = vec![0u8; width * height * 4];
- for px in buf.chunks_exact_mut(4) {
+ for px in buf.as_chunks_mut::<4>().0 {
px.copy_from_slice(&bg);
}
diff --git a/crates/wayland/src/icon_theme.rs b/crates/wayland/src/icon_theme.rs
index eaecdad..0fdfec7 100644
--- a/crates/wayland/src/icon_theme.rs
+++ b/crates/wayland/src/icon_theme.rs
@@ -214,7 +214,7 @@ pub(crate) fn rasterize_svg(path: &Path, width: u32, height: u32) -> Option<Vec<
resvg::render(&tree, transform, &mut pixmap.as_mut());
let rgba = pixmap.data();
let mut bgra = vec![0u8; rgba.len()];
- for (dst, src) in bgra.chunks_exact_mut(4).zip(rgba.chunks_exact(4)) {
+ for (dst, src) in bgra.as_chunks_mut::<4>().0.iter_mut().zip(rgba.as_chunks::<4>().0) {
dst[0] = src[2];
dst[1] = src[1];
dst[2] = src[0];
diff --git a/crates/wayland/src/native_lock.rs b/crates/wayland/src/native_lock.rs
index b5ff7c3..d05b3b3 100644
--- a/crates/wayland/src/native_lock.rs
+++ b/crates/wayland/src/native_lock.rs
@@ -893,7 +893,7 @@ fn render_ui_box(native: &NativeLock, theme: &srdwm_core::LockConfig) -> (Vec<u8
let panel_alpha = (theme.box_opacity.clamp(0.0, 1.0) * 255.0).round() as u8;
if panel_alpha > 0 {
let bg = rgb_to_bgra(theme.box_bg, panel_alpha);
- for px in buf.chunks_exact_mut(4) {
+ for px in buf.as_chunks_mut::<4>().0 {
px.copy_from_slice(&bg);
}
}
diff --git a/crates/wayland/src/udev/render.rs b/crates/wayland/src/udev/render.rs
index cefd759..83d721a 100644
--- a/crates/wayland/src/udev/render.rs
+++ b/crates/wayland/src/udev/render.rs
@@ -1532,7 +1532,7 @@ impl CompState {
if map.len() < expected_bytes {
return None;
}
- let read_channel = |offset: usize| -> Vec<u16> { map[offset..offset + size * 2].chunks_exact(2).map(|b| u16::from_ne_bytes([b[0], b[1]])).collect() };
+ let read_channel = |offset: usize| -> Vec<u16> { map[offset..offset + size * 2].as_chunks::<2>().0.iter().map(|b| u16::from_ne_bytes(*b)).collect() };
let red = read_channel(0);
let green = read_channel(size * 2);
let blue = read_channel(size * 4);