2022-06-15 20:40:43 +02:00
|
|
|
#include <vhex/display/draw/circle.h>
|
|
|
|
#include <vhex/display/draw/line.h>
|
|
|
|
#include <vhex/display.h>
|
|
|
|
|
|
|
|
//---
|
|
|
|
// Kernel-level API
|
|
|
|
//---
|
|
|
|
|
|
|
|
/* dcircle_render() : real drawing algorithm */
|
|
|
|
void dcircle_filled_render(
|
|
|
|
dsurface_t *surface,
|
|
|
|
int x, int y,
|
|
|
|
int radius,
|
|
|
|
int color
|
|
|
|
) {
|
|
|
|
int px;
|
|
|
|
int py;
|
|
|
|
int d;
|
|
|
|
|
|
|
|
px = 0;
|
|
|
|
py = radius;
|
|
|
|
d = 1 - radius;
|
|
|
|
|
2022-06-19 20:11:52 +02:00
|
|
|
dhline_render(surface, y, x - py, x + py, color);
|
2022-06-15 20:40:43 +02:00
|
|
|
while(py > px)
|
|
|
|
{
|
|
|
|
if(d < 0) {
|
|
|
|
d += (2 * px) + 3;
|
|
|
|
} else {
|
|
|
|
d += (2 * (px - py)) + 5;
|
|
|
|
py--;
|
|
|
|
dhline_render(surface, y + py + 1, x - px, x + px, color);
|
|
|
|
dhline_render(surface, y - py - 1, x - px, x + px, color);
|
|
|
|
}
|
|
|
|
px++;
|
|
|
|
if(py >= px) {
|
|
|
|
dhline_render(surface, y + px, x - py, x + py, color);
|
|
|
|
dhline_render(surface, y - px, x - py, x + py, color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---
|
|
|
|
// Dstack-level API
|
|
|
|
//---
|
|
|
|
|
|
|
|
/* dcircle_filled_dstack() : dstack wrapper primitive */
|
|
|
|
void dcircle_filled_dstack(dsurface_t *surface, uint32_t *args)
|
|
|
|
{
|
|
|
|
dcircle_filled_render(
|
|
|
|
surface,
|
|
|
|
(int)args[0],
|
|
|
|
(int)args[1],
|
|
|
|
(size_t)args[2],
|
|
|
|
(int)args[3]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---
|
|
|
|
// User-level API
|
|
|
|
//---
|
|
|
|
|
|
|
|
/* dcircle_filled() : draw a filled circle */
|
|
|
|
void dcircle_filled(int x, int y, size_t radius, int mode, int color)
|
|
|
|
{
|
|
|
|
if (color == C_NONE) return;
|
|
|
|
|
2022-06-19 20:11:52 +02:00
|
|
|
int offset = radius & 1;
|
|
|
|
|
|
|
|
if (mode & DCIRCLE_LEFT) x += (radius >> 1) + offset;
|
|
|
|
if (mode & DCIRCLE_RIGHT) x -= (radius >> 1) + offset;
|
|
|
|
if (mode & DCIRCLE_TOP) y += (radius >> 1) + offset;
|
|
|
|
if (mode & DCIRCLE_BOTTOM) y -= (radius >> 1) + offset;
|
2022-06-15 20:40:43 +02:00
|
|
|
|
|
|
|
dstack_add_action(
|
VxKernel 0.6.0-13 : Add keyboard API + update timer API
@add
<> include/vhex/driver/mpu/sh/sh7305/keysc
| add internal driver primitives
<> include/vhex/driver/mpu/sh/sh7305/tmu
| add internal driver primitives
<> include/vhex/keyboard
| add getkey* (high-level) API
| add key event API
| add key status API
| add keycode information
| add keyboard driver interface
@update
<> include/vhex/driver
| add KEYBOARD driver flags
<> include/vhex/keyboard
| isolate each part of the keyboard module
| link the keycache part with the driver-provided keycache information
<> src/drivers/mpu/sh/sh7305/keysc
| use the new keycache API (high-level interrupt handler)
| update keycache API
| link the new API in the driver device
<> src/drivers/mpu/sh/sh7305/tmu
| add timer reservation (WIP)
| use a "reservation" cache to known which timer is free instead of hardware
| rename internal functions
<> src/module/display
| Now, by default, DSTACK_CALL() create a pointer on a dstack_call_t
| use dsubimage dstack primitive in dimage()
@fix
<> board/fxcg50/fxcg50.ld
| remove the IL-memory and allow only the X-memory area. This because the
bootloader uses the IL-memory for DMA transfer and other "low-level"
routine used by Gint.
Moreover, I originally try to move each "display-driver" in this place,
but after some profiling and tests, the dclear()/dupdate() combo went from
9155us up to 33250us (for many reason). So, I keep this area free, but I
moved-back from RAM display routines.
<> board/fxcg50/initialize
| remove "section" copy. This role has been delegated to the bootload (vxBoot)
because, in the final ELF file generated by GCC, many relocalization
information for the IL/X memory has been set and the bootloader cannot
performs general relocalization.
So, all "special section/memory" displacement has been moved in the
bootloader and we don't have to worrying about the section copy.
<> src/drivers/mpu/sh/sh7305/tmu
| fix delay calculation in timer reload primitive
| disable interruption for profiling timer
<> src/module/dislay/
| fix shader index used during the dstack_render()
| fix many errors in dimage() shadow render (WIP)
2022-06-24 15:33:36 +02:00
|
|
|
DSTACK_CALL(&dcircle_filled_dstack, x, y, radius, color),
|
2022-06-15 20:40:43 +02:00
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
}
|