summaryrefslogtreecommitdiff
path: root/legacy/evas
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-09-24 07:51:45 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-09-24 07:51:45 +0000
commit06bb70765ed059edd7b101f6dea01a8a1f78729c (patch)
tree5ef4e302189eb5372d0637f24405cc1059f9a364 /legacy/evas
parentbbba85b546d587030cbeeb7453146c7a94c60d17 (diff)
really small thing - avoid palette alloc rounding down at extremes
(ff->fe). SVN revision: 77033
Diffstat (limited to 'legacy/evas')
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xcb_color.c8
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xlib_color.c10
2 files changed, 9 insertions, 9 deletions
diff --git a/legacy/evas/src/modules/engines/software_x11/evas_xcb_color.c b/legacy/evas/src/modules/engines/software_x11/evas_xcb_color.c
index 3ed603711e..f451fa193f 100644
--- a/legacy/evas/src/modules/engines/software_x11/evas_xcb_color.c
+++ b/legacy/evas/src/modules/engines/software_x11/evas_xcb_color.c
@@ -65,13 +65,13 @@ x_color_alloc_rgb(int nr,
65 int val; 65 int val;
66 int dr, dg, db; 66 int dr, dg, db;
67 67
68 val = (int)((((double)r) / ((nr) - 1)) * 255); 68 val = (int)(((r * 255) / ((nr) - 1)));
69 val = (val << 8) | val; 69 val = (val << 8) | val;
70 xcl.red = (uint16_t)(val); 70 xcl.red = (uint16_t)(val);
71 val = (int)((((double)g) / ((ng) - 1)) * 255); 71 val = (int)(((g * 255) / ((ng) - 1)));
72 val = (val << 8) | val; 72 val = (val << 8) | val;
73 xcl.green = (uint16_t)(val); 73 xcl.green = (uint16_t)(val);
74 val = (int)((((double)b) / ((nb) - 1)) * 255); 74 val = (int)(((b * 255) / ((nb) - 1)));
75 val = (val << 8) | val; 75 val = (val << 8) | val;
76 xcl.blue = (uint16_t)(val); 76 xcl.blue = (uint16_t)(val);
77 xcl_in = xcl; 77 xcl_in = xcl;
@@ -154,7 +154,7 @@ x_color_alloc_gray(int ng,
154 int val; 154 int val;
155 xcb_alloc_color_reply_t *rep; 155 xcb_alloc_color_reply_t *rep;
156 156
157 val = (int)((((double)g) / ((ng) - 1)) * 255); 157 val = (int)(((g * 255) / ((ng) - 1)));
158 val = (val << 8) | val; 158 val = (val << 8) | val;
159 xcl.red = (uint16_t)(val); 159 xcl.red = (uint16_t)(val);
160 xcl.green = (uint16_t)(val); 160 xcl.green = (uint16_t)(val);
diff --git a/legacy/evas/src/modules/engines/software_x11/evas_xlib_color.c b/legacy/evas/src/modules/engines/software_x11/evas_xlib_color.c
index 1df0406e57..a59a08ea85 100644
--- a/legacy/evas/src/modules/engines/software_x11/evas_xlib_color.c
+++ b/legacy/evas/src/modules/engines/software_x11/evas_xlib_color.c
@@ -61,13 +61,13 @@ x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v)
61 Status ret; 61 Status ret;
62 int dr, dg, db; 62 int dr, dg, db;
63 63
64 val = (int)((((double)r) / ((nr) - 1)) * 255); 64 val = (int)(((r * 255) / ((nr) - 1)));
65 val = (val << 8) | val; 65 val = (val << 8) | val;
66 xcl.red = (unsigned short)(val); 66 xcl.red = (unsigned short)(val);
67 val = (int)((((double)g) / ((ng) - 1)) * 255); 67 val = (int)(((g * 255) / ((ng) - 1)));
68 val = (val << 8) | val; 68 val = (val << 8) | val;
69 xcl.green = (unsigned short)(val); 69 xcl.green = (unsigned short)(val);
70 val = (int)((((double)b) / ((nb) - 1)) * 255); 70 val = (int)(((b * 255) / ((nb) - 1)));
71 val = (val << 8) | val; 71 val = (val << 8) | val;
72 xcl.blue = (unsigned short)(val); 72 xcl.blue = (unsigned short)(val);
73 xcl_in = xcl; 73 xcl_in = xcl;
@@ -78,7 +78,7 @@ x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v)
78 if (dg < 0) dg = -dg; 78 if (dg < 0) dg = -dg;
79 db = (int)xcl_in.blue - (int)xcl.blue; 79 db = (int)xcl_in.blue - (int)xcl.blue;
80 if (db < 0) db = -db; 80 if (db < 0) db = -db;
81/* 81/*
82 printf("ASK [%i]: %04x %04x %04x = %04x %04x %04x | dif = %04x / %04x\n", 82 printf("ASK [%i]: %04x %04x %04x = %04x %04x %04x | dif = %04x / %04x\n",
83 ret, 83 ret,
84 xcl_in.red, xcl_in.green, xcl_in.blue, 84 xcl_in.red, xcl_in.green, xcl_in.blue,
@@ -134,7 +134,7 @@ x_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v)
134 int val; 134 int val;
135 Status ret; 135 Status ret;
136 136
137 val = (int)((((double)g) / ((ng) - 1)) * 255); 137 val = (int)(((g * 255) / ((ng) - 1)));
138 val = (val << 8) | val; 138 val = (val << 8) | val;
139 xcl.red = (unsigned short)(val); 139 xcl.red = (unsigned short)(val);
140 xcl.green = (unsigned short)(val); 140 xcl.green = (unsigned short)(val);