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

Function Paint

System/FTerm/main.cpp:80–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void Paint(){
81 int lnPos = 0;
82 int fontHeight = terminalFont->height;
83 for(std::vector<TerminalChar>& line : screenBuffer){
84 for(int j = 0; j < static_cast<long>(line.size()) && j < wSize.ws_col; j++){
85 TerminalChar ch = screenBuffer[lnPos][j];
86 rgba_colour_t fg = colours[ch.s.fgColour];
87 rgba_colour_t bg = colours[ch.s.bgColour];
88
89 Lemon::Graphics::DrawRect(j * 8, lnPos * fontHeight, 8, fontHeight, bg.r, bg.g, bg.b, &renderSurface);
90
91 if(isprint(ch.c))
92 Lemon::Graphics::DrawChar(ch.c, j * 8, lnPos * fontHeight, fg.r, fg.g, fg.b, &renderSurface, {0, 0, renderSurface.width, renderSurface.height}, terminalFont);
93 }
94
95 if(++lnPos >= wSize.ws_row){
96 break;
97 }
98 }
99
100 timespec t;
101 clock_gettime(CLOCK_BOOTTIME, &t);
102
103 long msec = (t.tv_nsec / 1000000.0);
104 if(msec < 250 || (msec > 500 && msec < 750)) // Only draw the cursor for a quarter of a second so it blinks
105 Lemon::Graphics::DrawRect(curPos.x * 8, curPos.y * fontHeight + (fontHeight / 4 * 3), 8, fontHeight / 4, colours[state.fgColour], &renderSurface);
106
107 Lemon::Graphics::surfacecpy(&fbSurface, &renderSurface);
108}
109
110void DoAnsiSGR(){
111 int r = -1;

Callers 3

mainFunction · 0.85
ResizeMethod · 0.85
PaintMethod · 0.85

Calls 4

surfacecpyFunction · 0.85
sizeMethod · 0.80
DrawRectFunction · 0.50
DrawCharFunction · 0.50

Tested by

no test coverage detected