CComponentsInfoBox: Optimize display

- Paint full info box only when activating the menu,
 otherwise only body paint


Origin commit data
------------------
Branch: ni/coolstream
Commit: cb375cc214
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2012-07-22 (Sun, 22 Jul 2012)

Origin message was:
------------------
* CComponentsInfoBox: Optimize display

- Paint full info box only when activating the menu,
 otherwise only body paint


------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2012-07-22 12:31:19 +02:00
parent 4dc2ee9898
commit bafd9cb84e
2 changed files with 14 additions and 10 deletions

View File

@@ -204,7 +204,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i
col_body = color_body;
col_shadow = color_shadow;
fr_thickness = 2;
bg_saved = false;
firstPaint = true;
v_infobox_val.clear();
}
@@ -221,20 +221,22 @@ void CComponentsInfoBox::paint(bool do_save_bg)
{x+fr_thickness, y+fr_thickness, width-2*fr_thickness, height-2*fr_thickness, col_body, rad, NULL, NULL, false, 0},
};
int start = (shadow) ? 0 : 1;
if (do_save_bg) {
if (!bg_saved) {
if (firstPaint) {
int start = (shadow) ? 0 : 1;
if (do_save_bg) {
v_infobox_val.clear();
for(int i = start; i < INFOBOX_ITEMS_COUNT; i++) {
fbdata[i].pixbuf = saveScreen(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy);
v_infobox_val.push_back(fbdata[i]);
fbdata[i].pixbuf = NULL;
}
bg_saved = true;
}
paintFbItems((comp_fbdata_t*)&fbdata[start], INFOBOX_ITEMS_COUNT - start, false);
firstPaint = false;
}
paintFbItems((comp_fbdata_t*)&fbdata[start], INFOBOX_ITEMS_COUNT - start, false);
else
// paint body only
paintFbItems((comp_fbdata_t*)&fbdata[INFOBOX_ITEMS_COUNT - 1], 1, false);
}
//restore infobox
@@ -248,8 +250,10 @@ void CComponentsInfoBox::restore(bool clear_)
delete[] v_infobox_val[i].pixbuf;
}
}
if (clear_)
v_infobox_val.clear();
if (clear_) {
v_infobox_val.clear();
firstPaint = true;
}
}
}

View File

@@ -93,7 +93,7 @@ class CComponentsInfoBox : public CComponents
int rad,fr_thickness;
bool shadow;
fb_pixel_t col_frame, col_body, col_shadow;
bool bg_saved;
bool firstPaint;
std::vector<comp_fbdata_t> v_infobox_val;
public: