Changed CreateDirectory LastError returns to match Win32 (found out by
[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 BOOL WINAPI PatBlt( HDC hdc, INT left, INT top,
30                         INT width, INT 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 BOOL WINAPI BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
66                         INT height, HDC hdcSrc, INT xSrc, INT 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 BOOL WINAPI StretchBlt( HDC hdcDst, INT xDst, INT yDst,
111                             INT widthDst, INT heightDst,
112                             HDC hdcSrc, INT xSrc, INT ySrc,
113                             INT widthSrc, INT 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 FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
135                                INT16 width, INT16 height, DWORD rop )
136 {
137     HBRUSH hbrush = SelectObject( hdc, GetStockObject( GRAY_BRUSH ) );
138     PatBlt( hdc, rect->left, rect->top,
139               rect->right - rect->left - width, height, rop );
140     PatBlt( hdc, rect->left, rect->top + height, width,
141               rect->bottom - rect->top - height, rop );
142     PatBlt( hdc, rect->left + width, rect->bottom,
143               rect->right - rect->left - width, -height, rop );
144     PatBlt( hdc, rect->right, rect->top, -width, 
145               rect->bottom - rect->top - height, rop );
146     SelectObject( hdc, hbrush );
147     return TRUE;
148 }
149 /***********************************************************************
150  *           MaskBlt32 [GDI32.252]
151  */
152 BOOL WINAPI MaskBlt(HDC hdcDest, INT nXDest, INT nYDest,
153                         INT nWidth, INT nHeight, HDC hdcSource,
154                         INT nXSrc, INT nYSrc, HBITMAP hbmMask,
155                         INT xMask, INT 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 BOOL WINAPI PlgBlt( HDC hdcDest, const POINT *lpPoint,
168                         HDC hdcSrc, INT nXDest, INT nYDest, INT nWidth,
169                         INT nHeight, HBITMAP hbmMask, INT xMask, INT yMask)
170 {
171         FIXME(gdi, "PlgBlt, stub\n");
172         return 1;
173 }
174