setos

拙OS
Log | Files | Refs | LICENSE

commit d33e7593e155b1352df343e5394596099bf018f4
parent b0aba4ed96abbdbd523b16af006a220e1115383d
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Fri,  5 Apr 2024 15:30:15 +0900

change border

Diffstat:
Msys/src/kernel/draw.c | 12++++++++++--
Msys/src/kernel/main.c | 2+-
2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/sys/src/kernel/draw.c b/sys/src/kernel/draw.c @@ -105,8 +105,16 @@ border(Window *dst, Rectangle r, int i, RGBA32 col) { int x, y; int j; - int s = i > 0 ? 1 : -1; - for (j = 0; j != i+s; j += s) { + int start, end; + if (i < 0) { + start = -1; + end = i - 1; + } else { + start = 0; + end = i + 1; + } + int delta = i > 0 ? 1 : -1; + for (j = start; j != end; j += delta) { for (x = r.min.x+j, y = r.min.y+j; x < r.max.x-j; x++) { pixel(dst, (Point){x, y}, col); } diff --git a/sys/src/kernel/main.c b/sys/src/kernel/main.c @@ -44,7 +44,7 @@ kernel_main(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) .max = (Point){150 + 400, 100 + 300} }; clear(&win0); - border(&root_window, rect, -3, 0xaa666600); + border(&root_window, rect, -4, 0xaa666600); cons_printf(&con0, "hello world!\n"); halt: