textureloader - png fix, SIGQUIT removed

This commit is contained in:
Henrique Santiago 2011-03-18 18:09:56 -03:00
parent c70e27494c
commit 3164d7e691
4 changed files with 13 additions and 15 deletions

View File

@ -27,6 +27,16 @@
#include <png.h>
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;

View File

@ -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

View File

@ -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;

View File

@ -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]);