Now using the NT CD interface.
[wine] / dlls / quartz / videoblt.c
1 #include "config.h"
2
3 #include "windef.h"
4 #include "wingdi.h"
5
6 #include "debugtools.h"
7 DEFAULT_DEBUG_CHANNEL(quartz);
8
9 #include "videoblt.h"
10
11
12 #define QUARTZ_LOBYTE(pix)      ((BYTE)((pix)&0xff))
13 #define QUARTZ_HIBYTE(pix)      ((BYTE)((pix)>>8))
14
15 void VIDEOBLT_Blt_888_to_332(
16         BYTE* pDst, LONG pitchDst,
17         const BYTE* pSrc, LONG pitchSrc,
18         LONG width, LONG height,
19         const RGBQUAD* prgbSrc, LONG nClrUsed )
20 {
21         LONG x,y;
22
23         for ( y = 0; y < height; y++ )
24         {
25                 for ( x = 0; x < width; x++ )
26                 {
27                         *pDst++ = ((pSrc[2]&0xe0)   ) |
28                                           ((pSrc[1]&0xe0)>>3) |
29                                           ((pSrc[0]&0xc0)>>6);
30                         pSrc += 3;
31                 }
32                 pDst += pitchDst - width;
33                 pSrc += pitchSrc - width*3;
34         }
35 }
36
37 void VIDEOBLT_Blt_888_to_555(
38         BYTE* pDst, LONG pitchDst,
39         const BYTE* pSrc, LONG pitchSrc,
40         LONG width, LONG height,
41         const RGBQUAD* prgbSrc, LONG nClrUsed )
42 {
43         LONG x,y;
44         unsigned pix;
45
46         for ( y = 0; y < height; y++ )
47         {
48                 for ( x = 0; x < width; x++ )
49                 {
50                         pix = ((unsigned)(pSrc[2]&0xf8)<<7) |
51                                   ((unsigned)(pSrc[1]&0xf8)<<2) |
52                                   ((unsigned)(pSrc[0]&0xf8)>>3);
53                         *pDst++ = QUARTZ_LOBYTE(pix);
54                         *pDst++ = QUARTZ_HIBYTE(pix);
55                         pSrc += 3;
56                 }
57                 pDst += pitchDst - width*2;
58                 pSrc += pitchSrc - width*3;
59         }
60 }
61
62 void VIDEOBLT_Blt_888_to_565(
63         BYTE* pDst, LONG pitchDst,
64         const BYTE* pSrc, LONG pitchSrc,
65         LONG width, LONG height,
66         const RGBQUAD* prgbSrc, LONG nClrUsed )
67 {
68         LONG x,y;
69         unsigned pix;
70
71         for ( y = 0; y < height; y++ )
72         {
73                 for ( x = 0; x < width; x++ )
74                 {
75                         pix = ((unsigned)(pSrc[2]&0xf8)<<8) |
76                                   ((unsigned)(pSrc[1]&0xfc)<<3) |
77                                   ((unsigned)(pSrc[0]&0xf8)>>3);
78                         *pDst++ = QUARTZ_LOBYTE(pix);
79                         *pDst++ = QUARTZ_HIBYTE(pix);
80                         pSrc += 3;
81                 }
82                 pDst += pitchDst - width*2;
83                 pSrc += pitchSrc - width*3;
84         }
85 }
86
87 void VIDEOBLT_Blt_888_to_8888(
88         BYTE* pDst, LONG pitchDst,
89         const BYTE* pSrc, LONG pitchSrc,
90         LONG width, LONG height,
91         const RGBQUAD* prgbSrc, LONG nClrUsed )
92 {
93         LONG x,y;
94
95         for ( y = 0; y < height; y++ )
96         {
97                 for ( x = 0; x < width; x++ )
98                 {
99                         *pDst++ = *pSrc++;
100                         *pDst++ = *pSrc++;
101                         *pDst++ = *pSrc++;
102                         *pDst++ = (BYTE)0xff;
103                 }
104                 pDst += pitchDst - width*4;
105                 pSrc += pitchSrc - width*3;
106         }
107 }
108