X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FImageIO.cpp;h=3e9f15501eb70a65898476d1be80705c83f16a85;hb=cc92cb7b7f9b87cb791c504bf930d622d74db368;hp=eaeef5f2751764f2c62cab33b2ffe40979b1e6fb;hpb=5509b55dbc13227bdc7b97f2934fa71dad02cc66;p=lugaru.git diff --git a/Source/ImageIO.cpp b/Source/ImageIO.cpp index eaeef5f..3e9f155 100644 --- a/Source/ImageIO.cpp +++ b/Source/ImageIO.cpp @@ -28,7 +28,6 @@ along with Lugaru. If not, see . #include "Game.h" #include "ImageIO.h" -extern ImageRec texture; extern bool visibleloading; /* These two are needed for screenshot */ @@ -39,9 +38,15 @@ static bool load_png(const char * fname, ImageRec & tex); static bool load_jpg(const char * fname, ImageRec & tex); static bool save_screenshot_png(const char * fname); -bool upload_image(const char* fileName) +ImageRec::ImageRec() { - return load_image(fileName, texture); + data = ( GLubyte* )malloc( 1024 * 1024 * 4 ); +} + +ImageRec::~ImageRec() +{ + free(data); + data = NULL; } bool load_image(const char *file_name, ImageRec &tex) @@ -149,7 +154,7 @@ static bool load_png(const char *file_name, ImageRec &tex) if (fp == NULL) { cerr << file_name << " not found" << endl; - return(NULL); + return false; } png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);