1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-29 15:25:54 +02:00

eeshow/gfx/diff.c (show_areas): break out the actual coloring

... for future sharing.
This commit is contained in:
Werner Almesberger 2016-08-19 13:25:33 -03:00
parent c6db84aa26
commit c24c966fb0

View File

@ -242,26 +242,33 @@ static void differences(struct diff *diff, uint32_t *a, const uint32_t *b)
} }
static void show_areas(struct diff *diff, uint32_t *a) static void complement_box(struct diff *diff, uint32_t *a,
int xa, int ya, int xb, int yb, uint32_t color)
{ {
const struct area *area;
uint32_t *p; uint32_t *p;
int x, y; int x, y;
for (area = diff->areas; area; area = area->next) for (y = ya; y != yb; y++) {
for (y = area->ya; y != area->yb; y++) {
if (y < 0 || y >= diff->h) if (y < 0 || y >= diff->h)
continue; continue;
p = a + y * (diff->stride >> 2); p = a + y * (diff->stride >> 2);
for (x = area->xa; x != area->xb; x++) { for (x = xa; x != xb; x++)
if (x >= 0 && x < diff->w && if (x >= 0 && x < diff->w && (p[x] & MASK) == MASK)
(p[x] & MASK) == MASK) p[x] = color;
p[x] = AREA_FILL;
}
} }
} }
static void show_areas(struct diff *diff, uint32_t *a)
{
const struct area *area;
for (area = diff->areas; area; area = area->next)
complement_box(diff, a, area->xa, area->ya, area->xb, area->yb,
AREA_FILL);
}
static void free_areas(struct diff *diff) static void free_areas(struct diff *diff)
{ {
struct area *next; struct area *next;