From 078edb50b2ae7185f0159fc9cbad49b39d614498 Mon Sep 17 00:00:00 2001 From: Lephe Date: Mon, 5 Oct 2020 16:20:01 +0200 Subject: [PATCH] small cleanup --- TODO | 1 + include/gint/keyboard.h | 8 ++++---- src/kernel/start.c | 5 +++-- src/render-fx/bopti.c | 21 --------------------- src/render-fx/render-fx.h | 28 +++++++++++++++++----------- src/render/topti.c | 4 ---- 6 files changed, 25 insertions(+), 42 deletions(-) diff --git a/TODO b/TODO index b455488..7c0f57e 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ Extensions on existing code: +* project: add license file * kernel: group linker script symbols in a single header file * kernel: be consistent about *tlb_mapped_memory() in hw_detect() * bopti: try to display fullscreen images with TLB access + DMA on fxcg50 diff --git a/include/gint/keyboard.h b/include/gint/keyboard.h index 39787dc..767dfee 100644 --- a/include/gint/keyboard.h +++ b/include/gint/keyboard.h @@ -248,10 +248,10 @@ void getkey_repeat(int first, int next); /* getkey_repeat_filter(): Set the repeat filter function - This function is called by getkey() and getkey_opt() every time a repeat - event occurs when GETKEY_REPEAT_FILTER. The function can decide whether to - keep, delay it or drop it entirely. It can also change the repeat delays - with getkey_repeat() for fully custom repeat delay curves. + The repeat filter is called by getkey() and getkey_opt() every time a repeat + event occurs when GETKEY_REP_FILTER is set. The filter can decide whether to + keep, delay or drop the event. It can also change the repeat delays with + getkey_repeat() for fully custom repeat delay curves. The time elapsed since the last accepted repeat is passed to the filter function; this time must be larger than the repeat time set with diff --git a/src/kernel/start.c b/src/kernel/start.c index eda9415..cd70b22 100644 --- a/src/kernel/start.c +++ b/src/kernel/start.c @@ -126,7 +126,7 @@ int start(int isappli, int optnum) while(loaded < (uint32_t)&srom) { - volatile uint8_t y = *x; + GUNUSED volatile uint8_t y = *x; loaded += 1024; x += 1024; } @@ -148,7 +148,7 @@ int start(int isappli, int optnum) } #ifdef FX9860G - /* Copy permanentely-mapped code to start of user RAM (on fx-CG 50 it + /* Copy permanently-mapped code to start of user RAM (on fx-CG 50 it is loaded along ILRAM contents) */ void *rgmapped = mmu_uram(); regcpy(&lgmapped, &sgmapped, rgmapped); @@ -184,6 +184,7 @@ int start(int isappli, int optnum) } callarray(&bdtors, &edtors); + /* Before leaving the application, we need to clean everything we changed to hardware settings and peripheral modules. The OS is bound to be confused (and hang, or crash, or any other kind of giving up) diff --git a/src/render-fx/bopti.c b/src/render-fx/bopti.c index 1946dac..370664a 100644 --- a/src/render-fx/bopti.c +++ b/src/render-fx/bopti.c @@ -291,24 +291,3 @@ int bopti_clip(bopti_image_t const *img, struct rbox *r) /* Return non-zero if the result is empty */ return (width <= 0 || height <= 0); } - -void bopti_render_noclip(bopti_image_t const *img, struct rbox *r, - uint32_t *v1, uint32_t *v2) -{ - int left = r->left; - - /* Start column and end column (both included) */ - r->left >>= 5; - - if(r->columns == 1 && (r->visual_x & 31) + r->width <= 32) - { - r->x = (left & 31) - (r->visual_x & 31); - bopti_render_scsp(img, r, v1, v2); - } - else - { - /* x-coordinate of the first pixel of the first column */ - r->x = r->visual_x - (left & 31); - bopti_render(img, r, v1, v2); - } -} diff --git a/src/render-fx/render-fx.h b/src/render-fx/render-fx.h index b32eebe..e296c68 100644 --- a/src/render-fx/render-fx.h +++ b/src/render-fx/render-fx.h @@ -30,18 +30,24 @@ void masks(int x1, int x2, uint32_t *masks); @rbox Rendering box */ int bopti_clip(bopti_image_t const *img, struct rbox *rbox); -/* bopti_render_noclip(): Render a bopti image without clipping - This function is only ever slightly faster than bopti_render_clip(), - eliminating two types of coordinate checks: - 1. The bounding box does not overflow from the image - 2. The final rendering does not overflow from the screen +/* bopti_render(): Render a bopti image + Copies an image into the VRAM. This function does not perform clipping; + use bopti_clip() on the rbox before calling it if needed. - @x @y Location of the top-left corner - @img Image encoded by [fxconv] - @left @top @w @h Bounding box to render - @v1 @v2 VRAMs (gray rendering is used if v2 != NULL) */ -void bopti_render_noclip(bopti_image_t const *img, struct rbox *rbox, - uint32_t *v1, uint32_t *v2); + @img Image encoded by [fxconv] + @rbox Rendering box (may or may not be clipped) + @v1 @v2 VRAMs (gray rendering is used if v2 != NULL) */ +void bopti_render(bopti_image_t const *img, struct rbox *rbox, uint32_t *v1, + uint32_t *v2); + +/* bopti_render_scsp(): Single-column single-position image renderer + This function is a specialized version of bopti_render() that can be used + when only a single column of the source image is used (all pixels to be + rendered are in a single 32-aligned 32-wide pixel column of the source) and + a single position of the VRAM is used (all pixels to be rendered end up in a + single 32-aligned 32-wide pixel column of the VRAM). */ +void bopti_render_scsp(bopti_image_t const *img, struct rbox *rbox, + uint32_t *v1, uint32_t *v2); //--- // Alternate rendering modes diff --git a/src/render/topti.c b/src/render/topti.c index 4ce6ae1..203ae55 100644 --- a/src/render/topti.c +++ b/src/render/topti.c @@ -3,10 +3,6 @@ #include "../render/render.h" -/* TODO: These parameters will eventually be specified by the font */ -#define CHAR_SPACING 1 -#define PROP_SPACING 5 - /* dfont(): Set the default font for text rendering */ font_t const *dfont(font_t const * font) {