Skip to content

Commit

Permalink
Added missing ICO and CUR types to Xcode build
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 2, 2009
1 parent 8ea6533 commit 7830a48
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
21 changes: 21 additions & 0 deletions IMG_ImageIO.c
Expand Up @@ -420,6 +420,17 @@ static SDL_Surface* LoadImageFromFile(const char* file)
}


int IMG_isCUR(SDL_RWops *src)
{
/* FIXME: Is this a supported type? */
return Internal_isType(src, CFSTR("com.microsoft.cur"));
}

int IMG_isICO(SDL_RWops *src)
{
return Internal_isType(src, kUTTypeICO);
}

int IMG_isBMP(SDL_RWops *src)
{
return Internal_isType(src, kUTTypeBMP);
Expand All @@ -429,6 +440,7 @@ int IMG_isGIF(SDL_RWops *src)
{
return Internal_isType(src, kUTTypeGIF);
}

// Note: JPEG 2000 is kUTTypeJPEG2000
int IMG_isJPG(SDL_RWops *src)
{
Expand All @@ -451,6 +463,15 @@ int IMG_isTIF(SDL_RWops *src)
return Internal_isType(src, kUTTypeTIFF);
}

SDL_Surface* IMG_LoadCUR_RW(SDL_RWops *src)
{
/* FIXME: Is this a supported type? */
return LoadImageFromRWops(src, CFSTR("com.microsoft.cur"));
}
SDL_Surface* IMG_LoadICO_RW(SDL_RWops *src)
{
return LoadImageFromRWops(src, kUTTypeICO);
}
SDL_Surface* IMG_LoadBMP_RW(SDL_RWops *src)
{
return LoadImageFromRWops(src, kUTTypeBMP);
Expand Down
48 changes: 47 additions & 1 deletion IMG_UIImage.m
Expand Up @@ -268,6 +268,40 @@


/* Copied straight from other files so I don't have to alter them. */
static int IMG_isICOCUR(SDL_RWops *src, int type)
{
int start;
int is_ICOCUR;

/* The Win32 ICO file header (14 bytes) */
Uint16 bfReserved;
Uint16 bfType;
Uint16 bfCount;

if ( !src )
return 0;
start = SDL_RWtell(src);
is_ICOCUR = 0;
bfReserved = SDL_ReadLE16(src);
bfType = SDL_ReadLE16(src);
bfCount = SDL_ReadLE16(src);
if ((bfReserved == 0) && (bfType == type) && (bfCount != 0))
is_ICOCUR = 1;
SDL_RWseek(src, start, SEEK_SET);

return (is_ICOCUR);
}

int IMG_isICO(SDL_RWops *src)
{
return IMG_isICOCUR(src, 1);
}

int IMG_isCUR(SDL_RWops *src)
{
return IMG_isICOCUR(src, 2);
}

int IMG_isBMP(SDL_RWops *src)
{
int start;
Expand Down Expand Up @@ -420,7 +454,15 @@ int IMG_isTIF(SDL_RWops* src)
return(is_TIF);
}


SDL_Surface* IMG_LoadCUR_RW(SDL_RWops *src)
{
/* FIXME: Is this a supported type? */
return LoadImageFromRWops(src, CFSTR("com.microsoft.cur"));
}
SDL_Surface* IMG_LoadICO_RW(SDL_RWops *src)
{
return LoadImageFromRWops(src, kUTTypeICO);
}
SDL_Surface* IMG_LoadBMP_RW(SDL_RWops *src)
{
return LoadImageFromRWops(src, kUTTypeBMP);
Expand All @@ -437,6 +479,10 @@ int IMG_isTIF(SDL_RWops* src)
{
return LoadImageFromRWops(src, kUTTypePNG);
}
SDL_Surface* IMG_LoadTGA_RW(SDL_RWops *src)
{
return LoadImageFromRWops(src, CFSTR("com.truevision.tga-image"));
}
SDL_Surface* IMG_LoadTIF_RW(SDL_RWops *src)
{
return LoadImageFromRWops(src, kUTTypeTIFF);
Expand Down

0 comments on commit 7830a48

Please sign in to comment.