WinG fixes.
[wine] / graphics / bitblt.c
1 /*
2  * GDI bit-blit operations
3  *
4  * Copyright 1993, 1994  Alexandre Julliard
5  */
6
7 #include "dc.h"
8 #include "debug.h"
9
10
11 /***********************************************************************
12  *           PatBlt16    (GDI.29)
13  */
14 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
15                         INT16 width, INT16 height, DWORD rop)
16 {
17     DC * dc = DC_GetDCPtr( hdc );
18     if (!dc || !dc->funcs->pPatBlt) return FALSE;
19
20     TRACE(bitblt, "%04x %d,%d %dx%d %06lx\n",
21                     hdc, left, top, width, height, rop );
22     return dc->funcs->pPatBlt( dc, left, top, width, height, rop );
23 }
24
25
26 /***********************************************************************
27  *           PatBlt32    (GDI32.260)
28  */
29 BOOL32 WINAPI PatBlt32( HDC32 hdc, INT32 left, INT32 top,
30                         INT32 width, INT32 height, DWORD rop)
31 {
32     DC * dc = DC_GetDCPtr( hdc );
33     if (!dc || !dc->funcs->pPatBlt) return FALSE;
34
35     TRACE(bitblt, "%04x %d,%d %dx%d %06lx\n",
36                     hdc, left, top, width, height, rop );
37     return dc->funcs->pPatBlt( dc, left, top, width, height, rop );
38 }
39
40
41 /***********************************************************************
42  *           BitBlt16    (GDI.34)
43  */
44 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
45                         INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
46                         DWORD rop )
47 {
48     DC *dcDst, *dcSrc;
49
50     if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
51     if (!dcDst->funcs->pBitBlt) return FALSE;
52     dcSrc = DC_GetDCPtr( hdcSrc );
53
54     TRACE(bitblt, "hdcSrc=%04x %d,%d %d bpp -> hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n",
55                  hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
56                  hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
57     return dcDst->funcs->pBitBlt( dcDst, xDst, yDst, width, height,
58                                   dcSrc, xSrc, ySrc, rop );
59 }
60
61
62 /***********************************************************************
63  *           BitBlt32    (GDI32.10)
64  */
65 BOOL32 WINAPI BitBlt32( HDC32 hdcDst, INT32 xDst, INT32 yDst, INT32 width,
66                         INT32 height, HDC32 hdcSrc, INT32 xSrc, INT32 ySrc,
67                         DWORD rop )
68 {
69     DC *dcDst, *dcSrc;
70
71     if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
72     if (!dcDst->funcs->pBitBlt) return FALSE;
73     dcSrc = DC_GetDCPtr( hdcSrc );
74
75     TRACE(bitblt, "hdcSrc=%04x %d,%d %d bpp -> hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n",
76                  hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
77                  hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
78     return dcDst->funcs->pBitBlt( dcDst, xDst, yDst, width, height,
79                                   dcSrc, xSrc, ySrc, rop );
80 }
81
82
83 /***********************************************************************
84  *           StretchBlt16    (GDI.35)
85  */
86 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
87                             INT16 widthDst, INT16 heightDst,
88                             HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
89                             INT16 widthSrc, INT16 heightSrc, DWORD rop )
90 {
91     DC *dcDst, *dcSrc;
92
93     if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
94     if (!dcDst->funcs->pStretchBlt) return FALSE;
95     dcSrc = DC_GetDCPtr( hdcSrc );
96
97     TRACE(bitblt, "%04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n",
98                  hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
99                  dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst,
100                  widthDst, heightDst, dcDst->w.bitsPerPixel, rop );
101     return dcDst->funcs->pStretchBlt( dcDst, xDst, yDst, widthDst, heightDst,
102                                       dcSrc, xSrc, ySrc, widthSrc, heightSrc,
103                                       rop );
104 }
105
106
107 /***********************************************************************
108  *           StretchBlt32    (GDI32.350)
109  */
110 BOOL32 WINAPI StretchBlt32( HDC32 hdcDst, INT32 xDst, INT32 yDst,
111                             INT32 widthDst, INT32 heightDst,
112                             HDC32 hdcSrc, INT32 xSrc, INT32 ySrc,
113                             INT32 widthSrc, INT32 heightSrc, DWORD rop )
114 {
115     DC *dcDst, *dcSrc;
116
117     if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
118     if (!dcDst->funcs->pStretchBlt) return FALSE;
119     dcSrc = DC_GetDCPtr( hdcSrc );
120
121     TRACE(bitblt, "%04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n",
122                  hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
123                  dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst,
124                  widthDst, heightDst, dcDst->w.bitsPerPixel, rop );
125     return dcDst->funcs->pStretchBlt( dcDst, xDst, yDst, widthDst, heightDst,
126                                       dcSrc, xSrc, ySrc, widthSrc, heightSrc,
127                                       rop );
128 }
129
130
131 /***********************************************************************
132  *           FastWindowFrame    (GDI.400)
133  */
134 BOOL16 WINAPI FastWindowFrame( HDC16 hdc, const RECT16 *rect,
135                                INT16 width, INT16 height, DWORD rop )
136 {
137     HBRUSH32 hbrush = SelectObject32( hdc, GetStockObject32( GRAY_BRUSH ) );
138     PatBlt32( hdc, rect->left, rect->top,
139               rect->right - rect->left - width, height, rop );
140     PatBlt32( hdc, rect->left, rect->top + height, width,
141               rect->bottom - rect->top - height, rop );
142     PatBlt32( hdc, rect->left + width, rect->bottom,
143               rect->right - rect->left - width, -height, rop );
144     PatBlt32( hdc, rect->right, rect->top, -width, 
145               rect->bottom - rect->top - height, rop );
146     SelectObject32( hdc, hbrush );
147     return TRUE;
148 }
149 /***********************************************************************
150  *           MaskBlt32 [GDI32.252]
151  */
152 BOOL32 WINAPI MaskBlt32(HDC32 hdcDest, INT32 nXDest, INT32 nYDest,
153                         INT32 nWidth, INT32 nHeight, HDC32 hdcSource,
154                         INT32 nXSrc, INT32 nYSrc, HBITMAP32 hbmMask,
155                         INT32 xMask, INT32 yMask, DWORD dwRop)
156 {
157     FIXME(bitmap, "(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%ld): stub\n",
158              hdcDest,nXDest,nYDest,nWidth,nHeight,hdcSource,nXSrc,nYSrc,
159              hbmMask,xMask,yMask,dwRop);
160     return 1;
161 }
162   
163 /*********************************************************************
164  *      PlgBlt [GDI.267]
165  *
166  */
167 BOOL32 WINAPI PlgBlt32( HDC32 hdcDest, const POINT32 *lpPoint,
168                         HDC32 hdcSrc, INT32 nXDest, INT32 nYDest, INT32 nWidth,
169                         INT32 nHeight, HBITMAP32 hbmMask, INT32 xMask, INT32 yMask)
170 {
171         FIXME(gdi, "PlgBlt, stub\n");
172         return 1;
173 }
174