From: Matthew Fernandez Date: Sat, 18 Dec 2021 04:31:54 +0000 (-0800) Subject: remove unused 'colorCvt' X-Git-Tag: 3.0.0~123^2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b0d462123a103889b8f0ad1e4b8b1117c490d808;p=graphviz remove unused 'colorCvt' --- diff --git a/lib/common/colorprocs.h b/lib/common/colorprocs.h index 7a375ac32..598950669 100644 --- a/lib/common/colorprocs.h +++ b/lib/common/colorprocs.h @@ -19,7 +19,6 @@ extern "C" { extern void setColorScheme (char* s); extern int colorxlate(char *str, gvcolor_t * color, color_type_t target_type); extern char *canontoken(char *str); -extern int colorCvt(gvcolor_t *ocolor, gvcolor_t *ncolor); #ifdef __cplusplus } diff --git a/lib/common/colxlate.c b/lib/common/colxlate.c index fe419ef3a..85aa74f91 100644 --- a/lib/common/colxlate.c +++ b/lib/common/colxlate.c @@ -465,79 +465,6 @@ int colorxlate(char *str, gvcolor_t * color, color_type_t target_type) return rc; } -static void rgba_wordToByte (int* rrggbbaa, unsigned char* rgba) -{ - int i; - - for (i = 0; i < 4; i++) { - rgba[i] = rrggbbaa[i] * 255 / 65535; - } -} - -static void rgba_dblToByte (double* RGBA, unsigned char* rgba) -{ - int i; - - for (i = 0; i < 4; i++) { - rgba[i] = (unsigned char)(RGBA[i] * 255); - } -} - -/* colorCvt: - * Color format converter. - * Except for the trivial case, it converts the input color to a string - * representation and then calls colorxlate. - * ncolor must point to a gvcolor_t struct with type specifying the desired - * output type. - */ -int colorCvt(gvcolor_t *ocolor, gvcolor_t *ncolor) -{ - int rc; - char buf[BUFSIZ]; - char* s; - unsigned char rgba[4]; - - if (ocolor->type == ncolor->type) { - memcpy (&ncolor->u, &ocolor->u, sizeof(ocolor->u)); - return COLOR_OK; - } - s = buf; - switch (ocolor->type) { - case HSVA_DOUBLE : - snprintf(buf, sizeof(buf), "%.03f %.03f %.03f %.03f", - ocolor->u.HSVA[0], ocolor->u.HSVA[1], ocolor->u.HSVA[2], ocolor->u.HSVA[3]); - break; - case RGBA_BYTE : - snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x", - ocolor->u.rgba[0], ocolor->u.rgba[1], ocolor->u.rgba[2], ocolor->u.rgba[3]); - break; - case RGBA_WORD: - rgba_wordToByte (ocolor->u.rrggbbaa, rgba); - snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x", rgba[0], rgba[1], rgba[2], - rgba[3]); - break; - case RGBA_DOUBLE: - rgba_dblToByte (ocolor->u.RGBA, rgba); - snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x", rgba[0], rgba[1], rgba[2], - rgba[3]); - break; - case COLOR_STRING: - s = ocolor->u.string; - break; - case CMYK_BYTE : - return COLOR_UNKNOWN; - break; - case COLOR_INDEX: - return COLOR_UNKNOWN; - break; - default: - return COLOR_UNKNOWN; - break; - } - rc = colorxlate (s, ncolor, ncolor->type); - return rc; -} - /* setColorScheme: * Set current color scheme for resolving names. */