mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 15:10:38 +02:00
eeshow/gui/diff.c: improve sectioning
This commit is contained in:
parent
5e647637b6
commit
ef3d118c9e
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user