@@ -264,64 +264,28 @@ impl<RenderBackend: Backend> Surface<RenderBackend> {
264264 . unwrap_or ( & gfx_hal:: format:: Format :: Rgba8Srgb )
265265 . clone ( ) ;
266266 }
267- }
268-
269- /// Internal functions to work with the gfx-hal surface components
270- pub mod internal {
271- use gfx_hal:: window:: {
272- PresentationSurface ,
273- Surface as _,
274- } ;
275267
276- /// Helper function to retrieve the first supported format given a physical
277- /// GPU device.
278- pub fn get_first_supported_format < RenderBackend : gfx_hal:: Backend > (
279- surface : & super :: Surface < RenderBackend > ,
280- physical_device : & RenderBackend :: PhysicalDevice ,
281- ) -> gfx_hal:: format:: Format {
282- let supported_formats = surface. get_supported_formats ( physical_device) ;
283-
284- let default_format = * supported_formats
285- . get ( 0 )
286- . unwrap_or ( & gfx_hal:: format:: Format :: Rgba8Srgb ) ;
287-
288- return supported_formats
289- . into_iter ( )
290- . find ( |format| -> bool {
291- format. base_format ( ) . 1 == gfx_hal:: format:: ChannelType :: Srgb
292- } )
293- . unwrap_or ( default_format) ;
294- }
295-
296- /// Acquires a surface image for attaching to a framebuffer.
297- pub fn take_surface_image_for < RenderBackend : gfx_hal:: Backend > (
298- surface : & mut super :: Surface < RenderBackend > ,
299- ) -> Option < <RenderBackend :: Surface as PresentationSurface < RenderBackend > >:: SwapchainImage > {
300- return surface. image . take ( ) ;
301- }
302-
303- /// Acquires a surface image for attaching to a framebuffer.
304- pub fn borrow_surface_image_for < RenderBackend : gfx_hal:: Backend > (
305- surface : & super :: Surface < RenderBackend > ,
268+ pub ( super ) fn internal_surface_image (
269+ & self ,
306270 ) -> Option < & <RenderBackend :: Surface as PresentationSurface < RenderBackend > >:: SwapchainImage > {
307- return surface . image . as_ref ( ) ;
271+ return self . image . as_ref ( ) ;
308272 }
309273
310- /// FrameBuffer Attachment
311- pub fn frame_buffer_attachment_from < RenderBackend : gfx_hal:: Backend > (
312- surface : & super :: Surface < RenderBackend > ,
274+ pub ( super ) fn internal_frame_buffer_attachment (
275+ & self ,
313276 ) -> Option < gfx_hal:: image:: FramebufferAttachment > {
314- return surface . frame_buffer_attachment . clone ( ) ;
277+ return self . frame_buffer_attachment . clone ( ) ;
315278 }
316279
317- /// Borrow the surface and take the image. This internal function is used for
318- /// rendering and composes surface_for + take image.
319- pub fn borrow_surface_and_take_image < RenderBackend : gfx_hal:: Backend > (
320- surface : & mut super :: Surface < RenderBackend > ,
321- ) -> ( & mut RenderBackend :: Surface , <RenderBackend :: Surface as PresentationSurface < RenderBackend > >:: SwapchainImage ) {
280+ pub ( super ) fn internal_surface_and_image (
281+ & mut self ,
282+ ) -> (
283+ & mut RenderBackend :: Surface ,
284+ <RenderBackend :: Surface as PresentationSurface < RenderBackend > >:: SwapchainImage ,
285+ ) {
322286 return (
323- & mut surface . gfx_hal_surface ,
324- surface . image . take ( ) . expect ( "Surface image is not present" ) ,
287+ & mut self . gfx_hal_surface ,
288+ self . image . take ( ) . expect ( "Surface image is not present" ) ,
325289 ) ;
326290 }
327291}
0 commit comments