@@ -65,47 +65,34 @@ impl RenderReplay {
6565 }
6666 }
6767
68- #[ allow( clippy:: type_complexity) ]
6968 #[ doc( alias = "gsk_render_replay_set_font_filter" ) ]
70- pub fn set_font_filter (
69+ pub fn set_font_filter < P : Fn ( & RenderReplay , & pango :: Font ) -> pango :: Font + ' static > (
7170 & mut self ,
72- filter : Option < Box_ < dyn Fn ( & RenderReplay , & pango :: Font ) -> pango :: Font + ' static > > ,
71+ filter : P ,
7372 ) {
74- let filter_data: Box_ <
75- Option < Box_ < dyn Fn ( & RenderReplay , & pango :: Font ) -> pango :: Font + ' static > > ,
76- > = Box_ :: new ( filter ) ;
77- unsafe extern "C" fn filter_func (
73+ let filter_data: Box_ < P > = Box_ :: new ( filter ) ;
74+ unsafe extern "C" fn filter_func <
75+ P : Fn ( & RenderReplay , & pango :: Font ) -> pango :: Font + ' static ,
76+ > (
7877 replay : * mut ffi:: GskRenderReplay ,
7978 font : * mut pango:: ffi:: PangoFont ,
8079 user_data : glib:: ffi:: gpointer ,
8180 ) -> * mut pango:: ffi:: PangoFont {
8281 let replay = RenderReplay ( std:: ptr:: NonNull :: new_unchecked ( replay) ) ;
8382 let font = from_glib_borrow ( font) ;
84- let callback = & * ( user_data
85- as * mut Option < Box_ < dyn Fn ( & RenderReplay , & pango:: Font ) -> pango:: Font + ' static > > ) ;
86- if let Some ( ref callback) = * callback {
87- callback ( & replay, & font)
88- } else {
89- panic ! ( "cannot get closure..." )
90- }
91- . into_glib_ptr ( )
83+ let callback = & * ( user_data as * mut P ) ;
84+ ( * callback) ( & replay, & font) . into_glib_ptr ( )
9285 }
93- let filter = if filter_data. is_some ( ) {
94- Some ( filter_func as _ )
95- } else {
96- None
97- } ;
98- unsafe extern "C" fn user_destroy_func ( data : glib:: ffi:: gpointer ) {
99- let _callback = Box_ :: from_raw (
100- data as * mut Option <
101- Box_ < dyn Fn ( & RenderReplay , & pango:: Font ) -> pango:: Font + ' static > ,
102- > ,
103- ) ;
86+ let filter = Some ( filter_func :: < P > as _ ) ;
87+ unsafe extern "C" fn user_destroy_func <
88+ P : Fn ( & RenderReplay , & pango:: Font ) -> pango:: Font + ' static ,
89+ > (
90+ data : glib:: ffi:: gpointer ,
91+ ) {
92+ let _callback = Box_ :: from_raw ( data as * mut P ) ;
10493 }
105- let destroy_call3 = Some ( user_destroy_func as _ ) ;
106- let super_callback0: Box_ <
107- Option < Box_ < dyn Fn ( & RenderReplay , & pango:: Font ) -> pango:: Font + ' static > > ,
108- > = filter_data;
94+ let destroy_call3 = Some ( user_destroy_func :: < P > as _ ) ;
95+ let super_callback0: Box_ < P > = filter_data;
10996 unsafe {
11097 ffi:: gsk_render_replay_set_font_filter (
11198 self . 0 . as_mut ( ) ,
@@ -116,6 +103,19 @@ impl RenderReplay {
116103 }
117104 }
118105
106+ #[ doc( alias = "gsk_render_replay_set_font_filter" ) ]
107+ #[ doc( alias = "set_font_filter" ) ]
108+ pub fn unset_font_filter ( & mut self ) {
109+ unsafe {
110+ ffi:: gsk_render_replay_set_font_filter (
111+ self . 0 . as_mut ( ) ,
112+ None ,
113+ std:: ptr:: null_mut ( ) ,
114+ None ,
115+ )
116+ }
117+ }
118+
119119 #[ doc( alias = "gsk_render_replay_set_node_filter" ) ]
120120 pub fn set_node_filter < P : Fn ( & RenderReplay , & RenderNode ) -> Option < RenderNode > + ' static > (
121121 & mut self ,
@@ -192,49 +192,48 @@ impl RenderReplay {
192192 }
193193 }
194194
195- #[ allow( clippy:: type_complexity) ]
195+ #[ doc( alias = "gsk_render_replay_foreach_node" ) ]
196+ #[ doc( alias = "foreach_node" ) ]
197+ pub fn unset_foreach_node ( & mut self ) {
198+ unsafe {
199+ ffi:: gsk_render_replay_set_node_foreach (
200+ self . 0 . as_mut ( ) ,
201+ None ,
202+ std:: ptr:: null_mut ( ) ,
203+ None ,
204+ )
205+ }
206+ }
207+
208+
196209 #[ doc( alias = "gsk_render_replay_set_texture_filter" ) ]
197- pub fn set_texture_filter (
210+ pub fn set_texture_filter < P : Fn ( & RenderReplay , & gdk :: Texture ) -> gdk :: Texture + ' static > (
198211 & mut self ,
199- filter : Option < Box_ < dyn Fn ( & RenderReplay , & gdk :: Texture ) -> gdk :: Texture + ' static > > ,
212+ filter : P ,
200213 ) {
201- let filter_data: Box_ <
202- Option < Box_ < dyn Fn ( & RenderReplay , & gdk :: Texture ) -> gdk :: Texture + ' static > > ,
203- > = Box_ :: new ( filter ) ;
204- unsafe extern "C" fn filter_func (
214+ let filter_data: Box_ < P > = Box_ :: new ( filter ) ;
215+ unsafe extern "C" fn filter_func <
216+ P : Fn ( & RenderReplay , & gdk :: Texture ) -> gdk :: Texture + ' static ,
217+ > (
205218 replay : * mut ffi:: GskRenderReplay ,
206219 texture : * mut gdk:: ffi:: GdkTexture ,
207220 user_data : glib:: ffi:: gpointer ,
208221 ) -> * mut gdk:: ffi:: GdkTexture {
209222 let replay = RenderReplay ( std:: ptr:: NonNull :: new_unchecked ( replay) ) ;
210223 let texture = from_glib_borrow ( texture) ;
211- let callback = & * ( user_data
212- as * mut Option <
213- Box_ < dyn Fn ( & RenderReplay , & gdk:: Texture ) -> gdk:: Texture + ' static > ,
214- > ) ;
215- if let Some ( ref callback) = * callback {
216- callback ( & replay, & texture)
217- } else {
218- panic ! ( "cannot get closure..." )
219- }
220- . into_glib_ptr ( )
224+ let callback = & * ( user_data as * mut P ) ;
225+ ( * callback) ( & replay, & texture) . into_glib_ptr ( )
221226 }
222- let filter = if filter_data. is_some ( ) {
223- Some ( filter_func as _ )
224- } else {
225- None
226- } ;
227- unsafe extern "C" fn user_destroy_func ( data : glib:: ffi:: gpointer ) {
228- let _callback = Box_ :: from_raw (
229- data as * mut Option <
230- Box_ < dyn Fn ( & RenderReplay , & gdk:: Texture ) -> gdk:: Texture + ' static > ,
231- > ,
232- ) ;
227+ let filter = Some ( filter_func :: < P > as _ ) ;
228+ unsafe extern "C" fn user_destroy_func <
229+ P : Fn ( & RenderReplay , & gdk:: Texture ) -> gdk:: Texture + ' static ,
230+ > (
231+ data : glib:: ffi:: gpointer ,
232+ ) {
233+ let _callback = Box_ :: from_raw ( data as * mut P ) ;
233234 }
234- let destroy_call3 = Some ( user_destroy_func as _ ) ;
235- let super_callback0: Box_ <
236- Option < Box_ < dyn Fn ( & RenderReplay , & gdk:: Texture ) -> gdk:: Texture + ' static > > ,
237- > = filter_data;
235+ let destroy_call3 = Some ( user_destroy_func :: < P > as _ ) ;
236+ let super_callback0: Box_ < P > = filter_data;
238237 unsafe {
239238 ffi:: gsk_render_replay_set_texture_filter (
240239 self . 0 . as_mut ( ) ,
@@ -245,6 +244,19 @@ impl RenderReplay {
245244 }
246245 }
247246
247+ #[ doc( alias = "gsk_render_replay_set_texture_filter" ) ]
248+ #[ doc( alias = "set_texture_filter" ) ]
249+ pub fn unset_texture_filter ( & mut self ) {
250+ unsafe {
251+ ffi:: gsk_render_replay_set_texture_filter (
252+ self . 0 . as_mut ( ) ,
253+ None ,
254+ std:: ptr:: null_mut ( ) ,
255+ None ,
256+ )
257+ }
258+ }
259+
248260 #[ doc( alias = "gsk_render_replay_new" ) ]
249261 pub fn new ( ) -> RenderReplay {
250262 assert_initialized_main_thread ! ( ) ;
0 commit comments