use crate::{gpu, prelude::*, Surface, SurfaceProps};
use skia_bindings as sb;
#[allow(clippy::missing_safety_doc)]
#[allow(clippy::too_many_arguments)]
pub unsafe fn wrap_ca_metal_layer(
context: &mut gpu::RecordingContext,
layer: gpu::mtl::Handle,
origin: gpu::SurfaceOrigin,
sample_cnt: impl Into<Option<usize>>,
color_type: crate::ColorType,
color_space: impl Into<Option<crate::ColorSpace>>,
surface_props: Option<&SurfaceProps>,
drawable: *mut gpu::mtl::Handle,
) -> Option<Surface> {
Surface::from_ptr(sb::C_SkSurfaces_WrapCAMetalLayer(
context.native_mut(),
layer,
origin,
sample_cnt.into().unwrap_or(0).try_into().unwrap(),
color_type.into_native(),
color_space.into().into_ptr_or_null(),
surface_props.native_ptr_or_null(),
drawable,
))
}
#[allow(clippy::missing_safety_doc)]
#[cfg(feature = "metal")]
pub unsafe fn wrap_mtk_view(
context: &mut gpu::RecordingContext,
mtk_view: gpu::mtl::Handle,
origin: gpu::SurfaceOrigin,
sample_count: impl Into<Option<usize>>,
color_type: crate::ColorType,
color_space: impl Into<Option<crate::ColorSpace>>,
surface_props: Option<&SurfaceProps>,
) -> Option<Surface> {
Surface::from_ptr(sb::C_SkSurfaces_WrapMTKView(
context.native_mut(),
mtk_view,
origin,
sample_count.into().unwrap_or(0).try_into().unwrap(),
color_type.into_native(),
color_space.into().into_ptr_or_null(),
surface_props.native_ptr_or_null(),
))
}