CTextBox: ensure paint of background to avoid overlapped letters

Origin commit data
------------------
Commit: 08e23a917c
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-09-16 (Mon, 16 Sep 2013)
This commit is contained in:
2013-09-16 11:42:50 +02:00
parent 975673532a
commit b7ea3c3f76
2 changed files with 23 additions and 4 deletions

View File

@@ -135,13 +135,14 @@ CTextBox::~CTextBox()
//TRACE("[CTextBox] del\r\n"); //TRACE("[CTextBox] del\r\n");
m_cLineArray.clear(); m_cLineArray.clear();
hide(); hide();
delete[] m_bgpixbuf;
} }
void CTextBox::initVar(void) void CTextBox::initVar(void)
{ {
//TRACE("[CTextBox]->InitVar\r\n"); //TRACE("[CTextBox]->InitVar\r\n");
frameBuffer = NULL; frameBuffer = NULL;
m_bgpixbuf = NULL;
m_showTextFrame = 0; m_showTextFrame = 0;
m_nNrOfNewLine = 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()); //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 //Paint Text Background
if (m_nPaintBackground) if (m_nPaintBackground){
frameBuffer->paintBoxRel(m_cFrameTextRel.iX+m_cFrame.iX, /*m_cFrameTextRel.iY+*/m_cFrame.iY, if (m_bgpixbuf)
m_cFrameTextRel.iWidth, m_cFrameTextRel.iHeight, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType); 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) if( m_nNrOfLines <= 0)
return; return;

View File

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