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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
use crate::prelude::NativeTransmutable;
use skia_bindings as sb;
use skia_bindings::{GrGLFramebufferInfo, GrGLTextureInfo, GrGLenum, GrGLuint};
pub type Enum = GrGLenum;
pub type UInt = GrGLuint;
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct TextureInfo {
pub target: Enum,
pub id: Enum,
pub format: Enum,
}
impl NativeTransmutable<GrGLTextureInfo> for TextureInfo {}
#[test]
fn test_texture_info_layout() {
TextureInfo::test_layout()
}
impl PartialEq for TextureInfo {
fn eq(&self, other: &Self) -> bool {
unsafe { sb::C_GrGLTextureInfo_Equals(self.native(), other.native()) }
}
}
impl Default for TextureInfo {
fn default() -> Self {
TextureInfo {
target: 0,
id: 0,
format: 0,
}
}
}
impl TextureInfo {
pub fn from_target_and_id(target: Enum, id: Enum) -> Self {
Self {
target,
id,
format: 0,
}
}
}
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct FramebufferInfo {
pub fboid: UInt,
pub format: Enum,
}
impl NativeTransmutable<GrGLFramebufferInfo> for FramebufferInfo {}
#[test]
fn test_framebuffer_info_layout() {
FramebufferInfo::test_layout()
}
impl Default for FramebufferInfo {
fn default() -> Self {
FramebufferInfo {
fboid: 0,
format: 0,
}
}
}
impl FramebufferInfo {
pub fn from_fboid(fboid: UInt) -> Self {
Self { fboid, format: 0 }
}
}
bitflags! {
pub struct BackendState: u32 {
const RENDER_TARGET = sb::GrGLBackendState_kRenderTarget_GrGLBackendState as _;
const TEXTURE_BINDING = sb::GrGLBackendState_kTextureBinding_GrGLBackendState as _;
const VIEW = sb::GrGLBackendState_kView_GrGLBackendState as _;
const BLEND = sb::GrGLBackendState_kBlend_GrGLBackendState as _;
const MSAA_ENABLE = sb::GrGLBackendState_kMSAAEnable_GrGLBackendState as _;
const VERTEX = sb::GrGLBackendState_kVertex_GrGLBackendState as _;
const STENCIL = sb::GrGLBackendState_kStencil_GrGLBackendState as _;
const PIXEL_STORE = sb::GrGLBackendState_kPixelStore_GrGLBackendState as _;
const PROGRAM = sb::GrGLBackendState_kProgram_GrGLBackendState as _;
const FIXED_FUNCTION = sb::GrGLBackendState_kFixedFunction_GrGLBackendState as _;
const MISC = sb::GrGLBackendState_kMisc_GrGLBackendState as _;
const PATH_RENDERING = sb::GrGLBackendState_kPathRendering_GrGLBackendState as _;
}
}