fix segfault

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@205 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: ceb4bdf7f9
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2010-01-24 (Sun, 24 Jan 2010)



------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2010-01-24 08:50:37 +00:00
parent 661e08a143
commit 9be2ae41fc

View File

@@ -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,13 +500,14 @@ 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 #ifndef USE_NEVIS_GXA
@@ -556,6 +557,7 @@ void Font::RenderString(int x, int y, const int width, const char *text, const u
d += stride; d += stride;
#endif #endif
} }
}
x+=glyph->xadvance+1; x+=glyph->xadvance+1;
//x+=glyph->xadvance; //x+=glyph->xadvance;
if(pen1>x) if(pen1>x)