Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix dirty region processing of edit controls

  • Loading branch information...
commit 2bb623f449e873483ef76f9256a6f13c345c2ffe 1 parent 5707f70
Jonathan Marshall authored
Showing with 18 additions and 9 deletions.
  1. +16 −8 xbmc/guilib/GUIEditControl.cpp
  2. +2 −1  xbmc/guilib/GUIEditControl.h
View
24 xbmc/guilib/GUIEditControl.cpp
@@ -363,7 +363,7 @@ void CGUIEditControl::RecalcLabelPosition()
m_textOffset = 0;
}
-void CGUIEditControl::RenderText()
+void CGUIEditControl::ProcessText(unsigned int currentTime)
{
if (m_smsTimer.GetElapsedMilliseconds() > smsDelay)
UpdateText();
@@ -375,6 +375,7 @@ void CGUIEditControl::RenderText()
RecalcLabelPosition();
}
+ bool changed = false;
float posX = m_label.GetRenderRect().x1;
float maxTextWidth = m_label.GetMaxWidth();
@@ -384,8 +385,8 @@ void CGUIEditControl::RenderText()
if (leftTextWidth > 0)
{
// render the text on the left
- m_label.SetColor(GetTextColor());
- m_label.Render();
+ changed |= m_label.SetColor(GetTextColor());
+ changed |= m_label.Process(currentTime);
posX += leftTextWidth + spaceWidth;
maxTextWidth -= leftTextWidth + spaceWidth;
@@ -417,13 +418,20 @@ void CGUIEditControl::RenderText()
text.Insert(m_cursorPos, col);
}
- m_label2.SetMaxRect(posX + m_textOffset, m_posY, maxTextWidth - m_textOffset, m_height);
- m_label2.SetTextW(text);
- m_label2.SetAlign(align);
- m_label2.SetColor(GetTextColor());
- m_label2.Render();
+ changed |= m_label2.SetMaxRect(posX + m_textOffset, m_posY, maxTextWidth - m_textOffset, m_height);
+ if (text != m_lastRenderedText)
+ {
+ m_label2.SetTextW(text);
+ m_lastRenderedText = text;
+ changed = true;
+ }
+ changed |= m_label2.SetAlign(align);
+ changed |= m_label2.SetColor(GetTextColor());
+ changed |= m_label2.Process(currentTime);
g_graphicsContext.RestoreClipRegion();
}
+ if (changed)
+ MarkDirtyRegion();
}
CStdStringW CGUIEditControl::GetDisplayedText() const
View
3  xbmc/guilib/GUIEditControl.h
@@ -78,7 +78,7 @@ class CGUIEditControl : public CGUIButtonControl
bool HasTextChangeActions() { return m_textChangeActions.size() > 0; };
protected:
- virtual void RenderText();
+ virtual void ProcessText(unsigned int currentTime);
CStdStringW GetDisplayedText() const;
void RecalcLabelPosition();
void ValidateCursor();
@@ -115,5 +115,6 @@ class CGUIEditControl : public CGUIButtonControl
static const char* smsLetters[10];
static const unsigned int smsDelay;
+ CStdStringW m_lastRenderedText; ///< last rendered text
};
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.