fix: various bug fixes in desktop components
This commit is contained in:
@@ -12,16 +12,17 @@ namespace gui {
|
||||
|
||||
// Fast horizontal line
|
||||
inline void draw_hline(Framebuffer& fb, int x, int y, int w, Color c) {
|
||||
for (int i = 0; i < w; i++) fb.put_pixel(x + i, y, c);
|
||||
fb.fill_rect(x, y, w, 1, c);
|
||||
}
|
||||
|
||||
// Fast vertical line
|
||||
inline void draw_vline(Framebuffer& fb, int x, int y, int h, Color c) {
|
||||
for (int i = 0; i < h; i++) fb.put_pixel(x, y + i, c);
|
||||
fb.fill_rect(x, y, 1, h, c);
|
||||
}
|
||||
|
||||
// Rectangle outline
|
||||
inline void draw_rect(Framebuffer& fb, int x, int y, int w, int h, Color c) {
|
||||
if (w <= 0 || h <= 0) return;
|
||||
draw_hline(fb, x, y, w, c);
|
||||
draw_hline(fb, x, y + h - 1, w, c);
|
||||
draw_vline(fb, x, y, h, c);
|
||||
|
||||
Reference in New Issue
Block a user