summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-22 13:15:38 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-22 13:15:38 -0300
commit4056b557e4d7d3a49e4e9a233cb57127ee916b45 (patch)
treefa006368b23fe411bf9b5ac1c21d41a11f8364b4 /gfx
parent65b6d2a74d00d07505241516af58d0b1171082c1 (diff)
downloadeeshow-4056b557e4d7d3a49e4e9a233cb57127ee916b45.tar.gz
eeshow-4056b557e4d7d3a49e4e9a233cb57127ee916b45.tar.bz2
eeshow-4056b557e4d7d3a49e4e9a233cb57127ee916b45.zip
eeshow/gui/diff.c: improve sectioning
Diffstat (limited to 'gfx')
-rw-r--r--gfx/diff.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/gfx/diff.c b/gfx/diff.c
index 884f8b6..1eb8d35 100644
--- a/gfx/diff.c
+++ b/gfx/diff.c
@@ -116,7 +116,7 @@ static unsigned diff_text_width(void *ctx, const char *s, unsigned size)
}
-/* ----- Initialization and termination ------------------------------------ */
+/* ----- Initialization ---------------------------------------------------- */
static void *diff_init(int argc, char *const *argv)
@@ -182,6 +182,9 @@ fail_open:
}
+/* ----- Area highlighting ------------------------------------------------- */
+
+
void add_area(struct area **areas, int xa, int ya, int xb, int yb,
uint32_t color)
{
@@ -226,30 +229,6 @@ static void mark_area(struct diff *diff, int x, int y)
}
-static void differences(struct diff *diff, uint32_t *a, const uint32_t *b)
-{
- unsigned skip = diff->w * 4 - diff->stride;
- int x, y;
-
- for (y = 0; y != diff->h; y++) {
- for (x = 0; x != diff->w; x++) {
- if (!((*a ^ *b) & MASK)) {
- *a = ((*a >> FADE_SHIFT) & FADE_MASK) |
- FADE_OFFSET;
- } else {
- mark_area(diff, x, y);
- *a = (*a & MASK) == MASK ? ONLY_NEW :
- (*b & MASK) == MASK ? ONLY_OLD : BOTH;
- }
- a++;
- b++;
- }
- a += skip;
- b += skip;
- }
-}
-
-
static void complement_box(struct diff *diff, uint32_t *a,
int xa, int ya, int xb, int yb, uint32_t color)
{
@@ -296,6 +275,33 @@ void free_areas(struct area **areas)
}
+/* ----- Termination ------------------------------------------------------- */
+
+
+static void differences(struct diff *diff, uint32_t *a, const uint32_t *b)
+{
+ unsigned skip = diff->w * 4 - diff->stride;
+ int x, y;
+
+ for (y = 0; y != diff->h; y++) {
+ for (x = 0; x != diff->w; x++) {
+ if (!((*a ^ *b) & MASK)) {
+ *a = ((*a >> FADE_SHIFT) & FADE_MASK) |
+ FADE_OFFSET;
+ } else {
+ mark_area(diff, x, y);
+ *a = (*a & MASK) == MASK ? ONLY_NEW :
+ (*b & MASK) == MASK ? ONLY_OLD : BOTH;
+ }
+ a++;
+ b++;
+ }
+ a += skip;
+ b += skip;
+ }
+}
+
+
static void diff_end(void *ctx)
{
struct diff *diff = ctx;