vxKernel/src/modules/display/dclear.c

52 lines
881 B
C
Raw Normal View History

#include <vhex/defs/types.h>
#include <vhex/display.h>
#include <vhex/display/stack.h>
//---
// kernel-level API
//---
/* dclear_draw() : real drawing algorithm */
void dclear_render(dsurface_t *surface, uint32_t color)
{
uint32_t *vram;
int size = (surface->y1 == 220) ? 792 : 1980;
vram = surface->vram;
for (int i = 0; i < size; ++i)
VxKernel 0.6.0-4 : Support the text API @add <> src/modules/display/text/dascii | proof-of-concept of "one-char" drawing API (used for kernel debug) <> src/modules/fs | empty File System module used to expose some primitives used by the libc: | write(), read(), lseek() and close() which there have been removed from the | `fxlibc` project which used an old / deprecated ABI/sycall interface that | doesn't exist in this version of Vhex @update <> include/display/draw/pixel | remove the display ID returned by dpixel(). All primitives that support | shaders must provide explicit API. This to allow fast-optimized API and | polyvalence API for shadering which impact the performance <> src/modules/display/dclear | isolate tree level for this primitive: | - kernel : direct fragment drawing primitive (by-pass dstack) | - dstack : dstack drawing primitive | - user : user drawing primitive (dstack-API) | invalidate automatically the dstack each time the primitive (user-level) is | involved <> src/modules/display/dstack | isolate the dstack invalidate part in a specific primitive @fix <> make/Makefile | proper support of the OpenLibm header path <> src/drivers/screen/r61524 | proper support of the last data fragment size. This caused an override on | the first X line of the screen <> src/modules/display/dstack | fix a crash when the number of action is full | fix a crash with the default index used for action cache | fix a crash with the default index used for shader cache | fix action initialization | fix action quit primitive <> src/modules/display/text/dfont | fix the character drawing algorithm | proper support of the character drawing color (foreground/background) | fix the kernel-level primitive used to display a Unicode string <> src/modules/display/text/dtext | fix a crash with the internal index counter | fix a crash in the internal cache | fix the quit function
2022-06-10 21:28:51 +02:00
vram[i] = color;
}
//---
// Dstack-level API
//---
/* dclear_dstack() : dstack rwrapper primitive */
void dclear_dstack(dsurface_t *surface, uint32_t *arg)
VxKernel 0.6.0-4 : Support the text API @add <> src/modules/display/text/dascii | proof-of-concept of "one-char" drawing API (used for kernel debug) <> src/modules/fs | empty File System module used to expose some primitives used by the libc: | write(), read(), lseek() and close() which there have been removed from the | `fxlibc` project which used an old / deprecated ABI/sycall interface that | doesn't exist in this version of Vhex @update <> include/display/draw/pixel | remove the display ID returned by dpixel(). All primitives that support | shaders must provide explicit API. This to allow fast-optimized API and | polyvalence API for shadering which impact the performance <> src/modules/display/dclear | isolate tree level for this primitive: | - kernel : direct fragment drawing primitive (by-pass dstack) | - dstack : dstack drawing primitive | - user : user drawing primitive (dstack-API) | invalidate automatically the dstack each time the primitive (user-level) is | involved <> src/modules/display/dstack | isolate the dstack invalidate part in a specific primitive @fix <> make/Makefile | proper support of the OpenLibm header path <> src/drivers/screen/r61524 | proper support of the last data fragment size. This caused an override on | the first X line of the screen <> src/modules/display/dstack | fix a crash when the number of action is full | fix a crash with the default index used for action cache | fix a crash with the default index used for shader cache | fix action initialization | fix action quit primitive <> src/modules/display/text/dfont | fix the character drawing algorithm | proper support of the character drawing color (foreground/background) | fix the kernel-level primitive used to display a Unicode string <> src/modules/display/text/dtext | fix a crash with the internal index counter | fix a crash in the internal cache | fix the quit function
2022-06-10 21:28:51 +02:00
{
dclear_render(surface, arg[0]);
}
//---
// User-level API
//---
/* dclear(): Fill the screen with a single color */
did_t dclear(int color)
{
VxKernel 0.6.0-4 : Support the text API @add <> src/modules/display/text/dascii | proof-of-concept of "one-char" drawing API (used for kernel debug) <> src/modules/fs | empty File System module used to expose some primitives used by the libc: | write(), read(), lseek() and close() which there have been removed from the | `fxlibc` project which used an old / deprecated ABI/sycall interface that | doesn't exist in this version of Vhex @update <> include/display/draw/pixel | remove the display ID returned by dpixel(). All primitives that support | shaders must provide explicit API. This to allow fast-optimized API and | polyvalence API for shadering which impact the performance <> src/modules/display/dclear | isolate tree level for this primitive: | - kernel : direct fragment drawing primitive (by-pass dstack) | - dstack : dstack drawing primitive | - user : user drawing primitive (dstack-API) | invalidate automatically the dstack each time the primitive (user-level) is | involved <> src/modules/display/dstack | isolate the dstack invalidate part in a specific primitive @fix <> make/Makefile | proper support of the OpenLibm header path <> src/drivers/screen/r61524 | proper support of the last data fragment size. This caused an override on | the first X line of the screen <> src/modules/display/dstack | fix a crash when the number of action is full | fix a crash with the default index used for action cache | fix a crash with the default index used for shader cache | fix action initialization | fix action quit primitive <> src/modules/display/text/dfont | fix the character drawing algorithm | proper support of the character drawing color (foreground/background) | fix the kernel-level primitive used to display a Unicode string <> src/modules/display/text/dtext | fix a crash with the internal index counter | fix a crash in the internal cache | fix the quit function
2022-06-10 21:28:51 +02:00
uint32_t copti;
dstack_invalidate();
if (color == C_NONE)
return (-1);
color = color & 0xffff;
copti = (color << 16) | (color << 0);
return dstack_add_action(
&DSTACK_CALL(&dclear_dstack, copti),
VxKernel 0.6.0-4 : Support the text API @add <> src/modules/display/text/dascii | proof-of-concept of "one-char" drawing API (used for kernel debug) <> src/modules/fs | empty File System module used to expose some primitives used by the libc: | write(), read(), lseek() and close() which there have been removed from the | `fxlibc` project which used an old / deprecated ABI/sycall interface that | doesn't exist in this version of Vhex @update <> include/display/draw/pixel | remove the display ID returned by dpixel(). All primitives that support | shaders must provide explicit API. This to allow fast-optimized API and | polyvalence API for shadering which impact the performance <> src/modules/display/dclear | isolate tree level for this primitive: | - kernel : direct fragment drawing primitive (by-pass dstack) | - dstack : dstack drawing primitive | - user : user drawing primitive (dstack-API) | invalidate automatically the dstack each time the primitive (user-level) is | involved <> src/modules/display/dstack | isolate the dstack invalidate part in a specific primitive @fix <> make/Makefile | proper support of the OpenLibm header path <> src/drivers/screen/r61524 | proper support of the last data fragment size. This caused an override on | the first X line of the screen <> src/modules/display/dstack | fix a crash when the number of action is full | fix a crash with the default index used for action cache | fix a crash with the default index used for shader cache | fix action initialization | fix action quit primitive <> src/modules/display/text/dfont | fix the character drawing algorithm | proper support of the character drawing color (foreground/background) | fix the kernel-level primitive used to display a Unicode string <> src/modules/display/text/dtext | fix a crash with the internal index counter | fix a crash in the internal cache | fix the quit function
2022-06-10 21:28:51 +02:00
NULL,
NULL
);
}