641 |
{ |
{ |
642 |
HBITMAP bitmap; |
HBITMAP bitmap; |
643 |
uint16 cache_idx, bufsize; |
uint16 cache_idx, bufsize; |
644 |
uint8 cache_id, width, height, bpp; |
uint8 cache_id, width, height, bpp, Bpp; |
645 |
uint8 *data, *inverted; |
uint8 *data, *inverted; |
646 |
int y; |
int y; |
647 |
|
|
650 |
in_uint8(s, width); |
in_uint8(s, width); |
651 |
in_uint8(s, height); |
in_uint8(s, height); |
652 |
in_uint8(s, bpp); |
in_uint8(s, bpp); |
653 |
|
Bpp = (bpp + 7) / 8; |
654 |
in_uint16_le(s, bufsize); |
in_uint16_le(s, bufsize); |
655 |
in_uint16_le(s, cache_idx); |
in_uint16_le(s, cache_idx); |
656 |
in_uint8p(s, data, bufsize); |
in_uint8p(s, data, bufsize); |
|
if (bpp != 8) /* todo */ |
|
|
return; |
|
657 |
|
|
658 |
DEBUG(("RAW_BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx)); |
DEBUG(("RAW_BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx)); |
659 |
inverted = xmalloc(width * height); |
inverted = xmalloc(width * height * Bpp); |
660 |
for (y = 0; y < height; y++) |
for (y = 0; y < height; y++) |
661 |
{ |
{ |
662 |
memcpy(&inverted[(height - y - 1) * width], &data[y * width], width); |
memcpy(&inverted[(height - y - 1) * (width * Bpp)], &data[y * (width * Bpp)], width * Bpp); |
663 |
} |
} |
664 |
|
|
665 |
bitmap = ui_create_bitmap(width, height, inverted); |
bitmap = ui_create_bitmap(width, height, inverted); |
673 |
{ |
{ |
674 |
HBITMAP bitmap; |
HBITMAP bitmap; |
675 |
uint16 cache_idx, size; |
uint16 cache_idx, size; |
676 |
uint8 cache_id, width, height, bpp; |
uint8 cache_id, width, height, bpp, Bpp; |
677 |
uint8 *data, *bmpdata; |
uint8 *data, *bmpdata; |
678 |
|
|
679 |
in_uint8(s, cache_id); |
in_uint8(s, cache_id); |
681 |
in_uint8(s, width); |
in_uint8(s, width); |
682 |
in_uint8(s, height); |
in_uint8(s, height); |
683 |
in_uint8(s, bpp); |
in_uint8(s, bpp); |
684 |
|
Bpp = (bpp + 7) / 8; |
685 |
in_uint8s(s, 2); /* bufsize */ |
in_uint8s(s, 2); /* bufsize */ |
686 |
in_uint16_le(s, cache_idx); |
in_uint16_le(s, cache_idx); |
687 |
in_uint8s(s, 2); /* pad */ |
in_uint8s(s, 2); /* pad */ |
688 |
in_uint16_le(s, size); |
in_uint16_le(s, size); |
689 |
in_uint8s(s, 4); /* row_size, final_size */ |
in_uint8s(s, 4); /* row_size, final_size */ |
690 |
in_uint8p(s, data, size); |
in_uint8p(s, data, size); |
|
if (bpp != 8) /* todo */ |
|
|
return; |
|
691 |
|
|
692 |
DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx)); |
DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx)); |
693 |
|
|
694 |
bmpdata = xmalloc(width * height); |
bmpdata = xmalloc(width * height * Bpp); |
695 |
|
|
696 |
if (bitmap_decompress(bmpdata, width, height, data, size, bpp)) |
if (bitmap_decompress(bmpdata, width, height, data, size, Bpp)) |
697 |
{ |
{ |
698 |
bitmap = ui_create_bitmap(width, height, bmpdata); |
bitmap = ui_create_bitmap(width, height, bmpdata); |
699 |
cache_put_bitmap(cache_id, cache_idx, bitmap); |
cache_put_bitmap(cache_id, cache_idx, bitmap); |