CComponents: Add color gradient for CC_FBDATA_TYPE_BOX

Origin commit data
------------------
Branch: ni/coolstream
Commit: db6fd8480d
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-09-20 (Sat, 20 Sep 2014)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2014-09-20 21:34:07 +02:00
committed by [CST] Focus
parent eecd394b6f
commit 093d638920
3 changed files with 30 additions and 5 deletions

View File

@@ -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,9 +198,20 @@ void CComponents::paintFbItems(bool do_save_bg)
} }
} }
} }
else else {
if(cc_allow_paint) if(cc_allow_paint) {
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); 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
// 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);
}
}
} }
} }
@@ -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();
} }

View File

@@ -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);

View File

@@ -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++) {