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

Method allocBitmap

engine/source/gui/guiMLTextCtrl.cc:950–973  ·  view source on GitHub ↗

--------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

948
949//--------------------------------------------------------------------------
950GuiMLTextCtrl::Bitmap *GuiMLTextCtrl::allocBitmap(const char *bitmapName, U32 bitmapNameLen)
951{
952 for(Bitmap *walk = mBitmapList; walk; walk = walk->next)
953 {
954 if (bitmapNameLen == walk->bitmapNameLen && !dStrncmp(walk->bitmapName, bitmapName, bitmapNameLen))
955 return walk;
956 }
957
958 Bitmap *ret = constructInPlace((Bitmap *) mResourceChunker.alloc(sizeof(Bitmap)));
959 ret->bitmapName = bitmapName;
960 ret->bitmapNameLen = bitmapNameLen;
961 char nameBuffer[256];
962 AssertFatal(sizeof(nameBuffer) >= bitmapNameLen, "GuiMLTextCtrl::allocBitmap() - bitmap name too long");
963 dStrncpy(nameBuffer, bitmapName, bitmapNameLen);
964 nameBuffer[bitmapNameLen] = 0;
965 ret->bitmapHandle = TextureHandle(nameBuffer, TextureHandle::BitmapTexture);
966 if(bool(ret->bitmapHandle))
967 {
968 ret->next = mBitmapList;
969 mBitmapList = ret;
970 return ret;
971 }
972 return NULL;
973}
974
975//--------------------------------------------------------------------------
976GuiMLTextCtrl::LineTag *GuiMLTextCtrl::allocLineTag(U32 id)

Callers

nothing calls this directly

Calls 5

constructInPlaceFunction · 0.85
dStrncmpFunction · 0.50
dStrncpyFunction · 0.50
TextureHandleClass · 0.50
allocMethod · 0.45

Tested by

no test coverage detected