clarify PicoDrive's license
[picodrive.git] / platform / linux / blit.c
1 /*
2  * PicoDrive
3  * (C) notaz, 2006,2009
4  *
5  * This work is licensed under the terms of MAME license.
6  * See COPYING file in the top-level directory.
7  */
8
9 // Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0
10 // to      00000000 rrr00000 ggg00000 bbb00000 ...
11 // TODO: rm when gp2x/emu.c is no longer used
12
13 void bgr444_to_rgb32(void *to, void *from)
14 {
15         unsigned short *ps = from;
16         unsigned int   *pd = to;
17         int pixels;
18
19         for (pixels = 0x40; pixels; pixels--, ps++, pd++)
20         {
21                 *pd = ((*ps<<20)&0xe00000) | ((*ps<<8)&0xe000) | ((*ps>>4)&0xe0);
22                 *pd |= *pd >> 3;
23         }
24 }
25
26 void bgr444_to_rgb32_sh(void *to, void *from)
27 {
28         unsigned short *ps = from;
29         unsigned int   *pd = to;
30         int pixels;
31
32         pd += 0x40;
33         for (pixels = 0x40; pixels; pixels--, ps++, pd++)
34         {
35                 *pd = ((*ps<<20)&0xe00000) | ((*ps<<8)&0xe000) | ((*ps>>4)&0xe0);
36                 *pd >>= 1;
37                 *pd |= *pd >> 3;
38                 pd[0x40*2] = *pd;
39         }
40
41         ps -= 0x40;
42         for (pixels = 0x40; pixels; pixels--, ps++, pd++)
43         {
44                 *pd = ((*ps<<20)&0xe00000) | ((*ps<<8)&0xe000) | ((*ps>>4)&0xe0);
45                 continue;
46                 *pd += 0x00404040;
47                 if (*pd & 0x01000000) *pd |= 0x00e00000;
48                 if (*pd & 0x00010000) *pd |= 0x0000e000;
49                 if (*pd & 0x00000100) *pd |= 0x000000e0;
50                 *pd &= 0x00e0e0e0;
51                 *pd |= *pd >> 3;
52         }
53 }
54
55 void vidcpy_m2(void *dest, void *src, int m32col, int with_32c_border)
56 {
57         unsigned char *pd = dest, *ps = src;
58         int i, u;
59
60         if (m32col) {
61                 for (i = 0; i < 224; i++)
62                 {
63                         ps += 8;
64                         pd += 32;
65                         for (u = 0; u < 256; u++)
66                                 *pd++ = *ps++;
67                         ps += 64;
68                         pd += 32;
69                 }
70         } else {
71                 for (i = 0; i < 224; i++)
72                 {
73                         ps += 8;
74                         for (u = 0; u < 320; u++)
75                                 *pd++ = *ps++;
76                 }
77         }
78 }
79
80 void vidcpy_m2_rot(void *dest, void *src, int m32col, int with_32c_border)
81 {
82 }
83
84 void rotated_blit8 (void *dst, void *linesx4, int y, int is_32col)
85 {
86 }
87
88 void rotated_blit16(void *dst, void *linesx4, int y, int is_32col)
89 {
90 }