Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #3091 from stupid-boy/GUIControl

Small CGUIControl optimization
  • Loading branch information...
commit 6b3ff42a52c241caaaf0596ab0a3417bf1f04c7a 2 parents 602e9f2 + 7e37c96
@MartijnKaijser MartijnKaijser authored
Showing with 31 additions and 21 deletions.
  1. +31 −21 xbmc/guilib/GUIControl.cpp
View
52 xbmc/guilib/GUIControl.cpp
@@ -133,29 +133,34 @@ void CGUIControl::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyreg
changed |= Animate(currentTime);
- m_cachedTransform = g_graphicsContext.AddTransform(m_transform);
- if (m_hasCamera)
- g_graphicsContext.SetCameraPosition(m_camera);
-
if (IsVisible())
{
+ m_cachedTransform = g_graphicsContext.AddTransform(m_transform);
+ if (m_hasCamera)
+ g_graphicsContext.SetCameraPosition(m_camera);
+
Process(currentTime, dirtyregions);
m_bInvalidated = false;
- }
- changed |= m_controlIsDirty;
+ if (dirtyRegion != m_renderRegion)
+ {
+ dirtyRegion.Union(m_renderRegion);
+ changed = true;
+ }
- if (changed || dirtyRegion != m_renderRegion)
- {
- dirtyRegion.Union(m_renderRegion);
- dirtyregions.push_back(dirtyRegion);
+ if (m_hasCamera)
+ g_graphicsContext.RestoreCameraPosition();
+ g_graphicsContext.RemoveTransform();
}
- if (m_hasCamera)
- g_graphicsContext.RestoreCameraPosition();
- g_graphicsContext.RemoveTransform();
+ changed |= m_controlIsDirty;
m_controlIsDirty = false;
+
+ if (changed)
+ {
+ dirtyregions.push_back(dirtyRegion);
+ }
}
void CGUIControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
@@ -171,18 +176,20 @@ void CGUIControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyregio
// 3. reset the animation transform
void CGUIControl::DoRender()
{
- g_graphicsContext.SetTransform(m_cachedTransform);
- if (m_hasCamera)
- g_graphicsContext.SetCameraPosition(m_camera);
if (IsVisible())
{
+ g_graphicsContext.SetTransform(m_cachedTransform);
+ if (m_hasCamera)
+ g_graphicsContext.SetCameraPosition(m_camera);
+
GUIPROFILER_RENDER_BEGIN(this);
Render();
GUIPROFILER_RENDER_END(this);
+
+ if (m_hasCamera)
+ g_graphicsContext.RestoreCameraPosition();
+ g_graphicsContext.RemoveTransform();
}
- if (m_hasCamera)
- g_graphicsContext.RestoreCameraPosition();
- g_graphicsContext.RemoveTransform();
}
bool CGUIControl::OnAction(const CAction &action)
@@ -586,8 +593,11 @@ bool CGUIControl::OnMouseOver(const CPoint &point)
if (g_Mouse.GetState() != MOUSE_STATE_DRAG)
g_Mouse.SetState(MOUSE_STATE_FOCUS);
if (!CanFocus()) return false;
- CGUIMessage msg(GUI_MSG_SETFOCUS, GetParentID(), GetID());
- OnMessage(msg);
+ if (!HasFocus())
+ {
+ CGUIMessage msg(GUI_MSG_SETFOCUS, GetParentID(), GetID());
+ OnMessage(msg);
+ }
return true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.