mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
CComponents: Add color gradient for CC_FBDATA_TYPE_BOX
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include <global.h>
|
#include <global.h>
|
||||||
#include <neutrino.h>
|
#include <neutrino.h>
|
||||||
#include "cc_base.h"
|
#include "cc_base.h"
|
||||||
|
#include <cs_api.h>
|
||||||
#include <system/debug.h>
|
#include <system/debug.h>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -197,11 +198,22 @@ void CComponents::paintFbItems(bool do_save_bg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if(cc_allow_paint) {
|
||||||
|
if ((v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BOX) && (v_fbdata[i].data != NULL)) {
|
||||||
|
// color gradient
|
||||||
|
gradientData_t *gradientData = static_cast<gradientData_t*> (v_fbdata[i].data);
|
||||||
|
if (gradientData->boxBuf == NULL)
|
||||||
|
gradientData->boxBuf = frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, 0, gradientData, v_fbdata[i].r, corner_type);
|
||||||
else
|
else
|
||||||
if(cc_allow_paint)
|
// frameBuffer->blit2FB(gradientData->boxBuf, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].x, v_fbdata[i].y);
|
||||||
|
frameBuffer->blitBox2FB(gradientData->boxBuf, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].x, v_fbdata[i].y);
|
||||||
|
} else
|
||||||
frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type);
|
frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
is_painted = true;
|
is_painted = true;
|
||||||
}
|
}
|
||||||
@@ -272,9 +284,16 @@ void CComponents::kill(const fb_pixel_t& bg_color, const int& corner_radius)
|
|||||||
//clean old screen buffer
|
//clean old screen buffer
|
||||||
void CComponents::clearFbData()
|
void CComponents::clearFbData()
|
||||||
{
|
{
|
||||||
for(size_t i =0; i< v_fbdata.size() ;i++)
|
for(size_t i =0; i< v_fbdata.size() ;i++) {
|
||||||
if (v_fbdata[i].pixbuf)
|
if (v_fbdata[i].pixbuf)
|
||||||
delete[] v_fbdata[i].pixbuf;
|
delete[] v_fbdata[i].pixbuf;
|
||||||
|
|
||||||
|
if (v_fbdata[i].data && (v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BOX)) {
|
||||||
|
gradientData_t *gradientData = static_cast<gradientData_t*> (v_fbdata[i].data);
|
||||||
|
if (gradientData->boxBuf)
|
||||||
|
cs_free_uncached(gradientData->boxBuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
v_fbdata.clear();
|
v_fbdata.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -249,6 +249,8 @@ class CComponentsItem : public CComponents
|
|||||||
///Is typically the type CComponentsForm or derived classes, default intialized with NULL
|
///Is typically the type CComponentsForm or derived classes, default intialized with NULL
|
||||||
CComponentsForm *cc_parent;
|
CComponentsForm *cc_parent;
|
||||||
|
|
||||||
|
gradientData_t cc_gradientData;
|
||||||
|
|
||||||
///hides item, arg: no_restore=true causes no restore of background, but clean up pixel buffer if required
|
///hides item, arg: no_restore=true causes no restore of background, but clean up pixel buffer if required
|
||||||
void hideCCItem(bool no_restore = false);
|
void hideCCItem(bool no_restore = false);
|
||||||
|
|
||||||
|
@@ -51,6 +51,7 @@ CComponentsItem::CComponentsItem(CComponentsForm* parent)
|
|||||||
cc_item_selected = false;
|
cc_item_selected = false;
|
||||||
cc_page_number = 0;
|
cc_page_number = 0;
|
||||||
cc_has_focus = true;
|
cc_has_focus = true;
|
||||||
|
cc_gradientData.gradientBuf = NULL;
|
||||||
initParent(parent);
|
initParent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,12 +89,15 @@ void CComponentsItem::paintInit(bool do_save_bg)
|
|||||||
iy = cc_yr;
|
iy = cc_yr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_gradientData.boxBuf = NULL;
|
||||||
|
cc_gradientData.mode = CFrameBuffer::pbrg_noFree;
|
||||||
|
void* gradientData = (cc_gradientData.gradientBuf == NULL) ? NULL : &cc_gradientData;
|
||||||
comp_fbdata_t fbdata[] =
|
comp_fbdata_t fbdata[] =
|
||||||
{
|
{
|
||||||
{CC_FBDATA_TYPE_BGSCREEN, ix, iy, width+sw, height+sw, 0, 0, 0, NULL, NULL},
|
{CC_FBDATA_TYPE_BGSCREEN, ix, iy, width+sw, height+sw, 0, 0, 0, NULL, NULL},
|
||||||
{CC_FBDATA_TYPE_SHADOW_BOX, ix+sw, iy+sw, width, height, col_shadow, corner_rad, 0, NULL, NULL},//shadow
|
{CC_FBDATA_TYPE_SHADOW_BOX, ix+sw, iy+sw, width, height, col_shadow, corner_rad, 0, NULL, NULL},//shadow
|
||||||
{CC_FBDATA_TYPE_FRAME, ix, iy, width, height, col_frame_cur, corner_rad, th, NULL, NULL},//frame
|
{CC_FBDATA_TYPE_FRAME, ix, iy, width, height, col_frame_cur, corner_rad, th, NULL, NULL},//frame
|
||||||
{CC_FBDATA_TYPE_BOX, ix+th, iy+th, width-2*th, height-2*th, col_body, rad, 0, NULL, NULL},//body
|
{CC_FBDATA_TYPE_BOX, ix+th, iy+th, width-2*th, height-2*th, col_body, rad, 0, NULL, gradientData},//body
|
||||||
};
|
};
|
||||||
|
|
||||||
for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) {
|
for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) {
|
||||||
|
Reference in New Issue
Block a user