forked from enlightenment/efl
really small thing - avoid palette alloc rounding down at extremes
(ff->fe). SVN revision: 77033
This commit is contained in:
parent
bbba85b546
commit
06bb70765e
|
@ -65,13 +65,13 @@ x_color_alloc_rgb(int nr,
|
||||||
int val;
|
int val;
|
||||||
int dr, dg, db;
|
int dr, dg, db;
|
||||||
|
|
||||||
val = (int)((((double)r) / ((nr) - 1)) * 255);
|
val = (int)(((r * 255) / ((nr) - 1)));
|
||||||
val = (val << 8) | val;
|
val = (val << 8) | val;
|
||||||
xcl.red = (uint16_t)(val);
|
xcl.red = (uint16_t)(val);
|
||||||
val = (int)((((double)g) / ((ng) - 1)) * 255);
|
val = (int)(((g * 255) / ((ng) - 1)));
|
||||||
val = (val << 8) | val;
|
val = (val << 8) | val;
|
||||||
xcl.green = (uint16_t)(val);
|
xcl.green = (uint16_t)(val);
|
||||||
val = (int)((((double)b) / ((nb) - 1)) * 255);
|
val = (int)(((b * 255) / ((nb) - 1)));
|
||||||
val = (val << 8) | val;
|
val = (val << 8) | val;
|
||||||
xcl.blue = (uint16_t)(val);
|
xcl.blue = (uint16_t)(val);
|
||||||
xcl_in = xcl;
|
xcl_in = xcl;
|
||||||
|
@ -154,7 +154,7 @@ x_color_alloc_gray(int ng,
|
||||||
int val;
|
int val;
|
||||||
xcb_alloc_color_reply_t *rep;
|
xcb_alloc_color_reply_t *rep;
|
||||||
|
|
||||||
val = (int)((((double)g) / ((ng) - 1)) * 255);
|
val = (int)(((g * 255) / ((ng) - 1)));
|
||||||
val = (val << 8) | val;
|
val = (val << 8) | val;
|
||||||
xcl.red = (uint16_t)(val);
|
xcl.red = (uint16_t)(val);
|
||||||
xcl.green = (uint16_t)(val);
|
xcl.green = (uint16_t)(val);
|
||||||
|
|
|
@ -61,13 +61,13 @@ x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v)
|
||||||
Status ret;
|
Status ret;
|
||||||
int dr, dg, db;
|
int dr, dg, db;
|
||||||
|
|
||||||
val = (int)((((double)r) / ((nr) - 1)) * 255);
|
val = (int)(((r * 255) / ((nr) - 1)));
|
||||||
val = (val << 8) | val;
|
val = (val << 8) | val;
|
||||||
xcl.red = (unsigned short)(val);
|
xcl.red = (unsigned short)(val);
|
||||||
val = (int)((((double)g) / ((ng) - 1)) * 255);
|
val = (int)(((g * 255) / ((ng) - 1)));
|
||||||
val = (val << 8) | val;
|
val = (val << 8) | val;
|
||||||
xcl.green = (unsigned short)(val);
|
xcl.green = (unsigned short)(val);
|
||||||
val = (int)((((double)b) / ((nb) - 1)) * 255);
|
val = (int)(((b * 255) / ((nb) - 1)));
|
||||||
val = (val << 8) | val;
|
val = (val << 8) | val;
|
||||||
xcl.blue = (unsigned short)(val);
|
xcl.blue = (unsigned short)(val);
|
||||||
xcl_in = xcl;
|
xcl_in = xcl;
|
||||||
|
@ -134,7 +134,7 @@ x_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v)
|
||||||
int val;
|
int val;
|
||||||
Status ret;
|
Status ret;
|
||||||
|
|
||||||
val = (int)((((double)g) / ((ng) - 1)) * 255);
|
val = (int)(((g * 255) / ((ng) - 1)));
|
||||||
val = (val << 8) | val;
|
val = (val << 8) | val;
|
||||||
xcl.red = (unsigned short)(val);
|
xcl.red = (unsigned short)(val);
|
||||||
xcl.green = (unsigned short)(val);
|
xcl.green = (unsigned short)(val);
|
||||||
|
|
Loading…
Reference in New Issue