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
use crate::prelude::*;
use skia_bindings::{self as sb, GrBackendSurfaceMutableState};
use std::fmt;

pub type BackendSurfaceMutableState = Handle<GrBackendSurfaceMutableState>;
unsafe_send_sync!(BackendSurfaceMutableState);

impl NativeDrop for GrBackendSurfaceMutableState {
    fn drop(&mut self) {
        unsafe { sb::C_GrBackendSurfaceMutableState_destruct(self) }
    }
}

impl Default for BackendSurfaceMutableState {
    fn default() -> Self {
        BackendSurfaceMutableState::construct(|s| unsafe {
            sb::C_GrBackendSurfaceMutableState_Construct(s)
        })
    }
}

impl fmt::Debug for BackendSurfaceMutableState {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.debug_struct("BackendSurfaceMutableState").finish()
    }
}

impl BackendSurfaceMutableState {
    #[cfg(feature = "vulkan")]
    pub fn new_vk(layout: crate::gpu::vk::ImageLayout, queue_family_index: u32) -> Self {
        Self::construct(|ptr| unsafe {
            sb::C_GrBackendSurfaceMutableState_ConstructVK(ptr, layout, queue_family_index)
        })
    }
}