Luna/kernel/src/sys/paint.cpp
apio b035795eb3 Kernel: Move errno.h and (k)assert.h out of the main include directory
This is mostly so IDEs don't pick them up instead of the userspace headers :)
2022-10-19 17:41:23 +02:00

27 lines
616 B
C++

#include "bootboot.h"
#include "interrupts/Context.h"
#include "render/Framebuffer.h"
#include "std/errno.h"
#include <stdint.h>
extern BOOTBOOT bootboot;
void sys_paint(Context* context, uint64_t x, uint64_t y, uint64_t w, uint64_t h, uint64_t c)
{
if ((x + w) > bootboot.fb_width)
{
context->rax = -EINVAL;
return;
}
if ((y + h) > bootboot.fb_height)
{
context->rax = -EINVAL;
return;
}
uint32_t color = (uint32_t)c;
framebuffer0.paint_rect((uint32_t)x, (uint32_t)y, (uint32_t)w, (uint32_t)h, Color::from_integer(color));
context->rax = 0;
}