about summary refs log tree commit diff
path: root/prism/src/rotate.rs
blob: 82f29d1169ea0f0f855d7b01b72c30502ab1f62f (plain)
1
2
3
4
5
6
7
8
9
10
11
pub fn rotate_180<T: Copy>(data: &mut [T]) {
	let mut rat = vec![data[0]; data.len()];

	for (idx, px) in data.chunks(3).rev().enumerate() {
		rat[idx * 3] = px[0];
		rat[idx * 3 + 1] = px[1];
		rat[idx * 3 + 2] = px[2];
	}

	data.copy_from_slice(&rat);
}