275 |
colour = make_colour16(split_colour24(colour)); |
colour = make_colour16(split_colour24(colour)); |
276 |
break; |
break; |
277 |
case 24: |
case 24: |
278 |
|
colour = make_colour24(split_colour24(colour)); |
279 |
break; |
break; |
280 |
case 32: |
case 32: |
281 |
colour = make_colour32(split_colour24(colour)); |
colour = make_colour32(split_colour24(colour)); |
294 |
} |
} |
295 |
|
|
296 |
static void |
static void |
297 |
translate8to16(uint8 * data, uint16 * out, uint16 * end) |
translate8to16(uint8 * data, uint8 * out, uint8 * end) |
298 |
{ |
{ |
299 |
|
uint16 value; |
300 |
|
|
301 |
while (out < end) |
while (out < end) |
302 |
*(out++) = (uint16) g_colmap[*(data++)]; |
{ |
303 |
|
value = (uint16) g_colmap[*(data++)]; |
304 |
|
|
305 |
|
if (g_xserver_be) |
306 |
|
{ |
307 |
|
*(out++) = value >> 8; |
308 |
|
*(out++) = value; |
309 |
|
} |
310 |
|
else |
311 |
|
{ |
312 |
|
*(out++) = value; |
313 |
|
*(out++) = value >> 8; |
314 |
|
} |
315 |
|
} |
316 |
} |
} |
317 |
|
|
318 |
/* little endian - conversion happens when colourmap is built */ |
/* little endian - conversion happens when colourmap is built */ |
324 |
while (out < end) |
while (out < end) |
325 |
{ |
{ |
326 |
value = g_colmap[*(data++)]; |
value = g_colmap[*(data++)]; |
327 |
*(out++) = value; |
|
328 |
*(out++) = value >> 8; |
if (g_xserver_be) |
329 |
*(out++) = value >> 16; |
{ |
330 |
|
*(out++) = value >> 16; |
331 |
|
*(out++) = value >> 8; |
332 |
|
*(out++) = value; |
333 |
|
} |
334 |
|
else |
335 |
|
{ |
336 |
|
*(out++) = value; |
337 |
|
*(out++) = value >> 8; |
338 |
|
*(out++) = value >> 16; |
339 |
|
} |
340 |
} |
} |
341 |
} |
} |
342 |
|
|
343 |
static void |
static void |
344 |
translate8to32(uint8 * data, uint32 * out, uint32 * end) |
translate8to32(uint8 * data, uint8 * out, uint8 * end) |
345 |
{ |
{ |
346 |
|
uint32 value; |
347 |
|
|
348 |
while (out < end) |
while (out < end) |
349 |
*(out++) = g_colmap[*(data++)]; |
{ |
350 |
|
value = g_colmap[*(data++)]; |
351 |
|
|
352 |
|
if (g_xserver_be) |
353 |
|
{ |
354 |
|
*(out++) = value >> 24; |
355 |
|
*(out++) = value >> 16; |
356 |
|
*(out++) = value >> 8; |
357 |
|
*(out++) = value; |
358 |
|
} |
359 |
|
else |
360 |
|
{ |
361 |
|
*(out++) = value; |
362 |
|
*(out++) = value >> 8; |
363 |
|
*(out++) = value >> 16; |
364 |
|
*(out++) = value >> 24; |
365 |
|
} |
366 |
|
} |
367 |
} |
} |
368 |
|
|
369 |
/* todo the remaining translate function might need some big endian check ?? */ |
/* todo the remaining translate function might need some big endian check ?? */ |
380 |
|
|
381 |
if (g_host_be) |
if (g_host_be) |
382 |
{ |
{ |
383 |
BSWAP16(pixel)} |
BSWAP16(pixel); |
384 |
|
} |
385 |
|
|
386 |
value = make_colour16(split_colour15(pixel)); |
value = make_colour16(split_colour15(pixel)); |
387 |
|
|
410 |
|
|
411 |
if (g_host_be) |
if (g_host_be) |
412 |
{ |
{ |
413 |
BSWAP16(pixel)} |
BSWAP16(pixel); |
414 |
|
} |
415 |
|
|
416 |
value = make_colour24(split_colour15(pixel)); |
value = make_colour24(split_colour15(pixel)); |
417 |
if (g_xserver_be) |
if (g_xserver_be) |
504 |
|
|
505 |
if (g_host_be) |
if (g_host_be) |
506 |
{ |
{ |
507 |
BSWAP16(pixel)} |
BSWAP16(pixel); |
508 |
|
} |
509 |
|
|
510 |
value = make_colour24(split_colour16(pixel)); |
value = make_colour24(split_colour16(pixel)); |
511 |
|
|
673 |
translate8to8(data, out, end); |
translate8to8(data, out, end); |
674 |
break; |
break; |
675 |
case 16: |
case 16: |
676 |
translate8to16(data, (uint16 *) out, (uint16 *) end); |
translate8to16(data, out, end); |
677 |
break; |
break; |
678 |
case 24: |
case 24: |
679 |
translate8to24(data, out, end); |
translate8to24(data, out, end); |
680 |
break; |
break; |
681 |
case 32: |
case 32: |
682 |
translate8to32(data, (uint32 *) out, (uint32 *) end); |
translate8to32(data, out, end); |
683 |
break; |
break; |
684 |
} |
} |
685 |
break; |
break; |
1302 |
XImage *image; |
XImage *image; |
1303 |
Pixmap bitmap; |
Pixmap bitmap; |
1304 |
uint8 *tdata; |
uint8 *tdata; |
1305 |
|
int bitmap_pad; |
1306 |
|
|
1307 |
|
if (g_server_bpp == 8) |
1308 |
|
{ |
1309 |
|
bitmap_pad = 8; |
1310 |
|
} |
1311 |
|
else |
1312 |
|
{ |
1313 |
|
bitmap_pad = g_bpp; |
1314 |
|
|
1315 |
|
if (g_bpp == 24) |
1316 |
|
bitmap_pad = 32; |
1317 |
|
} |
1318 |
|
|
1319 |
tdata = (g_owncolmap ? data : translate_image(width, height, data)); |
tdata = (g_owncolmap ? data : translate_image(width, height, data)); |
1320 |
bitmap = XCreatePixmap(g_display, g_wnd, width, height, g_depth); |
bitmap = XCreatePixmap(g_display, g_wnd, width, height, g_depth); |
1321 |
image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, |
image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, |
1322 |
(char *) tdata, width, height, g_server_bpp == 8 ? 8 : g_bpp, 0); |
(char *) tdata, width, height, bitmap_pad, 0); |
1323 |
|
|
1324 |
XPutImage(g_display, bitmap, g_gc, image, 0, 0, 0, 0, width, height); |
XPutImage(g_display, bitmap, g_gc, image, 0, 0, 0, 0, width, height); |
1325 |
|
|
1334 |
{ |
{ |
1335 |
XImage *image; |
XImage *image; |
1336 |
uint8 *tdata; |
uint8 *tdata; |
1337 |
|
int bitmap_pad; |
1338 |
|
|
1339 |
|
if (g_server_bpp == 8) |
1340 |
|
{ |
1341 |
|
bitmap_pad = 8; |
1342 |
|
} |
1343 |
|
else |
1344 |
|
{ |
1345 |
|
bitmap_pad = g_bpp; |
1346 |
|
|
1347 |
|
if (g_bpp == 24) |
1348 |
|
bitmap_pad = 32; |
1349 |
|
} |
1350 |
|
|
1351 |
tdata = (g_owncolmap ? data : translate_image(width, height, data)); |
tdata = (g_owncolmap ? data : translate_image(width, height, data)); |
1352 |
image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, |
image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, |
1353 |
(char *) tdata, width, height, g_server_bpp == 8 ? 8 : g_bpp, 0); |
(char *) tdata, width, height, bitmap_pad, 0); |
1354 |
|
|
1355 |
if (g_ownbackstore) |
if (g_ownbackstore) |
1356 |
{ |
{ |