summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-01-22 18:31:25 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-01-24 19:05:14 +0100
commitdd1386684b6430337d3b270bec1ca53fa69f9593 (patch)
tree68ec0caa9e81af7ebd38f45e4a9fcbf8ed35625c /src/resources/image.cpp
parent8a4b82e3ed75e426d44b69640f009e1e731c75c4 (diff)
downloadmana-dd1386684b6430337d3b270bec1ca53fa69f9593.tar.gz
mana-dd1386684b6430337d3b270bec1ca53fa69f9593.tar.bz2
mana-dd1386684b6430337d3b270bec1ca53fa69f9593.tar.xz
mana-dd1386684b6430337d3b270bec1ca53fa69f9593.zip
Use SDL_RWops directly on top of PhysFS
This avoids the creation of a temporary buffer containing a complete file for the sole purpose of wrapping it up in an SDL_RWops. The necessary wrapper is by Ryan C. Gordon and is included in the PhysFS repository under 'extras'. Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 63f1bd2c..7f14a73e 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -105,10 +105,8 @@ Image::~Image()
unload();
}
-Resource *Image::load(void *buffer, unsigned bufferSize)
+Resource *Image::load(SDL_RWops *rw)
{
- // Load the raw file data from the buffer in an RWops structure
- SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
SDL_Surface *tmpImage = IMG_Load_RW(rw, 1);
if (!tmpImage)
@@ -123,9 +121,8 @@ Resource *Image::load(void *buffer, unsigned bufferSize)
return image;
}
-Resource *Image::load(void *buffer, unsigned bufferSize, Dye const &dye)
+Resource *Image::load(SDL_RWops *rw, Dye const &dye)
{
- SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
SDL_Surface *tmpImage = IMG_Load_RW(rw, 1);
if (!tmpImage)