mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
CFrameBuffer::paintBoxRel2Buf(): Align buffer at 4 byte boundary...
...for hw blit on apollo/kronos hardware
This commit is contained in:
@@ -48,6 +48,7 @@
|
|||||||
#include <gui/color.h>
|
#include <gui/color.h>
|
||||||
#include <gui/pictureviewer.h>
|
#include <gui/pictureviewer.h>
|
||||||
#include <system/debug.h>
|
#include <system/debug.h>
|
||||||
|
#include <system/helpers.h>
|
||||||
#include <global.h>
|
#include <global.h>
|
||||||
#include <video.h>
|
#include <video.h>
|
||||||
#include <cs_api.h>
|
#include <cs_api.h>
|
||||||
@@ -671,7 +672,7 @@ void CFrameBuffer::paintHLineRelInternal2Buf(const int& x, const int& dx, const
|
|||||||
*(dest++) = col;
|
*(dest++) = col;
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_pixel_t* CFrameBuffer::paintBoxRel2Buf(const int dx, const int dy, const fb_pixel_t col, fb_pixel_t* buf/* = NULL*/, int radius/* = 0*/, int type/* = CORNER_ALL*/)
|
fb_pixel_t* CFrameBuffer::paintBoxRel2Buf(const int dx, const int dy, const int w_align, const int offs_align, const fb_pixel_t col, fb_pixel_t* buf/* = NULL*/, int radius/* = 0*/, int type/* = CORNER_ALL*/)
|
||||||
{
|
{
|
||||||
if (!getActive())
|
if (!getActive())
|
||||||
return buf;
|
return buf;
|
||||||
@@ -682,13 +683,13 @@ fb_pixel_t* CFrameBuffer::paintBoxRel2Buf(const int dx, const int dy, const fb_p
|
|||||||
|
|
||||||
fb_pixel_t* pixBuf = buf;
|
fb_pixel_t* pixBuf = buf;
|
||||||
if (pixBuf == NULL) {
|
if (pixBuf == NULL) {
|
||||||
pixBuf = (fb_pixel_t*) cs_malloc_uncached(dx*dy*sizeof(fb_pixel_t));
|
pixBuf = (fb_pixel_t*) cs_malloc_uncached(w_align*dy*sizeof(fb_pixel_t));
|
||||||
if (pixBuf == NULL) {
|
if (pixBuf == NULL) {
|
||||||
dprintf(DEBUG_NORMAL, "[%s #%d] Error cs_malloc_uncached\n", __func__, __LINE__);
|
dprintf(DEBUG_NORMAL, "[%s #%d] Error cs_malloc_uncached\n", __func__, __LINE__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memset((void*)pixBuf, '\0', dx*dy*sizeof(fb_pixel_t));
|
memset((void*)pixBuf, '\0', w_align*dy*sizeof(fb_pixel_t));
|
||||||
|
|
||||||
if (type && radius) {
|
if (type && radius) {
|
||||||
setCornerFlags(type);
|
setCornerFlags(type);
|
||||||
@@ -709,16 +710,16 @@ fb_pixel_t* CFrameBuffer::paintBoxRel2Buf(const int dx, const int dy, const fb_p
|
|||||||
line++;
|
line++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
paintHLineRelInternal2Buf(ofl, dx-ofl-ofr, line, dx, col, pixBuf);
|
paintHLineRelInternal2Buf(ofl+offs_align, dx-ofl-ofr, line, w_align, col, pixBuf);
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fb_pixel_t *bp = pixBuf;
|
fb_pixel_t *bp = pixBuf;
|
||||||
int line = 0;
|
int line = 0;
|
||||||
while (line < dy) {
|
while (line < dy) {
|
||||||
for (int pos = 0; pos < dx; pos++)
|
for (int pos = offs_align; pos < dx+offs_align; pos++)
|
||||||
*(bp + pos) = col;
|
*(bp + pos) = col;
|
||||||
bp += dx;
|
bp += w_align;
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -729,42 +730,64 @@ fb_pixel_t* CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, co
|
|||||||
const fb_pixel_t /*col*/, gradientData_t *gradientData,
|
const fb_pixel_t /*col*/, gradientData_t *gradientData,
|
||||||
int radius, int type)
|
int radius, int type)
|
||||||
{
|
{
|
||||||
#define MASK 0xFFFFFFFF
|
fb_pixel_t MASK = 0xFFFFFFFF;
|
||||||
|
int _dx = dx;
|
||||||
|
int w_align;
|
||||||
|
int offs_align;
|
||||||
|
|
||||||
fb_pixel_t* boxBuf = paintBoxRel2Buf(dx, dy, MASK, NULL, radius, type);
|
#ifdef BOXMODEL_APOLLO
|
||||||
if (!boxBuf)
|
if (_dx%4 != 0) {
|
||||||
return NULL;
|
w_align = GetWidth4FB_HW_ACC(x, _dx, true);
|
||||||
|
if (w_align < _dx)
|
||||||
|
_dx = w_align;
|
||||||
|
offs_align = w_align - _dx;
|
||||||
|
if ((x - offs_align) < 0)
|
||||||
|
offs_align = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
w_align = _dx;
|
||||||
|
offs_align = 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
w_align = _dx;
|
||||||
|
offs_align = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fb_pixel_t* boxBuf = paintBoxRel2Buf(_dx, dy, w_align, offs_align, MASK, NULL, radius, type);
|
||||||
fb_pixel_t *bp = boxBuf;
|
fb_pixel_t *bp = boxBuf;
|
||||||
fb_pixel_t *gra = gradientData->gradientBuf;
|
fb_pixel_t *gra = gradientData->gradientBuf;
|
||||||
gradientData->boxBuf = boxBuf;
|
gradientData->boxBuf = boxBuf;
|
||||||
|
gradientData->x = x - offs_align;
|
||||||
|
gradientData->dx = w_align;
|
||||||
|
|
||||||
if (gradientData->direction == gradientVertical) {
|
if (gradientData->direction == gradientVertical) {
|
||||||
// vertical
|
// vertical
|
||||||
for (int pos = 0; pos < dx; pos++) {
|
for (int pos = offs_align; pos < _dx+offs_align; pos++) {
|
||||||
for(int count = 0; count < dy; count++) {
|
for(int count = 0; count < dy; count++) {
|
||||||
if (*(bp + pos) == MASK)
|
if (*(bp + pos) == MASK)
|
||||||
*(bp + pos) = (fb_pixel_t)(*(gra + count));
|
*(bp + pos) = (fb_pixel_t)(*(gra + count));
|
||||||
bp += dx;
|
bp += w_align;
|
||||||
}
|
}
|
||||||
bp = boxBuf;
|
bp = boxBuf;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// horizontal
|
// horizontal
|
||||||
for (int line = 0; line < dy; line++) {
|
for (int line = 0; line < dy; line++) {
|
||||||
for (int pos = 0; pos < dx; pos++) {
|
int gra_pos = 0;
|
||||||
if (*(bp + pos) == MASK)
|
for (int pos = 0; pos < w_align; pos++) {
|
||||||
*(bp + pos) = (fb_pixel_t)(*(gra + pos));
|
if ((*(bp + pos) == MASK) && (pos >= offs_align) && (gra_pos < _dx)) {
|
||||||
|
*(bp + pos) = (fb_pixel_t)(*(gra + gra_pos));
|
||||||
|
gra_pos++;
|
||||||
}
|
}
|
||||||
bp += dx;
|
}
|
||||||
|
bp += w_align;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gradientData->mode & pbrg_noPaint) == pbrg_noPaint)
|
if ((gradientData->mode & pbrg_noPaint) == pbrg_noPaint)
|
||||||
return boxBuf;
|
return boxBuf;
|
||||||
|
|
||||||
// blit2FB(boxBuf, dx, dy, x, y);
|
blitBox2FB(boxBuf, w_align, dy, x-offs_align, y);
|
||||||
blitBox2FB(boxBuf, dx, dy, x, y);
|
|
||||||
|
|
||||||
if ((gradientData->mode & pbrg_noFree) == pbrg_noFree)
|
if ((gradientData->mode & pbrg_noFree) == pbrg_noFree)
|
||||||
return boxBuf;
|
return boxBuf;
|
||||||
|
@@ -46,6 +46,8 @@ typedef struct gradientData_t
|
|||||||
fb_pixel_t* boxBuf;
|
fb_pixel_t* boxBuf;
|
||||||
bool direction;
|
bool direction;
|
||||||
int mode;
|
int mode;
|
||||||
|
int x;
|
||||||
|
int dx;
|
||||||
} gradientData_struct_t;
|
} gradientData_struct_t;
|
||||||
|
|
||||||
#define CORNER_NONE 0x0
|
#define CORNER_NONE 0x0
|
||||||
@@ -206,7 +208,7 @@ class CFrameBuffer : public sigc::trackable
|
|||||||
};
|
};
|
||||||
void paintPixel(int x, int y, const fb_pixel_t col);
|
void paintPixel(int x, int y, const fb_pixel_t col);
|
||||||
|
|
||||||
fb_pixel_t* paintBoxRel2Buf(const int dx, const int dy, const fb_pixel_t col, fb_pixel_t* buf = NULL, int radius = 0, int type = CORNER_ALL);
|
fb_pixel_t* paintBoxRel2Buf(const int dx, const int dy, const int w_align, const int offs_align, const fb_pixel_t col, fb_pixel_t* buf = NULL, int radius = 0, int type = CORNER_ALL);
|
||||||
fb_pixel_t* paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, gradientData_t *gradientData, int radius = 0, int type = CORNER_ALL);
|
fb_pixel_t* paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, gradientData_t *gradientData, int radius = 0, int type = CORNER_ALL);
|
||||||
|
|
||||||
void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL);
|
void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL);
|
||||||
|
@@ -598,7 +598,7 @@ void CCDraw::paintFbItems(bool do_save_bg)
|
|||||||
fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy);
|
fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy);
|
||||||
}else{
|
}else{
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint cached gradient)...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint cached gradient)...\033[0m\n", __func__, __LINE__);
|
||||||
frameBuffer->blitBox2FB(fbdata.gradient_data->boxBuf, fbdata.dx, fbdata.dy, fbdata.x, fbdata.y);
|
frameBuffer->blitBox2FB(fbdata.gradient_data->boxBuf, fbdata.gradient_data->dx, fbdata.dy, fbdata.gradient_data->x, fbdata.y);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint default box)...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint default box)...\033[0m\n", __func__, __LINE__);
|
||||||
|
Reference in New Issue
Block a user