Revert "Floating point color config formats"
This reverts commit 6b28d57730a390264b4d0daea2d765f841ad90d8.
This commit is contained in:
parent
98debc663a
commit
d110ba93e6
24
src/draw.c
24
src/draw.c
@ -59,17 +59,8 @@ static struct color hex_to_color(uintmax_t hexValue, int dpc)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void color_clip(struct color * c)
|
||||
{
|
||||
if (c->r > 1.0) c->r = 1.0;
|
||||
if (c->g > 1.0) c->g = 1.0;
|
||||
if (c->b > 1.0) c->b = 1.0;
|
||||
if (c->a > 1.0) c->a = 1.0;
|
||||
}
|
||||
|
||||
static struct color string_to_color(const char *str)
|
||||
{
|
||||
if (str[0] == '#') {
|
||||
uintmax_t val;
|
||||
unsigned clen;
|
||||
{
|
||||
@ -99,21 +90,6 @@ static struct color string_to_color(const char *str)
|
||||
}
|
||||
}
|
||||
return hex_to_color(val, clen);
|
||||
}
|
||||
|
||||
/* rgba(fp, fp, fp, fp) */
|
||||
{
|
||||
struct color col;
|
||||
if (sscanf(str, "rgba ( %lf , %lf , %lf , %lf )", &col.r, &col.g, &col.b, &col.a) == 4) {
|
||||
color_clip(&col);
|
||||
return col;
|
||||
}
|
||||
if (sscanf(str, "rgb ( %lf , %lf , %lf )", &col.r, &col.g, &col.b) == 3) {
|
||||
color_clip(&col);
|
||||
col.a = 1.0;
|
||||
return col;
|
||||
}
|
||||
}
|
||||
|
||||
/* return black on error */
|
||||
err:
|
||||
|
Loading…
x
Reference in New Issue
Block a user