1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
use crate::prelude::*; use crate::{EncodedOrigin, ISize}; use skia_bindings as sb; use skia_bindings::SkYUVASizeInfo; use std::ffi::c_void; #[derive(Clone, Default, Debug)] pub struct YUVASizeInfo { pub sizes: [ISize; Self::MAX_COUNT], pub width_bytes: [usize; Self::MAX_COUNT], pub origin: EncodedOrigin, } impl PartialEq for YUVASizeInfo { fn eq(&self, other: &Self) -> bool { unsafe { sb::C_SkYUVASizeInfo_equals(self.native(), other.native()) } } } impl NativeTransmutable<SkYUVASizeInfo> for YUVASizeInfo {} impl YUVASizeInfo { pub const MAX_COUNT: usize = 4; pub fn compute_total_bytes(&self) -> usize { unsafe { sb::C_SkYUVASizeInfo_computeTotalBytes(self.native()) } } pub unsafe fn compute_planes( &self, base: *mut c_void, planes: &mut [*mut c_void; Self::MAX_COUNT], ) { self.native().computePlanes(base, planes.as_mut_ptr()); } }