# HG changeset patch # User Matti Hamalainen # Date 1587038418 -10800 # Node ID a11ef670bd99f7a98bff11d20e28dc42145a0347 # Parent 213ce6d400dc04ed2e72dea410b5a0cdcea9e7cf Move dmCompareColor() from libgfx to gfxconv as it is used only there, rename to dmExactCompareColor(). diff -r 213ce6d400dc -r a11ef670bd99 tools/gfxconv.c --- a/tools/gfxconv.c Thu Apr 16 14:35:41 2020 +0300 +++ b/tools/gfxconv.c Thu Apr 16 15:00:18 2020 +0300 @@ -1067,6 +1067,17 @@ } +BOOL dmExactCompareColor(const DMColor *c1, const DMColor *c2, const BOOL alpha) +{ + if (c1->r == c2->r && + c1->g == c2->g && + c1->b == c2->b) + return alpha ? (c1->a == c2->a) : TRUE; + else + return FALSE; +} + + int dmRemoveUnusedImageColors(DMImage **pdst, const DMImage *src) { DMPalette *tmpPal = NULL; @@ -1132,7 +1143,7 @@ BOOL found = FALSE; for (n = 0; n < src->pal->ncolors; n++) { - if (dmCompareColor(&(src->pal->colors[n]), &(map->color), map->alpha)) + if (dmExactCompareColor(&(src->pal->colors[n]), &(map->color), map->alpha)) { dmMsg(3, "RGBA match #%02x%02x%02x%02x: %d -> %d\n", map->color.r, map->color.g, map->color.b, map->color.a, diff -r 213ce6d400dc -r a11ef670bd99 tools/libgfx.c --- a/tools/libgfx.c Thu Apr 16 14:35:41 2020 +0300 +++ b/tools/libgfx.c Thu Apr 16 15:00:18 2020 +0300 @@ -108,17 +108,6 @@ } -BOOL dmCompareColor(const DMColor *c1, const DMColor *c2, const BOOL alpha) -{ - if (c1->r == c2->r && - c1->g == c2->g && - c1->b == c2->b) - return alpha ? (c1->a == c2->a) : TRUE; - else - return FALSE; -} - - int dmImageGetBytesPerPixel(const int format) { switch (format) diff -r 213ce6d400dc -r a11ef670bd99 tools/libgfx.h --- a/tools/libgfx.h Thu Apr 16 14:35:41 2020 +0300 +++ b/tools/libgfx.h Thu Apr 16 15:00:18 2020 +0300 @@ -161,7 +161,6 @@ // // Palette handling // -BOOL dmCompareColor(const DMColor *c1, const DMColor *c2, const BOOL alpha); int dmPaletteAlloc(DMPalette **ppal, const int ncolors, const int ctransp); int dmPaletteResize(DMPalette **ppal, const int ncolors); void dmPaletteFree(DMPalette *pal);