Check texture cache before adding an icon button's disabled texture

This commit is contained in:
Marc Coll Carrillo 2014-10-07 18:27:08 +02:00
parent ee49604856
commit 9b57d76a79

View File

@ -288,6 +288,13 @@ const video::ITexture* IconButtonWidget::getTexture()
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* texture) video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* texture)
{
video::ITexture* t;
std::string name = texture->getName().getPath().c_str();
name += "_disabled";
t = irr_driver->getTexture(name);
if (t == NULL)
{ {
SColor c; SColor c;
u32 g; u32 g;
@ -309,7 +316,10 @@ video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* textur
} }
} }
return driver->addTexture(texture->getName().getPath() + "_disabled", image.get ()); t = driver->addTexture(name.c_str(), image.get ());
}
return t;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------