Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

profile: Cache controls' render regions to avoid the costly generateAABB

  • Loading branch information...
commit eb2074659f6ca5720a2efbfb029485225db5e294 1 parent dd07646
Cory Fields authored
Showing with 9 additions and 3 deletions.
  1. +8 −3 xbmc/guilib/GUIControl.cpp
  2. +1 −0  xbmc/guilib/GUIControl.h
View
11 xbmc/guilib/GUIControl.cpp
@@ -58,7 +58,8 @@ CGUIControl::CGUIControl()
}
CGUIControl::CGUIControl(int parentID, int controlID, float posX, float posY, float width, float height)
-: m_hitRect(posX, posY, posX + width, posY + height)
+: m_hitRect(posX, posY, posX + width, posY + height),
+ m_cachedRenderRegion(0,0,0,0)
{
m_posX = posX;
m_posY = posY;
@@ -161,9 +162,13 @@ void CGUIControl::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyreg
void CGUIControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
// update our render region
- m_renderRegion = g_graphicsContext.generateAABB(CalcRenderRegion());
+ CRect region(CalcRenderRegion());
+ if (region != m_cachedRenderRegion)
+ {
+ m_cachedRenderRegion = region;
+ m_renderRegion = g_graphicsContext.generateAABB(m_cachedRenderRegion);
+ }
}
-
// the main render routine.
// 1. set the animation transform
// 2. if visible, paint
View
1  xbmc/guilib/GUIControl.h
@@ -357,6 +357,7 @@ class CGUIControl
bool m_controlIsDirty;
CRect m_renderRegion; // In screen coordinates
+ CRect m_cachedRenderRegion;
};
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.