Release 971221
[wine.git] / graphics / bitblt.c
blob2356de8f150aef898a5e036b7f12bfeb4c0ce6c7
1 /*
2 * GDI bit-blit operations
4 * Copyright 1993, 1994 Alexandre Julliard
5 */
7 #include "dc.h"
8 #include "stddebug.h"
9 #include "debug.h"
12 /***********************************************************************
13 * PatBlt16 (GDI.29)
15 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
16 INT16 width, INT16 height, DWORD rop)
18 DC * dc = DC_GetDCPtr( hdc );
19 if (!dc || !dc->funcs->pPatBlt) return FALSE;
21 dprintf_bitblt( stddeb, "PatBlt16: %04x %d,%d %dx%d %06lx\n",
22 hdc, left, top, width, height, rop );
23 return dc->funcs->pPatBlt( dc, left, top, width, height, rop );
27 /***********************************************************************
28 * PatBlt32 (GDI32.260)
30 BOOL32 WINAPI PatBlt32( HDC32 hdc, INT32 left, INT32 top,
31 INT32 width, INT32 height, DWORD rop)
33 DC * dc = DC_GetDCPtr( hdc );
34 if (!dc || !dc->funcs->pPatBlt) return FALSE;
36 dprintf_bitblt( stddeb, "PatBlt32: %04x %d,%d %dx%d %06lx\n",
37 hdc, left, top, width, height, rop );
38 return dc->funcs->pPatBlt( dc, left, top, width, height, rop );
42 /***********************************************************************
43 * BitBlt16 (GDI.34)
45 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
46 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
47 DWORD rop )
49 DC *dcDst, *dcSrc;
51 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
52 if (!dcDst->funcs->pBitBlt) return FALSE;
53 dcSrc = DC_GetDCPtr( hdcSrc );
55 dprintf_bitblt(stddeb,
56 "BitBlt16: hdcSrc=%04x %d,%d %d bpp -> hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n",
57 hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
58 hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
59 return dcDst->funcs->pBitBlt( dcDst, xDst, yDst, width, height,
60 dcSrc, xSrc, ySrc, rop );
64 /***********************************************************************
65 * BitBlt32 (GDI32.10)
67 BOOL32 WINAPI BitBlt32( HDC32 hdcDst, INT32 xDst, INT32 yDst, INT32 width,
68 INT32 height, HDC32 hdcSrc, INT32 xSrc, INT32 ySrc,
69 DWORD rop )
71 DC *dcDst, *dcSrc;
73 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
74 if (!dcDst->funcs->pBitBlt) return FALSE;
75 dcSrc = DC_GetDCPtr( hdcSrc );
77 dprintf_bitblt(stddeb,
78 "BitBlt32: hdcSrc=%04x %d,%d %d bpp -> hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n",
79 hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
80 hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
81 return dcDst->funcs->pBitBlt( dcDst, xDst, yDst, width, height,
82 dcSrc, xSrc, ySrc, rop );
86 /***********************************************************************
87 * StretchBlt16 (GDI.35)
89 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
90 INT16 widthDst, INT16 heightDst,
91 HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
92 INT16 widthSrc, INT16 heightSrc, DWORD rop )
94 DC *dcDst, *dcSrc;
96 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
97 if (!dcDst->funcs->pStretchBlt) return FALSE;
98 dcSrc = DC_GetDCPtr( hdcSrc );
100 dprintf_bitblt(stddeb,
101 "StretchBlt16: %04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n",
102 hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
103 dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst,
104 widthDst, heightDst, dcDst->w.bitsPerPixel, rop );
105 return dcDst->funcs->pStretchBlt( dcDst, xDst, yDst, widthDst, heightDst,
106 dcSrc, xSrc, ySrc, widthSrc, heightSrc,
107 rop );
111 /***********************************************************************
112 * StretchBlt32 (GDI32.350)
114 BOOL32 WINAPI StretchBlt32( HDC32 hdcDst, INT32 xDst, INT32 yDst,
115 INT32 widthDst, INT32 heightDst,
116 HDC32 hdcSrc, INT32 xSrc, INT32 ySrc,
117 INT32 widthSrc, INT32 heightSrc, DWORD rop )
119 DC *dcDst, *dcSrc;
121 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
122 if (!dcDst->funcs->pStretchBlt) return FALSE;
123 dcSrc = DC_GetDCPtr( hdcSrc );
125 dprintf_bitblt(stddeb,
126 "StretchBlt32: %04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n",
127 hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
128 dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst,
129 widthDst, heightDst, dcDst->w.bitsPerPixel, rop );
130 return dcDst->funcs->pStretchBlt( dcDst, xDst, yDst, widthDst, heightDst,
131 dcSrc, xSrc, ySrc, widthSrc, heightSrc,
132 rop );
136 /***********************************************************************
137 * FastWindowFrame (GDI.400)
139 BOOL16 WINAPI FastWindowFrame( HDC16 hdc, const RECT16 *rect,
140 INT16 width, INT16 height, DWORD rop )
142 HBRUSH32 hbrush = SelectObject32( hdc, GetStockObject32( GRAY_BRUSH ) );
143 PatBlt32( hdc, rect->left, rect->top,
144 rect->right - rect->left - width, height, rop );
145 PatBlt32( hdc, rect->left, rect->top + height, width,
146 rect->bottom - rect->top - height, rop );
147 PatBlt32( hdc, rect->left + width, rect->bottom,
148 rect->right - rect->left - width, -height, rop );
149 PatBlt32( hdc, rect->right, rect->top, -width,
150 rect->bottom - rect->top - height, rop );
151 SelectObject32( hdc, hbrush );
152 return TRUE;