fix doc problems

This commit is contained in:
bendn 2023-09-09 17:58:13 +07:00
parent 36355a5c83
commit d270f656de
No known key found for this signature in database
GPG key ID: 0D9D3A2A3B2A93D6
2 changed files with 6 additions and 5 deletions

View file

@ -33,6 +33,7 @@ pub use overlay::{Overlay, OverlayAt};
/// like assert!(), but causes undefined behaviour at runtime when the condition is not met.
///
/// # Safety
///
/// UB if condition is false.
macro_rules! assert_unchecked {
($cond:expr) => {{

View file

@ -28,8 +28,8 @@ pub trait Overlay<W> {
/// See [blit](https://en.wikipedia.org/wiki/Bit_blit)
///
/// # Safety
/// UB if rgb.len() % 3 != 0
/// UB if rgba.len() % 4 != 0
/// - UB if rgb.len() % 3 != 0
/// - UB if rgba.len() % 4 != 0
unsafe fn blit(rgb: &mut [u8], rgba: &[u8]) {
let mut srci = 0;
let mut dsti = 0;
@ -180,9 +180,9 @@ impl OverlayAt<Image<&[u8], 4>> for Image<&mut [u8], 4> {
/// Overlay with => self at coordinates x, y, without blending
///
/// # Safety
/// UB if x, y is out of bounds
/// UB if x + with.width() > u32::MAX
/// UB if y + with.height() > u32::MAX
/// - UB if x, y is out of bounds
/// - UB if x + with.width() > [`u32::MAX`]
/// - UB if y + with.height() > [`u32::MAX`]
unsafe fn overlay_at(&mut self, with: &Image<&[u8], 4>, x: u32, y: u32) -> &mut Self {
for j in 0..with.height() {
for i in 0..with.width() {