MCPcopy Create free account
hub / github.com/defold/defold / DeleteDynamicTexture

Function DeleteDynamicTexture

engine/gui/src/gui.cpp:943–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

941 }
942
943 Result DeleteDynamicTexture(HScene scene, const dmhash_t texture_hash)
944 {
945 TextureInfo* t = scene->m_DynamicTextures.Get(texture_hash);
946 if (!t)
947 {
948 return RESULT_RESOURCE_NOT_FOUND;
949 }
950
951 if (t->m_ImageType != UINT32_MAX)
952 {
953 uint32_t buffer_size_mb = t->m_OriginalWidth * t->m_OriginalHeight * dmImage::BytesPerPixel((dmImage::Type) t->m_ImageType);
954 DM_PROPERTY_ADD_F32(rmtp_GuiDynamicTexturesSizeMb, - buffer_size_mb);
955 }
956
957 scene->m_DeleteTextureResourceCallback(scene, texture_hash, t->m_TextureSource);
958 scene->m_DynamicTextures.Erase(texture_hash);
959 t = scene->m_Textures.Get(texture_hash);
960 if (t)
961 {
962 UpdateTexture(scene, texture_hash, t->m_TextureSource, t->m_TextureSourceType);
963 }
964 else
965 {
966 UnassignTexture(scene, texture_hash);
967 }
968
969 return RESULT_OK;
970 }
971
972 Result SetDynamicTextureData(HScene scene, const dmhash_t texture_hash, uint32_t width, uint32_t height, dmImage::Type type, dmImage::CompressionType compression_type, bool flip, const void* buffer, uint32_t buffer_size)
973 {

Callers 2

LuaDeleteTextureFunction · 0.70
TEST_FFunction · 0.50

Calls 5

BytesPerPixelFunction · 0.85
UpdateTextureFunction · 0.85
UnassignTextureFunction · 0.85
GetMethod · 0.45
EraseMethod · 0.45

Tested by 1

TEST_FFunction · 0.40