@@ -9,32 +9,7 @@ use bevy_utils::BoxedFuture;
99#[ derive( Clone , Default ) ]
1010pub struct ImageTextureLoader ;
1111
12- macro_rules! define_file_extensions {
13- ( $( $s: literal => $v: ident ) ,+ $( , ) ? ) => {
14-
15- const FILE_EXTENSIONS : & ' static [ & ' static str ] = & [
16- $( $s ) ,+
17- ] ;
18-
19- fn match_file_extension ( ext: & str ) -> Option <image:: ImageFormat >
20- {
21- if false { None } $(
22-
23- else if ext. eq_ignore_ascii_case ( $s) {
24- Some ( image:: ImageFormat :: $v)
25- }
26-
27- ) + else { None }
28- }
29-
30- } ;
31- }
32-
33- define_file_extensions ! {
34- "png" => Png , "dds" => Dds ,
35- "tga" => Tga , "jpg" => Jpeg ,
36- "jpeg" => Jpeg ,
37- }
12+ const FILE_EXTENSIONS : & [ & str ] = & [ "png" , "dds" , "tga" , "jpg" , "jpeg" ] ;
3813
3914impl AssetLoader for ImageTextureLoader {
4015 fn load < ' a > (
@@ -50,7 +25,7 @@ impl AssetLoader for ImageTextureLoader {
5025
5126 let ext = load_context. path ( ) . extension ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
5227
53- let img_format = match_file_extension ( ext)
28+ let img_format = image :: ImageFormat :: from_extension ( ext)
5429 . ok_or_else ( || {
5530 format ! (
5631 "Unexpected image format {:?} for file {}, this is an error in `bevy_render`." ,
0 commit comments