displayio: area: add displayio_area_canon
This routine will be used to simplify code that deals with ranges of bitmap coordinates.
This commit is contained in:
parent
f40c0c13ad
commit
3b506f0fa5
|
@ -320,6 +320,19 @@ bool displayio_area_empty(const displayio_area_t *a) {
|
|||
return (a->x1 == a->x2) || (a->y1 == a->y2);
|
||||
}
|
||||
|
||||
void displayio_area_canon(displayio_area_t *a) {
|
||||
if (a->x1 < a->x2) {
|
||||
int16_t t = a->x1;
|
||||
a->x1 = a->x2;
|
||||
a->x2 = t;
|
||||
}
|
||||
if (a->y1 < a->y2) {
|
||||
int16_t t = a->y1;
|
||||
a->y1 = a->y2;
|
||||
a->y2 = t;
|
||||
}
|
||||
}
|
||||
|
||||
void displayio_area_union(const displayio_area_t *a,
|
||||
const displayio_area_t *b,
|
||||
displayio_area_t *u) {
|
||||
|
|
|
@ -55,6 +55,7 @@ extern displayio_buffer_transform_t null_transform;
|
|||
|
||||
bool displayio_area_empty(const displayio_area_t *a);
|
||||
void displayio_area_copy_coords(const displayio_area_t *src, displayio_area_t *dest);
|
||||
void displayio_area_canon(displayio_area_t *a);
|
||||
void displayio_area_union(const displayio_area_t *a,
|
||||
const displayio_area_t *b,
|
||||
displayio_area_t *u);
|
||||
|
|
Loading…
Reference in New Issue