void Release();
protected:
- unsigned char getbyte(FILE *fd);
+ static unsigned char getbyte(FILE *fd);
};
// Accessors
LPDIRECT3DTEXTURE9 Get() const { return m_texture; };
- UINT GetWidth() { return m_width; }
- UINT GetHeight() { return m_height; }
+ UINT GetWidth() const { return m_width; }
+ UINT GetHeight() const { return m_height; }
virtual void OnDestroyDevice();
virtual void OnCreateDevice();
return true;
}
-unsigned int CDDSImage::GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format) const
+unsigned int CDDSImage::GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format)
{
switch (format)
{
m_data = new unsigned char[m_desc.linearSize];
}
-const char *CDDSImage::GetFourCC(unsigned int format) const
+const char *CDDSImage::GetFourCC(unsigned int format)
{
switch (format)
{
private:
void Allocate(unsigned int width, unsigned int height, unsigned int format);
- const char *GetFourCC(unsigned int format) const;
+ static const char *GetFourCC(unsigned int format);
bool WriteFile(const std::string &file) const;
/*! \brief Compress an ARGB buffer into a DXT1/3/5 image
*/
bool Compress(unsigned int width, unsigned int height, unsigned int pitch, unsigned char const *argb, double maxMSE = 0);
- unsigned int GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format) const;
+ static unsigned int GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format);
enum {
ddsd_caps = 0x00000001,
ddsd_height = 0x00000002,
// Currently only works for 32bit and 8bit textures, with power of 2 width and height
void Unswizzle(const void *src, unsigned int depth, unsigned int width, unsigned int height, void *dest)
{
- if (height <= 0 || width <= 0)
+ if (height == 0 || width == 0)
return;
for (UINT y = 0; y < height; y++)
}
// Finish rendering to FBO
-void CFrameBufferObject::EndRender()
+void CFrameBufferObject::EndRender() const
{
if (IsValid())
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
bool IsSupported();
// returns true if FBO has been initialized
- bool IsValid() { return m_valid; }
+ bool IsValid() const { return m_valid; }
// returns true if FBO has a texture bound to it
- bool IsBound() { return m_bound; }
+ bool IsBound() const { return m_bound; }
// initialize the FBO
bool Initialize();
GLenum filter=GL_LINEAR, GLenum clampmode=GL_CLAMP_TO_EDGE);
// Return the internally created texture ID
- GLuint Texture() { return m_texid; }
+ GLuint Texture() const { return m_texid; }
// Begin rendering to FBO
bool BeginRender();
// Finish rendering to FBO
- void EndRender();
+ void EndRender() const;
private:
GLuint m_fbo;
if (m_actions.size() == 0) return false;
// take a copy of actions that satisfy our conditions
vector<CStdString> actions;
- for (ciActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+ for (ciActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
{
if (it->condition.IsEmpty() || g_infoManager.EvaluateBool(it->condition))
{
int CGUIAction::GetNavigation() const
{
- for (ciActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+ for (ciActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
{
if (StringUtils::IsInteger(it->action))
{
if (id == 0) return;
CStdString strId;
strId.Format("%i", id);
- for (iActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+ for (iActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
{
if (StringUtils::IsInteger(it->action) && it->condition.IsEmpty())
{
bool CGUIAction::HasActionsMeetingCondition() const
{
- for (ciActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+ for (ciActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
{
if (it->condition.IsEmpty() || g_infoManager.EvaluateBool(it->condition))
return true;
{
if (updateAllItems)
{ // free memory of items
- for (iItems it = m_items.begin(); it != m_items.end(); it++)
+ for (iItems it = m_items.begin(); it != m_items.end(); ++it)
(*it)->FreeMemory();
}
// and recalculate the layout
return GetOffset() / m_itemsPerPage + 1;
}
-void CGUIBaseContainer::GetCacheOffsets(int &cacheBefore, int &cacheAfter)
+void CGUIBaseContainer::GetCacheOffsets(int &cacheBefore, int &cacheAfter) const
{
if (m_scroller.IsScrollingDown())
{
// changing around)
void UpdateScrollByLetter();
- void GetCacheOffsets(int &cacheBefore, int &cacheAfter);
+ void GetCacheOffsets(int &cacheBefore, int &cacheAfter) const;
int GetCacheCount() const { return m_cacheItems; };
bool ScrollingDown() const { return m_scroller.IsScrollingDown(); };
bool ScrollingUp() const { return m_scroller.IsScrollingUp(); };
}
CGUIBorderedImage::CGUIBorderedImage(const CGUIBorderedImage &right)
-: CGUIImage(right), m_borderImage(right.m_borderImage)
+: CGUIImage(right), m_borderImage(right.m_borderImage), m_borderSize(right.m_borderSize)
{
- m_borderSize = right.m_borderSize;
ControlType = GUICONTROL_BORDEREDIMAGE;
}
void PythonSetDisabledColor(color_t disabledColor);
virtual void OnClick();
- bool HasClickActions() { return m_clickActions.HasActionsMeetingCondition(); };
+ bool HasClickActions() const { return m_clickActions.HasActionsMeetingCondition(); };
virtual bool UpdateColors();
// Assign an EventHandler (EventHandler's are derived from Event)
GUIEvent<Cookie> &operator=(GUIEvent<Cookie> &aEvent)
{
- if (&aEvent)
+ if (&aEvent != this)
{
m_pInstance = aEvent.m_pInstance;
m_pMethod = aEvent.m_pMethod;
}
- else
- {
- GUIEvent();
- }
-
return *this;
}
// Are the class instance and method pointers initialised?
- bool HasAHandler()
+ bool HasAHandler() const
{
return (m_pInstance && m_pMethod);
}
// Execute the associated class method
- void Fire(Cookie aCookie)
+ void Fire(Cookie aCookie) const
{
if (HasAHandler())
{
// Assign a CallbackHandler (CallbackHandler's are derived from Callback)
Callback<Result, Cookie> &operator=(Callback<Result, Cookie> &aCallback)
{
- if (&aCallback)
+ if (&aCallback != this)
{
m_pInstance = aCallback.m_pInstance;
m_pMethod = aCallback.m_pMethod;
}
- else
- {
- Callback();
- }
-
return *this;
}
// Are the class instance and method pointers initialised?
- bool HasAHandler()
+ bool HasAHandler() const
{
return (m_pInstance && m_pMethod);
}
// Execute the associated class method and return the result
- Result Fire(Cookie aCookie)
+ Result Fire(Cookie aCookie) const
{
if (HasAHandler())
{
, m_imgCheckMark(posX, posY, checkWidth, checkHeight, textureCheckMark)
, m_imgCheckMarkNoFocus(posX, posY, checkWidth, checkHeight, textureCheckMarkNF)
, m_label(posX, posY, width, height, labelInfo)
+ , m_strLabel("")
{
- m_strLabel = "";
m_bSelected = false;
m_label.GetLabelInfo().align |= XBFONT_CENTER_Y;
ControlType = GUICONTROL_CHECKMARK;
using namespace std;
-CGUIControl::CGUIControl()
+CGUIControl::CGUIControl() :
+ m_diffuseColor(0xffffffff)
{
m_hasProcessed = false;
m_bHasFocus = false;
m_visibleCondition = 0;
m_enableCondition = 0;
m_enabled = true;
- m_diffuseColor = 0xffffffff;
m_posX = 0;
m_posY = 0;
m_width = 0;
}
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_diffuseColor(0xffffffff)
{
m_posX = posX;
m_posY = posY;
m_parentID = parentID;
m_visible = VISIBLE;
m_visibleFromSkinCondition = true;
- m_diffuseColor = 0xffffffff;
m_forceHidden = false;
m_visibleCondition = 0;
m_enableCondition = 0;
return false;
}
-bool CGUIControl::Navigate(int direction)
+bool CGUIControl::Navigate(int direction) const
{
if (HasFocus())
{
Navigate(ACTION_PREV_CONTROL);
}
-bool CGUIControl::SendWindowMessage(CGUIMessage &message)
+bool CGUIControl::SendWindowMessage(CGUIMessage &message) const
{
CGUIWindow *pWindow = g_windowManager.GetWindow(GetParentID());
if (pWindow)
bool GetNavigationAction(int direction, CGUIAction& action) const;
/*! \brief Start navigating in given direction.
*/
- bool Navigate(int direction);
+ bool Navigate(int direction) const;
virtual void SetFocus(bool focus);
virtual void SetWidth(float width);
virtual void SetHeight(float height);
virtual bool 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);
+ bool SendWindowMessage(CGUIMessage &message) const;
// navigation and actions
CGUIAction m_actionLeft;
static CStdString GetType(const TiXmlElement *pControlNode);
static bool GetConditionalVisibility(const TiXmlNode* control, CStdString &condition, CStdString &allowHiddenFocus);
bool GetString(const TiXmlNode* pRootNode, const char* strTag, CStdString& strString);
- bool GetFloatRange(const TiXmlNode* pRootNode, const char* strTag, float& iMinValue, float& iMaxValue, float& iIntervalValue);
- bool GetIntRange(const TiXmlNode* pRootNode, const char* strTag, int& iMinValue, int& iMaxValue, int& iIntervalValue);
+ static bool GetFloatRange(const TiXmlNode* pRootNode, const char* strTag, float& iMinValue, float& iMaxValue, float& iIntervalValue);
+ static bool GetIntRange(const TiXmlNode* pRootNode, const char* strTag, int& iMinValue, int& iMaxValue, int& iIntervalValue);
};
#endif
if (first != m_lookup.end())
{
LookupMap::const_iterator last = m_lookup.upper_bound(iControl);
- for (LookupMap::const_iterator i = first; i != last; i++)
+ for (LookupMap::const_iterator i = first; i != last; ++i)
{
CGUIControl *control = i->second;
if (control->IsVisible())
if (control->IsGroup())
{ // first add all the subitems of this group (if they exist)
const LookupMap map = ((CGUIControlGroup *)control)->GetLookup();
- for (LookupMap::const_iterator i = map.begin(); i != map.end(); i++)
+ for (LookupMap::const_iterator i = map.begin(); i != map.end(); ++i)
m_lookup.insert(m_lookup.upper_bound(i->first), make_pair(i->first, i->second));
}
if (control->GetID())
if (control->IsGroup())
{ // remove the group's lookup
const LookupMap &map = ((CGUIControlGroup *)control)->GetLookup();
- for (LookupMap::const_iterator i = map.begin(); i != map.end(); i++)
+ for (LookupMap::const_iterator i = map.begin(); i != map.end(); ++i)
{ // remove this control
- for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); it++)
+ for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); ++it)
{
if (i->second == it->second)
{
// remove the actual control
if (control->GetID())
{
- for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); it++)
+ for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); ++it)
{
if (control == it->second)
{
{
if (control->GetID())
{
- for (LookupMap::const_iterator it = m_lookup.begin(); it != m_lookup.end(); it++)
+ for (LookupMap::const_iterator it = m_lookup.begin(); it != m_lookup.end(); ++it)
{
if (control == it->second)
return true;
// first remove from the lookup table
if (m_parentControl)
{
- for (iControls it = m_children.begin(); it != m_children.end(); it++)
+ for (iControls it = m_children.begin(); it != m_children.end(); ++it)
((CGUIControlGroup *)m_parentControl)->RemoveLookup(*it);
}
// and delete all our children
- for (iControls it = m_children.begin(); it != m_children.end(); it++)
+ for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
delete control;
typedef std::multimap<int, CGUIControl *> LookupMap;
void AddLookup(CGUIControl *control);
void RemoveLookup(CGUIControl *control);
- const LookupMap &GetLookup() { return m_lookup; };
+ const LookupMap &GetLookup() const { return m_lookup; };
LookupMap m_lookup;
int m_defaultControl;
void SetTextChangeActions(const CGUIAction& textChangeActions) { m_textChangeActions = textChangeActions; };
- bool HasTextChangeActions() { return m_textChangeActions.HasActionsMeetingCondition(); };
+ bool HasTextChangeActions() const { return m_textChangeActions.HasActionsMeetingCondition(); };
protected:
virtual void ProcessText(unsigned int currentTime);
using namespace std;
CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, unsigned int timeToDelayAtEnd, bool resetOnLabelChange)
- : CGUIControl(parentID, controlID, posX, posY, width, height), m_scrollInfo(50, labelInfo.offsetX, labelInfo.scrollSpeed)
+ : CGUIControl(parentID, controlID, posX, posY, width, height), m_label(labelInfo), m_scrollInfo(50, labelInfo.offsetX, labelInfo.scrollSpeed)
, m_textLayout(labelInfo.font, false)
+ , m_fadeAnim(CAnimation::CreateFader(100, 0, timeToDelayAtEnd, 200))
{
- m_label = labelInfo;
m_currentLabel = 0;
ControlType = GUICONTROL_FADELABEL;
m_scrollOut = scrollOut;
- m_fadeAnim = CAnimation::CreateFader(100, 0, timeToDelayAtEnd, 200);
m_fadeAnim.ApplyAnimation();
m_lastLabel = -1;
m_scrollSpeed = labelInfo.scrollSpeed; // save it for later
}
CGUIFadeLabelControl::CGUIFadeLabelControl(const CGUIFadeLabelControl &from)
-: CGUIControl(from), m_infoLabels(from.m_infoLabels), m_scrollInfo(from.m_scrollInfo), m_textLayout(from.m_textLayout)
+: CGUIControl(from), m_infoLabels(from.m_infoLabels), m_label(from.m_label), m_scrollInfo(from.m_scrollInfo), m_textLayout(from.m_textLayout),
+ m_fadeAnim(from.m_fadeAnim)
{
- m_label = from.m_label;
m_scrollOut = from.m_scrollOut;
m_scrollSpeed = from.m_scrollSpeed;
m_resetOnLabelChange = from.m_resetOnLabelChange;
- m_fadeAnim = from.m_fadeAnim;
m_fadeAnim.ApplyAnimation();
m_currentLabel = 0;
m_lastLabel = -1;
Clear();
}
-void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect) const
+void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect)
{
// set scaling resolution so that we can scale our font sizes correctly
// as fonts aren't scaled at render time (due to aliasing) we must scale
void GUIFontManager::UnloadTTFFonts()
{
- for (vector<CGUIFontTTFBase*>::iterator i = m_vecFontFiles.begin(); i != m_vecFontFiles.end(); i++)
+ for (vector<CGUIFontTTFBase*>::iterator i = m_vecFontFiles.begin(); i != m_vecFontFiles.end(); ++i)
delete (*i);
m_vecFontFiles.clear();
- for (vector<CGUIFont*>::iterator i = m_vecFonts.begin(); i != m_vecFonts.end(); i++)
+ for (vector<CGUIFont*>::iterator i = m_vecFonts.begin(); i != m_vecFonts.end(); ++i)
(*i)->SetFont(NULL);
}
void Clear();
void FreeFontFile(CGUIFontTTFBase *pFont);
- bool IsFontSetUnicode() { return m_fontsetUnicode; }
+ bool IsFontSetUnicode() const { return m_fontsetUnicode; }
bool IsFontSetUnicode(const CStdString& strFontSet);
bool GetFirstFontSetUnicode(CStdString& strFontSet);
static void SettingOptionsFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
protected:
- void RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect) const;
+ static void RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect);
void LoadFonts(const TiXmlNode* fontNode);
CGUIFontTTFBase* GetFontFile(const CStdString& strFontFile);
bool OpenFontFile(CXBMCTinyXML& xmlDoc);
return stroker;
};
- void ReleaseFont(FT_Face face)
+ static void ReleaseFont(FT_Face face)
{
assert(face);
FT_Done_Face(face);
};
- void ReleaseStroker(FT_Stroker stroker)
+ static void ReleaseStroker(FT_Stroker stroker)
{
assert(stroker);
FT_Stroker_Done(stroker);
// first compute the size of the text to render in both characters and pixels
unsigned int lineChars = 0;
float linePixels = 0;
- for (vecText::const_iterator pos = text.begin(); pos != text.end(); pos++)
+ for (vecText::const_iterator pos = text.begin(); pos != text.end(); ++pos)
{
Character *ch = GetCharacter(*pos);
if (ch)
}
float cursorX = 0; // current position along the line
- for (vecText::const_iterator pos = text.begin(); pos != text.end(); pos++)
+ for (vecText::const_iterator pos = text.begin(); pos != text.end(); ++pos)
{
// If starting text on a new line, determine justification effects
// Get the current letter in the CStdString
int low = 0;
int high = m_numChars - 1;
- int mid;
while (low <= high)
{
- mid = (low + high) >> 1;
+ int mid = (low + high) >> 1;
if (ch > m_char[mid].letterAndStyle)
low = mid + 1;
else if (ch < m_char[mid].letterAndStyle)
// modifying glyphs
void EmboldenGlyph(FT_GlyphSlot slot);
- void ObliqueGlyph(FT_GlyphSlot slot);
+ static void ObliqueGlyph(FT_GlyphSlot slot);
CBaseTexture* m_texture; // texture that holds our rendered characters (8bit alpha only)
CStdString m_strFileName;
private:
+ CGUIFontTTFBase(const CGUIFontTTFBase&);
+ CGUIFontTTFBase& operator=(const CGUIFontTTFBase&);
int m_referenceCount;
};
}
LPDIRECT3DSURFACE9 pSource, pTarget;
- HRESULT hr;
// There might be data to copy from the previous texture
if ((newSpeedupTexture && m_speedupTexture) || (newTexture && m_texture))
{
const RECT rect = { 0, 0, m_textureWidth, m_textureHeight };
const POINT point = { 0, 0 };
- hr = g_Windowing.Get3DDevice()->UpdateSurface(pSource, &rect, pTarget, &point);
+ HRESULT hr = g_Windowing.Get3DDevice()->UpdateSurface(pSource, &rect, pTarget, &point);
SAFE_RELEASE(pSource);
SAFE_RELEASE(pTarget);
}
CGUIImage::CGUIImage(const CGUIImage &left)
- : CGUIControl(left), m_texture(left.m_texture)
+ : CGUIControl(left),
+ m_image(left.m_image),
+ m_info(left.m_info),
+ m_texture(left.m_texture),
+ m_fadingTextures(),
+ m_currentTexture(),
+ m_currentFallback()
{
- m_info = left.m_info;
m_crossFadeTime = left.m_crossFadeTime;
// defaults
m_currentFadeTime = 0;
if (!ProcessFading(*i, frameTime, currentTime))
i = m_fadingTextures.erase(i);
else
- i++;
+ ++i;
}
if (m_texture.ReadyToRender() || m_texture.GetFileName().IsEmpty())
{
if (!IsVisible()) return;
- for (vector<CFadingTexture *>::iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); itr++)
+ for (vector<CFadingTexture *>::iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); ++itr)
(*itr)->m_texture->Render();
m_texture.Render();
{
CRect region = m_texture.GetRenderRect();
- for (vector<CFadingTexture *>::const_iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); itr++)
+ for (vector<CFadingTexture *>::const_iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); ++itr)
region.Union( (*itr)->m_texture->GetRenderRect() );
return CGUIControl::CalcRenderRegion().Intersect(region);
CGUITexture *m_texture; ///< texture to fade out
unsigned int m_fadeTime; ///< time to fade out (ms)
bool m_fading; ///< whether we're fading out
+
+ private:
+ CFadingTexture(const CFadingTexture&);
+ CFadingTexture& operator=(const CFadingTexture&);
};
CGUIImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture);
m_info = 0;
}
-const CGUIInfoColor &CGUIInfoColor::operator=(color_t color)
+CGUIInfoColor &CGUIInfoColor::operator=(color_t color)
{
m_color = color;
m_info = 0;
return *this;
}
-const CGUIInfoColor &CGUIInfoColor::operator=(const CGUIInfoColor &color)
+CGUIInfoColor &CGUIInfoColor::operator=(const CGUIInfoColor &color)
{
m_color = color.m_color;
m_info = color.m_info;
public:
CGUIInfoColor(color_t color = 0);
- const CGUIInfoColor &operator=(const CGUIInfoColor &color);
- const CGUIInfoColor &operator=(color_t color);
+ CGUIInfoColor& operator=(const CGUIInfoColor &color);
+ CGUIInfoColor& operator=(color_t color);
operator color_t() const { return m_color; };
bool Update();
if (rect.Intersect(label2.m_renderRect).IsEmpty())
return false; // nothing to do (though it could potentially encroach on the min_space requirement)
- static const float min_space = 10;
// overlap vertically and horizontally - check alignment
CGUILabel &left = label1.m_renderRect.x1 <= label2.m_renderRect.x1 ? label1 : label2;
CGUILabel &right = label1.m_renderRect.x1 <= label2.m_renderRect.x1 ? label2 : label1;
if ((left.m_label.align & 3) == 0 && right.m_label.align & XBFONT_RIGHT)
{
+ static const float min_space = 10;
float chopPoint = (left.m_maxRect.x1 + left.GetMaxWidth() + right.m_maxRect.x2 - right.GetMaxWidth()) * 0.5f;
// [1 [2...[2 1].|..........1] 2]
// [1 [2.....[2 | 1]..1] 2]
return m_bSelected;
}
-const CGUIListItem& CGUIListItem::operator =(const CGUIListItem& item)
+CGUIListItem& CGUIListItem::operator =(const CGUIListItem& item)
{
if (&item == this) return * this;
m_strLabel2 = item.m_strLabel2;
ar << m_bSelected;
ar << m_overlayIcon;
ar << (int)m_mapProperties.size();
- for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); it++)
+ for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); ++it)
{
ar << it->first;
ar << it->second;
}
ar << (int)m_art.size();
- for (ArtMap::const_iterator i = m_art.begin(); i != m_art.end(); i++)
+ for (ArtMap::const_iterator i = m_art.begin(); i != m_art.end(); ++i)
{
ar << i->first;
ar << i->second;
}
ar << (int)m_artFallbacks.size();
- for (ArtMap::const_iterator i = m_artFallbacks.begin(); i != m_artFallbacks.end(); i++)
+ for (ArtMap::const_iterator i = m_artFallbacks.begin(); i != m_artFallbacks.end(); ++i)
{
ar << i->first;
ar << i->second;
value["strIcon"] = m_strIcon;
value["selected"] = m_bSelected;
- for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); it++)
+ for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); ++it)
{
value["properties"][it->first] = it->second;
}
- for (ArtMap::const_iterator it = m_art.begin(); it != m_art.end(); it++)
+ for (ArtMap::const_iterator it = m_art.begin(); it != m_art.end(); ++it)
value["art"][it->first] = it->second;
}
virtual ~CGUIListItem(void);
virtual CGUIListItem *Clone() const { return new CGUIListItem(*this); };
- const CGUIListItem& operator =(const CGUIListItem& item);
+ CGUIListItem& operator =(const CGUIListItem& item);
virtual void SetLabel(const CStdString& strLabel);
const CStdString& GetLabel() const;
void Serialize(CVariant& value);
bool HasProperty(const CStdString &strKey) const;
- bool HasProperties() const { return m_mapProperties.size() > 0; };
+ bool HasProperties() const { return !m_mapProperties.empty(); };
void ClearProperty(const CStdString &strKey);
CVariant GetProperty(const CStdString &strKey) const;
CGUIListLabel::CGUIListLabel(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoLabel &info, bool alwaysScroll)
: CGUIControl(parentID, controlID, posX, posY, width, height)
, m_label(posX, posY, width, height, labelInfo, alwaysScroll ? CGUILabel::OVER_FLOW_SCROLL : CGUILabel::OVER_FLOW_TRUNCATE)
+ , m_info(info)
{
- m_info = info;
m_alwaysScroll = alwaysScroll;
// TODO: Remove this "correction"
if (labelInfo.align & XBFONT_RIGHT)
}
-const CGUIMessage& CGUIMessage::operator = (const CGUIMessage& msg)
+CGUIMessage& CGUIMessage::operator = (const CGUIMessage& msg)
{
if (this == &msg) return * this;
CGUIMessage(int msg, int senderID, int controlID, int param1, int param2, const CGUIListItemPtr &item);
CGUIMessage(const CGUIMessage& msg);
virtual ~CGUIMessage(void);
- const CGUIMessage& operator = (const CGUIMessage& msg);
+ CGUIMessage& operator = (const CGUIMessage& msg);
int GetControlId() const ;
int GetMessage() const;
}
CGUIMultiImage::CGUIMultiImage(const CGUIMultiImage &from)
-: CGUIControl(from), m_image(from.m_image)
+ : CGUIControl(from), m_texturePath(), m_imageTimer(), m_files(), m_image(from.m_image)
{
- m_texturePath = from.m_texturePath;
m_timePerImage = from.m_timePerImage;
m_timeToPauseAtEnd = from.m_timeToPauseAtEnd;
m_randomized = from.m_randomized;
CGUIMultiSelectTextControl::CGUIMultiSelectTextControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus, const CLabelInfo& labelInfo, const CGUIInfoLabel &content)
: CGUIControl(parentID, controlID, posX, posY, width, height)
+ , m_label(labelInfo)
+ , m_info(content)
, m_button(parentID, controlID, posX, posY, width, height, textureFocus, textureNoFocus, labelInfo)
{
- m_info = content;
- m_label = labelInfo;
m_selectedItem = 0;
m_offset = 0;
m_totalWidth = 0;
CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoColor &channelColor, const CGUIInfoColor &headlineColor, CStdString& strRSSTags)
: CGUIControl(parentID, controlID, posX, posY, width, height),
- m_scrollInfo(0,0,labelInfo.scrollSpeed,"")
+ m_label(labelInfo),
+ m_channelColor(channelColor),
+ m_headlineColor(headlineColor),
+ m_scrollInfo(0,0,labelInfo.scrollSpeed,""),
+ m_dirty(true)
{
- m_label = labelInfo;
- m_headlineColor = headlineColor;
- m_channelColor = channelColor;
-
m_strRSSTags = strRSSTags;
m_pReader = NULL;
}
CGUIRSSControl::CGUIRSSControl(const CGUIRSSControl &from)
-: CGUIControl(from),m_scrollInfo(from.m_scrollInfo), m_dirty(true)
+ : CGUIControl(from),
+ m_feed(),
+ m_label(from.m_label),
+ m_channelColor(from.m_channelColor),
+ m_headlineColor(from.m_headlineColor),
+ m_vecUrls(),
+ m_vecIntervals(),
+ m_scrollInfo(from.m_scrollInfo),
+ m_dirty(true)
{
- m_label = from.m_label;
- m_headlineColor = from.m_headlineColor;
- m_channelColor = from.m_channelColor;
m_strRSSTags = from.m_strRSSTags;
m_pReader = NULL;
m_rtl = from.m_rtl;
virtual bool OnMessage(CGUIMessage& message);
bool ProcessSelector(CGUITexture &nib, unsigned int currentTime, float fScaleY, RangeSelector selector);
void SetRangeSelection(bool rangeSelection);
- bool GetRangeSelection() { return m_rangeSelection; }
+ bool GetRangeSelection() const { return m_rangeSelection; }
void SetRangeSelector(RangeSelector selector);
void SwitchRangeSelector();
void SetInfo(int iInfo);
changed |= m_label.SetText(text);
- const float space = 5;
float textWidth = m_label.GetTextWidth() + 2 * m_label.GetLabelInfo().offsetX;
// Position the arrows
bool arrowsOnRight(0 != (m_label.GetLabelInfo().align & (XBFONT_RIGHT | XBFONT_CENTER_X)));
if (!arrowsOnRight)
{
+ const float space = 5;
changed |= m_imgspinDownFocus.SetPosition(m_posX + textWidth + space, m_posY);
changed |= m_imgspinDown.SetPosition(m_posX + textWidth + space, m_posY);
changed |= m_imgspinUpFocus.SetPosition(m_posX + textWidth + space + m_imgspinDown.GetWidth(), m_posY);
void CGUIStaticItem::UpdateProperties(int contextWindow)
{
- for (InfoVector::const_iterator i = m_info.begin(); i != m_info.end(); i++)
+ for (InfoVector::const_iterator i = m_info.begin(); i != m_info.end(); ++i)
{
const CGUIInfoLabel &info = i->first;
const CStdString &name = i->second;
const CLabelInfo& labelInfo, int scrollTime)
: CGUIControl(parentID, controlID, posX, posY, width, height)
, CGUITextLayout(labelInfo.font, true)
+ , m_label(labelInfo)
{
m_offset = 0;
m_scrollOffset = 0;
m_autoScrollDelay = 3000;
m_autoScrollDelayTime = 0;
m_autoScrollRepeatAnim = NULL;
- m_label = labelInfo;
}
CGUITextBox::CGUITextBox(const CGUITextBox &from)
alignment &= ~XBFONT_CENTER_Y;
}
m_font->Begin();
- for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+ for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
{
const CGUIString &string = *i;
uint32_t align = alignment;
// any difference to the smoothness of scrolling though which will be
// jumpy with this sort of thing. It's not exactly a well used situation
// though, so this hack is probably OK.
- for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+ for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
{
const CGUIString &string = *i;
m_font->DrawScrollingText(x, y, m_colors, shadowColor, string.m_text, alignment, maxWidth, scrollInfo);
// adjust so the baselines of the fonts align
float by = y + m_font->GetTextBaseLine() - m_borderFont->GetTextBaseLine();
m_borderFont->Begin();
- for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+ for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
{
const CGUIString &string = *i;
uint32_t align = alignment;
m_colors[0] = color;
m_font->Begin();
- for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+ for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
{
const CGUIString &string = *i;
uint32_t align = alignment;
// skip over spaces
pos = lastSpace;
while (pos != line.m_text.end() && IsSpace(*pos))
- pos++;
+ ++pos;
curLine.clear();
lastSpaceInLine = 0;
lastSpace = line.m_text.begin();
lastSpaceInLine = curLine.size();
}
curLine.push_back(letter);
- pos++;
+ ++pos;
}
// now add whatever we have left to the string
float width = m_font->GetTextWidth(curLine);
lines.push_back(string);
lineStart = pos + 1;
}
- pos++;
+ ++pos;
}
// handle the last line if non-empty
if (lineStart < text.end() && (nMaxLines <= 0 || lines.size() < (size_t)nMaxLines))
m_textHeight = 0;
if (!m_font) return;
- for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+ for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
{
const CGUIString &string = *i;
float w = m_font->GetTextWidth(string.m_text);
unsigned int CGUITextLayout::GetTextLength() const
{
unsigned int length = 0;
- for (vector<CGUIString>::const_iterator i = m_lines.begin(); i != m_lines.end(); i++)
+ for (vector<CGUIString>::const_iterator i = m_lines.begin(); i != m_lines.end(); ++i)
length += i->m_text.size();
return length;
}
protected:
void LineBreakText(const vecText &text, std::vector<CGUIString> &lines);
void WrapText(const vecText &text, float maxWidth);
- void BidiTransform(std::vector<CGUIString> &lines, bool forceLTRReadingOrder);
- CStdStringW BidiFlip(const CStdStringW &text, bool forceLTRReadingOrder);
+ static void BidiTransform(std::vector<CGUIString> &lines, bool forceLTRReadingOrder);
+ static CStdStringW BidiFlip(const CStdStringW &text, bool forceLTRReadingOrder);
void CalcTextExtent();
// our text to render
return *this;
}
-CGUITextureBase::CGUITextureBase(float posX, float posY, float width, float height, const CTextureInfo& texture)
+CGUITextureBase::CGUITextureBase(float posX, float posY, float width, float height, const CTextureInfo& texture) :
+ m_height(height), m_info(texture)
{
m_posX = posX;
m_posY = posY;
m_width = width;
- m_height = height;
- m_info = texture;
// defaults
m_visible = true;
m_invalid = true;
}
-CGUITextureBase::CGUITextureBase(const CGUITextureBase &right)
+CGUITextureBase::CGUITextureBase(const CGUITextureBase &right) :
+ m_height(right.m_height),
+ m_alpha(right.m_alpha),
+ m_info(right.m_info),
+ m_aspect(right.m_aspect)
{
m_posX = right.m_posX;
m_posY = right.m_posY;
m_width = right.m_width;
- m_height = right.m_height;
- m_info = right.m_info;
m_visible = right.m_visible;
m_diffuseColor = right.m_diffuseColor;
- m_alpha = right.m_alpha;
- m_aspect = right.m_aspect;
m_allocateDynamically = right.m_allocateDynamically;
bool AllocateOnDemand();
bool UpdateAnimFrame();
void Render(float left, float top, float bottom, float right, float u1, float v1, float u2, float v2, float u3, float v3);
- void OrientateTexture(CRect &rect, float width, float height, int orientation);
+ static void OrientateTexture(CRect &rect, float width, float height, int orientation);
// functions that our implementation classes handle
virtual void Allocate() {}; ///< called after our textures have been allocated
}
CGUIVisualisationControl::CGUIVisualisationControl(const CGUIVisualisationControl &from)
-: CGUIRenderingControl(from), m_bAttemptedLoad(false)
+ : CGUIRenderingControl(from), m_bAttemptedLoad(false), m_addon()
{
ControlType = GUICONTROL_VISUALISATION;
}
CLog::Log(LOGDEBUG, "Unfocus WindowID: %i, ControlID: %i",GetID(), control->GetID());
}
return true;
- break;
}
case GUI_MSG_SELCHANGED:
bool CGUIWindow::HasID(int controlID) const
{
- for (std::vector<int>::const_iterator it = m_idRange.begin(); it != m_idRange.end() ; it++)
+ for (std::vector<int>::const_iterator it = m_idRange.begin(); it != m_idRange.end() ; ++it)
{
if (controlID == *it)
return true;
dialog->OnMessage(message);
}
- for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+ for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
{
CGUIWindow *pWindow = (*it).second;
pWindow->OnMessage(message);
// push back all the windows if there are more than one covered by this class
CSingleLock lock(g_graphicsContext);
const vector<int>& idRange = pWindow->GetIDRange();
- for (vector<int>::const_iterator idIt = idRange.begin(); idIt != idRange.end() ; idIt++)
+ for (vector<int>::const_iterator idIt = idRange.begin(); idIt != idRange.end() ; ++idIt)
{
WindowMap::iterator it = m_mapWindows.find(*idIt);
if (it != m_mapWindows.end())
if(*it2 == it->second)
it2 = m_activeDialogs.erase(it2);
else
- it2++;
+ ++it2;
}
m_mapWindows.erase(it);
// as all messages done in WINDOW_INIT will want to be sent to the new
// topmost window). If we are swapping windows, we pop the old window
// off the history stack
- if (swappingWindows && m_windowHistory.size())
+ if (swappingWindows && !m_windowHistory.empty())
m_windowHistory.pop();
AddToWindowHistory(iWindowID);
// g_infoManager.SetPreviousWindow(WINDOW_INVALID);
}
-void CGUIWindowManager::CloseDialogs(bool forceClose)
+void CGUIWindowManager::CloseDialogs(bool forceClose) const
{
CSingleLock lock(g_graphicsContext);
while (m_activeDialogs.size() > 0)
}
}
-bool CGUIWindowManager::OnAction(const CAction &action)
+bool CGUIWindowManager::OnAction(const CAction &action) const
{
CSingleLock lock(g_graphicsContext);
unsigned int topMost = m_activeDialogs.size();
pWindow->DoProcess(currentTime, dirtyregions);
// process all dialogs - visibility may change etc.
- for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+ for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
{
CGUIWindow *pWindow = (*it).second;
if (pWindow && pWindow->IsDialog())
pWindow->DoProcess(currentTime, dirtyregions);
}
- for (CDirtyRegionList::iterator itr = dirtyregions.begin(); itr != dirtyregions.end(); itr++)
+ for (CDirtyRegionList::iterator itr = dirtyregions.begin(); itr != dirtyregions.end(); ++itr)
m_tracker.MarkDirtyRegion(*itr);
}
m_tracker.MarkDirtyRegion(rect);
}
-void CGUIWindowManager::RenderPass()
+void CGUIWindowManager::RenderPass() const
{
CGUIWindow* pWindow = GetWindow(GetActiveWindow());
if (pWindow)
}
else
{
- for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); i++)
+ for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); ++i)
{
if (i->IsEmpty())
continue;
{
g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
const CDirtyRegionList &markedRegions = m_tracker.GetMarkedRegions();
- for (CDirtyRegionList::const_iterator i = markedRegions.begin(); i != markedRegions.end(); i++)
+ for (CDirtyRegionList::const_iterator i = markedRegions.begin(); i != markedRegions.end(); ++i)
CGUITexture::DrawQuad(*i, 0x0fff0000);
- for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); i++)
+ for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); ++i)
CGUITexture::DrawQuad(*i, 0x4c00ff00);
}
if(m_iNested == 0)
{
// delete any windows queued for deletion
- for(iDialog it = m_deleteWindows.begin(); it != m_deleteWindows.end(); it++)
+ for(iDialog it = m_deleteWindows.begin(); it != m_deleteWindows.end(); ++it)
{
// Free any window resources
(*it)->FreeResources(true);
void CGUIWindowManager::DeInitialize()
{
CSingleLock lock(g_graphicsContext);
- for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+ for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
{
CGUIWindow* pWindow = (*it).second;
if (IsWindowActive(it->first))
CSingleLock lock(m_critSection);
- for(int msgCount = m_vecThreadMessages.size(); m_vecThreadMessages.size() > 0 && msgCount > 0; --msgCount)
+ for(int msgCount = m_vecThreadMessages.size(); !m_vecThreadMessages.empty() && msgCount > 0; --msgCount)
{
// pop up one message per time to make messages be processed by order.
// this will ensure rule No.2 & No.3
void CGUIWindowManager::LoadNotOnDemandWindows()
{
CSingleLock lock(g_graphicsContext);
- for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+ for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
{
CGUIWindow *pWindow = (*it).second;
if (pWindow->GetLoadType() == CGUIWindow::LOAD_ON_GUI_INIT)
void CGUIWindowManager::UnloadNotOnDemandWindows()
{
CSingleLock lock(g_graphicsContext);
- for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+ for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
{
CGUIWindow *pWindow = (*it).second;
if (pWindow->GetLoadType() == CGUIWindow::LOAD_ON_GUI_INIT ||
// and if so, pop all the other windows off the stack so that we
// always have a predictable "Back" behaviour for each window
stack<int> historySave = m_windowHistory;
- while (historySave.size())
+ while (!historySave.empty())
{
if (historySave.top() == newWindowID)
break;
void CGUIWindowManager::ClearWindowHistory()
{
- while (m_windowHistory.size())
+ while (!m_windowHistory.empty())
m_windowHistory.pop();
}
void ActivateWindow(int iWindowID, const std::vector<CStdString>& params, bool swappingWindows = false);
void PreviousWindow();
- void CloseDialogs(bool forceClose = false);
+ void CloseDialogs(bool forceClose = false) const;
// OnAction() runs through our active dialogs and windows and sends the message
// off to the callbacks (application, python, playlist player) and to the
// currently focused window(s). Returns true only if the message is handled.
- bool OnAction(const CAction &action);
+ bool OnAction(const CAction &action) const;
/*! \brief Process active controls allowing them to animate before rendering.
*/
void DumpTextureUse();
#endif
private:
- void RenderPass();
+ void RenderPass() const;
void LoadNotOnDemandWindows();
void UnloadNotOnDemandWindows();
void CGraphicContext::SetOrigin(float x, float y)
{
- if (m_origins.size())
+ if (!m_origins.empty())
m_origins.push(CPoint(x,y) + m_origins.top());
else
m_origins.push(CPoint(x,y));
void CGraphicContext::RestoreOrigin()
{
- if (m_origins.size())
+ if (!m_origins.empty())
m_origins.pop();
RemoveTransform();
}
bool CGraphicContext::SetClipRegion(float x, float y, float w, float h)
{ // transform from our origin
CPoint origin;
- if (m_origins.size())
+ if (!m_origins.empty())
origin = m_origins.top();
// ok, now intersect with our old clip region
CRect rect(x, y, x + w, y + h);
rect += origin;
- if (m_clipRegions.size())
+ if (!m_clipRegions.empty())
{
// intersect with original clip region
rect.Intersect(m_clipRegions.top());
void CGraphicContext::RestoreClipRegion()
{
- if (m_clipRegions.size())
+ if (!m_clipRegions.empty())
m_clipRegions.pop();
// here we could reset the hardware clipping, if applicable
{
// this is the software clipping routine. If the graphics hardware is set to do the clipping
// (eg via SetClipPlane in D3D for instance) then this routine is unneeded.
- if (m_clipRegions.size())
+ if (!m_clipRegions.empty())
{
// take a copy of the vertex rectangle and intersect
// it with our clip region (moved to the same coordinate system)
CRect clipRegion(m_clipRegions.top());
- if (m_origins.size())
+ if (!m_origins.empty())
clipRegion -= m_origins.top();
CRect original(vertex);
vertex.Intersect(clipRegion);
}
// reset our origin and camera
- while (m_origins.size())
+ while (!m_origins.empty())
m_origins.pop();
m_origins.push(CPoint(0, 0));
- while (m_cameras.size())
+ while (!m_cameras.empty())
m_cameras.pop();
m_cameras.push(CPoint(0.5f*m_iScreenWidth, 0.5f*m_iScreenHeight));
{
m_stereoView = view;
- while(m_viewStack.size())
+ while(!m_viewStack.empty())
m_viewStack.pop();
CRect viewport(0.0f, 0.0f, (float)m_iScreenWidth, (float)m_iScreenHeight);
// offset the camera from our current location (this is in XML coordinates) and scale it up to
// the screen resolution
CPoint cam(camera);
- if (m_origins.size())
+ if (!m_origins.empty())
cam += m_origins.top();
cam.x *= (float)m_iScreenWidth / m_windowResolution.iWidth;
{
/* we need to trick renderer that we are fullscreen already so it gives us a valid value */
m_bFullScreenRoot = true;
- newRes = g_renderManager.GetResolution();
+ uiRes = g_renderManager.GetResolution();
m_bFullScreenRoot = false;
}
#endif
if (!free_space)
{ // (re)alloc
m_inputBuffSize += chunksize;
- m_inputBuff = (unsigned char *)realloc(m_inputBuff, m_inputBuffSize);
- if (!m_inputBuff)
+ unsigned char* new_buf = (unsigned char *)realloc(m_inputBuff, m_inputBuffSize);
+ if (!new_buf)
{
CLog::Log(LOGERROR, "%s unable to allocate buffer of size %u", __FUNCTION__, m_inputBuffSize);
+ free(m_inputBuff);
return false;
}
+ else
+ m_inputBuff = new_buf;
+
free_space = chunksize;
chunksize = std::min(chunksize*2, maxchunksize);
}
long unsigned int outBufSize = width * height;
unsigned char* result;
unsigned char* src = buffer;
- unsigned char* rgbbuf, *src2, *dst2;
+ unsigned char* rgbbuf;
if(buffer == NULL)
{
unsigned char* dst = rgbbuf;
for (unsigned int y = 0; y < height; y++)
{
- dst2 = dst;
- src2 = src;
+ unsigned char* dst2 = dst;
+ unsigned char* src2 = src;
for (unsigned int x = 0; x < width; x++, src2 += 4)
{
*dst2++ = src2[2];
JSAMPROW row_pointer[1];
long unsigned int outBufSize = width * height;
unsigned char* src = bufferin;
- unsigned char* rgbbuf, *src2, *dst2;
+ unsigned char* rgbbuf;
if(bufferin == NULL)
{
unsigned char* dst = rgbbuf;
for (unsigned int y = 0; y < height; y++)
{
- dst2 = dst;
- src2 = src;
+
+ unsigned char* dst2 = dst;
+ unsigned char* src2 = src;
for (unsigned int x = 0; x < width; x++, src2 += 4)
{
*dst2++ = src2[2];
bool Read(unsigned char* buffer, unsigned int bufSize, unsigned int minx, unsigned int miny);
bool CreateThumbnail(const CStdString& sourceFile, const CStdString& destFile, int minx, int miny, bool rotateExif);
bool CreateThumbnailFromMemory(unsigned char* buffer, unsigned int bufSize, const CStdString& destFile, unsigned int minx, unsigned int miny);
- bool CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const CStdString& destFile);
+ static bool CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const CStdString& destFile);
void Close();
// methods for the imagefactory
virtual bool Decode(const unsigned char *pixels, unsigned int pitch, unsigned int format);
protected:
static void jpeg_error_exit(j_common_ptr cinfo);
- unsigned int GetExifOrientation(unsigned char* exif_data, unsigned int exif_data_size);
+ static unsigned int GetExifOrientation(unsigned char* exif_data, unsigned int exif_data_size);
unsigned char *m_inputBuff;
unsigned int m_inputBuffSize;
m_held = 0;
}
-const CKey& CKey::operator=(const CKey& key)
+CKey& CKey::operator=(const CKey& key)
{
if (&key == this) return * this;
m_leftTrigger = key.m_leftTrigger;
CKey(const CKey& key);
virtual ~CKey(void);
- const CKey& operator=(const CKey& key);
+ CKey& operator=(const CKey& key);
uint8_t GetLeftTrigger() const;
uint8_t GetRightTrigger() const;
float GetLeftThumbX() const;
*/
bool LoadXML(const CStdString &filename, CStdString &encoding, uint32_t offset = 0);
- CStdString ToUTF8(const CStdString &encoding, const CStdString &str);
+ static CStdString ToUTF8(const CStdString &encoding, const CStdString &str);
std::map<uint32_t, LocStr> m_strings;
typedef std::map<uint32_t, LocStr>::const_iterator ciStrings;
typedef std::map<uint32_t, LocStr>::iterator iStrings;
void MultMatrixf(const GLfloat *matrix);
void LookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx, GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, GLfloat upz);
void PrintMatrix(void);
- bool Project(GLfloat objx, GLfloat objy, GLfloat objz, const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4], GLfloat* winx, GLfloat* winy, GLfloat* winz);
+ static bool Project(GLfloat objx, GLfloat objy, GLfloat objz, const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4], GLfloat* winx, GLfloat* winy, GLfloat* winz);
protected:
struct MatrixWrapper
{
- MatrixWrapper(){};
+ MatrixWrapper(){ memset(&m_values, 0, sizeof(m_values)); };
MatrixWrapper( const float values[16]) { memcpy(m_values,values,sizeof(m_values)); }
MatrixWrapper( const MatrixWrapper &rhs ) { memcpy(m_values, rhs.m_values, sizeof(m_values)); }
MatrixWrapper &operator=( const MatrixWrapper &rhs ) { memcpy(m_values, rhs.m_values, sizeof(m_values)); return *this;}
{
return iWidth * fPixelRatio / iHeight;
}
- RESOLUTION_INFO(const RESOLUTION_INFO& res)
+ RESOLUTION_INFO(const RESOLUTION_INFO& res) :
+ Overscan(res.Overscan)
{
- Overscan = res.Overscan; bFullScreen = res.bFullScreen;
+ bFullScreen = res.bFullScreen;
iScreen = res.iScreen; iWidth = res.iWidth; iHeight = res.iHeight;
iScreenWidth = res.iScreenWidth; iScreenHeight = res.iScreenHeight;
iSubtitles = res.iSubtitles; dwFlags = res.dwFlags;
virtual GLuint Handle() = 0;
virtual void SetSource(const string& src) { m_source = src; }
virtual bool LoadSource(const string& filename, const string& prefix = "");
- bool OK() { return m_compiled; }
+ bool OK() const { return m_compiled; }
protected:
string m_source;
virtual void Disable() = 0;
// returns true if shader is compiled and linked
- bool OK() { return m_ok; }
+ bool OK() const { return m_ok; }
// free resources
virtual void Free() {}
: virtual public CShaderProgram
{
public:
- CGLSLShaderProgram()
+ CGLSLShaderProgram() :
+ m_validated(false)
{
m_pFP = new CGLSLPixelShader();
m_pVP = new CGLSLVertexShader();
}
CGLSLShaderProgram(const std::string& vert
- , const std::string& frag)
+ , const std::string& frag) :
+ m_validated(false)
{
m_pFP = new CGLSLPixelShader();
m_pFP->LoadSource(frag);
RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode();
RENDER_STEREO_MODE playing = GetStereoModeOfPlayingVideo();
- int idx_preferred = -1
- , idx_playing = -1
- , idx_mono = -1
- , idx_select = -1;
+ int idx_playing = -1
+ , idx_mono = -1;
+
// add choices
- idx_preferred = pDlgSelect->Add( g_localizeStrings.Get(36530)
+ int idx_preferred = pDlgSelect->Add( g_localizeStrings.Get(36530)
+ " ("
+ GetLabelForStereoMode(preferred)
+ ")");
+ GetLabelForStereoMode(playing)
+ ")");
- idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select
+ int idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select
pDlgSelect->DoModal();
if(!LoadIImage(pImage, (unsigned char *) inputBuff, inputBuffSize, width, height, autoRotate))
{
delete pImage;
- pImage = NULL;
pImage = ImageFactory::CreateFallbackLoader(texturePath);
if(!LoadIImage(pImage, (unsigned char *) inputBuff, inputBuffSize, width, height))
{
if(!LoadIImage(pImage, buffer, size, width, height))
{
delete pImage;
- pImage = NULL;
pImage = ImageFactory::CreateFallbackLoader(mimeType);
if(!LoadIImage(pImage, buffer, size, width, height))
{
void ClampToEdge();
static unsigned int PadPow2(unsigned int x);
- bool SwapBlueRed(unsigned char *pixels, unsigned int height, unsigned int pitch, unsigned int elements = 4, unsigned int offset=0);
+ static bool SwapBlueRed(unsigned char *pixels, unsigned int height, unsigned int pitch, unsigned int elements = 4, unsigned int offset=0);
private:
// no copy constructor
CAutoBuffer() { p = 0; }
explicit CAutoBuffer(size_t s) { p = (BYTE*)malloc(s); }
~CAutoBuffer() { free(p); }
-operator BYTE*() { return p; }
+operator BYTE*() const { return p; }
void Set(BYTE* buf) { free(p); p = buf; }
bool Resize(size_t s);
void Release() { p = 0; }
+
+private:
+ CAutoBuffer(const CAutoBuffer&);
+ CAutoBuffer& operator=(const CAutoBuffer&);
};
bool CAutoBuffer::Resize(size_t s)
CAutoTexBuffer() { p = 0; }
explicit CAutoTexBuffer(size_t s) { p = (BYTE*)XPhysicalAlloc(s, MAXULONG_PTR, 128, PAGE_READWRITE); }
~CAutoTexBuffer() { if (p) XPhysicalFree(p); }
-operator BYTE*() { return p; }
+operator BYTE*() const { return p; }
BYTE* Set(BYTE* buf) { if (p) XPhysicalFree(p); return p = buf; }
void Release() { p = 0; }
};
testPath += "\\";
int testLength = testPath.GetLength();
std::map<CStdString, FileHeader_t>::iterator it;
- for (it = m_FileHeaders.begin(); it != m_FileHeaders.end(); it++)
+ for (it = m_FileHeaders.begin(); it != m_FileHeaders.end(); ++it)
{
if (it->first.Left(testLength).Equals(testPath))
textures.push_back(it->first);
/************************************************************************/
/* */
/************************************************************************/
-bool CGUITextureManager::CanLoad(const CStdString &texturePath) const
+bool CGUITextureManager::CanLoad(const CStdString &texturePath)
{
if (texturePath == "-")
return false;
return emptyTexture;
}
- for (ilistUnused i = m_unusedTextures.begin(); i != m_unusedTextures.end(); i++)
+ for (ilistUnused i = m_unusedTextures.begin(); i != m_unusedTextures.end(); ++i)
{
CTextureMap* pMap = i->first;
if (pMap->GetName() == strTextureName)
i = m_unusedTextures.erase(i);
}
else
- i++;
+ ++i;
}
#if defined(HAS_GL) || defined(HAS_GLES)
virtual ~CGUITextureManager(void);
bool HasTexture(const CStdString &textureName, CStdString *path = NULL, int *bundle = NULL, int *size = NULL);
- bool CanLoad(const CStdString &texturePath) const; ///< Returns true if the texture manager can load this texture
+ static bool CanLoad(const CStdString &texturePath); ///< Returns true if the texture manager can load this texture
const CTextureArray& Load(const CStdString& strTextureName, bool checkBundleOnly = false);
void ReleaseTexture(const CStdString& strTextureName);
void Cleanup();
return easeOut(time, start, change, duration);
}
protected:
- float easeOut(float time, float start, float change, float duration)
+ static float easeOut(float time, float start, float change, float duration)
{
time /= duration;
if (time < (1/2.75)) {
float _a;
float _p;
- float easeIn(float time, float start, float change, float duration)
+ float easeIn(float time, float start, float change, float duration) const
{
float s=0;
float a=_a;
return -(a * pow(2.0f, 10*time) * sin((time * duration - s) * (2 * M_PI) / p )) + start;
}
- float easeOut(float time, float start, float change, float duration)
+ float easeOut(float time, float start, float change, float duration) const
{
float s=0;
float a=_a;
return (a * pow(2.0f, -10*time) * sin((time * duration - s) * (2 * M_PI) / p )) + change + start;
}
- float easeInOut(float time, float start, float change, float duration)
+ float easeInOut(float time, float start, float change, float duration) const
{
float s=0;
float a=_a;
*this = src;
}
-const CAnimEffect &CAnimEffect::operator=(const CAnimEffect &src)
+CAnimEffect& CAnimEffect::operator=(const CAnimEffect &src)
{
if (&src == this) return *this;
m_matrix.SetZRotation(((m_endAngle - m_startAngle)*offset + m_startAngle) * degree_to_radian, m_center.x, m_center.y, g_graphicsContext.GetScalingPixelRatio());
}
-CZoomEffect::CZoomEffect(const TiXmlElement *node, const CRect &rect) : CAnimEffect(node, EFFECT_TYPE_ZOOM)
+CZoomEffect::CZoomEffect(const TiXmlElement *node, const CRect &rect) : CAnimEffect(node, EFFECT_TYPE_ZOOM), m_center(CPoint(0,0))
{
// effect defaults
m_startX = m_startY = 100;
m_endX = m_endY = 100;
- m_center = CPoint(0,0);
m_autoCenter = false;
float startPosX = rect.x1;
m_effects.clear();
}
-const CAnimation &CAnimation::operator =(const CAnimation &src)
+CAnimation &CAnimation::operator =(const CAnimation &src)
{
if (this == &src) return *this; // same
m_type = src.m_type;
*this = right;
}
-const CScroller &CScroller::operator=(const CScroller &right)
+CScroller& CScroller::operator=(const CScroller &right)
{
if (&right == this) return *this;
CAnimEffect(const CAnimEffect &src);
virtual ~CAnimEffect();
- const CAnimEffect &operator=(const CAnimEffect &src);
+ CAnimEffect& operator=(const CAnimEffect &src);
void Calculate(unsigned int time, const CPoint ¢er);
void ApplyState(ANIMATION_STATE state, const CPoint ¢er);
virtual ~CAnimation();
- const CAnimation &operator=(const CAnimation &src);
+ CAnimation& operator=(const CAnimation &src);
static CAnimation CreateFader(float start, float end, unsigned int delay, unsigned int length, ANIMATION_TYPE type = ANIM_TYPE_NONE);
public:
CScroller(unsigned int duration = 200, boost::shared_ptr<Tweener> tweener = boost::shared_ptr<Tweener>());
CScroller(const CScroller& right);
- const CScroller &operator=(const CScroller &src);
+ CScroller& operator=(const CScroller &src);
~CScroller();
/**
*/
virtual void ReleaseThumbnailBuffer() {return;}
- unsigned int Width() { return m_width; }
- unsigned int Height() { return m_height; }
- unsigned int originalWidth() { return m_originalWidth; }
- unsigned int originalHeight() { return m_originalHeight; }
- unsigned int Orientation() { return m_orientation; }
- bool hasAlpha() { return m_hasAlpha; }
+ unsigned int Width() const { return m_width; }
+ unsigned int Height() const { return m_height; }
+ unsigned int originalWidth() const { return m_originalWidth; }
+ unsigned int originalHeight() const { return m_originalHeight; }
+ unsigned int Orientation() const { return m_orientation; }
+ bool hasAlpha() const { return m_hasAlpha; }
protected: