- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/rgb/ReaderWriterRGB.cpp
r12912 r13041 56 56 GLenum swapFlag; 57 57 short bpc; 58 58 59 59 typedef unsigned char * BytePtr; 60 60 … … 64 64 int testWord; 65 65 char testByte[sizeof(int)]; 66 }endianTest; 66 }endianTest; 67 67 endianTest.testWord = 1; 68 68 if( endianTest.testByte[0] == 1 ) … … 75 75 inline void swapBytes( T &s ) 76 76 { 77 if( sizeof( T ) == 1 ) 77 if( sizeof( T ) == 1 ) 78 78 return; 79 79 … … 136 136 if (raw) 137 137 { 138 138 139 139 if (raw->tmp) delete [] raw->tmp; 140 140 if (raw->tmpR) delete [] raw->tmpR; … … 143 143 if (raw->tmpA) delete [] raw->tmpA; 144 144 145 if (raw->rowStart) delete [] raw->rowStart; 146 if (raw->rowSize) delete [] raw->rowSize; 145 if (raw->rowStart) delete [] raw->rowStart; 146 if (raw->rowSize) delete [] raw->rowSize; 147 147 148 148 delete raw; … … 239 239 } 240 240 } 241 241 242 242 if ((raw->type & 0xFF00) == 0x0100) 243 243 { … … 296 296 iPtr = reinterpret_cast<unsigned char *>(tempShort); 297 297 } 298 298 299 299 if(raw->bpc != 1) 300 300 ConvertShort(&pixel, 1); 301 301 302 302 count = (int)(pixel & 0x7F); 303 303 304 304 // limit the count value to the remiaing row size 305 305 if (raw->sizeX*raw->bpc <= (oPtr - buf)) … … 307 307 count = raw->sizeX - (oPtr - buf) / raw->bpc; 308 308 } 309 309 310 310 if (count<=0) 311 311 { … … 313 313 return; 314 314 } 315 315 316 316 if (pixel & 0x80) 317 317 { … … 325 325 tempShort++; 326 326 iPtr = reinterpret_cast<unsigned char *>(tempShort); 327 327 328 328 ConvertShort(&pixel, 1); 329 329 … … 387 387 388 388 // byte aligned. 389 389 390 390 OSG_INFO<<"raw->sizeX = "<<raw->sizeX<<std::endl; 391 391 OSG_INFO<<"raw->sizeY = "<<raw->sizeY<<std::endl; 392 392 OSG_INFO<<"raw->sizeZ = "<<raw->sizeZ<<std::endl; 393 393 OSG_INFO<<"raw->bpc = "<<raw->bpc<<std::endl; 394 394 395 395 *data = new unsigned char [(raw->sizeX)*(raw->sizeY)*(raw->sizeZ)*(raw->bpc)]; 396 396 … … 457 457 { 458 458 public: 459 459 460 460 ReaderWriterRGB() 461 461 { … … 467 467 supportsExtension("bw","bw image format"); 468 468 } 469 469 470 470 virtual const char* className() const { return "RGB Image Reader/Writer"; } 471 471 472 472 ReadResult readRGBStream(std::istream& fin) const 473 473 { … … 630 630 } 631 631 632 632 633 633 if( raw.needsBytesSwapped() ) 634 634 raw.swapBytes(); … … 671 671 return WriteResult::ERROR_IN_WRITING_FILE; 672 672 } 673 673 674 674 return writeRGBStream(img,fout,""); 675 675 }
