@@ -61,9 +61,8 @@ pub struct RenderStates<'texture, 'shader, 'shader_texture: 'shader> {
61
61
pub blend_mode : BlendMode ,
62
62
/// The transform
63
63
pub transform : Transform ,
64
- texture : * const Texture ,
64
+ texture : Option < & ' texture Texture > ,
65
65
shader : * const ffi:: sfShader ,
66
- _texture : PhantomData < & ' texture Texture > ,
67
66
_shader : PhantomData < & ' shader Shader < ' shader_texture > > ,
68
67
}
69
68
@@ -87,24 +86,17 @@ impl<'texture, 'shader, 'shader_texture> RenderStates<'texture, 'shader, 'shader
87
86
Self {
88
87
blend_mode,
89
88
transform,
90
- texture : match texture {
91
- Some ( tex) => tex,
92
- None => ptr:: null ( ) ,
93
- } ,
89
+ texture,
94
90
shader : match shader {
95
91
Some ( shader) => shader. raw ( ) ,
96
92
None => ptr:: null ( ) ,
97
93
} ,
98
- _texture : PhantomData ,
99
94
_shader : PhantomData ,
100
95
}
101
96
}
102
97
/// Sets the texture
103
98
pub fn set_texture ( & mut self , texture : Option < & ' texture Texture > ) {
104
- self . texture = match texture {
105
- None => ptr:: null ( ) ,
106
- Some ( tex) => tex,
107
- } ;
99
+ self . texture = texture;
108
100
}
109
101
/// Sets the shader
110
102
pub fn set_shader ( & mut self , shader : Option < & ' shader Shader < ' shader_texture > > ) {
@@ -122,9 +114,8 @@ impl RenderStates<'static, 'static, 'static> {
122
114
pub const DEFAULT : Self = Self {
123
115
blend_mode : BlendMode :: ALPHA ,
124
116
transform : Transform :: IDENTITY ,
125
- texture : ptr :: null ( ) ,
117
+ texture : None ,
126
118
shader : ptr:: null ( ) ,
127
- _texture : PhantomData ,
128
119
_shader : PhantomData ,
129
120
} ;
130
121
}
0 commit comments