From 3164d7e69147891a6c5a0f59d4a7e6431979a13b Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Fri, 18 Mar 2011 18:09:56 -0300 Subject: [PATCH] textureloader - png fix, SIGQUIT removed --- src/framework/textureloader.cpp | 12 +++++++++++- src/framework/textureloader.h | 12 +----------- src/framework/texturemanager.cpp | 2 +- src/main.cpp | 2 -- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/framework/textureloader.cpp b/src/framework/textureloader.cpp index 69a3b500..0e1163cf 100644 --- a/src/framework/textureloader.cpp +++ b/src/framework/textureloader.cpp @@ -27,6 +27,16 @@ #include +struct File +{ + File() { + offset = 0; + } + + unsigned char *data; + unsigned int offset; +}; + void png_read_from_mem(png_structp png_ptr, png_bytep data, png_size_t size) { File *file = (File*)png_get_io_ptr(png_ptr); @@ -38,7 +48,7 @@ void png_read_from_mem(png_structp png_ptr, png_bytep data, png_size_t size) file->offset += size; } -Texture *TextureLoader::loadPNG(unsigned char *fileData, unsigned int fileSize) +Texture *TextureLoader::loadPNG(unsigned char *fileData) { File file; file.data = fileData; diff --git a/src/framework/textureloader.h b/src/framework/textureloader.h index 76cac3a0..a4c72414 100644 --- a/src/framework/textureloader.h +++ b/src/framework/textureloader.h @@ -29,20 +29,10 @@ class Texture; -struct File -{ - File() { - offset = 0; - } - - unsigned char *data; - unsigned long offset; -}; - namespace TextureLoader { /// Load a png textures using libpng - Texture *loadPNG(unsigned char *fileData, unsigned int fileSize); + Texture *loadPNG(unsigned char *fileData); } #endif // TEXTURELOADER_H diff --git a/src/framework/texturemanager.cpp b/src/framework/texturemanager.cpp index 93d65213..51d1ed70 100644 --- a/src/framework/texturemanager.cpp +++ b/src/framework/texturemanager.cpp @@ -58,7 +58,7 @@ TexturePtr TextureManager::get(const std::string& textureFile) if(!textureFileData) return texture; - texture = TexturePtr(TextureLoader::loadPNG(textureFileData, fileSize)); + texture = TexturePtr(TextureLoader::loadPNG(textureFileData)); if(!texture) error("Unable to load texture %s, loading error.", textureFile.c_str()); delete[] textureFileData; diff --git a/src/main.cpp b/src/main.cpp index 79d73d00..4d6def4e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,6 @@ void signal_handler(int sig) switch(sig) { case SIGTERM: case SIGINT: - //case SIGQUIT: { static bool stopping = false; if(!stopping) { @@ -58,7 +57,6 @@ int main(int argc, const char *argv[]) // install our signal handler signal(SIGTERM, signal_handler); signal(SIGINT, signal_handler); - //signal(SIGQUIT, signal_handler); // setup resources g_resources.init(argv[0]);