aboutsummaryrefslogtreecommitdiff
path: root/guilib
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2009-09-23 10:03:22 +0000
committerjmarshallnz <jmarshallnz@svn>2009-09-23 10:03:22 +0000
commitc3018c6090df3c4cf3c5a96cc2310f931ef8f37f (patch)
treee22747627d63a591f15d9f87e15aa08cde10a563 /guilib
parent59629d6966e46a99fc8e41a05f5e460d984997a4 (diff)
changed: DWORD -> unsigned int for frame-based timings, and moved to using CTimeUtils::Update/GetFrameTime() for UI timing.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23109 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib')
-rw-r--r--guilib/GUIActionDescriptor.h2
-rw-r--r--guilib/GUIBaseContainer.cpp13
-rw-r--r--guilib/GUIBaseContainer.h12
-rw-r--r--guilib/GUIButtonControl.cpp22
-rw-r--r--guilib/GUIButtonControl.h2
-rw-r--r--guilib/GUIControl.cpp4
-rw-r--r--guilib/GUIControl.h4
-rw-r--r--guilib/GUIControlFactory.cpp14
-rw-r--r--guilib/GUIControlFactory.h2
-rw-r--r--guilib/GUIControlGroup.cpp2
-rw-r--r--guilib/GUIControlGroup.h4
-rw-r--r--guilib/GUIControlGroupList.h2
-rw-r--r--guilib/GUIControlProfiler.cpp24
-rw-r--r--guilib/GUIControlProfiler.h204
-rw-r--r--guilib/GUIDialog.cpp9
-rw-r--r--guilib/GUIDialog.h6
-rw-r--r--guilib/GUIEditControl.cpp2
-rw-r--r--guilib/GUIFadeLabelControl.cpp4
-rw-r--r--guilib/GUIFadeLabelControl.h6
-rw-r--r--guilib/GUIFont.cpp3
-rw-r--r--guilib/GUIImage.cpp3
-rw-r--r--guilib/GUIListItemLayout.cpp2
-rw-r--r--guilib/GUIListItemLayout.h2
-rw-r--r--guilib/GUIMoverControl.cpp27
-rw-r--r--guilib/GUIMoverControl.h4
-rw-r--r--guilib/GUIMultiImage.cpp4
-rw-r--r--guilib/GUIMultiImage.h6
-rw-r--r--guilib/GUIMultiSelectText.cpp2
-rw-r--r--guilib/GUIMultiSelectText.h14
-rw-r--r--guilib/GUIResizeControl.cpp27
-rw-r--r--guilib/GUIResizeControl.h4
-rw-r--r--guilib/GUISelectButtonControl.cpp15
-rw-r--r--guilib/GUISelectButtonControl.h2
-rw-r--r--guilib/GUITextBox.cpp2
-rw-r--r--guilib/GUITextBox.h14
-rw-r--r--guilib/GUITexture.cpp6
-rw-r--r--guilib/GUIWindow.cpp5
-rw-r--r--guilib/GUIWindow.h2
-rw-r--r--guilib/SkinInfo.cpp4
-rw-r--r--guilib/SkinInfo.h2
-rw-r--r--guilib/Texture.cpp2
-rw-r--r--guilib/Texture.h2
-rw-r--r--guilib/TextureManager.cpp6
43 files changed, 253 insertions, 245 deletions
diff --git a/guilib/GUIActionDescriptor.h b/guilib/GUIActionDescriptor.h
index 6bd0ec1966..55bd4eb0e8 100644
--- a/guilib/GUIActionDescriptor.h
+++ b/guilib/GUIActionDescriptor.h
@@ -30,7 +30,7 @@ public:
CStdString m_action;
ActionLang m_lang;
- DWORD m_sourceWindowId; // the id of the window that was a source of an action
+ int m_sourceWindowId; // the id of the window that was a source of an action
};
#endif
diff --git a/guilib/GUIBaseContainer.cpp b/guilib/GUIBaseContainer.cpp
index 332c6dce34..f43c88f9ad 100644
--- a/guilib/GUIBaseContainer.cpp
+++ b/guilib/GUIBaseContainer.cpp
@@ -23,6 +23,7 @@
#include "GUIControlFactory.h"
#include "utils/CharsetConverter.h"
#include "utils/GUIInfoManager.h"
+#include "utils/TimeUtils.h"
#include "utils/log.h"
#include "GUILabelControl.h"
#include "XMLUtils.h"
@@ -217,8 +218,8 @@ bool CGUIBaseContainer::OnAction(const CAction &action)
float speed = std::min(1.0f, (float)(action.holdTime - HOLD_TIME_START) / (HOLD_TIME_END - HOLD_TIME_START));
unsigned int itemsPerFrame = 1;
if (m_lastHoldTime) // number of rows/10 items/second max speed
- itemsPerFrame = std::max((unsigned int)1, (unsigned int)(speed * 0.0001f * GetRows() * (timeGetTime() - m_lastHoldTime)));
- m_lastHoldTime = timeGetTime();
+ itemsPerFrame = std::max((unsigned int)1, (unsigned int)(speed * 0.0001f * GetRows() * (CTimeUtils::GetFrameTime() - m_lastHoldTime)));
+ m_lastHoldTime = CTimeUtils::GetFrameTime();
if (action.id == ACTION_MOVE_LEFT || action.id == ACTION_MOVE_UP)
while (itemsPerFrame--) MoveUp(false);
else
@@ -682,7 +683,7 @@ void CGUIBaseContainer::ValidateOffset()
{
}
-void CGUIBaseContainer::DoRender(DWORD currentTime)
+void CGUIBaseContainer::DoRender(unsigned int currentTime)
{
m_renderTime = currentTime;
CGUIControl::DoRender(currentTime);
@@ -761,10 +762,10 @@ void CGUIBaseContainer::UpdateVisibility(const CGUIListItem *item)
Reset();
bool updateItems = false;
if (!m_staticUpdateTime)
- m_staticUpdateTime = timeGetTime();
- if (timeGetTime() - m_staticUpdateTime > 1000)
+ m_staticUpdateTime = CTimeUtils::GetFrameTime();
+ if (CTimeUtils::GetFrameTime() - m_staticUpdateTime > 1000)
{
- m_staticUpdateTime = timeGetTime();
+ m_staticUpdateTime = CTimeUtils::GetFrameTime();
updateItems = true;
}
for (unsigned int i = 0; i < m_staticItems.size(); ++i)
diff --git a/guilib/GUIBaseContainer.h b/guilib/GUIBaseContainer.h
index 7a0fe0cd2d..3081446d8d 100644
--- a/guilib/GUIBaseContainer.h
+++ b/guilib/GUIBaseContainer.h
@@ -70,7 +70,7 @@ public:
virtual void SaveStates(std::vector<CControlState> &states);
virtual int GetSelectedItem() const;
- virtual void DoRender(DWORD currentTime);
+ virtual void DoRender(unsigned int currentTime);
void LoadLayout(TiXmlElement *layout);
void LoadContent(TiXmlElement *content);
@@ -130,7 +130,7 @@ protected:
int m_pageControl;
- DWORD m_renderTime;
+ unsigned int m_renderTime;
std::vector<CGUIListItemLayout> m_layouts;
std::vector<CGUIListItemLayout> m_focusedLayouts;
@@ -141,15 +141,15 @@ protected:
virtual void ScrollToOffset(int offset);
void UpdateScrollOffset();
- DWORD m_scrollLastTime;
- int m_scrollTime;
- float m_scrollOffset;
+ unsigned int m_scrollLastTime;
+ int m_scrollTime;
+ float m_scrollOffset;
VIEW_TYPE m_type;
CStdString m_label;
bool m_staticContent;
- DWORD m_staticUpdateTime;
+ unsigned int m_staticUpdateTime;
std::vector<CGUIListItemPtr> m_staticItems;
bool m_wasReset; // true if we've received a Reset message until we've rendered once. Allows
// us to make sure we don't tell the infomanager that we've been moving when
diff --git a/guilib/GUIButtonControl.cpp b/guilib/GUIButtonControl.cpp
index 6c52bb7991..5a85984bd7 100644
--- a/guilib/GUIButtonControl.cpp
+++ b/guilib/GUIButtonControl.cpp
@@ -36,7 +36,7 @@ CGUIButtonControl::CGUIButtonControl(int parentID, int controlID, float posX, fl
{
m_bSelected = false;
m_alpha = 255;
- m_dwFocusCounter = 0;
+ m_focusCounter = 0;
m_label = labelInfo;
ControlType = GUICONTROL_BUTTON;
}
@@ -60,20 +60,20 @@ void CGUIButtonControl::Render()
{
if (m_pulseOnSelect)
{
- DWORD dwAlphaCounter = m_dwFocusCounter + 2;
- DWORD dwAlphaChannel;
- if ((dwAlphaCounter % 128) >= 64)
- dwAlphaChannel = dwAlphaCounter % 64;
+ unsigned int alphaCounter = m_focusCounter + 2;
+ unsigned int alphaChannel;
+ if ((alphaCounter % 128) >= 64)
+ alphaChannel = alphaCounter % 64;
else
- dwAlphaChannel = 63 - (dwAlphaCounter % 64);
+ alphaChannel = 63 - (alphaCounter % 64);
- dwAlphaChannel += 192;
- dwAlphaChannel = (DWORD)((float)m_alpha * (float)dwAlphaChannel / 255.0f);
- m_imgFocus.SetAlpha((unsigned char)dwAlphaChannel);
+ alphaChannel += 192;
+ alphaChannel = (unsigned int)((float)m_alpha * (float)alphaChannel / 255.0f);
+ m_imgFocus.SetAlpha((unsigned char)alphaChannel);
}
m_imgFocus.SetVisible(true);
m_imgNoFocus.SetVisible(false);
- m_dwFocusCounter++;
+ m_focusCounter++;
}
else
{
@@ -175,7 +175,7 @@ bool CGUIButtonControl::OnMessage(CGUIMessage& message)
void CGUIButtonControl::AllocResources()
{
CGUIControl::AllocResources();
- m_dwFocusCounter = 0;
+ m_focusCounter = 0;
m_imgFocus.AllocResources();
m_imgNoFocus.AllocResources();
if (!m_width)
diff --git a/guilib/GUIButtonControl.h b/guilib/GUIButtonControl.h
index 2cbe87150e..915b6cf0b7 100644
--- a/guilib/GUIButtonControl.h
+++ b/guilib/GUIButtonControl.h
@@ -85,7 +85,7 @@ protected:
CGUITexture m_imgFocus;
CGUITexture m_imgNoFocus;
- uint32_t m_dwFocusCounter;
+ unsigned int m_focusCounter;
unsigned char m_alpha;
CGUIInfoLabel m_info;
diff --git a/guilib/GUIControl.cpp b/guilib/GUIControl.cpp
index d7ffc3caae..afd2a89a83 100644
--- a/guilib/GUIControl.cpp
+++ b/guilib/GUIControl.cpp
@@ -136,7 +136,7 @@ void CGUIControl::DynamicResourceAlloc(bool bOnOff)
// 1. animate and set the animation transform
// 2. if visible, paint
// 3. reset the animation transform
-void CGUIControl::DoRender(DWORD currentTime)
+void CGUIControl::DoRender(unsigned int currentTime)
{
Animate(currentTime);
if (m_hasCamera)
@@ -739,7 +739,7 @@ void CGUIControl::UpdateStates(ANIMATION_TYPE type, ANIMATION_PROCESS currentPro
}
}
-void CGUIControl::Animate(DWORD currentTime)
+void CGUIControl::Animate(unsigned int currentTime)
{
// check visible state outside the loop, as it could change
GUIVISIBLE visible = m_visible;
diff --git a/guilib/GUIControl.h b/guilib/GUIControl.h
index 4de51176c3..9a3f216777 100644
--- a/guilib/GUIControl.h
+++ b/guilib/GUIControl.h
@@ -97,7 +97,7 @@ public:
virtual ~CGUIControl(void);
virtual CGUIControl *Clone() const=0;
- virtual void DoRender(DWORD currentTime);
+ virtual void DoRender(unsigned int currentTime);
virtual void Render();
bool HasRendered() const { return m_hasRendered; };
@@ -258,7 +258,7 @@ public:
#endif
protected:
virtual void UpdateColors();
- virtual void Animate(DWORD currentTime);
+ virtual void Animate(unsigned int currentTime);
virtual bool CheckAnimation(ANIMATION_TYPE animType);
void UpdateStates(ANIMATION_TYPE type, ANIMATION_PROCESS currentProcess, ANIMATION_STATE currentState);
bool SendWindowMessage(CGUIMessage &message);
diff --git a/guilib/GUIControlFactory.cpp b/guilib/GUIControlFactory.cpp
index 28022b746c..0960ab7b55 100644
--- a/guilib/GUIControlFactory.cpp
+++ b/guilib/GUIControlFactory.cpp
@@ -124,7 +124,7 @@ bool CGUIControlFactory::GetFloat(const TiXmlNode* pRootNode, const char* strTag
return g_SkinInfo.ResolveConstant(pNode->FirstChild()->Value(), value);
}
-bool CGUIControlFactory::GetDWORD(const TiXmlNode* pRootNode, const char* strTag, DWORD &value)
+bool CGUIControlFactory::GetUnsigned(const TiXmlNode* pRootNode, const char* strTag, unsigned int &value)
{
const TiXmlNode* pNode = pRootNode->FirstChild(strTag );
if (!pNode || !pNode->FirstChild()) return false;
@@ -646,9 +646,9 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const FRECT &rect, TiXmlEl
bool bScrollLabel = false;
bool bPulse = true;
- DWORD timePerImage = 0;
- DWORD fadeTime = 0;
- DWORD timeToPauseAtEnd = 0;
+ unsigned int timePerImage = 0;
+ unsigned int fadeTime = 0;
+ unsigned int timeToPauseAtEnd = 0;
bool randomized = false;
bool loop = true;
bool wrapMultiLine = false;
@@ -930,9 +930,9 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const FRECT &rect, TiXmlEl
GetInfoTexture(pControlNode, "imagepath", texture, texturePath);
- GetDWORD(pControlNode,"timeperimage", timePerImage);
- GetDWORD(pControlNode,"fadetime", fadeTime);
- GetDWORD(pControlNode,"pauseatend", timeToPauseAtEnd);
+ GetUnsigned(pControlNode,"timeperimage", timePerImage);
+ GetUnsigned(pControlNode,"fadetime", fadeTime);
+ GetUnsigned(pControlNode,"pauseatend", timeToPauseAtEnd);
XMLUtils::GetBoolean(pControlNode, "randomize", randomized);
XMLUtils::GetBoolean(pControlNode, "loop", loop);
XMLUtils::GetBoolean(pControlNode, "scrollout", scrollOut);
diff --git a/guilib/GUIControlFactory.h b/guilib/GUIControlFactory.h
index 76db5d3f2f..d41d5c17da 100644
--- a/guilib/GUIControlFactory.h
+++ b/guilib/GUIControlFactory.h
@@ -49,7 +49,7 @@ public:
CGUIControl* Create(int parentID, const FRECT &rect, TiXmlElement* pControlNode, bool insideContainer = false);
void ScaleElement(TiXmlElement *element, RESOLUTION fileRes, RESOLUTION destRes);
static bool GetFloat(const TiXmlNode* pRootNode, const char* strTag, float& value);
- static bool GetDWORD(const TiXmlNode* pRootNode, const char* strTag, DWORD& value);
+ static bool GetUnsigned(const TiXmlNode* pRootNode, const char* strTag, unsigned int& value);
static bool GetAspectRatio(const TiXmlNode* pRootNode, const char* strTag, CAspectRatio &aspectRatio);
static bool GetInfoTexture(const TiXmlNode* pRootNode, const char* strTag, CTextureInfo &image, CGUIInfoLabel &info);
static bool GetTexture(const TiXmlNode* pRootNode, const char* strTag, CTextureInfo &image);
diff --git a/guilib/GUIControlGroup.cpp b/guilib/GUIControlGroup.cpp
index 1b377c1e4d..a699477a01 100644
--- a/guilib/GUIControlGroup.cpp
+++ b/guilib/GUIControlGroup.cpp
@@ -282,7 +282,7 @@ bool CGUIControlGroup::CanFocus() const
return false;
}
-void CGUIControlGroup::DoRender(DWORD currentTime)
+void CGUIControlGroup::DoRender(unsigned int currentTime)
{
m_renderTime = currentTime;
CGUIControl::DoRender(currentTime);
diff --git a/guilib/GUIControlGroup.h b/guilib/GUIControlGroup.h
index 914a9f84ce..e0458d6055 100644
--- a/guilib/GUIControlGroup.h
+++ b/guilib/GUIControlGroup.h
@@ -57,7 +57,7 @@ public:
virtual void SetInitialVisibility();
- virtual void DoRender(DWORD currentTime);
+ virtual void DoRender(unsigned int currentTime);
virtual bool IsAnimating(ANIMATION_TYPE anim);
virtual bool HasAnimation(ANIMATION_TYPE anim);
virtual void QueueAnimation(ANIMATION_TYPE anim);
@@ -108,6 +108,6 @@ protected:
bool m_renderFocusedLast;
// render time
- DWORD m_renderTime;
+ unsigned int m_renderTime;
};
diff --git a/guilib/GUIControlGroupList.h b/guilib/GUIControlGroupList.h
index e378a3adc0..78a8dbc645 100644
--- a/guilib/GUIControlGroupList.h
+++ b/guilib/GUIControlGroupList.h
@@ -65,7 +65,7 @@ protected:
float m_scrollSpeed;
float m_scrollOffset;
- DWORD m_scrollTime;
+ unsigned int m_scrollTime;
bool m_useControlPositions;
ORIENTATION m_orientation;
diff --git a/guilib/GUIControlProfiler.cpp b/guilib/GUIControlProfiler.cpp
index f7071b088f..4435189d4f 100644
--- a/guilib/GUIControlProfiler.cpp
+++ b/guilib/GUIControlProfiler.cpp
@@ -25,7 +25,7 @@
bool CGUIControlProfiler::m_bIsRunning = false;
CGUIControlProfilerItem::CGUIControlProfilerItem(CGUIControlProfiler *pProfiler, CGUIControlProfilerItem *pParent, CGUIControl *pControl)
-: m_pProfiler(pProfiler), m_pParent(pParent), m_pControl(pControl), m_dwVisTime(0), m_dwRenderTime(0)
+: m_pProfiler(pProfiler), m_pParent(pParent), m_pControl(pControl), m_visTime(0), m_renderTime(0)
{
if (m_pControl)
{
@@ -51,8 +51,8 @@ void CGUIControlProfilerItem::Reset(CGUIControlProfiler *pProfiler)
m_ControlType = CGUIControl::GUICONTROL_UNKNOWN;
m_pControl = NULL;
- m_dwVisTime = 0;
- m_dwRenderTime = 0;
+ m_visTime = 0;
+ m_renderTime = 0;
const unsigned int dwSize = m_vecChildren.size();
for (unsigned int i=0; i<dwSize; ++i)
delete m_vecChildren[i];
@@ -70,7 +70,7 @@ void CGUIControlProfilerItem::EndVisibility(void)
{
LARGE_INTEGER t2;
QueryPerformanceCounter(&t2);
- m_dwVisTime += (DWORD)(m_pProfiler->m_fPerfScale * (t2.QuadPart - m_i64VisStart.QuadPart));
+ m_visTime += (unsigned int)(m_pProfiler->m_fPerfScale * (t2.QuadPart - m_i64VisStart.QuadPart));
}
void CGUIControlProfilerItem::BeginRender(void)
@@ -82,7 +82,7 @@ void CGUIControlProfilerItem::EndRender(void)
{
LARGE_INTEGER t2;
QueryPerformanceCounter(&t2);
- m_dwRenderTime += (DWORD)(m_pProfiler->m_fPerfScale * (t2.QuadPart - m_i64RenderStart.QuadPart));
+ m_renderTime += (unsigned int)(m_pProfiler->m_fPerfScale * (t2.QuadPart - m_i64RenderStart.QuadPart));
}
void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent)
@@ -196,20 +196,20 @@ void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent)
}
// Note time is stored in 1/100 milliseconds but reported in ms
- DWORD dwVis = m_dwVisTime / 100;
- DWORD dwRend = m_dwRenderTime / 100;
- if (dwVis || dwRend)
+ unsigned int vis = m_visTime / 100;
+ unsigned int rend = m_renderTime / 100;
+ if (vis || rend)
{
CStdString val;
TiXmlElement *elem = new TiXmlElement("rendertime");
xmlControl->LinkEndChild(elem);
- val.Format("%u", dwRend);
+ val.Format("%u", rend);
TiXmlText *text = new TiXmlText(val.c_str());
elem->LinkEndChild(text);
elem = new TiXmlElement("visibletime");
xmlControl->LinkEndChild(elem);
- val.Format("%u", dwVis);
+ val.Format("%u", vis);
text = new TiXmlText(val.c_str());
elem->LinkEndChild(text);
}
@@ -337,8 +337,8 @@ void CGUIControlProfiler::EndFrame(void)
for (unsigned int i=0; i<dwSize; ++i)
{
CGUIControlProfilerItem *p = m_ItemHead.m_vecChildren[i];
- m_ItemHead.m_dwVisTime += p->m_dwVisTime;
- m_ItemHead.m_dwRenderTime += p->m_dwRenderTime;
+ m_ItemHead.m_visTime += p->m_visTime;
+ m_ItemHead.m_renderTime += p->m_renderTime;
}
m_bIsRunning = false;
diff --git a/guilib/GUIControlProfiler.h b/guilib/GUIControlProfiler.h
index 48675e0179..34953ba6ec 100644
--- a/guilib/GUIControlProfiler.h
+++ b/guilib/GUIControlProfiler.h
@@ -1,102 +1,102 @@
-/*
- * Copyright (C) 2005-2009 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#ifndef GUILIB_GUICONTROLPROFILER_H__
-#define GUILIB_GUICONTROLPROFILER_H__
-#pragma once
-
-#include "GUIControl.h"
-
-class CGUIControlProfiler;
-class TiXmlElement;
-
-class CGUIControlProfilerItem
-{
-public:
- CGUIControlProfiler *m_pProfiler;
- CGUIControlProfilerItem * m_pParent;
- CGUIControl *m_pControl;
- std::vector<CGUIControlProfilerItem *> m_vecChildren;
- CStdString m_strDescription;
- int m_controlID;
- CGUIControl::GUICONTROLTYPES m_ControlType;
- DWORD m_dwVisTime;
- DWORD m_dwRenderTime;
- LARGE_INTEGER m_i64VisStart;
- LARGE_INTEGER m_i64RenderStart;
-
- CGUIControlProfilerItem(CGUIControlProfiler *pProfiler, CGUIControlProfilerItem *pParent, CGUIControl *pControl);
- ~CGUIControlProfilerItem(void);
-
- void Reset(CGUIControlProfiler *pProfiler);
- void BeginVisibility(void);
- void EndVisibility(void);
- void BeginRender(void);
- void EndRender(void);
- void SaveToXML(TiXmlElement *parent);
- DWORD GetTotalTime(void) const { return m_dwVisTime + m_dwRenderTime; };
-
- CGUIControlProfilerItem *AddControl(CGUIControl *pControl);
- CGUIControlProfilerItem *FindOrAddControl(CGUIControl *pControl, bool recurse);
-};
-
-class CGUIControlProfiler
-{
-public:
- static CGUIControlProfiler &Instance(void);
- static bool IsRunning(void);
-
- void Start(void);
- void EndFrame(void);
- void BeginVisibility(CGUIControl *pControl);
- void EndVisibility(CGUIControl *pControl);
- void BeginRender(CGUIControl *pControl);
- void EndRender(CGUIControl *pControl);
- int GetMaxFrameCount(void) const { return m_iMaxFrameCount; };
- void SetMaxFrameCount(int iMaxFrameCount) { m_iMaxFrameCount = iMaxFrameCount; };
- void SetOutputFile(const CStdString &strOutputFile) { m_strOutputFile = strOutputFile; };
- const CStdString &GetOutputFile(void) const { return m_strOutputFile; };
- bool SaveResults(void);
- DWORD GetTotalTime(void) const { return m_ItemHead.GetTotalTime(); };
-
- float m_fPerfScale;
-private:
- CGUIControlProfiler(void);
- ~CGUIControlProfiler(void) {};
- CGUIControlProfiler(const CGUIControlProfiler &that);
- CGUIControlProfiler &operator=(const CGUIControlProfiler &that);
-
- CGUIControlProfilerItem m_ItemHead;
- CGUIControlProfilerItem *m_pLastItem;
- CGUIControlProfilerItem *FindOrAddControl(CGUIControl *pControl);
-
- static bool m_bIsRunning;
- CStdString m_strOutputFile;
- int m_iMaxFrameCount;
- int m_iFrameCount;
-};
-
-#define GUIPROFILER_VISIBILITY_BEGIN(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().BeginVisibility(x); }
-#define GUIPROFILER_VISIBILITY_END(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().EndVisibility(x); }
-#define GUIPROFILER_RENDER_BEGIN(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().BeginRender(x); }
-#define GUIPROFILER_RENDER_END(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().EndRender(x); }
-
-#endif
+/*
+ * Copyright (C) 2005-2009 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#ifndef GUILIB_GUICONTROLPROFILER_H__
+#define GUILIB_GUICONTROLPROFILER_H__
+#pragma once
+
+#include "GUIControl.h"
+
+class CGUIControlProfiler;
+class TiXmlElement;
+
+class CGUIControlProfilerItem
+{
+public:
+ CGUIControlProfiler *m_pProfiler;
+ CGUIControlProfilerItem * m_pParent;
+ CGUIControl *m_pControl;
+ std::vector<CGUIControlProfilerItem *> m_vecChildren;
+ CStdString m_strDescription;
+ int m_controlID;
+ CGUIControl::GUICONTROLTYPES m_ControlType;
+ unsigned int m_visTime;
+ unsigned int m_renderTime;
+ LARGE_INTEGER m_i64VisStart;
+ LARGE_INTEGER m_i64RenderStart;
+
+ CGUIControlProfilerItem(CGUIControlProfiler *pProfiler, CGUIControlProfilerItem *pParent, CGUIControl *pControl);
+ ~CGUIControlProfilerItem(void);
+
+ void Reset(CGUIControlProfiler *pProfiler);
+ void BeginVisibility(void);
+ void EndVisibility(void);
+ void BeginRender(void);
+ void EndRender(void);
+ void SaveToXML(TiXmlElement *parent);
+ unsigned int GetTotalTime(void) const { return m_visTime + m_renderTime; };
+
+ CGUIControlProfilerItem *AddControl(CGUIControl *pControl);
+ CGUIControlProfilerItem *FindOrAddControl(CGUIControl *pControl, bool recurse);
+};
+
+class CGUIControlProfiler
+{
+public:
+ static CGUIControlProfiler &Instance(void);
+ static bool IsRunning(void);
+
+ void Start(void);
+ void EndFrame(void);
+ void BeginVisibility(CGUIControl *pControl);
+ void EndVisibility(CGUIControl *pControl);
+ void BeginRender(CGUIControl *pControl);
+ void EndRender(CGUIControl *pControl);
+ int GetMaxFrameCount(void) const { return m_iMaxFrameCount; };
+ void SetMaxFrameCount(int iMaxFrameCount) { m_iMaxFrameCount = iMaxFrameCount; };
+ void SetOutputFile(const CStdString &strOutputFile) { m_strOutputFile = strOutputFile; };
+ const CStdString &GetOutputFile(void) const { return m_strOutputFile; };
+ bool SaveResults(void);
+ unsigned int GetTotalTime(void) const { return m_ItemHead.GetTotalTime(); };
+
+ float m_fPerfScale;
+private:
+ CGUIControlProfiler(void);
+ ~CGUIControlProfiler(void) {};
+ CGUIControlProfiler(const CGUIControlProfiler &that);
+ CGUIControlProfiler &operator=(const CGUIControlProfiler &that);
+
+ CGUIControlProfilerItem m_ItemHead;
+ CGUIControlProfilerItem *m_pLastItem;
+ CGUIControlProfilerItem *FindOrAddControl(CGUIControl *pControl);
+
+ static bool m_bIsRunning;
+ CStdString m_strOutputFile;
+ int m_iMaxFrameCount;
+ int m_iFrameCount;
+};
+
+#define GUIPROFILER_VISIBILITY_BEGIN(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().BeginVisibility(x); }
+#define GUIPROFILER_VISIBILITY_END(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().EndVisibility(x); }
+#define GUIPROFILER_RENDER_BEGIN(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().BeginRender(x); }
+#define GUIPROFILER_RENDER_END(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().EndRender(x); }
+
+#endif
diff --git a/guilib/GUIDialog.cpp b/guilib/GUIDialog.cpp
index 1dd30a7129..9b21ae4525 100644
--- a/guilib/GUIDialog.cpp
+++ b/guilib/GUIDialog.cpp
@@ -24,6 +24,7 @@
#include "GUILabelControl.h"
#include "GUIAudioManager.h"
#include "utils/SingleLock.h"
+#include "utils/TimeUtils.h"
#include "Application.h"
CGUIDialog::CGUIDialog(int id, const CStdString &xmlFile)
@@ -99,7 +100,7 @@ bool CGUIDialog::OnMessage(CGUIMessage& message)
case GUI_MSG_WINDOW_INIT:
{
CGUIWindow::OnMessage(message);
- m_showStartTime = timeGetTime();
+ m_showStartTime = CTimeUtils::GetFrameTime();
return true;
}
}
@@ -208,7 +209,7 @@ void CGUIDialog::Show()
g_application.getApplicationMessenger().Show(this);
}
-bool CGUIDialog::RenderAnimation(DWORD time)
+bool CGUIDialog::RenderAnimation(unsigned int time)
{
CGUIWindow::RenderAnimation(time);
return m_bRunning;
@@ -226,7 +227,7 @@ void CGUIDialog::Render()
Close(true);
}
- if (m_autoClosing && m_showStartTime + m_showDuration < timeGetTime() && !m_dialogClosing)
+ if (m_autoClosing && m_showStartTime + m_showDuration < CTimeUtils::GetFrameTime() && !m_dialogClosing)
{
Close();
}
@@ -250,7 +251,7 @@ void CGUIDialog::SetAutoClose(unsigned int timeoutMs)
m_autoClosing = true;
m_showDuration = timeoutMs;
if (m_bRunning)
- m_showStartTime = timeGetTime();
+ m_showStartTime = CTimeUtils::GetFrameTime();
}
diff --git a/guilib/GUIDialog.h b/guilib/GUIDialog.h
index e80ace3b6e..2ee2ac74a6 100644
--- a/guilib/GUIDialog.h
+++ b/guilib/GUIDialog.h
@@ -56,7 +56,7 @@ public:
void SetAutoClose(unsigned int timeoutMs);
protected:
- virtual bool RenderAnimation(DWORD time);
+ virtual bool RenderAnimation(unsigned int time);
virtual void SetDefaults();
virtual void OnWindowLoaded();
@@ -68,6 +68,6 @@ protected:
bool m_bModal;
bool m_dialogClosing;
bool m_autoClosing;
- DWORD m_showStartTime;
- DWORD m_showDuration;
+ unsigned int m_showStartTime;
+ unsigned int m_showDuration;
};
diff --git a/guilib/GUIEditControl.cpp b/guilib/GUIEditControl.cpp
index 604ca384a0..ed339a92f0 100644
--- a/guilib/GUIEditControl.cpp
+++ b/guilib/GUIEditControl.cpp
@@ -394,7 +394,7 @@ void CGUIEditControl::RenderText()
{ // cursor location assumes utf16 text, so deal with that (inefficient, but it's not as if it's a high-use area
// virtual keyboard only)
CStdStringW col;
- if ((m_dwFocusCounter % 64) > 32)
+ if ((m_focusCounter % 64) > 32)
col.Format(L"|");
else
col.Format(L"[COLOR %x]|[/COLOR]", 0x1000000);
diff --git a/guilib/GUIFadeLabelControl.cpp b/guilib/GUIFadeLabelControl.cpp
index 195740434e..a51733bd0d 100644
--- a/guilib/GUIFadeLabelControl.cpp
+++ b/guilib/GUIFadeLabelControl.cpp
@@ -24,7 +24,7 @@
using namespace std;
-CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, int scrollSpeed, DWORD timeToDelayAtEnd, bool resetOnLabelChange)
+CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, int scrollSpeed, unsigned int timeToDelayAtEnd, bool resetOnLabelChange)
: CGUIControl(parentID, controlID, posX, posY, width, height), m_scrollInfo(50, labelInfo.offsetX, scrollSpeed)
, m_textLayout(labelInfo.font, false)
{
@@ -76,7 +76,7 @@ void CGUIFadeLabelControl::AddLabel(const string &label)
m_infoLabels.push_back(CGUIInfoLabel(label));
}
-void CGUIFadeLabelControl::DoRender(DWORD currentTime)
+void CGUIFadeLabelControl::DoRender(unsigned int currentTime)
{
m_renderTime = currentTime;
CGUIControl::DoRender(currentTime);
diff --git a/guilib/GUIFadeLabelControl.h b/guilib/GUIFadeLabelControl.h
index bfa73d9557..b3b6407554 100644
--- a/guilib/GUIFadeLabelControl.h
+++ b/guilib/GUIFadeLabelControl.h
@@ -40,12 +40,12 @@
class CGUIFadeLabelControl : public CGUIControl
{
public:
- CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, int scrollSpeed, DWORD timeToDelayAtEnd, bool resetOnLabelChange);
+ CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, int scrollSpeed, unsigned int timeToDelayAtEnd, bool resetOnLabelChange);
CGUIFadeLabelControl(const CGUIFadeLabelControl &from);
virtual ~CGUIFadeLabelControl(void);
virtual CGUIFadeLabelControl *Clone() const { return new CGUIFadeLabelControl(*this); };
- virtual void DoRender(DWORD currentTime);
+ virtual void DoRender(unsigned int currentTime);
virtual void Render();
virtual bool CanFocus() const;
virtual bool OnMessage(CGUIMessage& message);
@@ -68,7 +68,7 @@ protected:
CScrollInfo m_scrollInfo;
CGUITextLayout m_textLayout;
CAnimation *m_fadeAnim;
- DWORD m_renderTime;
+ unsigned int m_renderTime;
unsigned int m_scrollSpeed;
bool m_resetOnLabelChange;
};
diff --git a/guilib/GUIFont.cpp b/guilib/GUIFont.cpp
index d80e3ab39d..a73bfc6932 100644
--- a/guilib/GUIFont.cpp
+++ b/guilib/GUIFont.cpp
@@ -24,6 +24,7 @@
#include "GraphicContext.h"
#include "utils/SingleLock.h"
+#include "utils/TimeUtils.h"
#include "MathUtils.h"
#define ROUND(x) (float)(MathUtils::round_int(x))
@@ -34,7 +35,7 @@ float CScrollInfo::GetPixelsPerFrame()
if (0 == pixelSpeed)
return 0; // not scrolling
- DWORD currentTime = timeGetTime();
+ unsigned int currentTime = CTimeUtils::GetFrameTime();
float delta = m_lastFrameTime ? (float)(currentTime - m_lastFrameTime) : m_averageFrameTime;
if (delta > 100)
delta = 100; // assume a minimum of 10 fps
diff --git a/guilib/GUIImage.cpp b/guilib/GUIImage.cpp
index b2f444eea4..ce90c19b14 100644
--- a/guilib/GUIImage.cpp
+++ b/guilib/GUIImage.cpp
@@ -22,6 +22,7 @@
#include "GUIImage.h"
#include "TextureManager.h"
#include "utils/log.h"
+#include "utils/TimeUtils.h"
using namespace std;
@@ -107,7 +108,7 @@ void CGUIImage::Render()
// compute the frame time
unsigned int frameTime = 0;
- unsigned int currentTime = timeGetTime();
+ unsigned int currentTime = CTimeUtils::GetFrameTime();
if (m_lastRenderTime)
frameTime = currentTime - m_lastRenderTime;
m_lastRenderTime = currentTime;
diff --git a/guilib/GUIListItemLayout.cpp b/guilib/GUIListItemLayout.cpp
index 7f5eae3da4..0c41e26dd9 100644
--- a/guilib/GUIListItemLayout.cpp
+++ b/guilib/GUIListItemLayout.cpp
@@ -71,7 +71,7 @@ float CGUIListItemLayout::Size(ORIENTATION orientation) const
return (orientation == HORIZONTAL) ? m_width : m_height;
}
-void CGUIListItemLayout::Render(CGUIListItem *item, int parentID, DWORD time)
+void CGUIListItemLayout::Render(CGUIListItem *item, int parentID, unsigned int time)
{
if (m_invalidated)
{ // need to update our item
diff --git a/guilib/GUIListItemLayout.h b/guilib/GUIListItemLayout.h
index f0c03ba641..2bea1afb9d 100644
--- a/guilib/GUIListItemLayout.h
+++ b/guilib/GUIListItemLayout.h
@@ -34,7 +34,7 @@ public:
CGUIListItemLayout(const CGUIListItemLayout &from);
virtual ~CGUIListItemLayout();
void LoadLayout(TiXmlElement *layout, bool focused);
- void Render(CGUIListItem *item, int parentID, DWORD time = 0);
+ void Render(CGUIListItem *item, int parentID, unsigned int time = 0);
float Size(ORIENTATION orientation) const;
unsigned int GetFocusedItem() const;
void SetFocusedItem(unsigned int focus);
diff --git a/guilib/GUIMoverControl.cpp b/guilib/GUIMoverControl.cpp
index 098e890d8f..029df7fbb4 100644
--- a/guilib/GUIMoverControl.cpp
+++ b/guilib/GUIMoverControl.cpp
@@ -23,6 +23,7 @@
#include "GUIWindowManager.h"
#include "MouseStat.h"
#include "Key.h"
+#include "utils/TimeUtils.h"
// time to reset accelerated cursors (digital movement)
#define MOVE_TIME_OUT 500L
@@ -32,8 +33,8 @@ CGUIMoverControl::CGUIMoverControl(int parentID, int controlID, float posX, floa
, m_imgFocus(posX, posY, width, height, textureFocus)
, m_imgNoFocus(posX, posY, width, height, textureNoFocus)
{
- m_dwFrameCounter = 0;
- m_dwLastMoveTime = 0;
+ m_frameCounter = 0;
+ m_lastMoveTime = 0;
m_fSpeed = 1.0;
m_fAnalogSpeed = 2.0f; // TODO: implement correct analog speed
m_fAcceleration = 0.2f; // TODO: implement correct computation of acceleration
@@ -58,18 +59,18 @@ void CGUIMoverControl::Render()
}
if (HasFocus())
{
- DWORD dwAlphaCounter = m_dwFrameCounter + 2;
- DWORD dwAlphaChannel;
- if ((dwAlphaCounter % 128) >= 64)
- dwAlphaChannel = dwAlphaCounter % 64;
+ unsigned int alphaCounter = m_frameCounter + 2;
+ unsigned int alphaChannel;
+ if ((alphaCounter % 128) >= 64)
+ alphaChannel = alphaCounter % 64;
else
- dwAlphaChannel = 63 - (dwAlphaCounter % 64);
+ alphaChannel = 63 - (alphaCounter % 64);
- dwAlphaChannel += 192;
- SetAlpha( (unsigned char)dwAlphaChannel );
+ alphaChannel += 192;
+ SetAlpha( (unsigned char)alphaChannel );
m_imgFocus.SetVisible(true);
m_imgNoFocus.SetVisible(false);
- m_dwFrameCounter++;
+ m_frameCounter++;
}
else
{
@@ -151,12 +152,12 @@ bool CGUIMoverControl::OnMouseClick(int button, const CPoint &point)
void CGUIMoverControl::UpdateSpeed(int nDirection)
{
- if (timeGetTime() - m_dwLastMoveTime > MOVE_TIME_OUT)
+ if (CTimeUtils::GetFrameTime() - m_lastMoveTime > MOVE_TIME_OUT)
{
m_fSpeed = 1;
m_nDirection = DIRECTION_NONE;
}
- m_dwLastMoveTime = timeGetTime();
+ m_lastMoveTime = CTimeUtils::GetFrameTime();
if (nDirection == m_nDirection)
{ // accelerate
m_fSpeed += m_fAcceleration;
@@ -172,7 +173,7 @@ void CGUIMoverControl::UpdateSpeed(int nDirection)
void CGUIMoverControl::AllocResources()
{
CGUIControl::AllocResources();
- m_dwFrameCounter = 0;
+ m_frameCounter = 0;
m_imgFocus.AllocResources();
m_imgNoFocus.AllocResources();
float width = m_width ? m_width : m_imgFocus.GetWidth();
diff --git a/guilib/GUIMoverControl.h b/guilib/GUIMoverControl.h
index 5cda5a0590..53a4304ef3 100644
--- a/guilib/GUIMoverControl.h
+++ b/guilib/GUIMoverControl.h
@@ -84,8 +84,8 @@ protected:
void Move(int iX, int iY);
CGUITexture m_imgFocus;
CGUITexture m_imgNoFocus;
- DWORD m_dwFrameCounter;
- DWORD m_dwLastMoveTime;
+ unsigned int m_frameCounter;
+ unsigned int m_lastMoveTime;
int m_nDirection;
float m_fSpeed;
float m_fAnalogSpeed;
diff --git a/guilib/GUIMultiImage.cpp b/guilib/GUIMultiImage.cpp
index 75db87e921..5ef4a4bd39 100644
--- a/guilib/GUIMultiImage.cpp
+++ b/guilib/GUIMultiImage.cpp
@@ -29,7 +29,7 @@
using namespace std;
using namespace DIRECTORY;
-CGUIMultiImage::CGUIMultiImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture, DWORD timePerImage, DWORD fadeTime, bool randomized, bool loop, DWORD timeToPauseAtEnd)
+CGUIMultiImage::CGUIMultiImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture, unsigned int timePerImage, unsigned int fadeTime, bool randomized, bool loop, unsigned int timeToPauseAtEnd)
: CGUIControl(parentID, controlID, posX, posY, width, height),
m_image(0, 0, posX, posY, width, height, texture)
{
@@ -116,7 +116,7 @@ void CGUIMultiImage::Render()
if (nextImage != m_currentImage)
{
// check if we should be loading a new image yet
- DWORD timeToShow = m_timePerImage;
+ unsigned int timeToShow = m_timePerImage;
if (0 == nextImage) // last image should be paused for a bit longer if that's what the skinner wishes.
timeToShow += m_timeToPauseAtEnd;
if (m_imageTimer.IsRunning() && m_imageTimer.GetElapsedMilliseconds() > timeToShow)
diff --git a/guilib/GUIMultiImage.h b/guilib/GUIMultiImage.h
index 60b03d966b..ba36827c24 100644
--- a/guilib/GUIMultiImage.h
+++ b/guilib/GUIMultiImage.h
@@ -39,7 +39,7 @@
class CGUIMultiImage : public CGUIControl
{
public:
- CGUIMultiImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture, DWORD timePerImage, DWORD fadeTime, bool randomized, bool loop, DWORD timeToPauseAtEnd);
+ CGUIMultiImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture, unsigned int timePerImage, unsigned int fadeTime, bool randomized, bool loop, unsigned int timeToPauseAtEnd);
CGUIMultiImage(const CGUIMultiImage &from);
virtual ~CGUIMultiImage(void);
virtual CGUIMultiImage *Clone() const { return new CGUIMultiImage(*this); };
@@ -65,8 +65,8 @@ protected:
CStdString m_currentPath;
unsigned int m_currentImage;
CStopWatch m_imageTimer;
- DWORD m_timePerImage;
- DWORD m_timeToPauseAtEnd;
+ unsigned int m_timePerImage;
+ unsigned int m_timeToPauseAtEnd;
bool m_randomized;
bool m_loop;
diff --git a/guilib/GUIMultiSelectText.cpp b/guilib/GUIMultiSelectText.cpp
index c2d5d4f9f4..25e7ae62df 100644
--- a/guilib/GUIMultiSelectText.cpp
+++ b/guilib/GUIMultiSelectText.cpp
@@ -58,7 +58,7 @@ CGUIMultiSelectTextControl::~CGUIMultiSelectTextControl(void)
{
}
-void CGUIMultiSelectTextControl::DoRender(DWORD currentTime)
+void CGUIMultiSelectTextControl::DoRender(unsigned int currentTime)
{
m_renderTime = currentTime;
CGUIControl::DoRender(currentTime);
diff --git a/guilib/GUIMultiSelectText.h b/guilib/GUIMultiSelectText.h
index 56e3d7a905..4101effb17 100644
--- a/guilib/GUIMultiSelectText.h
+++ b/guilib/GUIMultiSelectText.h
@@ -38,7 +38,7 @@ public:
virtual ~CGUIMultiSelectTextControl(void);
virtual CGUIMultiSelectTextControl *Clone() const { return new CGUIMultiSelectTextControl(*this); };
- virtual void DoRender(DWORD currentTime);
+ virtual void DoRender(unsigned int currentTime);
virtual void Render();
virtual bool OnAction(const CAction &action);
@@ -85,14 +85,14 @@ protected:
CLabelInfo m_label;
CGUIInfoLabel m_info;
CStdString m_oldText;
- DWORD m_renderTime;
+ unsigned int m_renderTime;
// scrolling
- float m_totalWidth;
- float m_offset;
- float m_scrollOffset;
- float m_scrollSpeed;
- DWORD m_scrollLastTime;
+ float m_totalWidth;
+ float m_offset;
+ float m_scrollOffset;
+ float m_scrollSpeed;
+ unsigned int m_scrollLastTime;
// buttons
CGUIButtonControl m_button;
diff --git a/guilib/GUIResizeControl.cpp b/guilib/GUIResizeControl.cpp
index 03d8b2106e..fab57f1925 100644
--- a/guilib/GUIResizeControl.cpp
+++ b/guilib/GUIResizeControl.cpp
@@ -23,6 +23,7 @@
#include "GUIWindowManager.h"
#include "MouseStat.h"
#include "Key.h"
+#include "utils/TimeUtils.h"
// time to reset accelerated cursors (digital movement)
#define MOVE_TIME_OUT 500L
@@ -32,8 +33,8 @@ CGUIResizeControl::CGUIResizeControl(int parentID, int controlID, float posX, fl
, m_imgFocus(posX, posY, width, height, textureFocus)
, m_imgNoFocus(posX, posY, width, height, textureNoFocus)
{
- m_dwFrameCounter = 0;
- m_dwLastMoveTime = 0;
+ m_frameCounter = 0;
+ m_lastMoveTime = 0;
m_fSpeed = 1.0;
m_fAnalogSpeed = 2.0f; // TODO: implement correct analog speed
m_fAcceleration = 0.2f; // TODO: implement correct computation of acceleration
@@ -57,18 +58,18 @@ void CGUIResizeControl::Render()
}
if (HasFocus())
{
- DWORD dwAlphaCounter = m_dwFrameCounter + 2;
- DWORD dwAlphaChannel;
- if ((dwAlphaCounter % 128) >= 64)
- dwAlphaChannel = dwAlphaCounter % 64;
+ unsigned int alphaCounter = m_frameCounter + 2;
+ unsigned int alphaChannel;
+ if ((alphaCounter % 128) >= 64)
+ alphaChannel = alphaCounter % 64;
else
- dwAlphaChannel = 63 - (dwAlphaCounter % 64);
+ alphaChannel = 63 - (alphaCounter % 64);
- dwAlphaChannel += 192;
- SetAlpha( (unsigned char)dwAlphaChannel );
+ alphaChannel += 192;
+ SetAlpha( (unsigned char)alphaChannel );
m_imgFocus.SetVisible(true);
m_imgNoFocus.SetVisible(false);
- m_dwFrameCounter++;
+ m_frameCounter++;
}
else
{
@@ -140,12 +141,12 @@ bool CGUIResizeControl::OnMouseClick(int button, const CPoint &point)
void CGUIResizeControl::UpdateSpeed(int nDirection)
{
- if (timeGetTime() - m_dwLastMoveTime > MOVE_TIME_OUT)
+ if (CTimeUtils::GetFrameTime() - m_lastMoveTime > MOVE_TIME_OUT)
{
m_fSpeed = 1;
m_nDirection = DIRECTION_NONE;
}
- m_dwLastMoveTime = timeGetTime();
+ m_lastMoveTime = CTimeUtils::GetFrameTime();
if (nDirection == m_nDirection)
{ // accelerate
m_fSpeed += m_fAcceleration;
@@ -161,7 +162,7 @@ void CGUIResizeControl::UpdateSpeed(int nDirection)
void CGUIResizeControl::AllocResources()
{
CGUIControl::AllocResources();
- m_dwFrameCounter = 0;
+ m_frameCounter = 0;
m_imgFocus.AllocResources();
m_imgNoFocus.AllocResources();
m_width = m_imgFocus.GetWidth();
diff --git a/guilib/GUIResizeControl.h b/guilib/GUIResizeControl.h
index 452bd72aaf..5b8d89c6e1 100644
--- a/guilib/GUIResizeControl.h
+++ b/guilib/GUIResizeControl.h
@@ -73,8 +73,8 @@ protected:
void Resize(float x, float y);
CGUITexture m_imgFocus;
CGUITexture m_imgNoFocus;
- DWORD m_dwFrameCounter;
- DWORD m_dwLastMoveTime;
+ unsigned int m_frameCounter;
+ unsigned int m_lastMoveTime;
int m_nDirection;
float m_fSpeed;
float m_fAnalogSpeed;
diff --git a/guilib/GUISelectButtonControl.cpp b/guilib/GUISelectButtonControl.cpp
index a51d30e6d9..0535ea52be 100644
--- a/guilib/GUISelectButtonControl.cpp
+++ b/guilib/GUISelectButtonControl.cpp
@@ -22,6 +22,7 @@
#include "GUISelectButtonControl.h"
#include "GUIWindowManager.h"
#include "utils/CharsetConverter.h"
+#include "utils/TimeUtils.h"
#include "MouseStat.h"
#include "Key.h"
@@ -52,7 +53,7 @@ CGUISelectButtonControl::CGUISelectButtonControl(int parentID, int controlID,
m_bRightSelected = false;
m_bMovedLeft = false;
m_bMovedRight = false;
- m_dwTicks = 0;
+ m_ticks = 0;
ControlType = GUICONTROL_SELECTBUTTON;
}
@@ -127,8 +128,8 @@ void CGUISelectButtonControl::Render()
// Select current item, if user doesn't
// move left or right for 1.5 sec.
- DWORD dwTicksSpan = timeGetTime() - m_dwTicks;
- if (dwTicksSpan > 1500)
+ unsigned int ticksSpan = CTimeUtils::GetFrameTime() - m_ticks;
+ if (ticksSpan > 1500)
{
// User hasn't moved disable selection mode...
m_bShowSelect = false;
@@ -198,7 +199,7 @@ bool CGUISelectButtonControl::OnAction(const CAction &action)
// Start timer, if user doesn't select an item
// or moves left/right. The control will
// automatically select the current item.
- m_dwTicks = timeGetTime();
+ m_ticks = CTimeUtils::GetFrameTime();
return true;
}
else
@@ -289,7 +290,7 @@ void CGUISelectButtonControl::OnLeft()
// Reset timer for automatically selecting
// the current item.
- m_dwTicks = timeGetTime();
+ m_ticks = CTimeUtils::GetFrameTime();
// Switch to previous item
if (m_vecItems.size() > 0)
@@ -315,7 +316,7 @@ void CGUISelectButtonControl::OnRight()
// Reset timer for automatically selecting
// the current item.
- m_dwTicks = timeGetTime();
+ m_ticks = CTimeUtils::GetFrameTime();
// Switch to next item
if (m_vecItems.size() > 0)
@@ -345,7 +346,7 @@ bool CGUISelectButtonControl::OnMouseOver(const CPoint &point)
m_bRightSelected = true;
}
// reset ticks
- m_dwTicks = timeGetTime();
+ m_ticks = CTimeUtils::GetFrameTime();
return ret;
}
diff --git a/guilib/GUISelectButtonControl.h b/guilib/GUISelectButtonControl.h
index 8ca08418f7..566dc1264f 100644
--- a/guilib/GUISelectButtonControl.h
+++ b/guilib/GUISelectButtonControl.h
@@ -129,6 +129,6 @@ protected:
bool m_bRightSelected;
bool m_bMovedLeft;
bool m_bMovedRight;
- DWORD m_dwTicks;
+ unsigned int m_ticks;
};
#endif
diff --git a/guilib/GUITextBox.cpp b/guilib/GUITextBox.cpp
index b424af6f15..de3f972155 100644
--- a/guilib/GUITextBox.cpp
+++ b/guilib/GUITextBox.cpp
@@ -78,7 +78,7 @@ CGUITextBox::~CGUITextBox(void)
m_autoScrollRepeatAnim = NULL;
}
-void CGUITextBox::DoRender(DWORD currentTime)
+void CGUITextBox::DoRender(unsigned int currentTime)
{
m_renderTime = currentTime;
diff --git a/guilib/GUITextBox.h b/guilib/GUITextBox.h
index c4ab36eef4..b9281918e1 100644
--- a/guilib/GUITextBox.h
+++ b/guilib/GUITextBox.h
@@ -48,7 +48,7 @@ public:
virtual ~CGUITextBox(void);
virtual CGUITextBox *Clone() const { return new CGUITextBox(*this); };
- virtual void DoRender(DWORD currentTime);
+ virtual void DoRender(unsigned int currentTime);
virtual void Render();
virtual bool OnMessage(CGUIMessage& message);
@@ -77,16 +77,16 @@ protected:
int m_scrollTime;
unsigned int m_itemsPerPage;
float m_itemHeight;
- DWORD m_renderTime;
- DWORD m_lastRenderTime;
+ unsigned int m_renderTime;
+ unsigned int m_lastRenderTime;
CLabelInfo m_label;
// autoscrolling
- int m_autoScrollCondition;
- int m_autoScrollTime; // time to scroll 1 line (ms)
- int m_autoScrollDelay; // delay before scroll (ms)
- DWORD m_autoScrollDelayTime; // current offset into the delay
+ int m_autoScrollCondition;
+ int m_autoScrollTime; // time to scroll 1 line (ms)
+ int m_autoScrollDelay; // delay before scroll (ms)
+ unsigned int m_autoScrollDelayTime; // current offset into the delay
CAnimation *m_autoScrollRepeatAnim;
int m_pageControl;
diff --git a/guilib/GUITexture.cpp b/guilib/GUITexture.cpp
index dd1204c408..7b7f079360 100644
--- a/guilib/GUITexture.cpp
+++ b/guilib/GUITexture.cpp
@@ -79,7 +79,7 @@ CGUITextureBase::CGUITextureBase(float posX, float posY, float width, float heig
// anim gifs
m_currentFrame = 0;
- m_frameCounter = (DWORD) -1;
+ m_frameCounter = (unsigned int) -1;
m_currentLoop = 0;
m_allocateDynamically = false;
@@ -118,7 +118,7 @@ CGUITextureBase::CGUITextureBase(const CGUITextureBase &right)
m_largeOrientation = 0;
m_currentFrame = 0;
- m_frameCounter = (DWORD) -1;
+ m_frameCounter = (unsigned int) -1;
m_currentLoop = 0;
m_isAllocated = NO;
@@ -471,7 +471,7 @@ void CGUITextureBase::DynamicResourceAlloc(bool allocateDynamically)
void CGUITextureBase::UpdateAnimFrame()
{
m_frameCounter++;
- DWORD delay = m_texture.m_delays[m_currentFrame];
+ unsigned int delay = m_texture.m_delays[m_currentFrame];
if (!delay) delay = 100;
if (m_frameCounter * 40 >= delay)
{
diff --git a/guilib/GUIWindow.cpp b/guilib/GUIWindow.cpp
index 30c7a90b7f..f68d72a034 100644
--- a/guilib/GUIWindow.cpp
+++ b/guilib/GUIWindow.cpp
@@ -36,6 +36,7 @@
#include "utils/GUIInfoManager.h"
#include "utils/log.h"
#include "utils/SingleLock.h"
+#include "utils/TimeUtils.h"
#include "ButtonTranslator.h"
#include "XMLUtils.h"
#include "MouseStat.h"
@@ -328,7 +329,7 @@ void CGUIWindow::Render()
if (m_hasCamera)
g_graphicsContext.SetCameraPosition(m_camera);
- DWORD currentTime = timeGetTime();
+ unsigned int currentTime = CTimeUtils::GetFrameTime();
// render our window animation - returns false if it needs to stop rendering
if (!RenderAnimation(currentTime))
return;
@@ -750,7 +751,7 @@ bool CGUIWindow::IsAnimating(ANIMATION_TYPE animType)
return CGUIControlGroup::IsAnimating(animType);
}
-bool CGUIWindow::RenderAnimation(DWORD time)
+bool CGUIWindow::RenderAnimation(unsigned int time)
{
g_graphicsContext.ResetWindowTransform();
if (m_animationsEnabled)
diff --git a/guilib/GUIWindow.h b/guilib/GUIWindow.h
index 868be691ff..aba217fbc6 100644
--- a/guilib/GUIWindow.h
+++ b/guilib/GUIWindow.h
@@ -174,7 +174,7 @@ protected:
virtual void OnInitWindow();
virtual void OnDeinitWindow(int nextWindowID);
virtual bool OnMouseAction();
- virtual bool RenderAnimation(DWORD time);
+ virtual bool RenderAnimation(unsigned int time);
virtual bool CheckAnimation(ANIMATION_TYPE animType);
CAnimation *GetAnimation(ANIMATION_TYPE animType, bool checkConditions = true);
diff --git a/guilib/SkinInfo.cpp b/guilib/SkinInfo.cpp
index 8b33ac0159..40e9aa2165 100644
--- a/guilib/SkinInfo.cpp
+++ b/guilib/SkinInfo.cpp
@@ -345,12 +345,12 @@ bool CSkinInfo::ResolveConstant(const CStdString &constant, float &value)
return m_includes.ResolveConstant(constant, value);
}
-bool CSkinInfo::ResolveConstant(const CStdString &constant, DWORD &value)
+bool CSkinInfo::ResolveConstant(const CStdString &constant, unsigned int &value)
{
float fValue;
if (m_includes.ResolveConstant(constant, fValue))
{
- value = (DWORD)fValue;
+ value = (unsigned int)fValue;
return true;
}
return false;
diff --git a/guilib/SkinInfo.h b/guilib/SkinInfo.h
index 38dec2bccf..9275596af3 100644
--- a/guilib/SkinInfo.h
+++ b/guilib/SkinInfo.h
@@ -58,7 +58,7 @@ public:
void ResolveIncludes(TiXmlElement *node, const CStdString &type = "");
bool ResolveConstant(const CStdString &constant, float &value);
- bool ResolveConstant(const CStdString &constant, DWORD &value);
+ bool ResolveConstant(const CStdString &constant, unsigned int &value);
double GetEffectsSlowdown() const { return m_effectsSlowDown; };
diff --git a/guilib/Texture.cpp b/guilib/Texture.cpp
index 89c16632c3..0f78d6b083 100644
--- a/guilib/Texture.cpp
+++ b/guilib/Texture.cpp
@@ -165,7 +165,7 @@ bool CBaseTexture::LoadPaletted(unsigned int width, unsigned int height, unsigne
return true;
}
-DWORD CBaseTexture::PadPow2(DWORD x)
+unsigned int CBaseTexture::PadPow2(unsigned int x)
{
--x;
x |= x >> 1;
diff --git a/guilib/Texture.h b/guilib/Texture.h
index 16a481cbe8..73751efd10 100644
--- a/guilib/Texture.h
+++ b/guilib/Texture.h
@@ -72,7 +72,7 @@ public:
void Update(int w, int h, int pitch, const unsigned char *pixels, bool loadToGPU);
void Allocate(unsigned int width, unsigned int height, unsigned int BPP);
- static DWORD PadPow2(DWORD x);
+ static unsigned int PadPow2(unsigned int x);
protected:
unsigned int m_imageWidth;
diff --git a/guilib/TextureManager.cpp b/guilib/TextureManager.cpp
index 22191b1e2c..55ae4f53ac 100644
--- a/guilib/TextureManager.cpp
+++ b/guilib/TextureManager.cpp
@@ -172,7 +172,7 @@ void CTextureMap::Dump() const
OutputDebugString(strLog.c_str());
}
-DWORD CTextureMap::GetMemoryUsage() const
+unsigned int CTextureMap::GetMemoryUsage() const
{
return m_memUsage;
}
@@ -512,9 +512,9 @@ void CGUITextureManager::Flush()
}
}
-DWORD CGUITextureManager::GetMemoryUsage() const
+unsigned int CGUITextureManager::GetMemoryUsage() const
{
- DWORD memUsage = 0;
+ unsigned int memUsage = 0;
for (int i = 0; i < (int)m_vecTextures.size(); ++i)
{
memUsage += m_vecTextures[i]->GetMemoryUsage();