From d8e3ecfa1dca131baaf4df085af99b0252a8f22e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 22 Mar 2016 11:35:02 +0100 Subject: [PATCH] CDBoxInfoWidget: remove superfluous paint of header --- src/gui/dboxinfo.cpp | 17 +++++++++++++---- src/gui/dboxinfo.h | 4 +++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index 5de8a1250..19119bb24 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -39,7 +39,7 @@ #include #include -#include + #include #include @@ -74,7 +74,7 @@ CDBoxInfoWidget::CDBoxInfoWidget() height = 0; x = 0; y = 0; - + header = NULL; fontWidth = fm->getWidth(); sizeWidth = 6 * fm->getMaxDigitWidth() + fm->getRenderWidth(std::string(" MiB") + g_Locale->getText(LOCALE_UNIT_DECIMAL)); ;//9999.99 MiB @@ -83,6 +83,12 @@ CDBoxInfoWidget::CDBoxInfoWidget() nameWidth = fontWidth * 17; } +CDBoxInfoWidget::~CDBoxInfoWidget() +{ + delete header; + header = NULL; +} + int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) { if (parent) @@ -166,6 +172,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) void CDBoxInfoWidget::hide() { + header->kill(); frameBuffer->paintBackgroundBoxRel(x,y, width,height); frameBuffer->blit(); } @@ -360,8 +367,10 @@ void CDBoxInfoWidget::paint() width = max(width, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(title, true) + 50); x = getScreenStartX(width); - CComponentsHeader header(x, ypos, width, hheight, title, NEUTRINO_ICON_SHELL); - header.paint(CC_SAVE_SCREEN_NO); + if (!header) + header = new CComponentsHeader(x, ypos, width, hheight, title, NEUTRINO_ICON_SHELL); + if (!header->isPainted()) + header->paint(CC_SAVE_SCREEN_NO); //paint body frameBuffer->paintBoxRel(x, ypos+ hheight, width, height- hheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); diff --git a/src/gui/dboxinfo.h b/src/gui/dboxinfo.h index 6a2260094..a78878570 100644 --- a/src/gui/dboxinfo.h +++ b/src/gui/dboxinfo.h @@ -36,6 +36,7 @@ #include #include #include +#include #include class CDBoxInfoWidget : public CMenuTarget @@ -54,12 +55,13 @@ class CDBoxInfoWidget : public CMenuTarget int nameWidth; void paint(); - + CComponentsHeader *header; Font *fm, *ft; public: CDBoxInfoWidget(); + ~CDBoxInfoWidget(); void hide(); int exec(CMenuTarget* parent, const std::string & actionKey);