blob: d876fc64f94fafedaf0fdab131defb8ca7184808 [file] [log] [blame]
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001/*
2 * GDI bit-blit operations
3 *
4 * Copyright 1993, 1994 Alexandre Julliard
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00005 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Alexandre Julliard75d86e11996-11-17 18:59:11 +000019 */
20
Alexandre Julliard2239abb2000-11-05 02:05:07 +000021#include "gdi.h"
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000022#include "wine/debug.h"
Alexandre Julliard75d86e11996-11-17 18:59:11 +000023
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000024WINE_DEFAULT_DEBUG_CHANNEL(bitblt);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000025
Alexandre Julliard75d86e11996-11-17 18:59:11 +000026
27/***********************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +000028 * PatBlt (GDI.29)
Alexandre Julliard75d86e11996-11-17 18:59:11 +000029 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +000030BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
31 INT16 width, INT16 height, DWORD rop)
Alexandre Julliard75d86e11996-11-17 18:59:11 +000032{
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000033 return PatBlt( hdc, left, top, width, height, rop );
Alexandre Julliard75d86e11996-11-17 18:59:11 +000034}
35
36
37/***********************************************************************
Patrik Stridvalld0a41772001-02-14 23:11:17 +000038 * PatBlt (GDI32.@)
Alexandre Julliard75d86e11996-11-17 18:59:11 +000039 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000040BOOL WINAPI PatBlt( HDC hdc, INT left, INT top,
41 INT width, INT height, DWORD rop)
Alexandre Julliard75d86e11996-11-17 18:59:11 +000042{
Alexandre Julliard0baa4e02000-08-22 20:01:47 +000043 DC * dc = DC_GetDCUpdate( hdc );
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000044 BOOL bRet = FALSE;
Alexandre Julliard75d86e11996-11-17 18:59:11 +000045
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000046 if (!dc) return FALSE;
47
48 if (dc->funcs->pPatBlt)
49 {
50 TRACE("%04x %d,%d %dx%d %06lx\n", hdc, left, top, width, height, rop );
Alexandre Julliarde21c15e2002-03-28 22:22:05 +000051 bRet = dc->funcs->pPatBlt( dc->physDev, left, top, width, height, rop );
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000052 }
53 GDI_ReleaseObj( hdc );
54 return bRet;
Alexandre Julliard75d86e11996-11-17 18:59:11 +000055}
56
57
58/***********************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +000059 * BitBlt (GDI.34)
Alexandre Julliard75d86e11996-11-17 18:59:11 +000060 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +000061BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
62 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
63 DWORD rop )
Alexandre Julliard75d86e11996-11-17 18:59:11 +000064{
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000065 return BitBlt( hdcDst, xDst, yDst, width, height, hdcSrc, xSrc, ySrc, rop );
Alexandre Julliard75d86e11996-11-17 18:59:11 +000066}
67
68
69/***********************************************************************
Patrik Stridvalld0a41772001-02-14 23:11:17 +000070 * BitBlt (GDI32.@)
Alexandre Julliard75d86e11996-11-17 18:59:11 +000071 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000072BOOL WINAPI BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000073 INT height, HDC hdcSrc, INT xSrc, INT ySrc, DWORD rop )
Alexandre Julliard75d86e11996-11-17 18:59:11 +000074{
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000075 BOOL ret = FALSE;
Alexandre Julliard75d86e11996-11-17 18:59:11 +000076 DC *dcDst, *dcSrc;
77
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000078 if ((dcSrc = DC_GetDCUpdate( hdcSrc ))) GDI_ReleaseObj( hdcSrc );
79 /* FIXME: there is a race condition here */
80 if ((dcDst = DC_GetDCUpdate( hdcDst )))
81 {
82 dcSrc = DC_GetDCPtr( hdcSrc );
83 TRACE("hdcSrc=%04x %d,%d %d bpp->hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n",
Alexandre Julliard2239abb2000-11-05 02:05:07 +000084 hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->bitsPerPixel : 0,
85 hdcDst, xDst, yDst, width, height, dcDst->bitsPerPixel, rop);
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000086 if (dcDst->funcs->pBitBlt)
Alexandre Julliarde21c15e2002-03-28 22:22:05 +000087 ret = dcDst->funcs->pBitBlt( dcDst->physDev, xDst, yDst, width, height,
Alexandre Julliardc71417c2002-04-02 03:00:00 +000088 dcSrc ? dcSrc->physDev : NULL, xSrc, ySrc, rop );
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000089 if (dcSrc) GDI_ReleaseObj( hdcSrc );
90 GDI_ReleaseObj( hdcDst );
91 }
92 return ret;
Alexandre Julliard75d86e11996-11-17 18:59:11 +000093}
94
95
96/***********************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +000097 * StretchBlt (GDI.35)
Alexandre Julliard75d86e11996-11-17 18:59:11 +000098 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +000099BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
100 INT16 widthDst, INT16 heightDst,
101 HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
102 INT16 widthSrc, INT16 heightSrc, DWORD rop )
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000103{
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000104 return StretchBlt( hdcDst, xDst, yDst, widthDst, heightDst,
105 hdcSrc, xSrc, ySrc, widthSrc, heightSrc, rop );
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000106}
107
108
109/***********************************************************************
Patrik Stridvalld0a41772001-02-14 23:11:17 +0000110 * StretchBlt (GDI32.@)
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000111 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000112BOOL WINAPI StretchBlt( HDC hdcDst, INT xDst, INT yDst,
113 INT widthDst, INT heightDst,
114 HDC hdcSrc, INT xSrc, INT ySrc,
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000115 INT widthSrc, INT heightSrc,
116 DWORD rop )
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000117{
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000118 BOOL ret = FALSE;
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000119 DC *dcDst, *dcSrc;
120
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000121 if ((dcSrc = DC_GetDCUpdate( hdcSrc ))) GDI_ReleaseObj( hdcSrc );
122 /* FIXME: there is a race condition here */
123 if ((dcDst = DC_GetDCUpdate( hdcDst )))
124 {
125 dcSrc = DC_GetDCPtr( hdcSrc );
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000126
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000127 TRACE("%04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n",
128 hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
Alexandre Julliard2239abb2000-11-05 02:05:07 +0000129 dcSrc ? dcSrc->bitsPerPixel : 0, hdcDst, xDst, yDst,
130 widthDst, heightDst, dcDst->bitsPerPixel, rop );
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000131
132 if (dcSrc) {
133 if (dcDst->funcs->pStretchBlt)
Alexandre Julliarde21c15e2002-03-28 22:22:05 +0000134 ret = dcDst->funcs->pStretchBlt( dcDst->physDev, xDst, yDst, widthDst, heightDst,
135 dcSrc->physDev, xSrc, ySrc, widthSrc, heightSrc,
136 rop );
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000137 GDI_ReleaseObj( hdcSrc );
138 }
139 GDI_ReleaseObj( hdcDst );
140 }
141 return ret;
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000142}
143
144
145/***********************************************************************
146 * FastWindowFrame (GDI.400)
147 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000148BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000149 INT16 width, INT16 height, DWORD rop )
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000150{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000151 HBRUSH hbrush = SelectObject( hdc, GetStockObject( GRAY_BRUSH ) );
152 PatBlt( hdc, rect->left, rect->top,
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000153 rect->right - rect->left - width, height, rop );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000154 PatBlt( hdc, rect->left, rect->top + height, width,
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000155 rect->bottom - rect->top - height, rop );
Noomen Hamzab309b371999-09-04 14:25:55 +0000156 PatBlt( hdc, rect->left + width, rect->bottom - 1,
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000157 rect->right - rect->left - width, -height, rop );
Noomen Hamzab309b371999-09-04 14:25:55 +0000158 PatBlt( hdc, rect->right - 1, rect->top, -width,
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000159 rect->bottom - rect->top - height, rop );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000160 SelectObject( hdc, hbrush );
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000161 return TRUE;
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000162
Alexandre Julliard75d86e11996-11-17 18:59:11 +0000163}
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000164
165
Paul Quinn1beaae51998-12-15 15:38:36 +0000166/***********************************************************************
Patrik Stridvalld0a41772001-02-14 23:11:17 +0000167 * MaskBlt [GDI32.@]
Paul Quinn1beaae51998-12-15 15:38:36 +0000168 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000169BOOL WINAPI MaskBlt(HDC hdcDest, INT nXDest, INT nYDest,
170 INT nWidth, INT nHeight, HDC hdcSource,
171 INT nXSrc, INT nYSrc, HBITMAP hbmMask,
172 INT xMask, INT yMask, DWORD dwRop)
Paul Quinn1beaae51998-12-15 15:38:36 +0000173{
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000174 FIXME("(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%ld): stub\n",
Paul Quinn1beaae51998-12-15 15:38:36 +0000175 hdcDest,nXDest,nYDest,nWidth,nHeight,hdcSource,nXSrc,nYSrc,
176 hbmMask,xMask,yMask,dwRop);
177 return 1;
178}
179
180/*********************************************************************
Patrik Stridvalld0a41772001-02-14 23:11:17 +0000181 * PlgBlt [GDI32.@]
Paul Quinn1beaae51998-12-15 15:38:36 +0000182 *
183 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000184BOOL WINAPI PlgBlt( HDC hdcDest, const POINT *lpPoint,
185 HDC hdcSrc, INT nXDest, INT nYDest, INT nWidth,
186 INT nHeight, HBITMAP hbmMask, INT xMask, INT yMask)
Paul Quinn1beaae51998-12-15 15:38:36 +0000187{
Alexandre Julliard2a2321b2000-08-19 21:38:55 +0000188 FIXME("PlgBlt, stub\n");
Paul Quinn1beaae51998-12-15 15:38:36 +0000189 return 1;
190}
191