rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
gfx_damage.h
Go to the documentation of this file.
1
23#pragma once
24
25#include <stdbool.h>
26#include <stdint.h>
27
28#include "gfx.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
35#define GFX_DAMAGE_BAND_SHIFT 4
37#define GFX_DAMAGE_BAND_H (1 << GFX_DAMAGE_BAND_SHIFT)
39#define GFX_DAMAGE_MAX_BANDS 64
41#define GFX_DAMAGE_MAX_RECTS 8
42
44typedef struct {
45 uintptr_t base;
46 uintptr_t end;
47 int32_t stride;
48 int16_t width;
49 int16_t height;
50 int16_t bands;
51 bool all;
55 uintptr_t last;
56 int16_t last_x;
57 int16_t last_y;
59
62
69void gfx_damage_init(gfx_damage_t *d, const gfx_canvas_t *root);
70
76
82
96void gfx_damage_mark(gfx_damage_t *d, const gfx_canvas_t *c, int x, int y,
97 int w, int h);
98
104bool gfx_damage_empty(const gfx_damage_t *d);
105
119int gfx_damage_rects(const gfx_damage_t *d, gfx_rect_t *out, int max);
120
128gfx_rect_t gfx_damage_turn(gfx_rect_t r, int width, int height);
129
135
136#ifdef __cplusplus
137}
138#endif
gfx: an RGB565 (16-bit red, green, blue) rasteriser with no dependencies.
gfx_rect_t gfx_damage_turn(gfx_rect_t r, int width, int height)
Where r lies in a width x height buffer turned by 180°.
Definition gfx_damage.c:198
void gfx_damage_init(gfx_damage_t *d, const gfx_canvas_t *root)
Bind d to the buffer under root, empty.
Definition gfx_damage.c:15
void gfx_damage_all(gfx_damage_t *d)
Count the whole buffer as written.
Definition gfx_damage.c:49
gfx_damage_t * gfx_damage_sink
The record the primitives report to, or NULL; gfx_damage.c.
Definition gfx_damage.c:13
void gfx_damage_reset(gfx_damage_t *d)
Forget what d holds: nothing written.
Definition gfx_damage.c:33
void gfx_damage_mark(gfx_damage_t *d, const gfx_canvas_t *c, int x, int y, int w, int h)
Count a rectangle written through c as written.
Definition gfx_damage.c:88
bool gfx_damage_empty(const gfx_damage_t *d)
Whether d holds no write.
Definition gfx_damage.c:119
int gfx_damage_rects(const gfx_damage_t *d, gfx_rect_t *out, int max)
The written area as at most max rectangles, top to bottom.
Definition gfx_damage.c:151
void gfx_damage_attach(gfx_damage_t *d)
Report the primitives' writes to d, or to nothing.
Definition gfx_damage.c:203
#define GFX_DAMAGE_MAX_BANDS
The bands a record holds, 64: 1,024 rows.
Definition gfx_damage.h:39
Definition gfx.h:129
What one buffer has had written since gfx_damage_reset().
Definition gfx_damage.h:44
uintptr_t base
Definition gfx_damage.h:45
int16_t lo[GFX_DAMAGE_MAX_BANDS]
Definition gfx_damage.h:52
int16_t width
Definition gfx_damage.h:48
uintptr_t last
Definition gfx_damage.h:55
int32_t stride
Definition gfx_damage.h:47
bool all
Definition gfx_damage.h:51
int16_t last_y
Definition gfx_damage.h:57
int16_t last_x
Definition gfx_damage.h:56
int16_t bands
Definition gfx_damage.h:50
int16_t height
Definition gfx_damage.h:49
uintptr_t end
Definition gfx_damage.h:46
int16_t hi[GFX_DAMAGE_MAX_BANDS]
Definition gfx_damage.h:54
Definition gfx.h:81