summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-19 13:25:33 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-19 13:25:33 -0300
commitd42be39a1dc86124a62598c6921f24fa9425a40b (patch)
treea794e8e7733976404c171e67631ca412b9cf5c06 /gfx
parent0fe596c2149d470536e7ee1f7a6d30390af96789 (diff)
downloadeeshow-d42be39a1dc86124a62598c6921f24fa9425a40b.tar.gz
eeshow-d42be39a1dc86124a62598c6921f24fa9425a40b.tar.bz2
eeshow-d42be39a1dc86124a62598c6921f24fa9425a40b.zip
eeshow/gfx/diff.c (show_areas): break out the actual coloring
... for future sharing.
Diffstat (limited to 'gfx')
-rw-r--r--gfx/diff.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/gfx/diff.c b/gfx/diff.c
index dc3e1f1..8379d22 100644
--- a/gfx/diff.c
+++ b/gfx/diff.c
@@ -242,23 +242,30 @@ 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;
int x, y;
+ for (y = ya; y != yb; y++) {
+ if (y < 0 || y >= diff->h)
+ continue;
+ p = a + y * (diff->stride >> 2);
+ for (x = xa; x != xb; x++)
+ if (x >= 0 && x < diff->w && (p[x] & MASK) == MASK)
+ p[x] = color;
+ }
+}
+
+
+static void show_areas(struct diff *diff, uint32_t *a)
+{
+ const struct area *area;
+
for (area = diff->areas; area; area = area->next)
- for (y = area->ya; y != area->yb; y++) {
- if (y < 0 || y >= diff->h)
- continue;
- p = a + y * (diff->stride >> 2);
- for (x = area->xa; x != area->xb; x++) {
- if (x >= 0 && x < diff->w &&
- (p[x] & MASK) == MASK)
- p[x] = AREA_FILL;
- }
- }
+ complement_box(diff, a, area->xa, area->ya, area->xb, area->yb,
+ AREA_FILL);
}