fix thread-unsafe tga loader

This commit is contained in:
David Rose 2012-05-14 16:58:44 +00:00
parent 78e72288ad
commit e137dfcaa4
2 changed files with 10 additions and 3 deletions

View File

@ -199,6 +199,12 @@ Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) :
ColorMap = NULL; ColorMap = NULL;
AlphaMap = NULL; AlphaMap = NULL;
Red = 0;
Grn = 0;
Blu = 0;
Alpha = 0;
l = 0;
/* Read the Targa file header. */ /* Read the Targa file header. */
readtga( file, tga_head, magic_number ); readtga( file, tga_head, magic_number );
/* /*
@ -701,10 +707,7 @@ get_map_entry( istream *ifp, pixel *Value, int Size, gray *Alpha ) {
void PNMFileTypeTGA::Reader:: void PNMFileTypeTGA::Reader::
get_pixel( istream *ifp, pixel *dest, int Size, gray *alpha_p) { get_pixel( istream *ifp, pixel *dest, int Size, gray *alpha_p) {
static pixval Red, Grn, Blu;
static pixval Alpha;
unsigned char j, k; unsigned char j, k;
static unsigned int l;
/* Check if run length encoded. */ /* Check if run length encoded. */
if ( rlencoded ) if ( rlencoded )

View File

@ -66,6 +66,10 @@ public:
pixel *ColorMap; pixel *ColorMap;
gray *AlphaMap; gray *AlphaMap;
int RLE_count, RLE_flag; int RLE_count, RLE_flag;
pixval Red, Grn, Blu;
pixval Alpha;
unsigned int l;
}; };
class Writer : public PNMWriter { class Writer : public PNMWriter {