Extra info on Image debug assertions (#13628)

Small message change that helps fix invalid slice lengths given to
`Image::new_fill`.
This commit is contained in:
Kornel 2024-06-03 14:35:33 +01:00 committed by GitHub
parent 8d666c8adf
commit 159b9a9091
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -552,11 +552,13 @@ impl Image {
debug_assert_eq!(
pixel.len() % format.pixel_size(),
0,
"Must not have incomplete pixel data."
"Must not have incomplete pixel data (pixel size is {}B).",
format.pixel_size(),
);
debug_assert!(
pixel.len() <= value.data.len(),
"Fill data must fit within pixel buffer."
"Fill data must fit within pixel buffer (expected {}B).",
value.data.len(),
);
for current_pixel in value.data.chunks_exact_mut(pixel.len()) {