diff --git a/src/osgPlugins/dds/ReaderWriterDDS.cpp b/src/osgPlugins/dds/ReaderWriterDDS.cpp index 475f210d6..0cc659fe9 100644 --- a/src/osgPlugins/dds/ReaderWriterDDS.cpp +++ b/src/osgPlugins/dds/ReaderWriterDDS.cpp @@ -264,7 +264,7 @@ struct DXT1TexelsBlock */ #define FOURCC_DX10 (MAKEFOURCC('D','X','1','0')) -typedef enum OSG_DXGI_FORMAT { +typedef enum OSG_DXGI_FORMAT { OSG_DXGI_FORMAT_UNKNOWN = 0, OSG_DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, OSG_DXGI_FORMAT_R32G32B32A32_FLOAT = 2, @@ -384,7 +384,7 @@ typedef enum OSG_DXGI_FORMAT { OSG_DXGI_FORMAT_FORCE_UINT = 0xffffffffUL } OSG_DXGI_FORMAT; -typedef enum OSG_D3D10_RESOURCE_DIMENSION { +typedef enum OSG_D3D10_RESOURCE_DIMENSION { OSG_D3D10_RESOURCE_DIMENSION_UNKNOWN = 0, OSG_D3D10_RESOURCE_DIMENSION_BUFFER = 1, OSG_D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2, @@ -407,7 +407,7 @@ static unsigned int ComputeImageSizeInBytes( int width, int height, int depth, if( width < 1 ) width = 1; if( height < 1 ) height = 1; if( depth < 1 ) depth = 1; - + return osg::Image::computeImageSizeInBytes(width, height, depth, pixelFormat, pixelType, packing, slice_packing, image_packing); } @@ -982,6 +982,8 @@ osg::Image* ReadDDSFile(std::istream& _istream, bool flipDDSRead) } } + OSG_INFO<<"ReadDDS, dataType = 0x"<setOrigin(osg::Image::BOTTOM_LEFT); if (!isDXTC || ((s>4 && s%4==0 && t>4 && t%4==0) || s<4)) // Flip may crash (access violation) or fail for non %4 dimensions (except for s<4). Tested with revision trunk 2013-02-22. { + OSG_INFO<<"Flipping dds on load"<flipVertical(); } else @@ -1061,7 +1064,9 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri unsigned int pixelSize = osg::Image::computePixelSizeInBits(pixelFormat, dataType); unsigned int imageSize = img->getTotalSizeInBytes(); - // Check that theorical image size (computation taking into account DXTC blocks) is not bigger than actual image size. + OSG_INFO<<"WriteDDS, dataType = 0x"< source; if (autoFlipDDSWrite && img->getOrigin() == osg::Image::BOTTOM_LEFT) { + OSG_INFO<<"Flipping dds image on write"< copy( new osg::Image(*img,osg::CopyOp::DEEP_COPY_ALL) ); const int s(copy->s()); const int t(copy->t()); @@ -1283,7 +1290,7 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri OSG_WARN << "WriteDDSFile warning: Vertical flip was skipped. Image dimensions have to be multiple of 4." << std::endl; } source = copy; - } + } else { source = img; @@ -1361,7 +1368,7 @@ public: if (options) { std::istringstream iss(options->getOptionString()); - std::string opt; + std::string opt; while (iss >> opt) { if (opt == "dds_flip") dds_flip = true;