IMG_xxx.c
author Thomas Bernard <miniupnp@free.fr>
Fri, 30 Nov 2018 11:04:15 +0100
branchSDL-1.2
changeset 634 68f958f43339
parent 280 ec4ae96c100c
child 347 ad5034cad524
permissions -rw-r--r--
IMG_xcf.c: Avoid infinite loop in read_xcf_header()
slouken@0
     1
/*
slouken@280
     2
  SDL_image:  An example image loading library for use with SDL
slouken@280
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
slouken@0
     4
slouken@280
     5
  This software is provided 'as-is', without any express or implied
slouken@280
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@280
     7
  arising from the use of this software.
slouken@0
     8
slouken@280
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@280
    10
  including commercial applications, and to alter it and redistribute it
slouken@280
    11
  freely, subject to the following restrictions:
slouken@0
    12
slouken@280
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@280
    14
     claim that you wrote the original software. If you use this software
slouken@280
    15
     in a product, an acknowledgment in the product documentation would be
slouken@280
    16
     appreciated but is not required.
slouken@280
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@280
    18
     misrepresented as being the original software.
slouken@280
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@0
    20
*/
slouken@0
    21
slouken@0
    22
/* This is a generic "format not supported" image framework */
slouken@0
    23
slouken@0
    24
#include <stdio.h>
slouken@0
    25
slouken@0
    26
#include "SDL_image.h"
slouken@0
    27
slouken@0
    28
#ifdef LOAD_XXX
slouken@0
    29
slouken@0
    30
/* See if an image is contained in a data source */
slouken@0
    31
int IMG_isXXX(SDL_RWops *src)
slouken@0
    32
{
slouken@117
    33
	int start;
slouken@0
    34
	int is_XXX;
slouken@0
    35
icculus@154
    36
	if ( !src )
icculus@154
    37
		return 0;
slouken@117
    38
	start = SDL_RWtell(src);
slouken@0
    39
	is_XXX = 0;
slouken@118
    40
slouken@118
    41
	/* Detect the image here */
slouken@118
    42
slouken@236
    43
	SDL_RWseek(src, start, RW_SEEK_SET);
slouken@0
    44
	return(is_XXX);
slouken@0
    45
}
slouken@0
    46
slouken@0
    47
/* Load a XXX type image from an SDL datasource */
slouken@0
    48
SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
slouken@0
    49
{
slouken@118
    50
	int start;
slouken@118
    51
	const char *error = NULL;
slouken@118
    52
	SDL_Surface *surface = NULL;
slouken@118
    53
slouken@98
    54
	if ( !src ) {
slouken@98
    55
		/* The error message has been set in SDL_RWFromFile */
slouken@98
    56
		return NULL;
slouken@98
    57
	}
slouken@118
    58
	start = SDL_RWtell(src);
slouken@118
    59
slouken@118
    60
	/* Load the image here */
slouken@118
    61
slouken@118
    62
	if ( error ) {
slouken@236
    63
		SDL_RWseek(src, start, RW_SEEK_SET);
slouken@118
    64
		if ( surface ) {
slouken@118
    65
			SDL_FreeSurface(surface);
slouken@118
    66
			surface = NULL;
slouken@118
    67
		}
slouken@118
    68
		IMG_SetError(error);
slouken@118
    69
	}
slouken@118
    70
	return surface;
slouken@0
    71
}
slouken@0
    72
slouken@0
    73
#else
slouken@0
    74
slouken@0
    75
/* See if an image is contained in a data source */
slouken@0
    76
int IMG_isXXX(SDL_RWops *src)
slouken@0
    77
{
slouken@0
    78
	return(0);
slouken@0
    79
}
slouken@0
    80
slouken@0
    81
/* Load a XXX type image from an SDL datasource */
slouken@0
    82
SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
slouken@0
    83
{
slouken@0
    84
	return(NULL);
slouken@0
    85
}
slouken@0
    86
slouken@0
    87
#endif /* LOAD_XXX */