ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.574 by root, Thu Jun 30 14:07:43 2016 UTC vs.
Revision 1.577 by root, Thu Jun 30 17:00:18 2016 UTC

3360 r &= 0xff; 3360 r &= 0xff;
3361 g &= 0xff; 3361 g &= 0xff;
3362 b &= 0xff; 3362 b &= 0xff;
3363 3363
3364 unsigned int color = (r << 16) | (g << 8) | b; 3364 unsigned int color = (r << 16) | (g << 8) | b;
3365 unsigned int idx_r = r / (0xff / (Red_levels - 1)); 3365 unsigned int idx_r = r * (Red_levels - 1) / 0xff;
3366 unsigned int idx_g = g / (0xff / (Green_levels - 1)); 3366 unsigned int idx_g = g * (Green_levels - 1) / 0xff;
3367 unsigned int idx_b = b / (0xff / (Blue_levels - 1)); 3367 unsigned int idx_b = b * (Blue_levels - 1) / 0xff;
3368 unsigned int idx = colorcube_index (idx_r, idx_g, idx_b); 3368 unsigned int idx = colorcube_index (idx_r, idx_g, idx_b);
3369 3369
3370 if (rgb24_color[idx] == color) 3370 if (rgb24_color[idx] == color)
3371 return idx + minTermCOLOR24; 3371 return idx + minTermCOLOR24;
3372 3372
3373 /* we allow one of the 6 directly neighbouring colours */ 3373 /* we allow one of the 6 directly neighbouring colours */
3374 /* to replace the current color, if they not used recently */ 3374 /* to replace the current color, if they not used recently */
3375 static const signed char dxyz[][3] = { 3375 static const signed char dxyz[][3] = {
3376 0, 0, 0, 3376 0, 0, 0,
3377 0, 0, +1,
3377 0, 0, -1, 3378 0, 0, -1,
3378 0, 0, +1, 3379 0, +1, 0,
3379 0, -1, 0, 3380 0, -1, 0,
3380 0, +1, 0, 3381 +1, 0, 0,
3381 -1, 0, 0, 3382 -1, 0, 0,
3382 +1, 0, 0,
3383 }; 3383 };
3384 3384
3385 for (int n = 0; n < ecb_array_length (dxyz); ++n) 3385 for (int n = 0; n < ecb_array_length (dxyz); ++n)
3386 { 3386 {
3387 int r = idx_r + dxyz[n][0]; 3387 int r = idx_r + dxyz[n][0];
3388 int g = idx_r + dxyz[n][1]; 3388 int g = idx_r + dxyz[n][1];
3389 int b = idx_r + dxyz[n][2]; 3389 int b = idx_r + dxyz[n][2];
3390 3390
3391 if (!IN_RANGE_EXC (r, 0, Red_levels)) 3391 if (!IN_RANGE_EXC (r, 0, Red_levels )) continue;
3392 continue;
3393
3394 if (!IN_RANGE_EXC (g, 0, Green_levels)) 3392 if (!IN_RANGE_EXC (g, 0, Green_levels)) continue;
3395 continue;
3396
3397 if (!IN_RANGE_EXC (b, 0, Blue_levels)) 3393 if (!IN_RANGE_EXC (b, 0, Blue_levels )) continue;
3398 continue;
3399 3394
3400 unsigned int index = colorcube_index (r, g, b); 3395 unsigned int index = colorcube_index (r, g, b);
3401 3396
3402 // minor issue: could update index 0 few more times 3397 // minor issue: could update index 0 few more times
3403 if ((rgb24_seqno[index] | rgb24_color[index]) == 0) 3398 if ((rgb24_seqno[index] | rgb24_color[index]) == 0)
3419 rgb24_color[idx] = color; 3414 rgb24_color[idx] = color;
3420 rgb24_seqno[idx] = ++rgb24_sequence; 3415 rgb24_seqno[idx] = ++rgb24_sequence;
3421 3416
3422 idx += minTermCOLOR24; 3417 idx += minTermCOLOR24;
3423 pix_colors_focused [idx].free (this); 3418 pix_colors_focused [idx].free (this);
3424 pix_colors_focused [idx].set (this, rgba (r * 0x0101, 3419 pix_colors_focused [idx].set (this, rgba (r * 0x0101, g * 0x0101, b * 0x0101));
3425 g * 0x0101,
3426 b * 0x0101));
3427 update_fade_color (idx, false); 3420 update_fade_color (idx, false);
3428 3421
3429 return idx; 3422 return idx;
3430} 3423}
3431 3424

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines