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

Function AddDynamicTexture

engine/gui/src/gui.cpp:762–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

760 }
761
762 Result AddDynamicTexture(HScene scene, dmhash_t texture_name_hash, HTextureSource texture_source, NodeTextureType texture_type, uint32_t original_width, uint32_t original_height)
763 {
764 TextureInfo* t = scene->m_DynamicTextures.Get(texture_name_hash);
765 if (t)
766 {
767 if (t->m_ImageType != UINT32_MAX)
768 {
769 uint32_t buffer_size_mb = t->m_OriginalWidth * t->m_OriginalHeight * dmImage::BytesPerPixel((dmImage::Type) t->m_ImageType);
770 DM_PROPERTY_ADD_F32(rmtp_GuiDynamicTexturesSizeMb, -buffer_size_mb);
771 }
772
773 scene->m_DeleteTextureResourceCallback(scene, texture_name_hash, t->m_TextureSource);
774 }
775 return AddTexture(scene, scene->m_DynamicTextures, texture_name_hash, texture_source, texture_type, original_width, original_height, UINT32_MAX);
776 }
777
778 static void UnassignTexture(HScene scene, dmhash_t texture_name_hash)
779 {

Callers 1

CompGuiSetPropertyFunction · 0.85

Calls 3

BytesPerPixelFunction · 0.85
AddTextureFunction · 0.70
GetMethod · 0.45

Tested by

no test coverage detected