diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-07-16 15:17:27 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-07-16 15:17:27 (GMT) |
commit | 95c723cdcfe9a574608d9d85288588b9ea982bc9 (patch) | |
tree | 8c509cc28415813d532c9048aab943572fefbdba /generic | |
parent | 9f6d41c61faba304dce324aa4d5629db643f4191 (diff) | |
download | tk-95c723cdcfe9a574608d9d85288588b9ea982bc9.zip tk-95c723cdcfe9a574608d9d85288588b9ea982bc9.tar.gz tk-95c723cdcfe9a574608d9d85288588b9ea982bc9.tar.bz2 |
better wrapper, with one less roundtrip through X11 server
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkColor.c | 14 | ||||
-rw-r--r-- | generic/tkInt.h | 2 |
2 files changed, 6 insertions, 10 deletions
diff --git a/generic/tkColor.c b/generic/tkColor.c index f1258f5..ea03e28 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -832,7 +832,7 @@ TkDebugColor( #undef XParseColor -static CONST char *CONST webColors[] = { +const char *const tkWebColors[20] = { /* 'a' */ "qua\0#0000ffffffff", /* 'b' */ NULL, /* 'c' */ "rimson\0#dcdc14143c3c", @@ -852,13 +852,7 @@ static CONST char *CONST webColors[] = { /* 'q' */ NULL, /* 'r' */ NULL, /* 's' */ "ilver\0#c0c0c0c0c0c0", - /* 't' */ "eal\0#000080808080", - /* 'u' */ NULL, - /* 'v' */ NULL, - /* 'w' */ NULL, - /* 'x' */ NULL, - /* 'y' */ NULL, - /* 'z' */ NULL + /* 't' */ "eal\0#000080808080" }; Status @@ -914,14 +908,14 @@ TkParseColor( name -= 13; } goto done; - } else if (((*name - 'A') & 0xdf) < sizeof(webColors)/sizeof(webColors[0])) { + } else if (((*name - 'A') & 0xdf) < sizeof(tkWebColors)/sizeof(tkWebColors[0])) { if (!((name[0] - 'G') & 0xdf) && !((name[1] - 'R') & 0xdf) && !((name[2] - 'A') & 0xdb) && !((name[3] - 'Y') & 0xdf) && !name[4]) { name = "#808080808080"; goto done; } else { - const char *p = webColors[((*name - 'A') & 0x1f)]; + const char *p = tkWebColors[((*name - 'A') & 0x1f)]; if (p) { const char *q = name; while (!((*p - *(++q)) & 0xdf)) { diff --git a/generic/tkInt.h b/generic/tkInt.h index 88e0c25..01cc9cb 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -944,6 +944,8 @@ MODULE_SCOPE TkMainInfo *tkMainWindowList; MODULE_SCOPE Tk_ImageType tkPhotoImageType; MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable; +MODULE_SCOPE const char *const tkWebColors[20]; + /* * The definition of pi, at least from the perspective of double-precision * floats. |