mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
cc_draw: use 'at' methode in vectors for more savety
This commit is contained in:
@@ -341,11 +341,11 @@ bool CCDraw::clearSavedScreen()
|
|||||||
*/
|
*/
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
for(size_t i =0; i< v_fbdata.size() ;i++) {
|
for(size_t i =0; i< v_fbdata.size() ;i++) {
|
||||||
if (v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BGSCREEN){
|
if (v_fbdata.at(i).fbdata_type == CC_FBDATA_TYPE_BGSCREEN){
|
||||||
if (v_fbdata[i].pixbuf){
|
if (v_fbdata.at(i).pixbuf){
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], cleanup bg...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], cleanup bg...\033[0m\n", __func__, __LINE__);
|
||||||
delete[] v_fbdata[i].pixbuf;
|
delete[] v_fbdata.at(i).pixbuf;
|
||||||
v_fbdata[i].pixbuf = NULL;
|
v_fbdata.at(i).pixbuf = NULL;
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -360,11 +360,11 @@ bool CCDraw::clearPaintCache()
|
|||||||
*/
|
*/
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
for(size_t i =0; i< v_fbdata.size() ;i++) {
|
for(size_t i =0; i< v_fbdata.size() ;i++) {
|
||||||
if (v_fbdata[i].fbdata_type != CC_FBDATA_TYPE_BGSCREEN){
|
if (v_fbdata.at(i).fbdata_type != CC_FBDATA_TYPE_BGSCREEN){
|
||||||
if (v_fbdata[i].pixbuf){
|
if (v_fbdata.at(i).pixbuf){
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], cleanup paint cache layer...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], cleanup paint cache layer...\033[0m\n", __func__, __LINE__);
|
||||||
delete[] v_fbdata[i].pixbuf;
|
delete[] v_fbdata.at(i).pixbuf;
|
||||||
v_fbdata[i].pixbuf = NULL;
|
v_fbdata.at(i).pixbuf = NULL;
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -377,20 +377,20 @@ bool CCDraw::clearFbGradientData()
|
|||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
for(size_t i =0; i< v_fbdata.size() ;i++) {
|
for(size_t i =0; i< v_fbdata.size() ;i++) {
|
||||||
if (v_fbdata[i].gradient_data){
|
if (v_fbdata.at(i).gradient_data){
|
||||||
if (v_fbdata[i].gradient_data->gradientBuf){
|
if (v_fbdata.at(i).gradient_data->gradientBuf){
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up gradientBuf \t %p...\033[0m\n", __func__, __LINE__, v_fbdata[i].gradient_data->gradientBuf);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up gradientBuf \t %p...\033[0m\n", __func__, __LINE__, v_fbdata.at(i).gradient_data->gradientBuf);
|
||||||
free(v_fbdata[i].gradient_data->gradientBuf);
|
free(v_fbdata.at(i).gradient_data->gradientBuf);
|
||||||
v_fbdata[i].gradient_data->gradientBuf = NULL;
|
v_fbdata.at(i).gradient_data->gradientBuf = NULL;
|
||||||
}
|
}
|
||||||
if (v_fbdata[i].gradient_data->boxBuf){
|
if (v_fbdata.at(i).gradient_data->boxBuf){
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up boxBuf \t %p...\033[0m\n", __func__, __LINE__, v_fbdata[i].gradient_data->boxBuf);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up boxBuf \t %p...\033[0m\n", __func__, __LINE__, v_fbdata.at(i).gradient_data->boxBuf);
|
||||||
cs_free_uncached(v_fbdata[i].gradient_data->boxBuf);
|
cs_free_uncached(v_fbdata.at(i).gradient_data->boxBuf);
|
||||||
v_fbdata[i].gradient_data->boxBuf = NULL;
|
v_fbdata.at(i).gradient_data->boxBuf = NULL;
|
||||||
}
|
}
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up gradient data \t %p...\033[0m\n", __func__, __LINE__, v_fbdata[i].gradient_data);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up gradient data \t %p...\033[0m\n", __func__, __LINE__, v_fbdata.at(i).gradient_data);
|
||||||
delete v_fbdata[i].gradient_data;
|
delete v_fbdata.at(i).gradient_data;
|
||||||
v_fbdata[i].gradient_data = NULL;
|
v_fbdata.at(i).gradient_data = NULL;
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -402,10 +402,10 @@ bool CCDraw::clearScreenBuffer()
|
|||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
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.at(i).pixbuf){
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], cleanup pixbuf...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], cleanup pixbuf...\033[0m\n", __func__, __LINE__);
|
||||||
delete[] v_fbdata[i].pixbuf;
|
delete[] v_fbdata.at(i).pixbuf;
|
||||||
v_fbdata[i].pixbuf = NULL;
|
v_fbdata.at(i).pixbuf = NULL;
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -518,7 +518,7 @@ void CCDraw::paintFbItems(const bool &do_save_bg)
|
|||||||
* usable item dimensions and exit here if found any problem.
|
* usable item dimensions and exit here if found any problem.
|
||||||
*/
|
*/
|
||||||
for(size_t i=0; i<v_fbdata.size(); i++){
|
for(size_t i=0; i<v_fbdata.size(); i++){
|
||||||
if (!CheckFbData(v_fbdata[i], __func__, __LINE__)){
|
if (!CheckFbData(v_fbdata.at(i), __func__, __LINE__)){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,8 +528,8 @@ void CCDraw::paintFbItems(const bool &do_save_bg)
|
|||||||
* call the restore method from framebuffer class to restore
|
* call the restore method from framebuffer class to restore
|
||||||
* background.
|
* background.
|
||||||
*/
|
*/
|
||||||
if (v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BGSCREEN){
|
if (v_fbdata.at(i).fbdata_type == CC_FBDATA_TYPE_BGSCREEN){
|
||||||
v_fbdata[i].pixbuf = getScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy);
|
v_fbdata.at(i).pixbuf = getScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -537,14 +537,14 @@ void CCDraw::paintFbItems(const bool &do_save_bg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(size_t i=0; i< v_fbdata.size(); i++){
|
for(size_t i=0; i< v_fbdata.size(); i++){
|
||||||
int fbtype = v_fbdata[i].fbdata_type;
|
int fbtype = v_fbdata.at(i).fbdata_type;
|
||||||
|
|
||||||
//ignore bg screen layer
|
//ignore bg screen layer
|
||||||
if (fbtype == CC_FBDATA_TYPE_BGSCREEN)
|
if (fbtype == CC_FBDATA_TYPE_BGSCREEN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Don't paint on dimension or position error dx or dy are 0.
|
// Don't paint on dimension or position error dx or dy are 0.
|
||||||
if (!CheckFbData(v_fbdata[i], __func__, __LINE__))
|
if (!CheckFbData(v_fbdata.at(i), __func__, __LINE__))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Paint all fb relevant basic parts (shadow, frame and body)
|
/* Paint all fb relevant basic parts (shadow, frame and body)
|
||||||
@@ -552,39 +552,39 @@ void CCDraw::paintFbItems(const bool &do_save_bg)
|
|||||||
*/
|
*/
|
||||||
if (cc_enable_frame && cc_body_image.empty()){
|
if (cc_enable_frame && cc_body_image.empty()){
|
||||||
if (fbtype == CC_FBDATA_TYPE_FRAME) {
|
if (fbtype == CC_FBDATA_TYPE_FRAME) {
|
||||||
if (v_fbdata[i].frame_thickness > 0 && cc_allow_paint){
|
if (v_fbdata.at(i).frame_thickness > 0 && cc_allow_paint){
|
||||||
frameBuffer->paintBoxFrame(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].frame_thickness, v_fbdata[i].color, v_fbdata[i].r, v_fbdata[i].rtype);
|
frameBuffer->paintBoxFrame(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, v_fbdata.at(i).frame_thickness, v_fbdata.at(i).color, v_fbdata.at(i).r, v_fbdata.at(i).rtype);
|
||||||
v_fbdata[i].is_painted = true;
|
v_fbdata.at(i).is_painted = true;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (paint_bg){
|
if (paint_bg){
|
||||||
if (fbtype == CC_FBDATA_TYPE_BACKGROUND){
|
if (fbtype == CC_FBDATA_TYPE_BACKGROUND){
|
||||||
frameBuffer->paintBackgroundBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy);
|
frameBuffer->paintBackgroundBoxRel(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy);
|
||||||
v_fbdata[i].is_painted = true;
|
v_fbdata.at(i).is_painted = true;
|
||||||
if (CCDraw_debug)
|
if (CCDraw_debug)
|
||||||
frameBuffer->paintBoxFrame(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, 1, COL_RANDOM);
|
frameBuffer->paintBoxFrame(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, 1, COL_RANDOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && ((!is_painted || !v_fbdata[i].is_painted)|| shadow_force || force_paint_bg)) {
|
if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && ((!is_painted || !v_fbdata.at(i).is_painted)|| shadow_force || force_paint_bg)) {
|
||||||
if (v_fbdata[i].enabled) {
|
if (v_fbdata.at(i).enabled) {
|
||||||
/* Here we paint the shadow around the body.
|
/* Here we paint the shadow around the body.
|
||||||
* On 1st step we check for already cached screen buffer, if true
|
* On 1st step we check for already cached screen buffer, if true
|
||||||
* then restore this instead to call the paint methode.
|
* then restore this instead to call the paint methode.
|
||||||
* This could be usally, if we use an existant instances of "this" object
|
* This could be usally, if we use an existant instances of "this" object
|
||||||
*/
|
*/
|
||||||
if (cc_allow_paint){
|
if (cc_allow_paint){
|
||||||
if (v_fbdata[i].pixbuf){
|
if (v_fbdata.at(i).pixbuf){
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint shadow from cache...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint shadow from cache...\033[0m\n", __func__, __LINE__);
|
||||||
frameBuffer->RestoreScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].pixbuf);
|
frameBuffer->RestoreScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, v_fbdata.at(i).pixbuf);
|
||||||
}else{
|
}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, v_fbdata[i].rtype);
|
frameBuffer->paintBoxRel(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, v_fbdata.at(i).color, v_fbdata.at(i).r, v_fbdata.at(i).rtype);
|
||||||
}
|
}
|
||||||
//If is paint cache enabled, catch screen into cache
|
//If is paint cache enabled, catch screen into cache
|
||||||
if (cc_paint_cache && v_fbdata[i].pixbuf == NULL)
|
if (cc_paint_cache && v_fbdata.at(i).pixbuf == NULL)
|
||||||
v_fbdata[i].pixbuf = getScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy);
|
v_fbdata.at(i).pixbuf = getScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy);
|
||||||
v_fbdata[i].is_painted = true;
|
v_fbdata.at(i).is_painted = true;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -597,17 +597,19 @@ void CCDraw::paintFbItems(const bool &do_save_bg)
|
|||||||
* then restore this instead to call the paint methodes and gradient creation.
|
* then restore this instead to call the paint methodes and gradient creation.
|
||||||
* Paint cache can be enable/disable with enablePaintCache()
|
* Paint cache can be enable/disable with enablePaintCache()
|
||||||
*/
|
*/
|
||||||
if (v_fbdata[i].pixbuf){
|
if (v_fbdata.at(i).pixbuf){
|
||||||
/* If is paint cache enabled and cache is filled, it's prefered to paint
|
/* If is paint cache enabled and cache is filled, it's prefered to paint
|
||||||
* from cache. Cache is also filled if body background images are used
|
* from cache. Cache is also filled if body background images are used
|
||||||
*/
|
*/
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint body from cache...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint body from cache...\033[0m\n", __func__, __LINE__);
|
||||||
frameBuffer->RestoreScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].pixbuf);
|
frameBuffer->RestoreScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, v_fbdata.at(i).pixbuf);
|
||||||
}else{
|
}else{
|
||||||
//Ensure clean gradient data on disabled gradient.
|
//Ensure clean gradient data on disabled gradient.
|
||||||
if(cc_body_gradient_enable == CC_COLGRAD_OFF && v_fbdata[i].gradient_data){
|
if (v_fbdata.at(i).gradient_data){
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], gradient mode is disabled but filled\033[0m\n", __func__, __LINE__);
|
if(cc_body_gradient_enable == CC_COLGRAD_OFF){
|
||||||
clearFbGradientData();
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], gradient mode is disabled but filled\033[0m\n", __func__, __LINE__);
|
||||||
|
clearFbGradientData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If background image is defined,
|
/* If background image is defined,
|
||||||
@@ -615,20 +617,20 @@ void CCDraw::paintFbItems(const bool &do_save_bg)
|
|||||||
* Paint of background image is prefered, next steps will be ignored!
|
* Paint of background image is prefered, next steps will be ignored!
|
||||||
*/
|
*/
|
||||||
if (!cc_body_image.empty()){
|
if (!cc_body_image.empty()){
|
||||||
if (g_PicViewer->DisplayImage(cc_body_image, v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy)){
|
if (g_PicViewer->DisplayImage(cc_body_image, v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy)){
|
||||||
// catch screen and store into paint cache
|
// catch screen and store into paint cache
|
||||||
v_fbdata[i].pixbuf = getScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy);
|
v_fbdata.at(i).pixbuf = getScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy);
|
||||||
v_fbdata[i].is_painted = true;
|
v_fbdata.at(i).is_painted = true;
|
||||||
}else{
|
}else{
|
||||||
if (v_fbdata[i].pixbuf){
|
if (v_fbdata.at(i).pixbuf){
|
||||||
delete[] v_fbdata[i].pixbuf;
|
delete[] v_fbdata.at(i).pixbuf;
|
||||||
v_fbdata[i].pixbuf = NULL;
|
v_fbdata.at(i).pixbuf = NULL;
|
||||||
}
|
}
|
||||||
v_fbdata[i].is_painted = false;
|
v_fbdata.at(i).is_painted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On failed image paint, write this into log and reset image name.
|
// On failed image paint, write this into log and reset image name.
|
||||||
if (!v_fbdata[i].is_painted){
|
if (!v_fbdata.at(i).is_painted){
|
||||||
dprintf(DEBUG_NORMAL, "\033[33m\[CCDraw]\t[%s - %d], WARNING: bg image %s defined, but paint failed,\nfallback to default rendering...\033[0m\n", __func__, __LINE__, cc_body_image.c_str());
|
dprintf(DEBUG_NORMAL, "\033[33m\[CCDraw]\t[%s - %d], WARNING: bg image %s defined, but paint failed,\nfallback to default rendering...\033[0m\n", __func__, __LINE__, cc_body_image.c_str());
|
||||||
cc_body_image = "";
|
cc_body_image = "";
|
||||||
}
|
}
|
||||||
@@ -644,22 +646,22 @@ void CCDraw::paintFbItems(const bool &do_save_bg)
|
|||||||
* instance and add it to the fbdata object
|
* instance and add it to the fbdata object
|
||||||
* On disabled color gradient or image paint was failed, we do paint only a default box
|
* On disabled color gradient or image paint was failed, we do paint only a default box
|
||||||
*/
|
*/
|
||||||
if (v_fbdata[i].gradient_data == NULL){
|
if (v_fbdata.at(i).gradient_data == NULL){
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], create new gradient data)...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], create new gradient data)...\033[0m\n", __func__, __LINE__);
|
||||||
v_fbdata[i].gradient_data = getGradientData();
|
v_fbdata.at(i).gradient_data = getGradientData();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v_fbdata[i].gradient_data->boxBuf == NULL){
|
if (v_fbdata.at(i).gradient_data->boxBuf == NULL){
|
||||||
if (v_fbdata[i].pixbuf == NULL){
|
if (v_fbdata.at(i).pixbuf == NULL){
|
||||||
/* Before we paint any gradient box with hw acceleration, we must cleanup first.
|
/* Before we paint any gradient box with hw acceleration, we must cleanup first.
|
||||||
* FIXME: This is only a workaround for this framebuffer behavior on enabled hw acceleration.
|
* FIXME: This is only a workaround for this framebuffer behavior on enabled hw acceleration.
|
||||||
* Without this, ugly ghost letters or ghost images inside gradient boxes are possible.
|
* Without this, ugly ghost letters or ghost images inside gradient boxes are possible.
|
||||||
*/
|
*/
|
||||||
if (cc_gradient_bg_cleanup)
|
if (cc_gradient_bg_cleanup)
|
||||||
frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, 0, v_fbdata[i].r, v_fbdata[i].rtype);
|
frameBuffer->paintBoxRel(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, 0, v_fbdata.at(i).r, v_fbdata.at(i).rtype);
|
||||||
|
|
||||||
// create gradient buffer and paint gradient box
|
// create gradient buffer and paint gradient box
|
||||||
v_fbdata[i].gradient_data->boxBuf = frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, 0, v_fbdata[i].gradient_data, v_fbdata[i].r, v_fbdata[i].rtype);
|
v_fbdata.at(i).gradient_data->boxBuf = frameBuffer->paintBoxRel(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, 0, v_fbdata.at(i).gradient_data, v_fbdata.at(i).r, v_fbdata.at(i).rtype);
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint and cache new gradient into gradient cache...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint and cache new gradient into gradient cache...\033[0m\n", __func__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -668,16 +670,16 @@ void CCDraw::paintFbItems(const bool &do_save_bg)
|
|||||||
*/
|
*/
|
||||||
if (cc_paint_cache || cc_gradient_bg_cleanup){
|
if (cc_paint_cache || cc_gradient_bg_cleanup){
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], cache new created gradient into external cache...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], cache new created gradient into external cache...\033[0m\n", __func__, __LINE__);
|
||||||
v_fbdata[i].pixbuf = getScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy);
|
v_fbdata.at(i).pixbuf = getScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy);
|
||||||
if (clearFbGradientData())
|
if (clearFbGradientData())
|
||||||
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], remove unused gradient data...\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], remove unused gradient data...\033[0m\n", __func__, __LINE__);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// If found gradient buffer, paint box from gradient cache.
|
// If found gradient buffer, paint box from gradient cache.
|
||||||
if (frameBuffer->checkFbArea(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, true)){
|
if (frameBuffer->checkFbArea(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, true)){
|
||||||
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(v_fbdata[i].gradient_data->boxBuf, v_fbdata[i].gradient_data->dx, v_fbdata[i].dy, v_fbdata[i].gradient_data->x, v_fbdata[i].y);
|
frameBuffer->blitBox2FB(v_fbdata.at(i).gradient_data->boxBuf, v_fbdata.at(i).gradient_data->dx, v_fbdata.at(i).dy, v_fbdata.at(i).gradient_data->x, v_fbdata.at(i).y);
|
||||||
frameBuffer->checkFbArea(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, false);
|
frameBuffer->checkFbArea(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@@ -685,21 +687,21 @@ void CCDraw::paintFbItems(const bool &do_save_bg)
|
|||||||
* render a default box.
|
* render a default box.
|
||||||
*/
|
*/
|
||||||
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__);
|
||||||
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, v_fbdata[i].rtype);
|
frameBuffer->paintBoxRel(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, v_fbdata.at(i).color, v_fbdata.at(i).r, v_fbdata.at(i).rtype);
|
||||||
|
|
||||||
//If is paint cache enabled, catch screen into cache.
|
//If is paint cache enabled, catch screen into cache.
|
||||||
if (cc_paint_cache)
|
if (cc_paint_cache)
|
||||||
v_fbdata[i].pixbuf = getScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy);
|
v_fbdata.at(i).pixbuf = getScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
v_fbdata[i].is_painted = true;
|
v_fbdata.at(i).is_painted = true;
|
||||||
OnAfterPaintBg();
|
OnAfterPaintBg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CCDraw_debug)
|
if (CCDraw_debug)
|
||||||
frameBuffer->paintBoxFrame(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, 1, getRandomColor({255, 255}, {1,255}, {1, 255}));
|
frameBuffer->paintBoxFrame(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, 1, getRandomColor({255, 255}, {1,255}, {1, 255}));
|
||||||
}
|
}
|
||||||
|
|
||||||
//set is_painted attribut. if any layer was painted set it to true;
|
//set is_painted attribut. if any layer was painted set it to true;
|
||||||
@@ -707,7 +709,7 @@ void CCDraw::paintFbItems(const bool &do_save_bg)
|
|||||||
is_painted = false;
|
is_painted = false;
|
||||||
}else{
|
}else{
|
||||||
for(size_t i=0; i< v_fbdata.size(); i++){
|
for(size_t i=0; i< v_fbdata.size(); i++){
|
||||||
if (v_fbdata[i].is_painted){
|
if (v_fbdata.at(i).is_painted){
|
||||||
is_painted = true;
|
is_painted = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -730,12 +732,12 @@ void CCDraw::hide()
|
|||||||
OnBeforeHide();
|
OnBeforeHide();
|
||||||
//restore saved screen background of item if available
|
//restore saved screen background of item if available
|
||||||
for(size_t i =0; i< v_fbdata.size() ;i++) {
|
for(size_t i =0; i< v_fbdata.size() ;i++) {
|
||||||
if (v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BGSCREEN){
|
if (v_fbdata.at(i).fbdata_type == CC_FBDATA_TYPE_BGSCREEN){
|
||||||
if (v_fbdata[i].pixbuf) {
|
if (v_fbdata.at(i).pixbuf) {
|
||||||
//restore screen from backround layer
|
//restore screen from backround layer
|
||||||
frameBuffer->waitForIdle("CCDraw::hide()");
|
frameBuffer->waitForIdle("CCDraw::hide()");
|
||||||
frameBuffer->RestoreScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].pixbuf);
|
frameBuffer->RestoreScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, v_fbdata.at(i).pixbuf);
|
||||||
v_fbdata[i].is_painted = false;
|
v_fbdata.at(i).is_painted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -753,40 +755,40 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const in
|
|||||||
layers = CC_FBDATA_TYPES;
|
layers = CC_FBDATA_TYPES;
|
||||||
|
|
||||||
for(size_t i =0; i< v_fbdata.size() ;i++){
|
for(size_t i =0; i< v_fbdata.size() ;i++){
|
||||||
if (v_fbdata[i].fbdata_type & layers){
|
if (v_fbdata.at(i).fbdata_type & layers){
|
||||||
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
if (corner_radius > -1){
|
if (corner_radius > -1){
|
||||||
r = v_fbdata[i].r;
|
r = v_fbdata.at(i).r;
|
||||||
if (corner_radius != v_fbdata[i].r)
|
if (corner_radius != v_fbdata.at(i).r)
|
||||||
r = corner_radius;
|
r = corner_radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v_fbdata[i].dx > 0 && v_fbdata[i].dy > 0){
|
if (v_fbdata.at(i).dx > 0 && v_fbdata.at(i).dy > 0){
|
||||||
frameBuffer->paintBoxRel(v_fbdata[i].x,
|
frameBuffer->paintBoxRel(v_fbdata.at(i).x,
|
||||||
v_fbdata[i].y,
|
v_fbdata.at(i).y,
|
||||||
v_fbdata[i].dx,
|
v_fbdata.at(i).dx,
|
||||||
v_fbdata[i].dy,
|
v_fbdata.at(i).dy,
|
||||||
bg_color,
|
bg_color,
|
||||||
r,
|
r,
|
||||||
v_fbdata[i].rtype);
|
v_fbdata.at(i).rtype);
|
||||||
|
|
||||||
if (v_fbdata[i].fbdata_type & CC_FBDATA_TYPE_FRAME){
|
if (v_fbdata.at(i).fbdata_type & CC_FBDATA_TYPE_FRAME){
|
||||||
if (v_fbdata[i].frame_thickness)
|
if (v_fbdata.at(i).frame_thickness)
|
||||||
frameBuffer->paintBoxFrame(v_fbdata[i].x,
|
frameBuffer->paintBoxFrame(v_fbdata.at(i).x,
|
||||||
v_fbdata[i].y,
|
v_fbdata.at(i).y,
|
||||||
v_fbdata[i].dx,
|
v_fbdata.at(i).dx,
|
||||||
v_fbdata[i].dy,
|
v_fbdata.at(i).dy,
|
||||||
v_fbdata[i].frame_thickness,
|
v_fbdata.at(i).frame_thickness,
|
||||||
bg_color,
|
bg_color,
|
||||||
v_fbdata[i].r,
|
v_fbdata.at(i).r,
|
||||||
v_fbdata[i].rtype);
|
v_fbdata.at(i).rtype);
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
dprintf(DEBUG_DEBUG, "\033[33m[CCDraw]\t[%s - %d] WARNING! render with bad dimensions [dx = %d dy = %d]\033[0m\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy );
|
dprintf(DEBUG_DEBUG, "\033[33m[CCDraw]\t[%s - %d] WARNING! render with bad dimensions [dx = %d dy = %d]\033[0m\n", __func__, __LINE__, v_fbdata.at(i).dx, v_fbdata.at(i).dy );
|
||||||
|
|
||||||
v_fbdata[i].is_painted = false;
|
v_fbdata.at(i).is_painted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user