rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
gfx_int.h File Reference

gfx internals shared by gfx.c and gfx_text.c. Not part of the public interface (include/gfx.h); nothing outside shared/gfx includes it. More...

#include "gfx.h"
#include "gfx_damage.h"
#include <limits.h>
#include <stddef.h>

Go to the source code of this file.

Macros

#define GFX_DAMAGE(c, x, y, w, h)
 Report a clipped rectangle written through c to the attached damage record (gfx_damage.h); one load and one branch without one.
#define GFX_DAMAGE_CLIP(cv, rx, ry, rw, rh)
 GFX_DAMAGE() for a rectangle not yet clipped: intersected with c's clip first, and only while a record is attached.
#define GFX_INL   static inline
 How the primitives' bodies are declared: plain inline.
#define TRACE_BOX(c, x, y, w, h)
 Report a shape's box to the fit check unless held back.
#define TRACE_HOLD()
 Hold back the boxes of the spans that fill one shape.
#define TRACE_RELEASE()
 End one TRACE_HOLD().

Functions

static bool canvas_ok (const gfx_canvas_t *c)
 Whether c can be drawn on: it exists, has pixels and a non-empty clip.
GFX_INL void gfx_pixel_inl (gfx_canvas_t *c, int x, int y, gfx_color_t color)
 The body of gfx_pixel(): one pixel inside the clip, reported to the damage record.
GFX_INL void gfx_pixel_put_inl (gfx_canvas_t *c, int x, int y, gfx_color_t color)
 One pixel inside the clip, not reported to the damage record: for a caller that reported the area it writes in already.
GFX_INL gfx_color_t gfx_pixel_get_inl (const gfx_canvas_t *c, int x, int y)
 The body of gfx_pixel_get().
GFX_INL void gfx_hline_inl (gfx_canvas_t *c, int x, int y, int w, gfx_color_t color)
 The body of gfx_hline(): a horizontal line through gfx_fill_rect(), drawn leftwards for a negative w.
GFX_INL bool gfx_clip_intersect_inl (gfx_canvas_t *c, gfx_rect_t r)
 The body of gfx_clip_intersect().

Variables

int s_trace_hold
 The fit check's hold depth: 0 reports, more holds back.

Detailed Description

gfx internals shared by gfx.c and gfx_text.c. Not part of the public interface (include/gfx.h); nothing outside shared/gfx includes it.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ GFX_DAMAGE

#define GFX_DAMAGE ( c,
x,
y,
w,
h )
Value:
do { \
if (gfx_damage_sink != NULL) { \
gfx_damage_mark(gfx_damage_sink, (c), (x), (y), (w), (h)); \
} \
} while (0)
gfx_damage_t * gfx_damage_sink
The record the primitives report to, or NULL; gfx_damage.c.
Definition gfx_damage.c:13

Report a clipped rectangle written through c to the attached damage record (gfx_damage.h); one load and one branch without one.

◆ GFX_DAMAGE_CLIP

#define GFX_DAMAGE_CLIP ( cv,
rx,
ry,
rw,
rh )
Value:
do { \
if (gfx_damage_sink != NULL) { \
gfx_rect_t dmg_; \
if (gfx_rect_intersect(gfx_rect_make((rx), (ry), (rw), (rh)), \
(cv)->clip, &dmg_)) { \
gfx_damage_mark(gfx_damage_sink, (cv), dmg_.x, dmg_.y, \
dmg_.w, dmg_.h); \
} \
} \
} while (0)
bool gfx_rect_intersect(gfx_rect_t a, gfx_rect_t b, gfx_rect_t *out)
Definition gfx.c:93
Definition gfx.h:81

GFX_DAMAGE() for a rectangle not yet clipped: intersected with c's clip first, and only while a record is attached.

◆ TRACE_BOX

#define TRACE_BOX ( c,
x,
y,
w,
h )
Value:
do { \
if (s_trace_hold == 0) { \
gfx_trace_box((c), (x), (y), (w), (h)); \
} \
} while (0)
int s_trace_hold
The fit check's hold depth: 0 reports, more holds back.
Definition gfx.c:25

Report a shape's box to the fit check unless held back.

◆ TRACE_HOLD

#define TRACE_HOLD ( )
Value:

Hold back the boxes of the spans that fill one shape.

◆ TRACE_RELEASE

#define TRACE_RELEASE ( )
Value:

End one TRACE_HOLD().

Function Documentation

◆ canvas_ok()

bool canvas_ok ( const gfx_canvas_t * c)
inlinestatic

Whether c can be drawn on: it exists, has pixels and a non-empty clip.

Parameters
cthe canvas, or NULL
Returns
true when it can

◆ gfx_clip_intersect_inl()

GFX_INL bool gfx_clip_intersect_inl ( gfx_canvas_t * c,
gfx_rect_t r )

The body of gfx_clip_intersect().

Parameters
cthe canvas
rthe rectangle the clip narrows to
Returns
false when the clip is now empty

◆ gfx_hline_inl()

GFX_INL void gfx_hline_inl ( gfx_canvas_t * c,
int x,
int y,
int w,
gfx_color_t color )

The body of gfx_hline(): a horizontal line through gfx_fill_rect(), drawn leftwards for a negative w.

Parameters
cthe canvas
xthe line's first column
yits row
wits length, pixels
colorits colour

◆ gfx_pixel_get_inl()

GFX_INL gfx_color_t gfx_pixel_get_inl ( const gfx_canvas_t * c,
int x,
int y )

The body of gfx_pixel_get().

Parameters
cthe canvas
xthe pixel's column
yits row
Returns
its colour, 0 outside the canvas

◆ gfx_pixel_inl()

GFX_INL void gfx_pixel_inl ( gfx_canvas_t * c,
int x,
int y,
gfx_color_t color )

The body of gfx_pixel(): one pixel inside the clip, reported to the damage record.

Parameters
cthe canvas
xthe pixel's column
yits row
colorits colour

◆ gfx_pixel_put_inl()

GFX_INL void gfx_pixel_put_inl ( gfx_canvas_t * c,
int x,
int y,
gfx_color_t color )

One pixel inside the clip, not reported to the damage record: for a caller that reported the area it writes in already.

Parameters
cthe canvas
xthe pixel's column
yits row
colorits colour