neutrino: resize framebuffer on videomode change

this is needed on spark because the framebuffer has the same resolution
as the video plane...
This commit is contained in:
Stefan Seyfried
2012-02-22 23:29:51 +01:00
parent a96dca1547
commit b34e7205b9
4 changed files with 15 additions and 1 deletions

View File

@@ -246,6 +246,7 @@ Font::Font(FBFontRenderClass *render, FTC_FaceID faceid, const int isize, const
xmult = frameBuffer->scaleX(SCALE_MULT, false); xmult = frameBuffer->scaleX(SCALE_MULT, false);
ymult = frameBuffer->scaleY(SCALE_MULT, false); ymult = frameBuffer->scaleY(SCALE_MULT, false);
last_xmult = xmult;
setSize(isize); setSize(isize);
} }
@@ -258,6 +259,7 @@ FT_Error Font::getGlyphBitmap(FT_ULong glyph_index, FTC_SBit *sbit)
int Font::setSize(int isize) int Font::setSize(int isize)
{ {
int temp = font.width; int temp = font.width;
last_size = isize;
font.width = isize * xmult / SCALE_MULT; font.width = isize * xmult / SCALE_MULT;
font.height = isize * ymult / SCALE_MULT; font.height = isize * ymult / SCALE_MULT;
scaler.width = font.width * 64; scaler.width = font.width * 64;
@@ -379,6 +381,13 @@ void Font::RenderString(int _x, int _y, const int _width, const char *text, cons
if (!frameBuffer->getActive()) if (!frameBuffer->getActive())
return; return;
if ((xmult = frameBuffer->scaleX(SCALE_MULT, false)) != last_xmult)
{
last_xmult = xmult;
ymult = frameBuffer->scaleY(SCALE_MULT, false);
setSize(last_size);
}
int x = _x * xmult / SCALE_MULT; int x = _x * xmult / SCALE_MULT;
int y = _y * ymult / SCALE_MULT; int y = _y * ymult / SCALE_MULT;
int boxheight = _boxheight * ymult / SCALE_MULT; int boxheight = _boxheight * ymult / SCALE_MULT;

View File

@@ -54,6 +54,7 @@ class Font
int height,DigitHeight,DigitOffset,ascender,descender,upper,lower; int height,DigitHeight,DigitOffset,ascender,descender,upper,lower;
int fontwidth; int fontwidth;
int xmult, ymult; int xmult, ymult;
int last_xmult, last_size;
public: public:
enum fontmodifier enum fontmodifier

View File

@@ -693,7 +693,7 @@ void CFrameBuffer::paintHLineRel(int x, int dx, int y, const fb_pixel_t col)
return; return;
int _x = scaleX(x); int _x = scaleX(x);
int _y = scaleY(y); int _y = scaleY(y);
int _dx = scaleY(dx); int _dx = scaleX(dx);
blitRect(_x, _y, _dx, 1, col); blitRect(_x, _y, _dx, 1, col);
} }
@@ -1483,6 +1483,7 @@ void CFrameBuffer::resize(int format)
yRes = xyres[format][1]; yRes = xyres[format][1];
bpp = 32; bpp = 32;
stride = xRes * bpp / 8; stride = xRes * bpp / 8;
fprintf(stderr, "CFrameBuffer::resize(%d): %d x %d\n", format, xRes, yRes);
} }
void CFrameBuffer::blitRect(int x, int y, int width, int height, unsigned long color) void CFrameBuffer::blitRect(int x, int y, int width, int height, unsigned long color)

View File

@@ -318,6 +318,7 @@ void CVideoSettings::setupVideoSystem(bool do_ask)
{ {
printf("[neutrino VideoSettings] %s setup videosystem...\n", __FUNCTION__); printf("[neutrino VideoSettings] %s setup videosystem...\n", __FUNCTION__);
videoDecoder->SetVideoSystem(g_settings.video_Mode); //FIXME videoDecoder->SetVideoSystem(g_settings.video_Mode); //FIXME
frameBuffer->resize(g_settings.video_Mode);
if (do_ask) if (do_ask)
{ {
@@ -328,6 +329,7 @@ void CVideoSettings::setupVideoSystem(bool do_ask)
{ {
g_settings.video_Mode = prev_video_mode; g_settings.video_Mode = prev_video_mode;
videoDecoder->SetVideoSystem(g_settings.video_Mode); videoDecoder->SetVideoSystem(g_settings.video_Mode);
frameBuffer->resize(g_settings.video_Mode);
} }
} }
else else
@@ -491,6 +493,7 @@ void CVideoSettings::nextMode(void)
g_settings.video_Mode = VIDEOMENU_VIDEOMODE_OPTIONS[curmode].key; g_settings.video_Mode = VIDEOMENU_VIDEOMODE_OPTIONS[curmode].key;
//CVFD::getInstance()->ShowText(text); //CVFD::getInstance()->ShowText(text);
videoDecoder->SetVideoSystem(g_settings.video_Mode); videoDecoder->SetVideoSystem(g_settings.video_Mode);
frameBuffer->resize(g_settings.video_Mode);
//return; //return;
disp_cur = 1; disp_cur = 1;
} }