mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
fb_generic: add swidth variable, "stride in fb_pixel_t units"
this should allow to use fb_pixel_t pointer arithmetics more often instead of byte pointers
This commit is contained in:
committed by
M. Liebmann
parent
b7110faaf6
commit
7c7d5f08dd
@@ -82,7 +82,6 @@ void CFbAccel::paintBoxRel(const int x, const int y, const int dx, const int dy,
|
||||
void CFbAccel::paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col)
|
||||
{
|
||||
int line = 0;
|
||||
int swidth = stride / sizeof(fb_pixel_t);
|
||||
fb_pixel_t *fbp = getFrameBufferPointer() + (swidth * y);
|
||||
int pos;
|
||||
while (line < dy)
|
||||
|
@@ -346,6 +346,7 @@ int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int)
|
||||
return -1;
|
||||
}
|
||||
stride = _fix.line_length;
|
||||
swidth = stride / sizeof(fb_pixel_t);
|
||||
if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0)
|
||||
printf("screen unblanking failed\n");
|
||||
xRes = screeninfo.xres;
|
||||
@@ -355,7 +356,7 @@ int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int)
|
||||
int needmem = stride * yRes * 2;
|
||||
if (available >= needmem)
|
||||
{
|
||||
backbuffer = lfb + stride / sizeof(fb_pixel_t) * yRes;
|
||||
backbuffer = lfb + swidth * yRes;
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, LOGTAG "not enough FB memory (have %d, need %d)\n", available, needmem);
|
||||
|
@@ -216,6 +216,7 @@ int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int)
|
||||
return -1;
|
||||
}
|
||||
stride = _fix.line_length;
|
||||
swidth = stride / sizeof(fb_pixel_t);
|
||||
if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0)
|
||||
printf("screen unblanking failed\n");
|
||||
xRes = screeninfo.xres;
|
||||
@@ -225,7 +226,7 @@ int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int)
|
||||
int needmem = stride * yRes * 2;
|
||||
if (available >= needmem)
|
||||
{
|
||||
backbuffer = lfb + stride / sizeof(fb_pixel_t) * yRes;
|
||||
backbuffer = lfb + swidth * yRes;
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, LOGTAG "not enough FB memory (have %d, need %d)\n", available, needmem);
|
||||
|
@@ -54,6 +54,7 @@ void CFbAccelGLFB::init(const char *)
|
||||
}
|
||||
screeninfo = glfb->getScreenInfo();
|
||||
stride = 4 * screeninfo.xres;
|
||||
swidth = screeninfo.xres;
|
||||
available = glfb->getOSDBuffer()->size(); /* allocated in glfb constructor */
|
||||
lbb = lfb = reinterpret_cast<fb_pixel_t*>(glfb->getOSDBuffer()->data());
|
||||
|
||||
@@ -135,7 +136,7 @@ int CFbAccelGLFB::setMode(unsigned int, unsigned int, unsigned int)
|
||||
int needmem = stride * yRes * 2;
|
||||
if (available >= needmem)
|
||||
{
|
||||
backbuffer = lfb + stride / sizeof(fb_pixel_t) * yRes;
|
||||
backbuffer = lfb + swidth * yRes;
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, LOGTAG " not enough FB memory (have %d, need %d)\n", available, needmem);
|
||||
|
@@ -512,6 +512,7 @@ int CFbAccelSTi::setMode(unsigned int, unsigned int, unsigned int)
|
||||
yRes = screeninfo.yres = screeninfo.yres_virtual = DEFAULT_YRES;
|
||||
bpp = screeninfo.bits_per_pixel = DEFAULT_BPP;
|
||||
stride = screeninfo.xres * screeninfo.bits_per_pixel / 8;
|
||||
swidth = screeninfo.xres;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -156,6 +156,7 @@ void CFbAccelTD::init(const char *)
|
||||
lbb = lfb; /* the memory area to draw to... */
|
||||
available = fix.smem_len;
|
||||
stride = fix.line_length;
|
||||
swidth = stride / sizeof(fb_pixel_t);
|
||||
xRes = screeninfo.xres;
|
||||
yRes = screeninfo.yres;
|
||||
bpp = screeninfo.bits_per_pixel;
|
||||
@@ -169,7 +170,7 @@ int CFbAccelTD::setMode(unsigned int, unsigned int, unsigned int)
|
||||
int needmem = stride * yRes * 2;
|
||||
if (available >= needmem)
|
||||
{
|
||||
backbuffer = lfb + stride / sizeof(fb_pixel_t) * yRes;
|
||||
backbuffer = lfb + swidth * yRes;
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, LOGTAG " not enough FB memory (have %d, need %d)\n", available, needmem);
|
||||
|
@@ -340,6 +340,7 @@ int CFrameBuffer::setMode(unsigned int /*nxRes*/, unsigned int /*nyRes*/, unsign
|
||||
}
|
||||
|
||||
stride = _fix.line_length;
|
||||
swidth = stride / sizeof(fb_pixel_t);
|
||||
printf("FB: %dx%dx%d line length %d. %s accelerator.\n", xRes, yRes, bpp, stride,
|
||||
"Not using graphics"
|
||||
);
|
||||
@@ -623,7 +624,6 @@ void CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, const int
|
||||
line++;
|
||||
}
|
||||
} else {
|
||||
int swidth = stride / sizeof(fb_pixel_t);
|
||||
fb_pixel_t *fbp = getFrameBufferPointer() + (swidth * y);
|
||||
int line = 0;
|
||||
while (line < dy) {
|
||||
@@ -934,7 +934,7 @@ void CFrameBuffer::paintPixel(const int x, const int y, const fb_pixel_t col)
|
||||
return;
|
||||
|
||||
fb_pixel_t * pos = getFrameBufferPointer();
|
||||
pos += (stride / sizeof(fb_pixel_t)) * y;
|
||||
pos += swidth * y;
|
||||
pos += x;
|
||||
|
||||
*pos = col;
|
||||
@@ -1680,7 +1680,6 @@ void CFrameBuffer::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t
|
||||
uint32_t xc = (width > xRes) ? (uint32_t)xRes : width;
|
||||
uint32_t yc = (height > yRes) ? (uint32_t)yRes : height;
|
||||
|
||||
uint32_t swidth = stride / sizeof(fb_pixel_t);
|
||||
fb_pixel_t *fbp = getFrameBufferPointer() + (swidth * yoff);
|
||||
fb_pixel_t* data = (fb_pixel_t*)boxBuf;
|
||||
|
||||
|
@@ -112,7 +112,7 @@ class CFrameBuffer : public sigc::trackable
|
||||
fb_pixel_t backgroundColor;
|
||||
std::string backgroundFilename;
|
||||
bool useBackgroundPaint;
|
||||
unsigned int xRes, yRes, stride, bpp;
|
||||
unsigned int xRes, yRes, stride, swidth, bpp;
|
||||
t_fb_var_screeninfo screeninfo;
|
||||
fb_cmap cmap;
|
||||
__u16 red[256], green[256], blue[256], trans[256];
|
||||
|
Reference in New Issue
Block a user