aboutsummaryrefslogtreecommitdiff
path: root/guilib/GUIWindow.cpp
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2010-01-09 01:51:03 +0000
committerjmarshallnz <jmarshallnz@svn>2010-01-09 01:51:03 +0000
commita0b35e03721893f1c9edc679efd67649e5814999 (patch)
tree45095fc0e956c2019886ae1d80b085bce62ac81d /guilib/GUIWindow.cpp
parent564548db186d2e6df7990336d428d3a364598b2e (diff)
fixed: Discrepancy between order in which window and group transformations were applied. Now the window animation and any camera setting is applied in the coordinate space of the parent (i.e. the screen) rather than the child. NOTE to skinners: Zoom animations on dialogs are the most likely to be adversely affected by this change. Also fixes mouse offset in dialogs after r26534.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@26563 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUIWindow.cpp')
-rw-r--r--guilib/GUIWindow.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/guilib/GUIWindow.cpp b/guilib/GUIWindow.cpp
index 492aee999f..7c86de713a 100644
--- a/guilib/GUIWindow.cpp
+++ b/guilib/GUIWindow.cpp
@@ -312,17 +312,20 @@ void CGUIWindow::Render()
// to occur.
if (!m_bAllocated) return;
- // find our origin point
- CPoint pos = GetOrigin();
- g_graphicsContext.SetRenderingResolution(m_coordsRes, pos.x, pos.y, m_needsScaling);
- if (m_hasCamera)
- g_graphicsContext.SetCameraPosition(m_camera);
+ g_graphicsContext.SetRenderingResolution(m_coordsRes, 0, 0, m_needsScaling);
unsigned int currentTime = CTimeUtils::GetFrameTime();
// render our window animation - returns false if it needs to stop rendering
if (!RenderAnimation(currentTime))
return;
+ if (m_hasCamera)
+ g_graphicsContext.SetCameraPosition(m_camera);
+
+ // find our origin point
+ CPoint pos = GetOrigin();
+ g_graphicsContext.SetOrigin(pos.x, pos.y);
+
for (iControls i = m_children.begin(); i != m_children.end(); ++i)
{
CGUIControl *pControl = *i;
@@ -335,6 +338,8 @@ void CGUIWindow::Render()
}
}
if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().EndFrame();
+
+ g_graphicsContext.RestoreOrigin();
m_hasRendered = true;
}
@@ -375,13 +380,9 @@ CPoint CGUIWindow::GetOrigin()
// OnMouseAction - called by OnAction()
bool CGUIWindow::OnMouseAction()
{
- // we need to convert the mouse coordinates to window coordinates
- CPoint pos = GetOrigin();
-
- g_graphicsContext.SetScalingResolution(m_coordsRes, pos.x, pos.y, m_needsScaling);
+ g_graphicsContext.SetScalingResolution(m_coordsRes, 0, 0, m_needsScaling);
CPoint mousePoint(g_Mouse.GetLocation());
g_graphicsContext.InvertFinalCoords(mousePoint.x, mousePoint.y);
- m_transform.InverseTransformPosition(mousePoint.x, mousePoint.y);
bool bHandled = false;
// check if we have exclusive access
@@ -857,8 +858,8 @@ void CGUIWindow::SetDefaults()
CRect CGUIWindow::GetScaledBounds() const
{
CSingleLock lock(g_graphicsContext);
- g_graphicsContext.SetScalingResolution(m_coordsRes, m_posX, m_posY, m_needsScaling);
- CRect rect(0, 0, m_width, m_height);
+ g_graphicsContext.SetScalingResolution(m_coordsRes, 0, 0, m_needsScaling);
+ CRect rect(m_posX, m_posY, m_posX + m_width, m_posY + m_height);
float z = 0;
g_graphicsContext.ScaleFinalCoords(rect.x1, rect.y1, z);
g_graphicsContext.ScaleFinalCoords(rect.x2, rect.y2, z);