mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 04:53:27 +02:00
textureloader - png fix, SIGQUIT removed
This commit is contained in:
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user