MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / Paint

Method Paint

System/LemonWM/compositor.cpp:22–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22void CompositorInstance::Paint(){
23 timespec cTime;
24 clock_gettime(CLOCK_BOOTTIME, &cTime);
25
26 if(displayFramerate){
27 unsigned int renderTime = (cTime - lastRender);
28
29 if(avgFrametime)
30 avgFrametime = (avgFrametime + renderTime) / 2;
31 else
32 avgFrametime = renderTime;
33
34 if(++fCount >= 200){
35 if(avgFrametime)
36 fRate = 1000000000 / avgFrametime;
37 fCount = 0;
38 avgFrametime = renderTime;
39 }
40 }
41
42 if(capFramerate && (cTime - lastRender) < (6944443)) return; // Cap at 90 FPS
43
44 lastRender = cTime;
45
46 surface_t* renderSurface = &wm->surface;
47
48 if(wm->redrawBackground){
49 #ifdef LEMONWM_USE_CLIPPING
50 auto doClipping = [&](rect_t newRect){
51 retry:
52 for(WMWindow* win : wm->windows){
53 auto& clips = win->clips;
54 for(auto it = clips.begin(); it != clips.end(); it++){
55 rect_t rect = *it;
56 if(rect.left() < newRect.right() && rect.right() > newRect.left() && rect.top() < newRect.bottom() && rect.bottom() > newRect.top()){
57 clips.erase(it);
58 cclips.erase(it);
59
60 clips.splice(clips.end(), rect.Split(newRect));
61 cclips.splice(cclips.end(), rect.Split(newRect));
62 goto retry;
63 }
64 }
65 }
66 };
67
68 for(WMWindow* win : wm->windows){
69 win->clips.clear();
70 }
71 cclips.clear();
72
73 for(WMWindow* win : wm->windows){
74 if(win->minimized) continue;
75
76 if(win->flags & WINDOW_FLAGS_NODECORATION) {
77 doClipping({win->pos, win->size});
78 cclips.push_back({win->pos, win->size});
79 } else {

Callers 2

mainFunction · 0.45
UpdateMethod · 0.45

Calls 14

surfacecpyFunction · 0.85
PointInRectFunction · 0.85
surfacecpyTransparentFunction · 0.85
leftMethod · 0.80
rightMethod · 0.80
topMethod · 0.80
bottomMethod · 0.80
SplitMethod · 0.80
DrawMethod · 0.80
DrawRectFunction · 0.50
DrawStringFunction · 0.50
beginMethod · 0.45

Tested by

no test coverage detected