Just for the record.  Not meant for upstream merge.

Example debug output:

urxvt: 24-bit color collision 139: [000] [111] [ 36] #202020 => #1c1c1c
[R0]
[G0]     [B0]  105 204070    [B1]  107 000000
[G1]     [B0]   80 1a1a1a    [B1]   96 222222

[R1]
[G0]     [B0]  126 141414    [B1]   70 202020
[G1]     [B0]  108 242424    [B1]  114 121212

urxvt: 24-bit color collision 151: [111] [333] [ 81] #586e75 => #3f3f3f
[R0]
[G0]     [B0]  105 204070    [B1]  107 000000    [B2]   11 000099
[G1]     [B0]   80 1a1a1a    [B1]   96 222222    [B2]   32 4a708b
[G2]     [B0]   35 004a41    [B1]   53 303030    [B2]   56 0e8ed3

[R1]
[G0]     [B0]  126 141414    [B1]  140 1c1c1c    [B2]   94 004488
[G1]     [B0]  108 242424    [B1]  114 121212    [B2]   66 7c7c7c
[G2]     [B0]   73 555555    [B1]   76 333333    [B2]   12 335588

[R2]
[G0]     [B0]   75 8b0000    [B1]   82 34383c    [B2]  113 444444
[G1]     [B0]   88 555753    [B1]  120 61614a    [B2]  145 4e4e4e
[G2]     [B0]   85 606000    [B1]    3 586e75    [B2]    9 7f7f7f

Signed-off-by: Fengguang Wu <[email protected]>
---
 src/command.C | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/command.C b/src/command.C
index a1e0757..52f6f02 100644
--- a/src/command.C
+++ b/src/command.C
@@ -3365,6 +3365,8 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int 
g, unsigned int b)
   unsigned int color;
   unsigned short seqno;
   unsigned int index;
+  char buf[4096];
+  char *p = buf;
 
   r &= 0xff;
   g &= 0xff;
@@ -3403,10 +3405,12 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned 
int g, unsigned int b)
       // larger than Red/Green/Blue_levels and skipped by below if's.
       if ((unsigned) i >= (unsigned) Red_levels)
        continue;
+      p += snprintf (p, buf + sizeof(buf) - p, "[R%d]\n", i);
       for (j = idx_g - 1; j <= (signed) idx_g + 1; j++)
        {
          if ((unsigned) j >= (unsigned) Green_levels)
            continue;
+          p += snprintf (p, buf + sizeof(buf) - p, "[G%d] ", j);
          for (k = idx_b - 1; k <= (signed) idx_b + 1; k++)
            {
              if ((unsigned) k >= (unsigned) Blue_levels)
@@ -3433,15 +3437,22 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned 
int g, unsigned int b)
                   idx = index;
                  seqno = rgb24_seqno[index];
                 }
+
+              p += snprintf (p, buf + sizeof(buf) - p, "    [B%d] %4hu %06x",
+                             k, rgb24_seqno[index], rgb24_color[index]);
            }
+          p += snprintf (p, buf + sizeof(buf) - p, "\n");
        }
+        p += snprintf (p, buf + sizeof(buf) - p, "\n");
     }
 
+#define DEBUG_RGB24
 #if defined(DEBUG_RGB24)
     rxvt_warn ("24-bit color collision %hu: [%d%d%d] [%03x] [%3u] #%06x => 
#%06x\n",
                rgb24_sequence,
                idx_r, idx_g, idx_b,
                key, idx, rgb24_color[idx], color);
+    fprintf (stderr, buf);
 #endif
 
 update:
-- 
2.8.1


_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/rxvt-unicode

Reply via email to