230 |
return make_colour(pc); |
return make_colour(pc); |
231 |
} |
} |
232 |
|
|
233 |
|
/* indent is confused by UNROLL8 */ |
234 |
|
/* *INDENT-OFF* */ |
235 |
|
|
236 |
|
/* repeat and unroll, similar to bitmap.c */ |
237 |
|
/* potentialy any of the following translate */ |
238 |
|
/* functions can use repeat but just doing */ |
239 |
|
/* the most common ones */ |
240 |
|
|
241 |
#define UNROLL8(stm) { stm stm stm stm stm stm stm stm } |
#define UNROLL8(stm) { stm stm stm stm stm stm stm stm } |
242 |
#define REPEAT(stm) \ |
/* 2 byte output repeat */ |
243 |
|
#define REPEAT2(stm) \ |
244 |
|
{ \ |
245 |
|
while (out <= end - 8 * 2) \ |
246 |
|
UNROLL8(stm) \ |
247 |
|
while (out < end) \ |
248 |
|
{ stm } \ |
249 |
|
} |
250 |
|
/* 4 byte output repeat */ |
251 |
|
#define REPEAT4(stm) \ |
252 |
{ \ |
{ \ |
253 |
while (out <= end - 8 * 4) \ |
while (out <= end - 8 * 4) \ |
254 |
UNROLL8(stm) \ |
UNROLL8(stm) \ |
269 |
uint16 value; |
uint16 value; |
270 |
|
|
271 |
if (g_arch_match) |
if (g_arch_match) |
|
REPEAT(*((uint16 *) out) = g_colmap[*(data++)]; |
|
|
out += 2;) |
|
|
else |
|
|
if (g_xserver_be) |
|
|
{ |
|
|
while (out < end) |
|
272 |
{ |
{ |
273 |
value = (uint16) g_colmap[*(data++)]; |
REPEAT2 |
274 |
*(out++) = value >> 8; |
( |
275 |
*(out++) = value; |
*((uint16 *) out) = g_colmap[*(data++)]; |
276 |
|
out += 2; |
277 |
|
) |
278 |
} |
} |
279 |
} |
else if (g_xserver_be) |
280 |
else |
{ |
281 |
{ |
while (out < end) |
282 |
while (out < end) |
{ |
283 |
|
value = (uint16) g_colmap[*(data++)]; |
284 |
|
*(out++) = value >> 8; |
285 |
|
*(out++) = value; |
286 |
|
} |
287 |
|
} |
288 |
|
else |
289 |
{ |
{ |
290 |
value = (uint16) g_colmap[*(data++)]; |
while (out < end) |
291 |
*(out++) = value; |
{ |
292 |
*(out++) = value >> 8; |
value = (uint16) g_colmap[*(data++)]; |
293 |
|
*(out++) = value; |
294 |
|
*(out++) = value >> 8; |
295 |
|
} |
296 |
} |
} |
297 |
} |
} |
|
} |
|
298 |
|
|
299 |
/* little endian - conversion happens when colourmap is built */ |
/* little endian - conversion happens when colourmap is built */ |
300 |
static void |
static void |
330 |
uint32 value; |
uint32 value; |
331 |
|
|
332 |
if (g_arch_match) |
if (g_arch_match) |
|
REPEAT(*((uint32 *) out) = g_colmap[*(data++)]; |
|
|
out += 4;) |
|
|
else |
|
|
if (g_xserver_be) |
|
|
{ |
|
|
while (out < end) |
|
333 |
{ |
{ |
334 |
value = g_colmap[*(data++)]; |
REPEAT4 |
335 |
*(out++) = value >> 24; |
( |
336 |
*(out++) = value >> 16; |
*((uint32 *) out) = g_colmap[*(data++)]; |
337 |
*(out++) = value >> 8; |
out += 4; |
338 |
*(out++) = value; |
) |
339 |
} |
} |
340 |
} |
else if (g_xserver_be) |
|
else |
|
|
{ |
|
|
while (out < end) |
|
341 |
{ |
{ |
342 |
value = g_colmap[*(data++)]; |
while (out < end) |
343 |
*(out++) = value; |
{ |
344 |
*(out++) = value >> 8; |
value = g_colmap[*(data++)]; |
345 |
*(out++) = value >> 16; |
*(out++) = value >> 24; |
346 |
*(out++) = value >> 24; |
*(out++) = value >> 16; |
347 |
|
*(out++) = value >> 8; |
348 |
|
*(out++) = value; |
349 |
|
} |
350 |
|
} |
351 |
|
else |
352 |
|
{ |
353 |
|
while (out < end) |
354 |
|
{ |
355 |
|
value = g_colmap[*(data++)]; |
356 |
|
*(out++) = value; |
357 |
|
*(out++) = value >> 8; |
358 |
|
*(out++) = value >> 16; |
359 |
|
*(out++) = value >> 24; |
360 |
|
} |
361 |
} |
} |
|
} |
|
362 |
} |
} |
363 |
|
|
364 |
|
/* *INDENT-ON* */ |
365 |
|
|
366 |
static void |
static void |
367 |
translate15to16(uint16 * data, uint8 * out, uint8 * end) |
translate15to16(uint16 * data, uint8 * out, uint8 * end) |
368 |
{ |
{ |
1058 |
ui_resize_window() |
ui_resize_window() |
1059 |
{ |
{ |
1060 |
XSizeHints *sizehints; |
XSizeHints *sizehints; |
1061 |
|
Pixmap bs; |
1062 |
|
|
1063 |
sizehints = XAllocSizeHints(); |
sizehints = XAllocSizeHints(); |
1064 |
if (sizehints) |
if (sizehints) |
1074 |
{ |
{ |
1075 |
XResizeWindow(g_display, g_wnd, g_width, g_height); |
XResizeWindow(g_display, g_wnd, g_width, g_height); |
1076 |
} |
} |
1077 |
|
|
1078 |
|
/* create new backstore pixmap */ |
1079 |
|
if (g_backstore != 0) |
1080 |
|
{ |
1081 |
|
bs = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth); |
1082 |
|
XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen)); |
1083 |
|
XFillRectangle(g_display, bs, g_gc, 0, 0, g_width, g_height); |
1084 |
|
XCopyArea(g_display, g_backstore, bs, g_gc, 0, 0, g_width, g_height, 0, 0); |
1085 |
|
XFreePixmap(g_display, g_backstore); |
1086 |
|
g_backstore = bs; |
1087 |
|
} |
1088 |
} |
} |
1089 |
|
|
1090 |
void |
void |
2183 |
|
|
2184 |
XFree(image); |
XFree(image); |
2185 |
} |
} |
2186 |
|
|
2187 |
|
/* these do nothing here but are used in uiports */ |
2188 |
|
void |
2189 |
|
ui_begin_update(void) |
2190 |
|
{ |
2191 |
|
} |
2192 |
|
|
2193 |
|
void |
2194 |
|
ui_end_update(void) |
2195 |
|
{ |
2196 |
|
} |