fast image operations
-rw-r--r--benches/affine_transformations.rs5
-rw-r--r--src/affine.rs2
2 files changed, 4 insertions, 3 deletions
diff --git a/benches/affine_transformations.rs b/benches/affine_transformations.rs
index ac68d6e..1b38428 100644
--- a/benches/affine_transformations.rs
+++ b/benches/affine_transformations.rs
@@ -12,9 +12,10 @@ macro_rules! bench {
64.try_into().unwrap(),
include_bytes!("4_180x180.imgbuf").to_vec(),
);
- b.iter(|| {
+ #[allow(unused_unsafe)]
+ b.iter(|| unsafe {
for _ in 0..256 {
- img.flip_h();
+ img.$fn();
}
});
}
diff --git a/src/affine.rs b/src/affine.rs
index f50ba30..7404293 100644
--- a/src/affine.rs
+++ b/src/affine.rs
@@ -27,7 +27,7 @@ impl<const CHANNELS: usize> Image<&mut [u8], CHANNELS> {
}
/// Flip a image horizontally.
- fn flip_h(&mut self) {
+ pub fn flip_h(&mut self) {
for y in 0..self.height() {
for x in 0..self.width() / 2 {
let x2 = self.width() - x - 1;