mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +02:00
fix segfault
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@205 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -412,7 +412,7 @@ void Font::RenderString(int x, int y, const int width, const char *text, const u
|
|||||||
int pen1=-1; // "pen" positions for kerning, pen2 is "x"
|
int pen1=-1; // "pen" positions for kerning, pen2 is "x"
|
||||||
|
|
||||||
static fb_pixel_t oldbgcolor = 0, oldfgcolor = 0;
|
static fb_pixel_t oldbgcolor = 0, oldfgcolor = 0;
|
||||||
static fb_pixel_t colors[256];
|
static fb_pixel_t colors[256]={0};
|
||||||
|
|
||||||
fb_pixel_t bgcolor = frameBuffer->realcolor[color];
|
fb_pixel_t bgcolor = frameBuffer->realcolor[color];
|
||||||
fb_pixel_t fgcolor = frameBuffer->realcolor[(((((int)color) + 2) | 7) - 2)];
|
fb_pixel_t fgcolor = frameBuffer->realcolor[(((((int)color) + 2) | 7) - 2)];
|
||||||
@@ -500,61 +500,63 @@ void Font::RenderString(int x, int y, const int width, const char *text, const u
|
|||||||
|
|
||||||
#ifndef USE_NEVIS_GXA
|
#ifndef USE_NEVIS_GXA
|
||||||
int stride = frameBuffer->getStride();
|
int stride = frameBuffer->getStride();
|
||||||
uint8_t * d = ((uint8_t *)frameBuffer->getFrameBufferPointer()) + (x + glyph->left) * sizeof(fb_pixel_t) + stride * (y - glyph->top);
|
int ap=(x + glyph->left) * sizeof(fb_pixel_t) + stride * (y - glyph->top);
|
||||||
|
uint8_t * d = ((uint8_t *)frameBuffer->getFrameBufferPointer()) + ap;
|
||||||
#endif
|
#endif
|
||||||
uint8_t * s = glyph->buffer;
|
uint8_t * s = glyph->buffer;
|
||||||
int w = glyph->width;
|
int w = glyph->width;
|
||||||
int h = glyph->height;
|
int h = glyph->height;
|
||||||
int pitch = glyph->pitch;
|
int pitch = glyph->pitch;
|
||||||
|
if(ap>-1){
|
||||||
for (int ay=0; ay<h; ay++)
|
for (int ay=0; ay<h; ay++)
|
||||||
{
|
|
||||||
#ifndef USE_NEVIS_GXA
|
|
||||||
fb_pixel_t * td = (fb_pixel_t *)d;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int ax;
|
|
||||||
for (ax=0; ax < w + spread_by; ax++)
|
|
||||||
{
|
{
|
||||||
if (stylemodifier != Font::Embolden)
|
#ifndef USE_NEVIS_GXA
|
||||||
|
fb_pixel_t * td = (fb_pixel_t *)d;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int ax;
|
||||||
|
for (ax=0; ax < w + spread_by; ax++)
|
||||||
{
|
{
|
||||||
#ifdef USE_NEVIS_GXA
|
if (stylemodifier != Font::Embolden)
|
||||||
/* not nice (and also slower), but currently the easiest way to prevent visible errors */
|
{
|
||||||
frameBuffer->paintPixel(x + glyph->left + ax, y - glyph->top + ay, colors[*s++]);
|
#ifdef USE_NEVIS_GXA
|
||||||
#else
|
/* not nice (and also slower), but currently the easiest way to prevent visible errors */
|
||||||
*td++= colors[*s++];
|
frameBuffer->paintPixel(x + glyph->left + ax, y - glyph->top + ay, colors[*s++]);
|
||||||
#endif
|
#else
|
||||||
}
|
*td++= colors[*s++];
|
||||||
else
|
#endif
|
||||||
{
|
}
|
||||||
int start, end;
|
|
||||||
int lcolor = -1;
|
|
||||||
|
|
||||||
if (ax < w)
|
|
||||||
start = 0;
|
|
||||||
else
|
else
|
||||||
start = ax - w + 1;
|
{
|
||||||
|
int start, end;
|
||||||
|
int lcolor = -1;
|
||||||
|
|
||||||
if (ax < spread_by)
|
if (ax < w)
|
||||||
end = ax + 1;
|
start = 0;
|
||||||
else
|
else
|
||||||
end = spread_by + 1;
|
start = ax - w + 1;
|
||||||
|
|
||||||
for (int i = start; i < end; i++)
|
if (ax < spread_by)
|
||||||
if (lcolor < *(s - i))
|
end = ax + 1;
|
||||||
lcolor = *(s - i);
|
else
|
||||||
#ifdef USE_NEVIS_GXA
|
end = spread_by + 1;
|
||||||
frameBuffer->paintPixel(x + glyph->left + ax, y - glyph->top + ay, colors[lcolor]);
|
|
||||||
#else
|
for (int i = start; i < end; i++)
|
||||||
*td++= colors[lcolor];
|
if (lcolor < *(s - i))
|
||||||
#endif
|
lcolor = *(s - i);
|
||||||
s++;
|
#ifdef USE_NEVIS_GXA
|
||||||
|
frameBuffer->paintPixel(x + glyph->left + ax, y - glyph->top + ay, colors[lcolor]);
|
||||||
|
#else
|
||||||
|
*td++= colors[lcolor];
|
||||||
|
#endif
|
||||||
|
s++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
s += pitch- ax;
|
||||||
|
#ifndef USE_NEVIS_GXA
|
||||||
|
d += stride;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
s += pitch- ax;
|
|
||||||
#ifndef USE_NEVIS_GXA
|
|
||||||
d += stride;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
x+=glyph->xadvance+1;
|
x+=glyph->xadvance+1;
|
||||||
//x+=glyph->xadvance;
|
//x+=glyph->xadvance;
|
||||||
|
Reference in New Issue
Block a user