1 | use skia_bindings as sb; |
---|---|
2 | use std::convert::TryInto; |
3 | |
4 | pub fn swap_rb(dest: &mut [u32], src: &[u32]) { |
5 | assert_eq!(dest.len(), src.len()); |
6 | unsafe { |
7 | sb::SkSwapRB( |
8 | dest:dest.as_mut_ptr(), |
9 | src:src.as_ptr(), |
10 | count:dest.len().try_into().unwrap(), |
11 | ) |
12 | } |
13 | } |
14 | |
15 | pub fn swap_rb_inplace(pixels: &mut [u32]) { |
16 | unsafe { |
17 | sb::SkSwapRB( |
18 | dest:pixels.as_mut_ptr(), |
19 | src:pixels.as_ptr(), |
20 | count:pixels.len().try_into().unwrap(), |
21 | ) |
22 | } |
23 | } |
24 |