1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 15:12:28 +02:00

eeshow/diff.c (differences): clean up pixel processing

This commit is contained in:
Werner Almesberger 2016-08-07 16:03:56 -03:00
parent 3b8b8a20d2
commit 43542d6504

View File

@ -28,6 +28,12 @@
#define DEFAULT_FRAME_RADIUS 30 #define DEFAULT_FRAME_RADIUS 30
#define FADE_SHIFT 3
#define FADE_MASK ((0xff >> FADE_SHIFT) * (0x010101))
#define FADE_OFFSET (~FADE_MASK & 0xffffff)
#define MASK 0xffffff
struct area { struct area {
int xa, ya, xb, yb; int xa, ya, xb, yb;
@ -208,25 +214,20 @@ static void mark_area(struct diff *diff, int x, int y)
} }
#define MASK 0xffffff
static void differences(struct diff *diff, uint32_t *a, const uint32_t *b) static void differences(struct diff *diff, uint32_t *a, const uint32_t *b)
{ {
int x, y;
unsigned skip = diff->w * 4 - diff->stride; unsigned skip = diff->w * 4 - diff->stride;
int x, y;
for (y = 0; y != diff->h; y++) { for (y = 0; y != diff->h; y++) {
for (x = 0; x != diff->w; x++) { for (x = 0; x != diff->w; x++) {
if (!((*a ^ *b) & MASK)) { if (!((*a ^ *b) & MASK)) {
*a = ((*a >> 3) & 0x1f1f1f) | 0xe0e0e0; *a = ((*a >> FADE_SHIFT) & FADE_MASK) |
// *a = ((*a >> 2) & 0x3f3f3f) | 0xc0c0c0; FADE_OFFSET;
} else { } else {
mark_area(diff, x, y); mark_area(diff, x, y);
//fprintf(stderr, "0x%06x 0x%06x", *a, *b);
*a = (*a & MASK) == MASK ? ONLY_NEW : *a = (*a & MASK) == MASK ? ONLY_NEW :
(*b & MASK) == MASK ? ONLY_OLD : BOTH; (*b & MASK) == MASK ? ONLY_OLD : BOTH;
//fprintf(stderr, "-> 0x%06x\n", *a);
} }
a++; a++;
b++; b++;