mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 09:39:15 +00:00
Readd rotation cases
This commit is contained in:
@@ -23,7 +23,7 @@ impl<T> HardUnwrap<T> for Option<T> {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
fn rotate(width: usize, height: usize, _rotate: usize) {
|
||||
fn rotate(width: usize, height: usize, rotate: usize) {
|
||||
let num_pixels = width * height;
|
||||
let in_b: &mut [u32];
|
||||
let out_b: &mut [u32];
|
||||
@@ -32,6 +32,13 @@ fn rotate(width: usize, height: usize, _rotate: usize) {
|
||||
out_b = from_raw_parts_mut::<u32>((num_pixels * 4 + 8) as *mut u32, num_pixels);
|
||||
}
|
||||
|
||||
match rotate {
|
||||
0 => {
|
||||
for i in 0..num_pixels {
|
||||
*out_b.get_mut(i).unwrap_hard() = *in_b.get(i).unwrap_hard();
|
||||
}
|
||||
}
|
||||
90 => {
|
||||
let new_width = height;
|
||||
let _new_height = width;
|
||||
for y in 0..height {
|
||||
@@ -43,3 +50,8 @@ fn rotate(width: usize, height: usize, _rotate: usize) {
|
||||
}
|
||||
}
|
||||
}
|
||||
180 => std::process::abort(),
|
||||
270 => std::process::abort(),
|
||||
_ => std::process::abort(),
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user