Implement ResetDC and PHYSICALOFFSET[X|Y] devcaps.
[wine] / dlls / quartz / videoblt.c
1 /*
2  * Copyright (C) Hidenori TAKESHIMA
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include "config.h"
20
21 #include "windef.h"
22 #include "wingdi.h"
23
24 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
26
27 #include "videoblt.h"
28
29
30 #define QUARTZ_LOBYTE(pix)      ((BYTE)((pix)&0xff))
31 #define QUARTZ_HIBYTE(pix)      ((BYTE)((pix)>>8))
32
33 void VIDEOBLT_Blt_888_to_332(
34         BYTE* pDst, LONG pitchDst,
35         const BYTE* pSrc, LONG pitchSrc,
36         LONG width, LONG height,
37         const RGBQUAD* prgbSrc, LONG nClrUsed )
38 {
39         LONG x,y;
40
41         for ( y = 0; y < height; y++ )
42         {
43                 for ( x = 0; x < width; x++ )
44                 {
45                         *pDst++ = ((pSrc[2]&0xe0)   ) |
46                                           ((pSrc[1]&0xe0)>>3) |
47                                           ((pSrc[0]&0xc0)>>6);
48                         pSrc += 3;
49                 }
50                 pDst += pitchDst - width;
51                 pSrc += pitchSrc - width*3;
52         }
53 }
54
55 void VIDEOBLT_Blt_888_to_555(
56         BYTE* pDst, LONG pitchDst,
57         const BYTE* pSrc, LONG pitchSrc,
58         LONG width, LONG height,
59         const RGBQUAD* prgbSrc, LONG nClrUsed )
60 {
61         LONG x,y;
62         unsigned pix;
63
64         for ( y = 0; y < height; y++ )
65         {
66                 for ( x = 0; x < width; x++ )
67                 {
68                         pix = ((unsigned)(pSrc[2]&0xf8)<<7) |
69                                   ((unsigned)(pSrc[1]&0xf8)<<2) |
70                                   ((unsigned)(pSrc[0]&0xf8)>>3);
71                         *pDst++ = QUARTZ_LOBYTE(pix);
72                         *pDst++ = QUARTZ_HIBYTE(pix);
73                         pSrc += 3;
74                 }
75                 pDst += pitchDst - width*2;
76                 pSrc += pitchSrc - width*3;
77         }
78 }
79
80 void VIDEOBLT_Blt_888_to_565(
81         BYTE* pDst, LONG pitchDst,
82         const BYTE* pSrc, LONG pitchSrc,
83         LONG width, LONG height,
84         const RGBQUAD* prgbSrc, LONG nClrUsed )
85 {
86         LONG x,y;
87         unsigned pix;
88
89         for ( y = 0; y < height; y++ )
90         {
91                 for ( x = 0; x < width; x++ )
92                 {
93                         pix = ((unsigned)(pSrc[2]&0xf8)<<8) |
94                                   ((unsigned)(pSrc[1]&0xfc)<<3) |
95                                   ((unsigned)(pSrc[0]&0xf8)>>3);
96                         *pDst++ = QUARTZ_LOBYTE(pix);
97                         *pDst++ = QUARTZ_HIBYTE(pix);
98                         pSrc += 3;
99                 }
100                 pDst += pitchDst - width*2;
101                 pSrc += pitchSrc - width*3;
102         }
103 }
104
105 void VIDEOBLT_Blt_888_to_8888(
106         BYTE* pDst, LONG pitchDst,
107         const BYTE* pSrc, LONG pitchSrc,
108         LONG width, LONG height,
109         const RGBQUAD* prgbSrc, LONG nClrUsed )
110 {
111         LONG x,y;
112
113         for ( y = 0; y < height; y++ )
114         {
115                 for ( x = 0; x < width; x++ )
116                 {
117                         *pDst++ = *pSrc++;
118                         *pDst++ = *pSrc++;
119                         *pDst++ = *pSrc++;
120                         *pDst++ = (BYTE)0xff;
121                 }
122                 pDst += pitchDst - width*4;
123                 pSrc += pitchSrc - width*3;
124         }
125 }
126