lib-libtuxtxt-tuxtxt.cpp avoid segfault, supplement to 6771de1

Origin commit data
------------------
Branch: ni/coolstream
Commit: a6344b3527
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2017-06-29 (Thu, 29 Jun 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2017-06-29 15:03:16 +02:00
parent 43d2aeee1c
commit 8d1a669301

View File

@@ -47,6 +47,9 @@ static int cfg_national_subset;
static int screen_x, screen_y, screen_w, screen_h;
void FillRect(int x, int y, int w, int h, fb_pixel_t color, bool modeFullColor=false);
void FillBorder(fb_pixel_t color, bool modeFullColor=false);
fb_pixel_t *getFBp(int *y)
{
if (*y < (int)var_screeninfo.yres)
@@ -56,34 +59,31 @@ fb_pixel_t *getFBp(int *y)
return lbb;
}
void FillRect(int x, int y, int w, int h, int color)
void FillRect(int x, int y, int w, int h, fb_pixel_t color, bool modeFullColor/*=false*/)
{
if(color < 0 || SIZECOLTABLE < color){
printf("FIXME array size %i color %i not in range\n",SIZECOLTABLE,color);
return;
}
fb_pixel_t *p = getFBp(&y);
MARK_FB(x, y, w, h);
p += x + y * stride;
if (w > 0)
if (w > 0) {
fb_pixel_t col = (modeFullColor) ? color : bgra[color];
for (int count = 0; count < h; count++) {
fb_pixel_t *dest0 = p;
for (int i = 0; i < w; i++)
*(dest0++) = bgra[color];
*(dest0++) = col;
p += stride;
}
}
}
void FillBorder(int color)
void FillBorder(fb_pixel_t color, bool modeFullColor/*=false*/)
{
int ys = (var_screeninfo.yres-var_screeninfo.yoffset);
FillRect(0 , ys ,StartX ,var_screeninfo.yres ,color);
FillRect(StartX, ys ,displaywidth,StartY ,color);
FillRect(StartX, ys+StartY+25*fontheight,displaywidth,var_screeninfo.yres-(StartY+25*fontheight),color);
FillRect(0 , ys ,StartX ,var_screeninfo.yres ,color, modeFullColor);
FillRect(StartX, ys ,displaywidth,StartY ,color, modeFullColor);
FillRect(StartX, ys+StartY+25*fontheight,displaywidth,var_screeninfo.yres-(StartY+25*fontheight),color, modeFullColor);
if (screenmode == 0 )
FillRect(StartX+displaywidth, ys,var_screeninfo.xres-(StartX+displaywidth),var_screeninfo.yres ,color);
FillRect(StartX+displaywidth, ys,var_screeninfo.xres-(StartX+displaywidth),var_screeninfo.yres ,color, modeFullColor);
}
int getIndexOfPageInHotlist()
@@ -258,7 +258,7 @@ void RenderClearMenuLineBB(char *p, tstPageAttr *attrcol, tstPageAttr *attr)
memset(p-TOPMENUCHARS, ' ', TOPMENUCHARS); /* init with spaces */
}
void ClearBB(int color)
void ClearBB(fb_pixel_t color)
{
FillRect(0, (var_screeninfo.yres - var_screeninfo.yoffset), var_screeninfo.xres, var_screeninfo.yres, color);
}
@@ -270,7 +270,7 @@ void ClearFB(int /*color*/)
}
#if 0
//never used
void ClearB(int color)
void ClearB(fb_pixel_t color)
{
FillRect(0, 0, var_screeninfo.xres, var_screeninfo.yres, color); /* framebuffer */
FillRect(0, var_screeninfo.yres, var_screeninfo.xres, var_screeninfo.yres, color); /* backbuffer */
@@ -841,7 +841,7 @@ int eval_triplet(int iOData, tstCachedPage *pstCachedPage,
{
*pAPy = RowAddress2Row(iAddress); /* new Active Row */
int color = iData & 0x1f;
fb_pixel_t color = iData & 0x1f;
int row = *pAPy0 + *pAPy;
int maxrow;
#if TUXTXT_DEBUG
@@ -892,7 +892,7 @@ int eval_triplet(int iOData, tstCachedPage *pstCachedPage,
*pAPx = *pAPy = 0; /* new Active Position 0,0 */
if (*endcol == 40) /* active object */
{
int color = iData & 0x1f;
fb_pixel_t color = iData & 0x1f;
int row = *pAPy0; // + *pAPy;
int maxrow;
@@ -4096,7 +4096,7 @@ void RenderDRCS( //FIX ME
}
void DrawVLine(int x, int y, int l, int color)
void DrawVLine(int x, int y, int l, fb_pixel_t color)
{
fb_pixel_t *p = getFBp(&y);
MARK_FB(x, y, 0, l);
@@ -4109,7 +4109,7 @@ void DrawVLine(int x, int y, int l, int color)
}
}
void DrawHLine(int x, int y, int l, int color)
void DrawHLine(int x, int y, int l, fb_pixel_t color)
{
int ltmp;
fb_pixel_t *p = getFBp(&y);
@@ -4130,7 +4130,7 @@ void FillRectMosaicSeparated(int x, int y, int w, int h, int fgcolor, int bgcolo
}
}
void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, int color)
void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, fb_pixel_t color)
{
fb_pixel_t *p = getFBp(&y0);
MARK_FB(x0, y0, l0, h);
@@ -4789,7 +4789,7 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
{
for (Bit = 0x80; Bit; Bit >>= 1)
{
int color;
fb_pixel_t color;
if (--pixtodo < 0)
break;
@@ -5559,7 +5559,7 @@ void CopyBB2FB()
/* adapt background of backbuffer if changed */
if (StartX > 0 && *lfb != *lbb) {
FillBorder(*lbb);
FillBorder(*lbb, true);
// ClearBB(*(lfb + var_screeninfo.xres * var_screeninfo.yoffset));
}