Added futher use of readSize/writeSize.
This commit is contained in:
parent
725258ea54
commit
eac767d494
@ -524,7 +524,7 @@ osg::Image* InputStream::readImage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// _mipmapData
|
// _mipmapData
|
||||||
unsigned int levelSize = 0; *this >> levelSize;
|
unsigned int levelSize = readSize();
|
||||||
osg::Image::MipmapDataType levels(levelSize);
|
osg::Image::MipmapDataType levels(levelSize);
|
||||||
for ( unsigned int i=0; i<levelSize; ++i )
|
for ( unsigned int i=0; i<levelSize; ++i )
|
||||||
{
|
{
|
||||||
@ -538,7 +538,7 @@ osg::Image* InputStream::readImage()
|
|||||||
case IMAGE_INLINE_FILE:
|
case IMAGE_INLINE_FILE:
|
||||||
if ( isBinary() )
|
if ( isBinary() )
|
||||||
{
|
{
|
||||||
unsigned int size = 0; *this >> size;
|
unsigned int size = readSize();
|
||||||
if ( size>0 )
|
if ( size>0 )
|
||||||
{
|
{
|
||||||
char* data = new char[size];
|
char* data = new char[size];
|
||||||
|
@ -355,11 +355,11 @@ void OutputStream::writeImage( const osg::Image* img )
|
|||||||
*this << img->getDataType(); // _dataType
|
*this << img->getDataType(); // _dataType
|
||||||
*this << img->getPacking(); // _packing
|
*this << img->getPacking(); // _packing
|
||||||
*this << img->getAllocationMode(); // _allocationMode
|
*this << img->getAllocationMode(); // _allocationMode
|
||||||
|
|
||||||
// _data
|
// _data
|
||||||
unsigned int size = img->getTotalSizeInBytesIncludingMipmaps();
|
unsigned int size = img->getTotalSizeInBytesIncludingMipmaps();
|
||||||
*this << size; writeCharArray( (char*)img->data(), size );
|
writeSize(size); writeCharArray( (char*)img->data(), size );
|
||||||
|
|
||||||
// _mipmapData
|
// _mipmapData
|
||||||
const osg::Image::MipmapDataType& levels = img->getMipmapLevels();
|
const osg::Image::MipmapDataType& levels = img->getMipmapLevels();
|
||||||
writeSize(levels.size());
|
writeSize(levels.size());
|
||||||
@ -379,7 +379,7 @@ void OutputStream::writeImage( const osg::Image* img )
|
|||||||
{
|
{
|
||||||
infile.seekg( 0, std::ios::end );
|
infile.seekg( 0, std::ios::end );
|
||||||
unsigned int size = infile.tellg();
|
unsigned int size = infile.tellg();
|
||||||
*this << size;
|
writeSize(size);
|
||||||
|
|
||||||
if ( size>0 )
|
if ( size>0 )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user