use crate::error::VZResult;
use crate::shim_ffi;
use std::ffi::c_void;
pub struct MacGraphicsDeviceConfiguration {
inner: *mut c_void,
}
unsafe impl Send for MacGraphicsDeviceConfiguration {}
impl MacGraphicsDeviceConfiguration {
pub fn new(
width_in_pixels: isize,
height_in_pixels: isize,
pixels_per_inch: isize,
) -> VZResult<Self> {
let obj = unsafe {
shim_ffi::abx_graphics_mac_new(
width_in_pixels as i64,
height_in_pixels as i64,
pixels_per_inch as i64,
)
};
Ok(Self { inner: obj })
}
#[must_use]
pub(crate) fn into_ptr(self) -> *mut c_void {
let ptr = self.inner;
std::mem::forget(self);
ptr
}
}
impl Drop for MacGraphicsDeviceConfiguration {
fn drop(&mut self) {
if !self.inner.is_null() {
unsafe { shim_ffi::abx_object_release(self.inner.cast()) };
}
}
}