added support for JPEG images

This commit is contained in:
Sylvain PILLOT 2022-05-08 20:17:39 +02:00
parent 497eac2c47
commit 5a848275de
3 changed files with 15 additions and 3 deletions

View File

@ -19,17 +19,19 @@
3. This notice may not be removed or altered from any source distribution.
*/
#if !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND)
//#if !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND)
/* This is a JPEG image file loading framework */
#include <gint/gint.h>
#include "SDL/SDL_image.h"
#include "SDL/SDL.h"
#ifdef LOAD_JPG
#include <jpeglib.h>
#include <setjmp.h>
#ifdef JPEG_TRUE /* MinGW version of jpeg-8.x renamed TRUE to JPEG_TRUE etc. */
typedef JPEG_boolean boolean;
@ -175,6 +177,7 @@ void IMG_QuitJPG()
/* See if an image is contained in a data source */
int IMG_isJPG(SDL_RWops *src)
{
cSDL_LogToFile("checking if it is a JPEG image");
int start;
int is_JPG;
int in_scan;
@ -234,6 +237,10 @@ int IMG_isJPG(SDL_RWops *src)
}
}
SDL_RWseek(src, start, RW_SEEK_SET);
if (is_JPG==0) cSDL_LogToFile( "It is not a JPEG image");
else cSDL_LogToFile( "Yes let's go further we have a JPEG image");
return(is_JPG);
}
@ -479,6 +486,7 @@ void IMG_QuitJPG()
/* See if an image is contained in a data source */
int IMG_isJPG(SDL_RWops *src)
{
cSDL_LogToFile( "Wrong fonction to detect JPEG");
return(0);
}
@ -490,4 +498,4 @@ SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
#endif /* LOAD_JPG */
#endif /* !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND) */
//#endif /* !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND) */

View File

@ -1,5 +1,5 @@
INCLUDE = -I./include -I/home/sylvain/.local/share/giteapc/Lephenixnoir/sh-elf-gcc/lib/gcc/sh3eb-elf/11.1.0/include/openlibm/
CFLAGS = -O2 $(INCLUDE) -lm -m4-nofpu -mb -ffreestanding -nostdlib -lcJPG -lcPNG -lczlib -lSDL_prizm -Wa,--dsp -DLOAD_GIF -LOAD_JPG -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM -DLOAD_TGA -DLOAD_XCF -DLOAD_BMP -DLOAD_PNG
CFLAGS = -O2 $(INCLUDE) -lm -m4-nofpu -mb -ffreestanding -nostdlib -lcJPG -lcPNG -lczlib -lSDL_prizm -Wa,--dsp -DLOAD_GIF -DLOAD_JPG -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM -DLOAD_TGA -DLOAD_XCF -DLOAD_BMP -DLOAD_PNG
AR = sh-elf-gcc-ar
RANLIB = sh-elf-gcc-ranlib
CC = sh-elf-gcc

View File

@ -33,6 +33,10 @@
extern "C" {
#endif
#undef LOAD_JPG_DYNAMIC
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
#define SDL_IMAGE_MAJOR_VERSION 1