mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
neutrino: fix artefacts with scaling framebuffer and 1080i
This commit is contained in:
@@ -39,6 +39,7 @@ class CPrivateData
|
||||
|
||||
CFBWindow::CFBWindow(const int _x, const int _y, const int _dx, const int _dy)
|
||||
{
|
||||
int realx, realy;
|
||||
x = _x ;
|
||||
y = _y ;
|
||||
dx = _dx;
|
||||
@@ -46,7 +47,9 @@ CFBWindow::CFBWindow(const int _x, const int _y, const int _dx, const int _dy)
|
||||
|
||||
private_data = (void *) new CPrivateData;
|
||||
((CPrivateData *)private_data)->frameBuffer = CFrameBuffer::getInstance();
|
||||
((CPrivateData *)private_data)->Background = new fb_pixel_t [_dx * _dy];
|
||||
realx = ((CPrivateData *)private_data)->frameBuffer->scaleX(_dx);
|
||||
realy = ((CPrivateData *)private_data)->frameBuffer->scaleX(_dy);
|
||||
((CPrivateData *)private_data)->Background = new fb_pixel_t [realx * realy];
|
||||
if (((CPrivateData *)private_data)->Background != NULL)
|
||||
((CPrivateData *)private_data)->frameBuffer->SaveScreen(_x, _y, _dx, _dy, (fb_pixel_t *)((CPrivateData *)private_data)->Background);
|
||||
|
||||
|
@@ -477,10 +477,15 @@ void CFrameBuffer::paintBoxRel(const int _x, const int _y, const int _dx, const
|
||||
if (!getActive())
|
||||
return;
|
||||
|
||||
int add = 0;
|
||||
/* hack to remove artefacts caused by rounding in scaling mode */
|
||||
if (xRes > 1280 && col == backgroundColor)
|
||||
add = 1;
|
||||
|
||||
int x = scaleX(_x);
|
||||
int y = scaleY(_y);
|
||||
int dx = scaleX(_dx);
|
||||
int dy = scaleY(_dy);
|
||||
int dx = scaleX(_dx + add);
|
||||
int dy = scaleY(_dy + add);
|
||||
int radius = scaleX(_radius);
|
||||
|
||||
int corner_tl = (type & CORNER_TOP_LEFT) ? 1 : 0;
|
||||
@@ -586,6 +591,11 @@ void CFrameBuffer::paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t co
|
||||
if (!getActive())
|
||||
return;
|
||||
|
||||
xa = scaleX(xa);
|
||||
xb = scaleX(xb);
|
||||
ya = scaleY(ya);
|
||||
yb = scaleY(yb);
|
||||
|
||||
int dx = abs (xa - xb);
|
||||
int dy = abs (ya - yb);
|
||||
int x;
|
||||
@@ -1228,7 +1238,7 @@ void CFrameBuffer::paintBackground()
|
||||
}
|
||||
else
|
||||
{
|
||||
paintBoxRel(0, 0, xRes, yRes, backgroundColor);
|
||||
paintBoxRel(0, 0, screeninfo.xres, screeninfo.yres, backgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1237,6 +1247,12 @@ void CFrameBuffer::SaveScreen(int x, int y, int dx, int dy, fb_pixel_t * const m
|
||||
if (!getActive())
|
||||
return;
|
||||
|
||||
/* danger: memp needs to be big enough for scaled picture...
|
||||
* need to make sure all callers know this... */
|
||||
x = scaleX(x);
|
||||
y = scaleY(y);
|
||||
dx = scaleX(dx);
|
||||
dy = scaleY(dy);
|
||||
|
||||
uint8_t * pos = ((uint8_t *)getFrameBufferPointer()) + x * sizeof(fb_pixel_t) + stride * y;
|
||||
fb_pixel_t * bkpos = memp;
|
||||
@@ -1269,6 +1285,13 @@ void CFrameBuffer::RestoreScreen(int x, int y, int dx, int dy, fb_pixel_t * cons
|
||||
if (!getActive())
|
||||
return;
|
||||
|
||||
/* danger: memp needs to be big enough for scaled picture...
|
||||
* need to make sure all callers know this... */
|
||||
x = scaleX(x);
|
||||
y = scaleY(y);
|
||||
dx = scaleX(dx);
|
||||
dy = scaleY(dy);
|
||||
|
||||
uint8_t * fbpos = ((uint8_t *)getFrameBufferPointer()) + x * sizeof(fb_pixel_t) + stride * y;
|
||||
fb_pixel_t * bkpos = memp;
|
||||
for (int count = 0; count < dy; count++)
|
||||
|
@@ -1016,9 +1016,12 @@ void CInfoViewer::showSubchan ()
|
||||
y = g_settings.screen_EndY - dy - 10;
|
||||
}
|
||||
|
||||
fb_pixel_t pixbuf[(dx + 2 * borderwidth) * (dy + 2 * borderwidth)];
|
||||
lframeBuffer->SaveScreen (x - borderwidth, y - borderwidth, dx + 2 * borderwidth, dy + 2 * borderwidth, pixbuf);
|
||||
|
||||
int x_pic = lframeBuffer->scaleX(dx + 2 * borderwidth);
|
||||
int y_pic = lframeBuffer->scaleY(dy + 2 * borderwidth);
|
||||
fb_pixel_t *pixbuf = new fb_pixel_t[x_pic * y_pic];
|
||||
if (pixbuf)
|
||||
lframeBuffer->SaveScreen(x - borderwidth, y - borderwidth,
|
||||
dx + 2 * borderwidth, dy + 2 * borderwidth, pixbuf);
|
||||
// clear border
|
||||
lframeBuffer->paintBackgroundBoxRel (x - borderwidth, y - borderwidth, dx + 2 * borderwidth, borderwidth);
|
||||
lframeBuffer->paintBackgroundBoxRel (x - borderwidth, y + dy, dx + 2 * borderwidth, borderwidth);
|
||||
@@ -1057,7 +1060,11 @@ void CInfoViewer::showSubchan ()
|
||||
}
|
||||
}
|
||||
}
|
||||
lframeBuffer->RestoreScreen (x - borderwidth, y - borderwidth, dx + 2 * borderwidth, dy + 2 * borderwidth, pixbuf);
|
||||
if (pixbuf) {
|
||||
lframeBuffer->RestoreScreen(x - borderwidth, y - borderwidth,
|
||||
dx + 2 * borderwidth, dy + 2 * borderwidth, pixbuf);
|
||||
delete[] pixbuf;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
g_RCInput->postMsg (NeutrinoMessages::SHOW_INFOBAR, 0);
|
||||
|
@@ -996,7 +996,7 @@ void CMenuWidget::saveScreen()
|
||||
|
||||
delete[] background;
|
||||
|
||||
background = new fb_pixel_t [full_width * full_height];
|
||||
background = new fb_pixel_t [frameBuffer->scaleX(full_width) * frameBuffer->scaleY(full_height)];
|
||||
if(background)
|
||||
frameBuffer->SaveScreen(x, y, full_width, full_height, background);
|
||||
}
|
||||
|
@@ -888,7 +888,7 @@ const char * CPLPINInput::getHint1(void)
|
||||
|
||||
int CPLPINInput::exec( CMenuTarget* parent, const std::string & )
|
||||
{
|
||||
fb_pixel_t * pixbuf = new fb_pixel_t[(width+ 2* borderwidth) * (height+ 2* borderwidth)];
|
||||
fb_pixel_t * pixbuf = new fb_pixel_t[frameBuffer->scaleX(width+ 2* borderwidth) * frameBuffer->scaleY(height+ 2* borderwidth)];
|
||||
|
||||
if (pixbuf != NULL)
|
||||
frameBuffer->SaveScreen(x- borderwidth, y- borderwidth, width+ 2* borderwidth, height+ 2* borderwidth, pixbuf);
|
||||
|
Reference in New Issue
Block a user