[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 64e25cd: More robust NS hex colour string parsing

From: Mattias Engdegård
Subject: Re: master 64e25cd: More robust NS hex colour string parsing
Date: Mon, 8 Jun 2020 18:15:00 +0200

8 juni 2020 kl. 14.26 skrev Pip Cet <pipcet@gmail.com>:

> I believe there's very similar code for the X case, where we also
> translate #fff to rgb:f/f/f. That code has annoyed me lately by
> producing nonsensical GCC warnings, maybe you'd like to replace it
> with yours? Having two different versions of this seems superfluous

Thought crossed my mind too. I'm not sure if it makes sense to share the code 
that transforms #RRGGBB to rgb:RR/GG/BB; it's not a very natural abstraction, 
and just why are we doing this string transformation step in the first place.

The X11 backend does it so that it can use Xlib for the rest, which is a 
dubious saving since the string-munging code isn't much simpler than what would 
be needed to parse the original string to RGB values right away.

The Windows code looks more robust, except that it appears to apply a funny 
numeric conversion for 4, 12 and 16 bits/colour. It doesn't look quite right at 

We should probably have a single, correct parser for the numeric colour strings 
#RGB, rgb:R/G/B, and rgbi:R/G/B instead of three subtly broken ones. X11 and NS 
additionally have their own formats that I suppose we need to retain for 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]