MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / loadBitmap

Method loadBitmap

engine/source/graphics/TextureManager.cc:910–939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

908//--------------------------------------------------------------------------------------------------------------------
909
910GBitmap *TextureManager::loadBitmap( const char* pTextureKey, bool recurse, bool nocompression )
911{
912 char fileNameBuffer[512];
913 Con::expandPath( fileNameBuffer, sizeof(fileNameBuffer), pTextureKey );
914 GBitmap *bmp = NULL;
915
916 // Loop through the supported extensions to find the file.
917 U32 len = dStrlen(fileNameBuffer);
918 for (U32 i = 0; i < EXT_ARRAY_SIZE && bmp == NULL; i++)
919 {
920#if defined(TORQUE_OS_IOS)
921 // check to see if requested no-compression...
922 if (nocompression && (dStrncmp( extArray[i], ".pvr", 4 ) == 0)) {
923 continue;
924 }
925#endif
926 dStrcpy(fileNameBuffer + len, extArray[i]);
927
928 bmp = (GBitmap*)ResourceManager->loadInstance(fileNameBuffer);
929
930 if ( bmp != NULL && (bmp->getWidth() > MaximumProductSupportedTextureWidth || bmp->getHeight() > MaximumProductSupportedTextureHeight) )
931 {
932 Con::warnf( "TextureManager::loadBitmap() - Cannot load bitmap '%s' as its dimensions exceed the maximum product-supported texture dimension.", fileNameBuffer );
933 delete bmp;
934 return NULL;
935 }
936 }
937
938 return bmp;
939}
940
941//--------------------------------------------------------------------------------------------------------------------
942

Callers

nothing calls this directly

Calls 8

expandPathFunction · 0.85
warnfFunction · 0.85
loadInstanceMethod · 0.80
dStrlenFunction · 0.50
dStrncmpFunction · 0.50
dStrcpyFunction · 0.50
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected