Skip to content

Commit

Permalink
fix(color): window tree preventing superfluous drawing (#2509)
Browse files Browse the repository at this point in the history
This prevents the main view to be redrawn if fully covered by a tab group, a page or a full screen dialog.
  • Loading branch information
raphaelcoeffic authored Oct 11, 2022
1 parent 786fbcb commit 3700208
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 44 deletions.
41 changes: 0 additions & 41 deletions radio/src/gui/colorlcd/draw_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,47 +116,6 @@ const uint8_t _LBM_SHUTDOWN_CIRCLE[] = {
};
STATIC_LZ4_BITMAP(LBM_SHUTDOWN_CIRCLE);

class ShutdownAnimation: public FormGroup
{
public:
ShutdownAnimation(uint32_t duration, uint32_t totalDuration):
FormGroup(MainWindow::instance(), {0, 0, LCD_W, LCD_H}, OPAQUE | FORM_NO_BORDER),
duration(duration),
totalDuration(totalDuration)
{
Layer::push(this);
bringToTop();
// setFocus(SET_FOCUS_DEFAULT);
}

#if defined(DEBUG_WINDOWS)
std::string getName() const override
{
return "ShutdownAnimation";
}
#endif
void paint(BitmapBuffer * dc) override
{
}

void deleteLater(bool detach = true, bool trash = true) override
{
Layer::pop(this);
Window::deleteLater(detach, trash);
}

void update(uint32_t newDuration, uint32_t newTotalDuration)
{
duration = newDuration;
totalDuration = newTotalDuration;
}

protected:
uint32_t duration;
uint32_t totalDuration;
std::string message;
};

void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
const char* message)
{
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/fullscreen_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
FullScreenDialog::FullScreenDialog(
uint8_t type, std::string title, std::string message, std::string action,
const std::function<void(void)>& confirmHandler) :
Window(MainWindow::instance(), {0, 0, LCD_W, LCD_H}, OPAQUE),
Window(Layer::back(), {0, 0, LCD_W, LCD_H}, OPAQUE),
type(type),
title(std::move(title)),
message(std::move(message)),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static constexpr rect_t _get_body_rect()
}

Page::Page(unsigned icon):
Window(MainWindow::instance(), {0, 0, LCD_W, LCD_H}, OPAQUE),
Window(Layer::back(), {0, 0, LCD_W, LCD_H}, OPAQUE),
header(this, icon),
body(this, _get_body_rect(), FORM_FORWARD_FOCUS)
{
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/tabsgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static constexpr rect_t _get_body_rect()
}

TabsGroup::TabsGroup(uint8_t icon):
Window(MainWindow::instance(), { 0, 0, LCD_W, LCD_H }, OPAQUE),
Window(Layer::back(), { 0, 0, LCD_W, LCD_H }, OPAQUE),
header(this, icon),
body(this, _get_body_rect(), NO_FOCUS | FORM_FORWARD_FOCUS)
{
Expand Down

0 comments on commit 3700208

Please sign in to comment.