graphics: migrate drawables to shared ownership

- introduce DrawablePtr and per-consumer createInstance() semantics
  - add TextureDrawable wrappers backed by shared TexturePtr handles
  - migrate regions, sprites, nine-patches, state lists, skins, groups, gradients,
    UI widgets, tools, modules, ecode, and eeiv to shared drawable ownership
  - remove ownIt flags, manual drawable deletion, and unload-based lifetime handling
  - replace drawable callback IDs with RAII change connections
  - move Variant drawable storage outside its scalar union
  - split UIIcon source lookup from explicit drawable instance creation
  - retain icon instances used by rendering loops instead of cloning per frame
  - avoid shared source mutation in texture-region consumers
  - use drawable type tags instead of RTTI casts
  - fix nearest-size UIIcon lookup
  - document the drawable source/instance contract and add ownership tests
This commit is contained in:
Martín Lucas Golini
2026-07-20 01:09:36 -03:00
parent 04f600bef5
commit dc377335b9
131 changed files with 1747 additions and 1178 deletions

View File

@@ -1303,7 +1303,7 @@ bool GitPlugin::onCreateContextMenu( UICodeEditor*, UIPopUpMenu* menu, const Vec
const std::string& icon = "" ) {
subMenu
->add( i18n( txtKey, txtVal ),
!icon.empty() ? findIcon( icon )->getSize( PixelDensity::dpToPxI( 12 ) )
!icon.empty() ? findIcon( icon )->createDrawable( PixelDensity::dpToPxI( 12 ) )
: nullptr,
KeyBindings::keybindFormat( mKeyBindings[txtKey] ) )
->setId( txtKey );
@@ -1314,7 +1314,7 @@ bool GitPlugin::onCreateContextMenu( UICodeEditor*, UIPopUpMenu* menu, const Vec
menu->addSubMenu( i18n( "git", "Git" ),
mManager->getUISceneNode()
->findIcon( "source-control" )
->getSize( PixelDensity::dpToPxI( 12 ) ),
->createDrawable( PixelDensity::dpToPxI( 12 ) ),
subMenu );
return false;
@@ -1453,7 +1453,7 @@ void GitPlugin::buildSidePanelTab() {
return;
UIIcon* icon = findIcon( "source-control" );
mTab = mSidePanel->add( i18n( "source_control", "Source Control" ), mTabContents,
icon ? icon->getSize( PixelDensity::dpToPx( 12 ) ) : nullptr );
icon ? icon->createDrawable( PixelDensity::dpToPx( 12 ) ) : nullptr );
mTab->setId( "source_control_tab" );
mTab->setTextAsFallback( true );
return;
@@ -1526,7 +1526,7 @@ void GitPlugin::buildSidePanelTab() {
String::format( STYLE, color, color ), nullptr, String::hash( "git_plugin_style" ) );
mTab = mSidePanel->add( i18n( "source_control", "Source Control" ), mTabContents,
icon ? icon->getSize( PixelDensity::dpToPx( 12 ) ) : nullptr );
icon ? icon->createDrawable( PixelDensity::dpToPx( 12 ) ) : nullptr );
mTab->setId( "source_control_tab" );
mTab->setTextAsFallback( true );