A little hack so colors with alpha == 0 compare equal regardless of the

A little hack so colors with alpha == 0 compare equal regardless of
the other color bytes.

--klm
This commit is contained in:
Kelly Martin 1999-10-07 15:05:49 +00:00
parent 8873e7553a
commit 9b90608c60
2 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,8 @@
1999-10-07 Kelly Lynn Martin <kelly@poverty.bloomington.in.us>
* plug-ins/common/autocrop.c (colors_equal): little hack so that
all colors with alpha == 0 compare equal
1999-10-3 Simon Budig <Simon.Budig@unix-ag.org>
* app/path_tool.h

View file

@ -261,9 +261,16 @@ static int guess_bgcolor(GPixelRgn *pr, int width, int height, int bytes,
}
}
static int colors_equal(guchar *col1, guchar *col2, int bytes) {
static int
colors_equal(guchar *col1, guchar *col2, int bytes) {
int equal = 1;
int b;
if ((bytes == 2 || bytes == 4) && /* HACK! */
col1[bytes-1] == 0 &&
col2[bytes-1] == 0) {
return 1; /* handle zero alpha */
}
for (b = 0; b < bytes; b++) {
if (col1[b] != col2[b]) {