Skip to content

Latest commit

 

History

History
496 lines (442 loc) · 13.8 KB

IMG_jpg.c

File metadata and controls

496 lines (442 loc) · 13.8 KB
 
Aug 10, 2000
Aug 10, 2000
1
/*
Dec 14, 2001
Dec 14, 2001
2
SDL_image: An example image loading library for use with SDL
Dec 8, 2008
Dec 8, 2008
3
Copyright (C) 1997-2009 Sam Lantinga
Aug 10, 2000
Aug 10, 2000
4
5
This library is free software; you can redistribute it and/or
Feb 4, 2006
Feb 4, 2006
6
modify it under the terms of the GNU Lesser General Public
Aug 10, 2000
Aug 10, 2000
7
License as published by the Free Software Foundation; either
Feb 4, 2006
Feb 4, 2006
8
version 2.1 of the License, or (at your option) any later version.
Aug 10, 2000
Aug 10, 2000
9
10
11
12
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Feb 4, 2006
Feb 4, 2006
13
Lesser General Public License for more details.
Aug 10, 2000
Aug 10, 2000
14
Feb 4, 2006
Feb 4, 2006
15
16
17
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Aug 10, 2000
Aug 10, 2000
18
19
Sam Lantinga
Dec 14, 2001
Dec 14, 2001
20
slouken@libsdl.org
Aug 10, 2000
Aug 10, 2000
21
22
*/
Nov 10, 2009
Nov 10, 2009
23
24
#if !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND)
Aug 10, 2000
Aug 10, 2000
25
26
27
/* This is a JPEG image file loading framework */
#include <stdio.h>
Nov 29, 2000
Nov 29, 2000
28
#include <string.h>
Dec 29, 2001
Dec 29, 2001
29
#include <setjmp.h>
Aug 10, 2000
Aug 10, 2000
30
31
32
33
34
35
36
#include "SDL_image.h"
#ifdef LOAD_JPG
#include <jpeglib.h>
Apr 7, 2011
Apr 7, 2011
37
38
39
40
41
42
#if JPEG_LIB_VERSION >= 80
typedef JPEG_boolean boolean;
#define TRUE JPEG_TRUE
#define FALSE JPEG_FALSE
#endif
Aug 10, 2000
Aug 10, 2000
43
44
45
/* Define this for fast loading and not as good image quality */
/*#define FAST_JPEG*/
Apr 20, 2006
Apr 20, 2006
46
47
48
/* Define this for quicker (but less perfect) JPEG identification */
#define FAST_IS_JPEG
May 12, 2006
May 12, 2006
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
static struct {
int loaded;
void *handle;
void (*jpeg_calc_output_dimensions) (j_decompress_ptr cinfo);
void (*jpeg_CreateDecompress) (j_decompress_ptr cinfo, int version, size_t structsize);
void (*jpeg_destroy_decompress) (j_decompress_ptr cinfo);
boolean (*jpeg_finish_decompress) (j_decompress_ptr cinfo);
int (*jpeg_read_header) (j_decompress_ptr cinfo, boolean require_image);
JDIMENSION (*jpeg_read_scanlines) (j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines);
boolean (*jpeg_resync_to_restart) (j_decompress_ptr cinfo, int desired);
boolean (*jpeg_start_decompress) (j_decompress_ptr cinfo);
struct jpeg_error_mgr * (*jpeg_std_error) (struct jpeg_error_mgr * err);
} lib;
#ifdef LOAD_JPG_DYNAMIC
Sep 26, 2009
Sep 26, 2009
64
int IMG_InitJPG()
May 12, 2006
May 12, 2006
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{
if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_JPG_DYNAMIC);
if ( lib.handle == NULL ) {
return -1;
}
lib.jpeg_calc_output_dimensions =
(void (*) (j_decompress_ptr))
SDL_LoadFunction(lib.handle, "jpeg_calc_output_dimensions");
if ( lib.jpeg_calc_output_dimensions == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_CreateDecompress =
(void (*) (j_decompress_ptr, int, size_t))
SDL_LoadFunction(lib.handle, "jpeg_CreateDecompress");
if ( lib.jpeg_CreateDecompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_destroy_decompress =
(void (*) (j_decompress_ptr))
SDL_LoadFunction(lib.handle, "jpeg_destroy_decompress");
if ( lib.jpeg_destroy_decompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_finish_decompress =
(boolean (*) (j_decompress_ptr))
SDL_LoadFunction(lib.handle, "jpeg_finish_decompress");
if ( lib.jpeg_finish_decompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_read_header =
(int (*) (j_decompress_ptr, boolean))
SDL_LoadFunction(lib.handle, "jpeg_read_header");
if ( lib.jpeg_read_header == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_read_scanlines =
(JDIMENSION (*) (j_decompress_ptr, JSAMPARRAY, JDIMENSION))
SDL_LoadFunction(lib.handle, "jpeg_read_scanlines");
if ( lib.jpeg_read_scanlines == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_resync_to_restart =
(boolean (*) (j_decompress_ptr, int))
SDL_LoadFunction(lib.handle, "jpeg_resync_to_restart");
if ( lib.jpeg_resync_to_restart == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_start_decompress =
(boolean (*) (j_decompress_ptr))
SDL_LoadFunction(lib.handle, "jpeg_start_decompress");
if ( lib.jpeg_start_decompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_std_error =
(struct jpeg_error_mgr * (*) (struct jpeg_error_mgr *))
SDL_LoadFunction(lib.handle, "jpeg_std_error");
if ( lib.jpeg_std_error == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
}
++lib.loaded;
return 0;
}
Sep 26, 2009
Sep 26, 2009
139
void IMG_QuitJPG()
May 12, 2006
May 12, 2006
140
141
142
143
144
145
146
147
148
149
{
if ( lib.loaded == 0 ) {
return;
}
if ( lib.loaded == 1 ) {
SDL_UnloadObject(lib.handle);
}
--lib.loaded;
}
#else
Sep 26, 2009
Sep 26, 2009
150
int IMG_InitJPG()
May 12, 2006
May 12, 2006
151
152
153
154
155
156
157
158
159
160
161
162
163
{
if ( lib.loaded == 0 ) {
lib.jpeg_calc_output_dimensions = jpeg_calc_output_dimensions;
lib.jpeg_CreateDecompress = jpeg_CreateDecompress;
lib.jpeg_destroy_decompress = jpeg_destroy_decompress;
lib.jpeg_finish_decompress = jpeg_finish_decompress;
lib.jpeg_read_header = jpeg_read_header;
lib.jpeg_read_scanlines = jpeg_read_scanlines;
lib.jpeg_resync_to_restart = jpeg_resync_to_restart;
lib.jpeg_start_decompress = jpeg_start_decompress;
lib.jpeg_std_error = jpeg_std_error;
}
++lib.loaded;
May 13, 2006
May 13, 2006
164
165
return 0;
May 12, 2006
May 12, 2006
166
}
Sep 26, 2009
Sep 26, 2009
167
void IMG_QuitJPG()
May 12, 2006
May 12, 2006
168
169
170
171
172
173
174
175
176
177
{
if ( lib.loaded == 0 ) {
return;
}
if ( lib.loaded == 1 ) {
}
--lib.loaded;
}
#endif /* LOAD_JPG_DYNAMIC */
Aug 10, 2000
Aug 10, 2000
178
179
180
/* See if an image is contained in a data source */
int IMG_isJPG(SDL_RWops *src)
{
Feb 4, 2006
Feb 4, 2006
181
int start;
Aug 10, 2000
Aug 10, 2000
182
int is_JPG;
Apr 20, 2006
Apr 20, 2006
183
int in_scan;
Aug 10, 2000
Aug 10, 2000
184
185
Uint8 magic[4];
Apr 20, 2006
Apr 20, 2006
186
187
188
189
/* This detection code is by Steaphan Greene <stea@cs.binghamton.edu> */
/* Blame me, not Sam, if this doesn't work right. */
/* And don't forget to report the problem to the the sdl list too! */
Feb 13, 2007
Feb 13, 2007
190
191
if ( !src )
return 0;
Feb 4, 2006
Feb 4, 2006
192
start = SDL_RWtell(src);
Aug 10, 2000
Aug 10, 2000
193
is_JPG = 0;
Apr 20, 2006
Apr 20, 2006
194
in_scan = 0;
Aug 10, 2000
Aug 10, 2000
195
196
if ( SDL_RWread(src, magic, 2, 1) ) {
if ( (magic[0] == 0xFF) && (magic[1] == 0xD8) ) {
Apr 20, 2006
Apr 20, 2006
197
198
199
200
201
202
203
204
205
is_JPG = 1;
while (is_JPG == 1) {
if(SDL_RWread(src, magic, 1, 2) != 2) {
is_JPG = 0;
} else if( (magic[0] != 0xFF) && (in_scan == 0) ) {
is_JPG = 0;
} else if( (magic[0] != 0xFF) || (magic[1] == 0xFF) ) {
/* Extra padding in JPEG (legal) */
/* or this is data and we are scanning */
Nov 8, 2009
Nov 8, 2009
206
SDL_RWseek(src, -1, RW_SEEK_CUR);
Apr 20, 2006
Apr 20, 2006
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
} else if(magic[1] == 0xD9) {
/* Got to end of good JPEG */
break;
} else if( (in_scan == 1) && (magic[1] == 0x00) ) {
/* This is an encoded 0xFF within the data */
} else if( (magic[1] >= 0xD0) && (magic[1] < 0xD9) ) {
/* These have nothing else */
} else if(SDL_RWread(src, magic+2, 1, 2) != 2) {
is_JPG = 0;
} else {
/* Yes, it's big-endian */
Uint32 start;
Uint32 size;
Uint32 end;
start = SDL_RWtell(src);
size = (magic[2] << 8) + magic[3];
Nov 8, 2009
Nov 8, 2009
223
end = SDL_RWseek(src, size-2, RW_SEEK_CUR);
Apr 20, 2006
Apr 20, 2006
224
225
226
227
228
229
230
231
232
233
234
235
if ( end != start + size - 2 ) is_JPG = 0;
if ( magic[1] == 0xDA ) {
/* Now comes the actual JPEG meat */
#ifdef FAST_IS_JPEG
/* Ok, I'm convinced. It is a JPEG. */
break;
#else
/* I'm not convinced. Prove it! */
in_scan = 1;
#endif
}
}
Aug 10, 2000
Aug 10, 2000
236
237
238
}
}
}
Nov 8, 2009
Nov 8, 2009
239
SDL_RWseek(src, start, RW_SEEK_SET);
Aug 10, 2000
Aug 10, 2000
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
return(is_JPG);
}
#define INPUT_BUFFER_SIZE 4096
typedef struct {
struct jpeg_source_mgr pub;
SDL_RWops *ctx;
Uint8 buffer[INPUT_BUFFER_SIZE];
} my_source_mgr;
/*
* Initialize source --- called by jpeg_read_header
* before any data is actually read.
*/
Mar 18, 2001
Mar 18, 2001
255
static void init_source (j_decompress_ptr cinfo)
Aug 10, 2000
Aug 10, 2000
256
257
258
259
260
261
262
263
{
/* We don't actually need to do anything */
return;
}
/*
* Fill the input buffer --- called whenever buffer is emptied.
*/
Mar 18, 2001
Mar 18, 2001
264
static int fill_input_buffer (j_decompress_ptr cinfo)
Aug 10, 2000
Aug 10, 2000
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
{
my_source_mgr * src = (my_source_mgr *) cinfo->src;
int nbytes;
nbytes = SDL_RWread(src->ctx, src->buffer, 1, INPUT_BUFFER_SIZE);
if (nbytes <= 0) {
/* Insert a fake EOI marker */
src->buffer[0] = (Uint8) 0xFF;
src->buffer[1] = (Uint8) JPEG_EOI;
nbytes = 2;
}
src->pub.next_input_byte = src->buffer;
src->pub.bytes_in_buffer = nbytes;
return TRUE;
}
/*
* Skip data --- used to skip over a potentially large amount of
* uninteresting data (such as an APPn marker).
*
* Writers of suspendable-input applications must note that skip_input_data
* is not granted the right to give a suspension return. If the skip extends
* beyond the data currently in the buffer, the buffer can be marked empty so
* that the next read will cause a fill_input_buffer call that can suspend.
* Arranging for additional bytes to be discarded before reloading the input
* buffer is the application writer's problem.
*/
Mar 18, 2001
Mar 18, 2001
294
static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
Aug 10, 2000
Aug 10, 2000
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
{
my_source_mgr * src = (my_source_mgr *) cinfo->src;
/* Just a dumb implementation for now. Could use fseek() except
* it doesn't work on pipes. Not clear that being smart is worth
* any trouble anyway --- large skips are infrequent.
*/
if (num_bytes > 0) {
while (num_bytes > (long) src->pub.bytes_in_buffer) {
num_bytes -= (long) src->pub.bytes_in_buffer;
(void) src->pub.fill_input_buffer(cinfo);
/* note we assume that fill_input_buffer will never
* return FALSE, so suspension need not be handled.
*/
}
src->pub.next_input_byte += (size_t) num_bytes;
src->pub.bytes_in_buffer -= (size_t) num_bytes;
}
}
/*
* Terminate source --- called by jpeg_finish_decompress
* after all data has been read.
*/
Mar 18, 2001
Mar 18, 2001
319
static void term_source (j_decompress_ptr cinfo)
Aug 10, 2000
Aug 10, 2000
320
321
322
323
324
325
326
327
328
329
{
/* We don't actually need to do anything */
return;
}
/*
* Prepare for input from a stdio stream.
* The caller must have already opened the stream, and is responsible
* for closing it after finishing decompression.
*/
Mar 18, 2001
Mar 18, 2001
330
static void jpeg_SDL_RW_src (j_decompress_ptr cinfo, SDL_RWops *ctx)
Aug 10, 2000
Aug 10, 2000
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
{
my_source_mgr *src;
/* The source object and input buffer are made permanent so that a series
* of JPEG images can be read from the same file by calling jpeg_stdio_src
* only before the first one. (If we discarded the buffer at the end of
* one image, we'd likely lose the start of the next one.)
* This makes it unsafe to use this manager and a different source
* manager serially with the same JPEG object. Caveat programmer.
*/
if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
sizeof(my_source_mgr));
src = (my_source_mgr *) cinfo->src;
}
src = (my_source_mgr *) cinfo->src;
Mar 18, 2001
Mar 18, 2001
349
350
351
src->pub.init_source = init_source;
src->pub.fill_input_buffer = fill_input_buffer;
src->pub.skip_input_data = skip_input_data;
May 12, 2006
May 12, 2006
352
src->pub.resync_to_restart = lib.jpeg_resync_to_restart; /* use default method */
Mar 18, 2001
Mar 18, 2001
353
src->pub.term_source = term_source;
Aug 10, 2000
Aug 10, 2000
354
355
356
357
358
src->ctx = ctx;
src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
src->pub.next_input_byte = NULL; /* until buffer loaded */
}
Dec 29, 2001
Dec 29, 2001
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
struct my_error_mgr {
struct jpeg_error_mgr errmgr;
jmp_buf escape;
};
static void my_error_exit(j_common_ptr cinfo)
{
struct my_error_mgr *err = (struct my_error_mgr *)cinfo->err;
longjmp(err->escape, 1);
}
static void output_no_message(j_common_ptr cinfo)
{
/* do nothing */
}
Aug 10, 2000
Aug 10, 2000
375
376
377
/* Load a JPEG type image from an SDL datasource */
SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
{
Feb 4, 2006
Feb 4, 2006
378
int start;
Aug 10, 2000
Aug 10, 2000
379
380
struct jpeg_decompress_struct cinfo;
JSAMPROW rowptr[1];
Dec 29, 2001
Dec 29, 2001
381
382
SDL_Surface *volatile surface = NULL;
struct my_error_mgr jerr;
Aug 10, 2000
Aug 10, 2000
383
Jan 4, 2004
Jan 4, 2004
384
385
386
387
if ( !src ) {
/* The error message has been set in SDL_RWFromFile */
return NULL;
}
Feb 4, 2006
Feb 4, 2006
388
start = SDL_RWtell(src);
Jan 4, 2004
Jan 4, 2004
389
Nov 8, 2009
Nov 8, 2009
390
if ( !IMG_Init(IMG_INIT_JPG) ) {
May 12, 2006
May 12, 2006
391
392
393
return NULL;
}
Aug 10, 2000
Aug 10, 2000
394
/* Create a decompression structure and load the JPEG header */
May 12, 2006
May 12, 2006
395
cinfo.err = lib.jpeg_std_error(&jerr.errmgr);
Dec 29, 2001
Dec 29, 2001
396
397
398
399
jerr.errmgr.error_exit = my_error_exit;
jerr.errmgr.output_message = output_no_message;
if(setjmp(jerr.escape)) {
/* If we get here, libjpeg found an error */
May 12, 2006
May 12, 2006
400
lib.jpeg_destroy_decompress(&cinfo);
Feb 4, 2006
Feb 4, 2006
401
402
403
if ( surface != NULL ) {
SDL_FreeSurface(surface);
}
Nov 8, 2009
Nov 8, 2009
404
SDL_RWseek(src, start, RW_SEEK_SET);
Dec 29, 2001
Dec 29, 2001
405
406
407
408
IMG_SetError("JPEG loading error");
return NULL;
}
May 12, 2006
May 12, 2006
409
lib.jpeg_create_decompress(&cinfo);
Aug 10, 2000
Aug 10, 2000
410
jpeg_SDL_RW_src(&cinfo, src);
May 12, 2006
May 12, 2006
411
lib.jpeg_read_header(&cinfo, TRUE);
Aug 10, 2000
Aug 10, 2000
412
Apr 20, 2006
Apr 20, 2006
413
414
415
416
if(cinfo.num_components == 4) {
/* Set 32-bit Raw output */
cinfo.out_color_space = JCS_CMYK;
cinfo.quantize_colors = FALSE;
May 12, 2006
May 12, 2006
417
lib.jpeg_calc_output_dimensions(&cinfo);
Apr 20, 2006
Apr 20, 2006
418
419
420
421
422
423
424
425
426
427
428
429
430
/* Allocate an output surface to hold the image */
surface = SDL_AllocSurface(SDL_SWSURFACE,
cinfo.output_width, cinfo.output_height, 32,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
#else
0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF);
#endif
} else {
/* Set 24-bit RGB output */
cinfo.out_color_space = JCS_RGB;
cinfo.quantize_colors = FALSE;
Aug 10, 2000
Aug 10, 2000
431
#ifdef FAST_JPEG
Apr 20, 2006
Apr 20, 2006
432
433
434
435
cinfo.scale_num = 1;
cinfo.scale_denom = 1;
cinfo.dct_method = JDCT_FASTEST;
cinfo.do_fancy_upsampling = FALSE;
Aug 10, 2000
Aug 10, 2000
436
#endif
May 12, 2006
May 12, 2006
437
lib.jpeg_calc_output_dimensions(&cinfo);
Aug 10, 2000
Aug 10, 2000
438
Apr 20, 2006
Apr 20, 2006
439
440
441
/* Allocate an output surface to hold the image */
surface = SDL_AllocSurface(SDL_SWSURFACE,
cinfo.output_width, cinfo.output_height, 24,
Aug 10, 2000
Aug 10, 2000
442
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
Apr 20, 2006
Apr 20, 2006
443
0x0000FF, 0x00FF00, 0xFF0000,
Aug 10, 2000
Aug 10, 2000
444
#else
Apr 20, 2006
Apr 20, 2006
445
0xFF0000, 0x00FF00, 0x0000FF,
Aug 10, 2000
Aug 10, 2000
446
#endif
Apr 20, 2006
Apr 20, 2006
447
448
449
0);
}
Aug 10, 2000
Aug 10, 2000
450
if ( surface == NULL ) {
May 12, 2006
May 12, 2006
451
lib.jpeg_destroy_decompress(&cinfo);
Nov 8, 2009
Nov 8, 2009
452
SDL_RWseek(src, start, RW_SEEK_SET);
Aug 10, 2000
Aug 10, 2000
453
IMG_SetError("Out of memory");
Feb 4, 2006
Feb 4, 2006
454
return NULL;
Aug 10, 2000
Aug 10, 2000
455
456
457
}
/* Decompress the image */
May 12, 2006
May 12, 2006
458
lib.jpeg_start_decompress(&cinfo);
Aug 10, 2000
Aug 10, 2000
459
460
461
while ( cinfo.output_scanline < cinfo.output_height ) {
rowptr[0] = (JSAMPROW)(Uint8 *)surface->pixels +
cinfo.output_scanline * surface->pitch;
May 12, 2006
May 12, 2006
462
lib.jpeg_read_scanlines(&cinfo, rowptr, (JDIMENSION) 1);
Aug 10, 2000
Aug 10, 2000
463
}
May 12, 2006
May 12, 2006
464
465
466
lib.jpeg_finish_decompress(&cinfo);
lib.jpeg_destroy_decompress(&cinfo);
Aug 10, 2000
Aug 10, 2000
467
468
469
470
471
return(surface);
}
#else
Sep 26, 2009
Sep 26, 2009
472
473
474
475
476
477
478
479
480
481
int IMG_InitJPG()
{
IMG_SetError("JPEG images are not supported");
return(-1);
}
void IMG_QuitJPG()
{
}
Aug 10, 2000
Aug 10, 2000
482
483
484
485
486
487
488
489
490
491
492
493
494
/* See if an image is contained in a data source */
int IMG_isJPG(SDL_RWops *src)
{
return(0);
}
/* Load a JPEG type image from an SDL datasource */
SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
{
return(NULL);
}
#endif /* LOAD_JPG */
Nov 10, 2009
Nov 10, 2009
495
496
#endif /* !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND) */