Avoid redundant per-frame calls to getDbProp in NLGUI::CWidgetManager
This commit is contained in:
parent
cc6e271607
commit
2cc97d42e9
3 changed files with 51 additions and 13 deletions
|
@ -444,7 +444,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAlphaRolloverSpeed();
|
float getAlphaRolloverSpeed();
|
||||||
void resetAlphaRolloverSpeed();
|
void resetAlphaRolloverSpeedProps();
|
||||||
|
|
||||||
void setContainerAlpha( uint8 alpha );
|
void setContainerAlpha( uint8 alpha );
|
||||||
uint8 getContainerAlpha() const { return _ContainerAlpha; }
|
uint8 getContainerAlpha() const { return _ContainerAlpha; }
|
||||||
|
@ -454,6 +454,7 @@ namespace NLGUI
|
||||||
uint8 getGlobalRolloverFactorContainer() const { return _GlobalRolloverFactorContainer; }
|
uint8 getGlobalRolloverFactorContainer() const { return _GlobalRolloverFactorContainer; }
|
||||||
|
|
||||||
void updateGlobalAlphas();
|
void updateGlobalAlphas();
|
||||||
|
void resetGlobalAlphasProps();
|
||||||
|
|
||||||
const SInterfaceTimes& getInterfaceTimes() const{ return interfaceTimes; }
|
const SInterfaceTimes& getInterfaceTimes() const{ return interfaceTimes; }
|
||||||
void updateInterfaceTimes( const SInterfaceTimes × ){ interfaceTimes = times; }
|
void updateInterfaceTimes( const SInterfaceTimes × ){ interfaceTimes = times; }
|
||||||
|
@ -527,6 +528,11 @@ namespace NLGUI
|
||||||
NLMISC::CCDBNodeLeaf *_BProp;
|
NLMISC::CCDBNodeLeaf *_BProp;
|
||||||
NLMISC::CCDBNodeLeaf *_AProp;
|
NLMISC::CCDBNodeLeaf *_AProp;
|
||||||
NLMISC::CCDBNodeLeaf *_AlphaRolloverSpeedDB;
|
NLMISC::CCDBNodeLeaf *_AlphaRolloverSpeedDB;
|
||||||
|
|
||||||
|
NLMISC::CCDBNodeLeaf *_GlobalContentAlphaDB;
|
||||||
|
NLMISC::CCDBNodeLeaf *_GlobalContainerAlphaDB;
|
||||||
|
NLMISC::CCDBNodeLeaf *_GlobalContentRolloverFactorDB;
|
||||||
|
NLMISC::CCDBNodeLeaf *_GlobalContainerRolloverFactorDB;
|
||||||
|
|
||||||
uint8 _ContainerAlpha;
|
uint8 _ContainerAlpha;
|
||||||
uint8 _GlobalContentAlpha;
|
uint8 _GlobalContentAlpha;
|
||||||
|
|
|
@ -1035,8 +1035,8 @@ namespace NLGUI
|
||||||
setCapturePointerRight(NULL);
|
setCapturePointerRight(NULL);
|
||||||
|
|
||||||
resetColorProps();
|
resetColorProps();
|
||||||
|
resetAlphaRolloverSpeedProps();
|
||||||
_AlphaRolloverSpeedDB = NULL;
|
resetGlobalAlphasProps();
|
||||||
|
|
||||||
activeAnims.clear();
|
activeAnims.clear();
|
||||||
}
|
}
|
||||||
|
@ -1967,10 +1967,18 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update global color from database
|
// Update global color from database
|
||||||
setGlobalColor( NLMISC::CRGBA ( (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R")->getValue32(),
|
if (!_RProp)
|
||||||
(uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G")->getValue32(),
|
{
|
||||||
(uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B")->getValue32(),
|
_RProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R");
|
||||||
(uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A")->getValue32() ) );
|
_GProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G");
|
||||||
|
_BProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B");
|
||||||
|
_AProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A");
|
||||||
|
}
|
||||||
|
setGlobalColor(NLMISC::CRGBA(
|
||||||
|
(uint8)_RProp->getValue32(),
|
||||||
|
(uint8)_GProp->getValue32(),
|
||||||
|
(uint8)_BProp->getValue32(),
|
||||||
|
(uint8)_AProp->getValue32()));
|
||||||
|
|
||||||
NLMISC::CRGBA c = getGlobalColorForContent();
|
NLMISC::CRGBA c = getGlobalColorForContent();
|
||||||
NLMISC::CRGBA gc = getGlobalColor();
|
NLMISC::CRGBA gc = getGlobalColor();
|
||||||
|
@ -2965,7 +2973,7 @@ namespace NLGUI
|
||||||
return fTmp*fTmp*fTmp;
|
return fTmp*fTmp*fTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWidgetManager::resetAlphaRolloverSpeed()
|
void CWidgetManager::resetAlphaRolloverSpeedProps()
|
||||||
{
|
{
|
||||||
_AlphaRolloverSpeedDB = NULL;
|
_AlphaRolloverSpeedDB = NULL;
|
||||||
}
|
}
|
||||||
|
@ -2981,10 +2989,29 @@ namespace NLGUI
|
||||||
|
|
||||||
void CWidgetManager::updateGlobalAlphas()
|
void CWidgetManager::updateGlobalAlphas()
|
||||||
{
|
{
|
||||||
_GlobalContentAlpha = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA")->getValue32();
|
if (!_GlobalContentAlphaDB)
|
||||||
_GlobalContainerAlpha = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ALPHA")->getValue32();
|
{
|
||||||
_GlobalRolloverFactorContent = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ROLLOVER_FACTOR")->getValue32();
|
_GlobalContentAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA");
|
||||||
_GlobalRolloverFactorContainer = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR")->getValue32();
|
nlassert(_GlobalContentAlphaDB);
|
||||||
|
_GlobalContainerAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ALPHA");
|
||||||
|
nlassert(_GlobalContainerAlphaDB);
|
||||||
|
_GlobalContentRolloverFactorDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ROLLOVER_FACTOR");
|
||||||
|
nlassert(_GlobalContentRolloverFactorDB);
|
||||||
|
_GlobalContainerRolloverFactorDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR");
|
||||||
|
nlassert(_GlobalContainerRolloverFactorDB);
|
||||||
|
}
|
||||||
|
_GlobalContentAlpha = (uint8)_GlobalContentAlphaDB->getValue32();
|
||||||
|
_GlobalContainerAlpha = (uint8)_GlobalContainerAlphaDB->getValue32();
|
||||||
|
_GlobalRolloverFactorContent = (uint8)_GlobalContentRolloverFactorDB->getValue32();
|
||||||
|
_GlobalRolloverFactorContainer = (uint8)_GlobalContainerRolloverFactorDB->getValue32();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWidgetManager::resetGlobalAlphasProps()
|
||||||
|
{
|
||||||
|
_GlobalContentAlphaDB = NULL;
|
||||||
|
_GlobalContainerAlphaDB = NULL;
|
||||||
|
_GlobalContentRolloverFactorDB = NULL;
|
||||||
|
_GlobalContainerRolloverFactorDB = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWidgetManager::registerNewScreenSizeHandler( INewScreenSizeHandler *handler )
|
void CWidgetManager::registerNewScreenSizeHandler( INewScreenSizeHandler *handler )
|
||||||
|
@ -3171,6 +3198,8 @@ namespace NLGUI
|
||||||
_LastYContextHelp= -10000;
|
_LastYContextHelp= -10000;
|
||||||
|
|
||||||
resetColorProps();
|
resetColorProps();
|
||||||
|
resetAlphaRolloverSpeedProps();
|
||||||
|
resetGlobalAlphasProps();
|
||||||
|
|
||||||
_GlobalColor = NLMISC::CRGBA(255,255,255,255);
|
_GlobalColor = NLMISC::CRGBA(255,255,255,255);
|
||||||
_GlobalColorForContent = _GlobalColor;
|
_GlobalColorForContent = _GlobalColor;
|
||||||
|
|
|
@ -511,6 +511,8 @@ CInterfaceManager::CInterfaceManager()
|
||||||
_LogState = false;
|
_LogState = false;
|
||||||
_KeysLoaded = false;
|
_KeysLoaded = false;
|
||||||
CWidgetManager::getInstance()->resetColorProps();
|
CWidgetManager::getInstance()->resetColorProps();
|
||||||
|
CWidgetManager::getInstance()->resetAlphaRolloverSpeedProps();
|
||||||
|
CWidgetManager::getInstance()->resetGlobalAlphasProps();
|
||||||
_NeutralColor = NULL;
|
_NeutralColor = NULL;
|
||||||
_WarningColor = NULL;
|
_WarningColor = NULL;
|
||||||
_ErrorColor = NULL;
|
_ErrorColor = NULL;
|
||||||
|
@ -1420,8 +1422,9 @@ void CInterfaceManager::uninitInGame1 ()
|
||||||
_NeutralColor = NULL;
|
_NeutralColor = NULL;
|
||||||
_WarningColor = NULL;
|
_WarningColor = NULL;
|
||||||
_ErrorColor = NULL;
|
_ErrorColor = NULL;
|
||||||
CWidgetManager::getInstance()->resetAlphaRolloverSpeed();
|
|
||||||
CWidgetManager::getInstance()->resetColorProps();
|
CWidgetManager::getInstance()->resetColorProps();
|
||||||
|
CWidgetManager::getInstance()->resetAlphaRolloverSpeedProps();
|
||||||
|
CWidgetManager::getInstance()->resetGlobalAlphasProps();
|
||||||
|
|
||||||
#ifdef AJM_DEBUG_TRACK_INTERFACE_GROUPS
|
#ifdef AJM_DEBUG_TRACK_INTERFACE_GROUPS
|
||||||
CInterfaceManager::getInstance()->DebugTrackGroupsDump();
|
CInterfaceManager::getInstance()->DebugTrackGroupsDump();
|
||||||
|
|
Loading…
Reference in a new issue