From b4e47fb41a19ca09c02bcd009b28cb7c3caa2256 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 22 Jan 2012 18:31:25 +0100 Subject: 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 Conflicts: mana.files src/CMakeLists.txt src/resources/resourcemanager.cpp src/resources/soundeffect.cpp --- src/resources/image.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/resources/image.cpp') diff --git a/src/resources/image.cpp b/src/resources/image.cpp index d94967631..9e9124ab6 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -119,10 +119,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) @@ -137,9 +135,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) -- cgit v1.2.3-60-g2f50