sram bugfix + savestate refactoring
[picodrive.git] / platform / linux / blit.c
CommitLineData
cc68a136 1
2// Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0
3// to 00000000 rrr00000 ggg00000 bbb00000 ...
645ec129 4// TODO: rm when gp2x/emu.c is no longer used
cc68a136 5
6void vidConvCpyRGB32 (void *to, void *from, int pixels)
7{
8 unsigned short *ps = from;
9 unsigned int *pd = to;
10
11 for (; pixels; pixels--, ps++, pd++)
12 {
13 *pd = ((*ps<<20)&0xe00000) | ((*ps<<8)&0xe000) | ((*ps>>4)&0xe0);
14 *pd |= *pd >> 3;
15 }
16}
17
18void vidConvCpyRGB32sh(void *to, void *from, int pixels)
19{
20 unsigned short *ps = from;
21 unsigned int *pd = to;
22
23 for (; pixels; pixels--, ps++, pd++)
24 {
25 *pd = ((*ps<<20)&0xe00000) | ((*ps<<8)&0xe000) | ((*ps>>4)&0xe0);
26 *pd >>= 1;
27 *pd |= *pd >> 3;
28 }
29}
30
31void vidConvCpyRGB32hi(void *to, void *from, int pixels)
32{
33 unsigned short *ps = from;
34 unsigned int *pd = to;
35
36 for (; pixels; pixels--, ps++, pd++)
37 {
38 *pd = ((*ps<<20)&0xe00000) | ((*ps<<8)&0xe000) | ((*ps>>4)&0xe0);
39 continue;
40 *pd += 0x00404040;
41 if (*pd & 0x01000000) *pd |= 0x00e00000;
42 if (*pd & 0x00010000) *pd |= 0x0000e000;
43 if (*pd & 0x00000100) *pd |= 0x000000e0;
44 *pd &= 0x00e0e0e0;
45 *pd |= *pd >> 3;
46 }
47}
48
645ec129 49void vidcpy_m2(void *dest, void *src, int m32col, int with_32c_border)
cc68a136 50{
51 unsigned char *pd = dest, *ps = src;
52 int i, u;
53
645ec129 54 if (m32col) {
55 for (i = 0; i < 224; i++)
56 {
57 ps += 8;
58 pd += 32;
59 for (u = 0; u < 256; u++)
60 *pd++ = *ps++;
61 ps += 64;
62 pd += 32;
63 }
64 } else {
65 for (i = 0; i < 224; i++)
66 {
67 ps += 8;
68 for (u = 0; u < 320; u++)
69 *pd++ = *ps++;
70 }
cc68a136 71 }
72}
73
645ec129 74void vidcpy_m2_rot(void *dest, void *src, int m32col, int with_32c_border)
cc68a136 75{
cc68a136 76}
77
645ec129 78void rotated_blit8 (void *dst, void *linesx4, int y, int is_32col)
cc68a136 79{
cc68a136 80}
81
645ec129 82void rotated_blit16(void *dst, void *linesx4, int y, int is_32col)
83{
84}