[Plib-cvs] plib/src/ssg ssgLoadPCX.cxx,1.2,1.3
Brought to you by:
sjbaker
From: Wolfram K. <wol...@us...> - 2004-09-13 12:15:04
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6422/ssg Modified Files: ssgLoadPCX.cxx Log Message: Major rework, especially to previously virtually not existing the alfa handling. Index: ssgLoadPCX.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadPCX.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ssgLoadPCX.cxx 24 Jan 2004 18:21:55 -0000 1.2 +++ ssgLoadPCX.cxx 13 Sep 2004 12:14:56 -0000 1.3 @@ -45,7 +45,8 @@ #ifdef SSG_LOAD_PCX_SUPPORTED -bool ssgLoadPCX ( const char *fname, ssgTextureInfo* info ) +int ReadFileIntoBuffer(const char *fname, UByte *&buffer, UByte *&bufferorig, unsigned long &file_length) +// Opens the file, allocates buffer of correct size to hold the file, reads it, closes it { // **** open file **** FILE *tfile; @@ -56,15 +57,23 @@ [...93 lines suppressed...] for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { - UByte b = *pBody++; + UByte a = pAlfa?pAlfa[iRunningIndex]:255; + UByte b = pBody[iRunningIndex++]; texels[c++] = buffer[b*3 ]; texels[c++] = buffer[b*3 + 1]; texels[c++] = buffer[b*3 + 2]; - texels[c++] = 255; //(b<index)?0:255; + texels[c++] = a; } } delete [] pBodyorig; delete [] bufferorig; + if (pAlfa) + delete [] pAlfa; return ssgMakeMipMaps ( texels, width, height, 4 ) ; } #else |