CTextBox: ensure paint of background to avoid overlapped letters

This commit is contained in:
2013-09-16 11:42:50 +02:00
parent 33ec56ad6f
commit 08e23a917c
2 changed files with 23 additions and 4 deletions

View File

@@ -135,13 +135,14 @@ CTextBox::~CTextBox()
//TRACE("[CTextBox] del\r\n");
m_cLineArray.clear();
hide();
delete[] m_bgpixbuf;
}
void CTextBox::initVar(void)
{
//TRACE("[CTextBox]->InitVar\r\n");
frameBuffer = NULL;
m_bgpixbuf = NULL;
m_showTextFrame = 0;
m_nNrOfNewLine = 0;
@@ -510,10 +511,27 @@ void CTextBox::refreshText(void)
//TRACE("[CTextBox] m_nCurrentLine: %d, m_nNrOfLines %d, m_cLineArray[m_nCurrentLine]: %s\r\n",m_nCurrentLine, m_nNrOfLines, m_cLineArray[m_nCurrentLine].c_str());
//bg variables
int ax = m_cFrameTextRel.iX+m_cFrame.iX;
int ay = /*m_cFrameTextRel.iY+*/m_cFrame.iY;
int dx = m_cFrameTextRel.iWidth;
int dy = m_cFrameTextRel.iHeight;
//save screen
if (m_bgpixbuf == NULL){
m_bgpixbuf= new fb_pixel_t[dx * dy];
frameBuffer->SaveScreen(ax, ay, dx, dy, m_bgpixbuf);
}
//Paint Text Background
if (m_nPaintBackground)
frameBuffer->paintBoxRel(m_cFrameTextRel.iX+m_cFrame.iX, /*m_cFrameTextRel.iY+*/m_cFrame.iY,
m_cFrameTextRel.iWidth, m_cFrameTextRel.iHeight, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType);
if (m_nPaintBackground){
if (m_bgpixbuf)
delete[] m_bgpixbuf;
m_bgpixbuf = NULL;
frameBuffer->paintBoxRel(ax, ay, dx, dy, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType);
}
else
frameBuffer->RestoreScreen(ax, ay, dx, dy, m_bgpixbuf);
if( m_nNrOfLines <= 0)
return;

View File

@@ -150,6 +150,7 @@ class CTextBox
int m_nFontTextHeight;
CFBWindow::color_t m_textBackgroundColor;
fb_pixel_t m_textColor;
fb_pixel_t* m_bgpixbuf;
CFrameBuffer * frameBuffer;
/* int max_width;*/