summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-26 01:54:25 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-26 01:54:25 +0000
commitb40bfe580d2dc9038c00521a44fcd6edd352f239 (patch)
treeab6ca6ea7b4592bba4e10bddac773528f6467853 /src/resources/image.cpp
parentaa3877cbe156b04c9194856e92ab0dbc129280c1 (diff)
downloadmana-client-b40bfe580d2dc9038c00521a44fcd6edd352f239.tar.gz
mana-client-b40bfe580d2dc9038c00521a44fcd6edd352f239.tar.bz2
mana-client-b40bfe580d2dc9038c00521a44fcd6edd352f239.tar.xz
mana-client-b40bfe580d2dc9038c00521a44fcd6edd352f239.zip
Images are now exclusively loaded through PhysFS, and Tiled maps should load
fine again.
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp36
1 files changed, 7 insertions, 29 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index a8af4e13..5114d1d3 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -50,18 +50,16 @@ Image::~Image()
unload();
}
-Image* Image::load(const std::string &filePath, int flags)
+Image* Image::load(void* buffer, unsigned int bufferSize, int flags)
{
- logger.log("Image::load(%s)", filePath.c_str());
+ // Load the raw file data from the buffer in an RWops structure
+ SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
- // Attempt to use SDL_Image to load the file.
- SDL_Surface *tmpImage = IMG_Load(filePath.c_str());
+ // Use SDL_Image to load the raw image data
+ SDL_Surface* tmpImage = IMG_Load_RW(rw, 1);
- // Check if the file was opened and return the appropriate value.
- if (!tmpImage) {
- logger.log("Error: Image load failed.");
- return NULL;
- }
+ // Now free the SDL_RWops data
+ //SDL_FreeRW(rw);
#ifndef USE_OPENGL
@@ -196,26 +194,6 @@ Image* Image::load(const std::string &filePath, int flags)
}
return new Image(texture, width, height, realWidth, realHeight);
-
-#endif
-}
-
-Image* Image::load(void* buffer, unsigned int bufferSize)
-{
- // Load the raw file data from the buffer in an RWops structure
- SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
-
- // Use SDL_Image to load the raw image data
- SDL_Surface* texture = IMG_Load_RW(rw, 1);
-
- // Now free the SDL_RWops data
- //SDL_FreeRW(rw);
-
-#ifndef USE_OPENGL
- return new Image(texture);
-#else
- return new Image(0, 0, 0, 0, 0);
- // Warning: need implementation to use with OpenGL
#endif
}