Fixed some bugs.
[wine/multimedia.git] / dlls / quartz / videoblt.c
blob07a01d3e1eae8f0a27aaebc17fb6a0d7b84a4b76
1 /*
2 * Copyright (C) Hidenori TAKESHIMA
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.
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.
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
19 #include "config.h"
21 #include "windef.h"
22 #include "wingdi.h"
24 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
27 #include "videoblt.h"
30 #define QUARTZ_LOBYTE(pix) ((BYTE)((pix)&0xff))
31 #define QUARTZ_HIBYTE(pix) ((BYTE)((pix)>>8))
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 )
39 LONG x,y;
41 for ( y = 0; y < height; y++ )
43 for ( x = 0; x < width; x++ )
45 *pDst++ = ((pSrc[2]&0xe0) ) |
46 ((pSrc[1]&0xe0)>>3) |
47 ((pSrc[0]&0xc0)>>6);
48 pSrc += 3;
50 pDst += pitchDst - width;
51 pSrc += pitchSrc - width*3;
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 )
61 LONG x,y;
62 unsigned pix;
64 for ( y = 0; y < height; y++ )
66 for ( x = 0; x < width; x++ )
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;
75 pDst += pitchDst - width*2;
76 pSrc += pitchSrc - width*3;
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 )
86 LONG x,y;
87 unsigned pix;
89 for ( y = 0; y < height; y++ )
91 for ( x = 0; x < width; x++ )
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;
100 pDst += pitchDst - width*2;
101 pSrc += pitchSrc - width*3;
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 )
111 LONG x,y;
113 for ( y = 0; y < height; y++ )
115 for ( x = 0; x < width; x++ )
117 *pDst++ = *pSrc++;
118 *pDst++ = *pSrc++;
119 *pDst++ = *pSrc++;
120 *pDst++ = (BYTE)0xff;
122 pDst += pitchDst - width*4;
123 pSrc += pitchSrc - width*3;