blob: 861fff41c9df4060db89fe776420ce3b2aa6d348 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#pragma once
#include "../Base.hpp"
#include "cru/platform/gui/TimerHelper.hpp"
#include "cru/platform/gui/UiApplication.hpp"
#include <chrono>
namespace cru::ui::host {
class LayoutPaintCycler {
public:
explicit LayoutPaintCycler(WindowHost* host);
CRU_DELETE_COPY(LayoutPaintCycler)
CRU_DELETE_MOVE(LayoutPaintCycler)
~LayoutPaintCycler();
public:
void InvalidateLayout();
void InvalidatePaint();
bool IsLayoutDirty() { return layout_dirty_; }
private:
void OnCycle();
private:
WindowHost* host_;
platform::gui::TimerAutoCanceler timer_canceler_;
bool layout_dirty_ = true;
bool paint_dirty_ = true;
std::chrono::steady_clock::time_point last_cycle_time_;
std::chrono::steady_clock::duration cycle_threshold_ =
std::chrono::milliseconds(1000) / 144;
};
} // namespace cru::ui::host
|