MCPcopy Create free account
hub / github.com/codestation/qcma / LoadTexture

Function LoadTexture

common/dds.cpp:814–833  ·  view source on GitHub ↗

Load a 2d texture.

Source from the content-addressed store, hash-verified

812
813// Load a 2d texture.
814static bool LoadTexture( QDataStream & s, const DDSHeader & header, QImage & img )
815{
816 // Create dst image.
817 img = QImage( header.width, header.height, QImage::Format_RGB32 );
818
819 // Read image.
820 DDSType type = GetType( header );
821
822 // Enable alpha buffer for transparent or DDS images.
823 if( HasAlpha( header ) || type >= DDS_DXT1 ) {
824 img = img.convertToFormat( QImage::Format_ARGB32 );
825 }
826
827 TextureLoader loader = GetTextureLoader( type );
828 if( loader == NULL ) {
829 return false;
830 }
831
832 return loader( s, header, img );
833}
834
835
836static int FaceOffset( const DDSHeader & header )

Callers 1

loadDDSFunction · 0.85

Calls 3

GetTypeFunction · 0.85
HasAlphaFunction · 0.85
GetTextureLoaderFunction · 0.85

Tested by

no test coverage detected