@@ -132,7 +132,7 @@ static const Format formats[] =
132
132
#else
133
133
false,
134
134
#endif
135
- SDL_IMAGE_SAVE_AVIF ,
135
+ SAVE_AVIF ,
136
136
IMG_isAVIF ,
137
137
IMG_LoadAVIF_IO ,
138
138
},
@@ -148,7 +148,7 @@ static const Format formats[] =
148
148
#else
149
149
false,
150
150
#endif
151
- false, /* can save */
151
+ SAVE_BMP ,
152
152
IMG_isBMP ,
153
153
IMG_LoadBMP_IO ,
154
154
},
@@ -174,13 +174,13 @@ static const Format formats[] =
174
174
"palette.bmp" ,
175
175
23 ,
176
176
42 ,
177
- 0 , /* lossless */
177
+ 10 , /* lossless indexed, dithered rgba */
178
178
#if USING_IMAGEIO || defined (LOAD_GIF )
179
179
true ,
180
180
#else
181
181
false,
182
182
#endif
183
- false, /* can save */
183
+ SAVE_GIF ,
184
184
IMG_isGIF ,
185
185
IMG_LoadGIF_IO ,
186
186
},
@@ -212,7 +212,7 @@ static const Format formats[] =
212
212
#else
213
213
false,
214
214
#endif
215
- SDL_IMAGE_SAVE_JPG ,
215
+ SAVE_JPG ,
216
216
IMG_isJPG ,
217
217
IMG_LoadJPG_IO ,
218
218
},
@@ -280,7 +280,7 @@ static const Format formats[] =
280
280
#else
281
281
false,
282
282
#endif
283
- SDL_IMAGE_SAVE_PNG ,
283
+ SAVE_PNG ,
284
284
IMG_isPNG ,
285
285
IMG_LoadPNG_IO ,
286
286
},
@@ -376,7 +376,7 @@ static const Format formats[] =
376
376
#else
377
377
false,
378
378
#endif
379
- false , /* can save */
379
+ SAVE_TGA , /* can save */
380
380
NULL ,
381
381
IMG_LoadTGA_IO ,
382
382
},
@@ -408,7 +408,7 @@ static const Format formats[] =
408
408
#else
409
409
false,
410
410
#endif
411
- false , /* can save */
411
+ SAVE_WEBP , /* can save */
412
412
IMG_isWEBP ,
413
413
IMG_LoadWEBP_IO ,
414
414
},
@@ -795,33 +795,12 @@ FormatSaveTest(const Format *format,
795
795
}
796
796
797
797
SDL_ClearError ();
798
- if (SDL_strcmp (format -> name , "AVIF" ) == 0 ) {
799
- if (rw ) {
800
- dest = SDL_IOFromFile (filename , "wb" );
801
- result = IMG_SaveAVIF_IO (reference , dest , false, 90 );
802
- SDL_CloseIO (dest );
803
- } else {
804
- result = IMG_SaveAVIF (reference , filename , 90 );
805
- }
806
- } else if (SDL_strcmp (format -> name , "JPG" ) == 0 ) {
807
- if (rw ) {
808
- dest = SDL_IOFromFile (filename , "wb" );
809
- result = IMG_SaveJPG_IO (reference , dest , false, 90 );
810
- SDL_CloseIO (dest );
811
- } else {
812
- result = IMG_SaveJPG (reference , filename , 90 );
813
- }
814
- } else if (SDL_strcmp (format -> name , "PNG" ) == 0 ) {
815
- if (rw ) {
816
- dest = SDL_IOFromFile (filename , "wb" );
817
- result = IMG_SavePNG_IO (reference , dest , false);
818
- SDL_CloseIO (dest );
819
- } else {
820
- result = IMG_SavePNG (reference , filename );
821
- }
798
+ if (rw ) {
799
+ dest = SDL_IOFromFile (filename , "wb" );
800
+ result = IMG_SaveTyped_IO (reference , dest , false, format -> name );
801
+ SDL_CloseIO (dest );
822
802
} else {
823
- SDLTest_AssertCheck (false, "How do I save %s?" , format -> name );
824
- goto out ;
803
+ result = IMG_Save (reference , filename );
825
804
}
826
805
827
806
SDLTest_AssertCheck (result , "Save %s (%s)" , filename , SDL_GetError ());
0 commit comments