cc_draw: declare some functions as const, minor format changes

This commit is contained in:
2019-10-27 16:24:47 +01:00
parent b206e7025c
commit ed701f450a
2 changed files with 26 additions and 24 deletions

View File

@@ -440,11 +440,11 @@ bool CCDraw::CheckFbData(const cc_fbdata_t& fbdata, const char* func, const int&
if (end >= (int32_t)frameBuffer->getScreenWidth(true)*(int32_t)frameBuffer->getScreenHeight(true))
{
dprintf(DEBUG_NORMAL, "[CCDraw] ERROR! Position > FB end [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n item: %s [type: %d]\n",
func, line,
fbdata.x, fbdata.y,
fbdata.dx, fbdata.dy,
cc_item_type.name.c_str(),
cc_item_type.id
func, line,
fbdata.x, fbdata.y,
fbdata.dx, fbdata.dy,
cc_item_type.name.c_str(),
cc_item_type.id
);
return false;
}
@@ -842,29 +842,31 @@ bool CCDraw::paintBlink(CComponentsTimer* Timer)
bool CCDraw::paintBlink(const int& interval, bool is_nano)
{
if (cc_draw_timer == NULL)
if (cc_draw_timer == NULL){
cc_draw_timer = new CComponentsTimer(interval, is_nano);
cc_draw_timer->setThreadName(__func__);
cc_draw_timer->setThreadName(__func__);
}
return paintBlink(cc_draw_timer);
}
bool CCDraw::cancelBlink(bool keep_on_screen)
{
bool res = false;
if (cc_draw_timer){
res = cc_draw_timer->stopTimer();
delete cc_draw_timer; cc_draw_timer = NULL;
cc_draw_timer->stopTimer();
delete cc_draw_timer;
cc_draw_timer = NULL;
}
if(keep_on_screen)
paint1();
else
hide();
return res;
if (!cc_draw_timer)
return true;
return false;
}
bool CCDraw::setBodyBGImage(const std::string& image_path)
@@ -885,22 +887,22 @@ bool CCDraw::setBodyBGImageName(const std::string& image_name)
return setBodyBGImage(frameBuffer->getIconPath(image_name));
}
int CCDraw::getXPos()
int CCDraw::getXPos() const
{
return x;
}
int CCDraw::getYPos()
int CCDraw::getYPos() const
{
return y;
}
int CCDraw::getHeight()
int CCDraw::getHeight() const
{
return height;
}
int CCDraw::getWidth()
int CCDraw::getWidth() const
{
return width;
}
@@ -915,7 +917,7 @@ void CCDraw::setPos(const int& xpos, const int& ypos)
setXPos(xpos); setYPos(ypos);
}
void CCDraw::allowPaint(bool allow)
void CCDraw::allowPaint(const bool& allow)
{
if (allow != cc_allow_paint)
cc_allow_paint = allow;

View File

@@ -194,15 +194,15 @@ class CCDraw : public COSDFader, public CComponentsSignals, public CCTypes
///return screen x-position of component
///Note: position of bound components (items) means position related within parent form, not for screen!
///to get the real screen position, use getRealXPos(), to find in CComponentsItem sub classes
int getXPos();
int getXPos() const;
///return screen y-position of component
///Note: position of bound components (items) means position related within parent form, not for screen!
///to get the real screen position, use getRealYPos(), to find in CComponentsItem sub classes
int getYPos();
int getYPos() const;
///return height of component
int getHeight();
int getHeight() const;
///return width of component
int getWidth();
int getWidth() const;
///return/set (pass through) width and height of component
void getSize(int* w, int* h){*w=width; *h=height;}
@@ -274,11 +274,11 @@ class CCDraw : public COSDFader, public CComponentsSignals, public CCTypes
///disable background buffering, does the same like enableSaveBg(false), NOTE: cleans existant pixbuffer content!
void disableSaveBg(){enableSaveBg(false);}
///returns background buffering mode. Mode is assigned with paint() or enableSaveBg()/disableSaveBg())
bool SaveBg(){return cc_save_bg;}
bool SaveBg() const {return cc_save_bg;}
///allow/disalows paint of item and its contents, but initialize of other properties are not touched
///this can be understood as a counterpart to isPainted(), but before paint and value of is_painted is modified temporarily till next paint of item //TODO: is this sufficiently?
void allowPaint(bool allow);
void allowPaint(const bool& allow);
///returns visibility mode
bool paintAllowed();
/**Overrides internal firstpaint and is_painted modes to provoke full repaint of item.