CCDraw: add member to remove shadow only

This commit is contained in:
2016-01-24 16:08:59 +01:00
committed by M. Liebmann
parent 4a72274efb
commit f521e32981
3 changed files with 66 additions and 17 deletions

View File

@@ -536,16 +536,19 @@ void CCDraw::paintFbItems(bool do_save_bg)
*/ */
if (cc_enable_frame){ if (cc_enable_frame){
if (fbtype == CC_FBDATA_TYPE_FRAME) { if (fbtype == CC_FBDATA_TYPE_FRAME) {
if (fbdata.frame_thickness > 0 && cc_allow_paint) if (fbdata.frame_thickness > 0 && cc_allow_paint){
frameBuffer->paintBoxFrame(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, fbdata.frame_thickness, fbdata.color, fbdata.r, fbdata.rtype); frameBuffer->paintBoxFrame(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, fbdata.frame_thickness, fbdata.color, fbdata.r, fbdata.rtype);
v_fbdata[i].is_painted = true;
}
} }
} }
if (paint_bg){ if (paint_bg){
if (fbtype == CC_FBDATA_TYPE_BACKGROUND){ if (fbtype == CC_FBDATA_TYPE_BACKGROUND){
frameBuffer->paintBackgroundBoxRel(x, y, fbdata.dx, fbdata.dy); frameBuffer->paintBackgroundBoxRel(x, y, fbdata.dx, fbdata.dy);
v_fbdata[i].is_painted = true;
} }
} }
if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && (!is_painted || shadow_force)) { if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && ((!is_painted || !fbdata.is_painted)|| shadow_force)) {
if (fbdata.enabled) { if (fbdata.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
@@ -562,6 +565,7 @@ void CCDraw::paintFbItems(bool do_save_bg)
//if is paint cache enabled //if is paint cache enabled
if (cc_paint_cache && fbdata.pixbuf == NULL) if (cc_paint_cache && fbdata.pixbuf == NULL)
fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy); fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy);
fbdata.is_painted = true;
} }
} }
} }
@@ -611,7 +615,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);
} }
} }
is_painted = true; is_painted = v_fbdata[i].is_painted = true;
} }
} }
} }
@@ -629,6 +633,7 @@ void CCDraw::hide()
//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[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].pixbuf);
v_fbdata[i].is_painted = false;
} }
} }
} }
@@ -637,9 +642,10 @@ void CCDraw::hide()
} }
//erase or paint over rendered objects //erase or paint over rendered objects
void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius) void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const int& fblayer_type /*fbdata_type*/)
{ {
for(size_t i =0; i< v_fbdata.size() ;i++){ for(size_t i =0; i< v_fbdata.size() ;i++){
if (fblayer_type == CC_FBDATA_TYPES || v_fbdata[i].fbdata_type & fblayer_type){
#if 0 #if 0
if (bg_color != COL_BACKGROUND_PLUS_0) if (bg_color != COL_BACKGROUND_PLUS_0)
#endif #endif
@@ -662,15 +668,23 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius)
bg_color, bg_color,
r, r,
corner_type); corner_type);
v_fbdata[i].is_painted = false;
#if 0 #if 0
else else
frameBuffer->paintBackgroundBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); frameBuffer->paintBackgroundBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy);
#endif #endif
}
} }
firstPaint = true; if (fblayer_type == CC_FBDATA_TYPE_BOX){
is_painted = false; firstPaint = true;
is_painted = false;
}
}
void CCDraw::killShadow(const fb_pixel_t& bg_color, const int& corner_radius)
{
kill(bg_color, corner_radius, CC_FBDATA_TYPE_SHADOW_BOX);
} }
bool CCDraw::doPaintBg(bool do_paint) bool CCDraw::doPaintBg(bool do_paint)
@@ -685,8 +699,10 @@ bool CCDraw::doPaintBg(bool do_paint)
void CCDraw::enableShadow(int mode, const int& shadow_width, bool force_paint) void CCDraw::enableShadow(int mode, const int& shadow_width, bool force_paint)
{ {
if (shadow != mode) if (shadow != mode){
killShadow();
shadow = mode; shadow = mode;
}
if (shadow != CC_SHADOW_OFF) if (shadow != CC_SHADOW_OFF)
if (shadow_width != -1) if (shadow_width != -1)
setShadowWidth(shadow_width); setShadowWidth(shadow_width);

View File

@@ -314,9 +314,42 @@ class CCDraw : public COSDFader, public CComponentsSignals
*/ */
virtual void hide(); virtual void hide();
///erase or paint over rendered objects without restore of background, it's similar to paintBackgroundBoxRel() known /**Erase or paint over rendered objects without restore of background, it's similar to paintBackgroundBoxRel() known
///from CFrameBuffer but with possiblity to define color, default color is COL_BACKGROUND_PLUS_0 (empty background) * from CFrameBuffer but with possiblity to define color, default color is COL_BACKGROUND_PLUS_0 (empty background)
virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1); *
* @return void
*
* @param[in] bg_color optional, color, default color is current screen
* @param[in] corner_radius optional, defined corner radius, default radius is the current defined radius
* @param[in] fblayer_type optional, defines layer that to remove, default all layers (cc_fbdata_t) will remove
* possible layer types are:
* @li CC_FBDATA_TYPE_BGSCREEN,
* @li CC_FBDATA_TYPE_BOX,
* @li CC_FBDATA_TYPE_SHADOW_BOX,
* @li CC_FBDATA_TYPE_FRAME,
* @li CC_FBDATA_TYPE_BACKGROUND,
* @see
* cc_types.h
* gui/color.h
* driver/framebuffer.h
* @todo
* Shadow paint must be reworked, because dimensions of shadow containes not the real defined size. Parts of item are killed too.
*
*/
virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES);
/**Erase shadow around rendered item.
* This is similar with the kill() member, but shadow will be handled only.
*
* @return void
*
* @param[in] bg_color optional, color, default color is current screen
* @param[in] corner_radius optional, defined corner radius, default radius is the current defined radius
*
* @see
* kill()
*/
virtual void killShadow(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1);
virtual void enableGradientBgCleanUp(bool enable = true) { cc_gradient_bg_cleanup = enable; }; virtual void enableGradientBgCleanUp(bool enable = true) { cc_gradient_bg_cleanup = enable; };
virtual void disableGradientBgCleanUp(){ enableGradientBgCleanUp(false); }; virtual void disableGradientBgCleanUp(){ enableGradientBgCleanUp(false); };

View File

@@ -90,13 +90,13 @@ typedef struct cc_fbdata_t
//fb data object layer types //fb data object layer types
typedef enum typedef enum
{ {
CC_FBDATA_TYPE_BGSCREEN, CC_FBDATA_TYPE_BGSCREEN = 1,
CC_FBDATA_TYPE_BOX, CC_FBDATA_TYPE_BOX = 2,
CC_FBDATA_TYPE_SHADOW_BOX, CC_FBDATA_TYPE_SHADOW_BOX = 4,
CC_FBDATA_TYPE_FRAME, CC_FBDATA_TYPE_FRAME = 8,
CC_FBDATA_TYPE_BACKGROUND, CC_FBDATA_TYPE_BACKGROUND = 16,
CC_FBDATA_TYPES CC_FBDATA_TYPES = 32
}FBDATA_TYPES; }FBDATA_TYPES;
//fb color gradient types //fb color gradient types