Changed DOS extended error handling to be based on SetLastError;
[wine/multimedia.git] / graphics / bitblt.c
blob4576d0b74a637b67ef778692d96c8096f2a18e52
1 /*
2 * GDI bit-blit operations
4 * Copyright 1993, 1994 Alexandre Julliard
5 */
7 #include "dc.h"
8 #include "debug.h"
11 /***********************************************************************
12 * PatBlt16 (GDI.29)
14 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
15 INT16 width, INT16 height, DWORD rop)
17 DC * dc = DC_GetDCPtr( hdc );
18 if (!dc || !dc->funcs->pPatBlt) return FALSE;
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 );
26 /***********************************************************************
27 * PatBlt32 (GDI32.260)
29 BOOL32 WINAPI PatBlt32( HDC32 hdc, INT32 left, INT32 top,
30 INT32 width, INT32 height, DWORD rop)
32 DC * dc = DC_GetDCPtr( hdc );
33 if (!dc || !dc->funcs->pPatBlt) return FALSE;
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 );
41 /***********************************************************************
42 * BitBlt16 (GDI.34)
44 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
45 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
46 DWORD rop )
48 DC *dcDst, *dcSrc;
50 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
51 if (!dcDst->funcs->pBitBlt) return FALSE;
52 dcSrc = DC_GetDCPtr( hdcSrc );
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 );
62 /***********************************************************************
63 * BitBlt32 (GDI32.10)
65 BOOL32 WINAPI BitBlt32( HDC32 hdcDst, INT32 xDst, INT32 yDst, INT32 width,
66 INT32 height, HDC32 hdcSrc, INT32 xSrc, INT32 ySrc,
67 DWORD rop )
69 DC *dcDst, *dcSrc;
71 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
72 if (!dcDst->funcs->pBitBlt) return FALSE;
73 dcSrc = DC_GetDCPtr( hdcSrc );
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 );
83 /***********************************************************************
84 * StretchBlt16 (GDI.35)
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 )
91 DC *dcDst, *dcSrc;
93 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
94 if (!dcDst->funcs->pStretchBlt) return FALSE;
95 dcSrc = DC_GetDCPtr( hdcSrc );
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 );
107 /***********************************************************************
108 * StretchBlt32 (GDI32.350)
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 )
115 DC *dcDst, *dcSrc;
117 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
118 if (!dcDst->funcs->pStretchBlt) return FALSE;
119 dcSrc = DC_GetDCPtr( hdcSrc );
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 );
131 /***********************************************************************
132 * FastWindowFrame (GDI.400)
134 BOOL16 WINAPI FastWindowFrame( HDC16 hdc, const RECT16 *rect,
135 INT16 width, INT16 height, DWORD rop )
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;
149 /***********************************************************************
150 * MaskBlt32 [GDI32.252]
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)
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;
163 /*********************************************************************
164 * PlgBlt [GDI.267]
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)
171 FIXME(gdi, "PlgBlt, stub\n");
172 return 1;