Skip to content

Commit

Permalink
Jamie Knight to slouken
Browse files Browse the repository at this point in the history
Hi Sam,

I'm working on a cross-platform casual game and we're currently evaluating using SDL 1.3 to deploy it for the iPhone.

Some of our textures are currently in tga files current SDL_image built from subversion fails to load on the iPhone.  I think I've tracked this down and it is basically because while the ImageIO backend supports TGA, UIImage does not and the fallback code path to use the old RW_ops loaders is broken AND the tga loader is compiled out for ImageIO and UIImage.
  • Loading branch information
slouken committed Apr 9, 2010
1 parent d89386e commit aa68c6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
16 changes: 4 additions & 12 deletions IMG_UIImage.m
Expand Up @@ -114,7 +114,6 @@
SDL_Surface* sdl_surface;
UIImage* ui_image;

CGImageRef image_ref = NULL;
int bytes_read = 0;
// I don't know what a good size is.
// Max recommended texture size is 1024x1024 on iPhone so maybe base it on that?
Expand All @@ -130,11 +129,6 @@
[ns_data appendBytes:temp_buffer length:bytes_read];
} while(bytes_read > 0);

if(NULL == image_ref)
{
return NULL;
}

ui_image = [[UIImage alloc] initWithData:ns_data];

sdl_surface = Create_SDL_Surface_From_CGImage([ui_image CGImage]);
Expand All @@ -156,8 +150,10 @@

ns_string = [[NSString alloc] initWithUTF8String:file];
ui_image = [[UIImage alloc] initWithContentsOfFile:ns_string];

sdl_surface = Create_SDL_Surface_From_CGImage([ui_image CGImage]);
if(ui_image != NULL)
{
sdl_surface = Create_SDL_Surface_From_CGImage([ui_image CGImage]);
}

[ui_image release];
[ns_string release];
Expand Down Expand Up @@ -433,10 +429,6 @@ 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
6 changes: 0 additions & 6 deletions IMG_tga.c
Expand Up @@ -20,10 +20,6 @@
slouken@libsdl.org
*/

#if !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND)

/* This is a Targa image file loading framework */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -333,5 +329,3 @@ SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src)
}

#endif /* LOAD_TGA */

#endif /* !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND) */

0 comments on commit aa68c6e

Please sign in to comment.