Skip to content

Commit

Permalink
1.1.0:
Browse files Browse the repository at this point in the history
Sam Lantinga - Wed Nov 29 00:46:27 PST 2000
 * Added XPM file format support
   Supports color, greyscale, and mono XPMs with and without transparency
Mattias Engdeg?rd - Thu, 2 Nov 2000 23:23:17 +0100 (MET)
 * Fixed array overrun when loading an unsupported format
 * Minor compilation fixes for various platforms
  • Loading branch information
Sam Lantinga committed Nov 29, 2000
1 parent 7114758 commit 79f8b13
Show file tree
Hide file tree
Showing 12 changed files with 506 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CHANGES
@@ -1,4 +1,12 @@

1.1.0:
Sam Lantinga - Wed Nov 29 00:46:27 PST 2000
* Added XPM file format support
Supports color, greyscale, and mono XPMs with and without transparency
Mattias Engdeg�rd - Thu, 2 Nov 2000 23:23:17 +0100 (MET)
* Fixed array overrun when loading an unsupported format
* Minor compilation fixes for various platforms

1.0.10:
Mattias Engdeg�rd - Wed Aug 9 20:32:22 MET DST 2000
* Removed the alpha flipping, made IMG_InvertAlpha() a noop
Expand Down
7 changes: 5 additions & 2 deletions IMG.c
Expand Up @@ -30,6 +30,8 @@

#include "SDL_image.h"

#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))

/* Table of image detection and loading functions */
static struct {
char *type;
Expand All @@ -40,11 +42,12 @@ static struct {
{ "TGA", NULL, IMG_LoadTGA_RW },
{ "BMP", IMG_isBMP, IMG_LoadBMP_RW },
{ "PPM", IMG_isPPM, IMG_LoadPPM_RW },
{ "XPM", IMG_isXPM, IMG_LoadXPM_RW },
{ "PCX", IMG_isPCX, IMG_LoadPCX_RW },
{ "GIF", IMG_isGIF, IMG_LoadGIF_RW },
{ "JPG", IMG_isJPG, IMG_LoadJPG_RW },
{ "TIF", IMG_isTIF, IMG_LoadTIF_RW },
{ "PNG", IMG_isPNG, IMG_LoadPNG_RW },
{ "PNG", IMG_isPNG, IMG_LoadPNG_RW }
};

/* Load an image from a file */
Expand Down Expand Up @@ -96,7 +99,7 @@ SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type)
/* Detect the type of image being loaded */
start = SDL_RWtell(src);
image = NULL;
for ( i=0; supported[i].type && !image; ++i ) {
for ( i=0; i < ARRAYSIZE(supported) && !image; ++i ) {
if( (supported[i].is
&& (SDL_RWseek(src, start, SEEK_SET),
supported[i].is(src)))
Expand Down
2 changes: 1 addition & 1 deletion IMG_gif.c
Expand Up @@ -254,7 +254,7 @@ IMG_LoadGIF_RW(SDL_RWops *src)

#ifdef USED_BY_SDL
if ( Gif89.transparent > 0 ) {
SDL_SetColorKey(image, SDL_SRCCOLORKEY, Gif89. transparent);
SDL_SetColorKey(image, SDL_SRCCOLORKEY, Gif89.transparent);
}
#endif

Expand Down
1 change: 1 addition & 0 deletions IMG_jpg.c
Expand Up @@ -25,6 +25,7 @@
/* This is a JPEG image file loading framework */

#include <stdio.h>
#include <string.h>

#include "SDL_image.h"

Expand Down
1 change: 0 additions & 1 deletion IMG_pcx.c
Expand Up @@ -113,7 +113,6 @@ SDL_Surface *IMG_LoadPCX_RW(SDL_RWops *src)
Gmask = 0x0000FF00;
Bmask = 0x00FF0000;
} else {
int s = (pcxh.NPlanes == 4) ? 0 : 8;
Rmask = 0xFF0000;
Gmask = 0x00FF00;
Bmask = 0x0000FF;
Expand Down
6 changes: 3 additions & 3 deletions IMG_png.c
Expand Up @@ -93,7 +93,7 @@ static void png_read_data(png_structp ctx, png_bytep area, png_size_t size)
}
SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
{
SDL_Surface *surface;
SDL_Surface *volatile surface;
png_structp png_ptr;
png_infop info_ptr;
png_uint_32 width, height;
Expand All @@ -103,9 +103,9 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
Uint32 Bmask;
Uint32 Amask;
SDL_Palette *palette;
png_bytep *row_pointers;
png_bytep *volatile row_pointers;
int row, i;
int ckey = -1;
volatile int ckey = -1;
png_color_16 *transv;

/* Initialize the data we will clean up when we're done */
Expand Down
1 change: 1 addition & 0 deletions IMG_ppm.c
Expand Up @@ -88,6 +88,7 @@ static int ReadNumber(SDL_RWops *src)

return(number);
}

SDL_Surface *IMG_LoadPPM_RW(SDL_RWops *src)
{
SDL_Surface *surface;
Expand Down

0 comments on commit 79f8b13

Please sign in to comment.