ReactOS 0.4.16-dev-197-g92996da
callbacks_surf_hel.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS DirectX
4 * FILE: dll/directx/ddraw/Surface/callbacks_surf_hel.c
5 * PURPOSE: HEL Callbacks For Surface APIs
6 * PROGRAMMER: Magnus Olsen
7 *
8 */
9
10#include "rosdraw.h"
11
13{
14 DX_STUB;
15}
16
18{
20
21 if (lpBltData->dwFlags & DDBLT_COLORFILL)
22 {
23 HBRUSH hbr = CreateSolidBrush(lpBltData->bltFX.dwFillColor );
25 (CONST RECT *)&lpBltData->rDest,
26 hbr);
27 DeleteObject(hbr);
28 lpBltData->ddRVal = DD_OK;
29 }
30 else if (lpBltData->dwFlags & DDBLT_ROP)
31 {
33 lpBltData->rDest.top,
34 lpBltData->rDest.left,
35 lpBltData->rDest.right,
36 lpBltData->rDest.bottom,
38 lpBltData->rSrc.top,
39 lpBltData->rSrc.right,
40 lpBltData->bltFX.dwROP);
41 lpBltData->ddRVal = DD_OK;
42 }
44}
45
47{
48 DX_STUB;
49}
50
52{
53 DX_STUB;
54}
55
57{
58 DX_STUB;
59}
60
62{
63 DX_STUB;
64}
65
67{
68
69 HDC hDC;
70 HBITMAP hImage = NULL;
71
72 LONG cbBuffer = 0;
74
75 HDC hMemDC = NULL;
76 HBITMAP hDCBmp = NULL;
77 BITMAP bm = {0};
78
80
81 /* ToDo tell ddraw internal this surface is locked */
82 /* ToDo add support for dwFlags */
83
84
85 /* Get our hdc for the active window */
87
88 if (hDC != NULL)
89 {
90 /* Create a memory bitmap to store a copy of current hdc surface */
91
92 if (!lpLockData->bHasRect)
93 {
94 hImage = CreateCompatibleBitmap (hDC, lpLockData->lpDDSurface->lpGbl->wWidth, lpLockData->lpDDSurface->lpGbl->wHeight);
95 }
96 else
97 {
98 hImage = CreateCompatibleBitmap (hDC, lpLockData->rArea.right, lpLockData->rArea.bottom);
99 }
100
101 /* Create a memory hdc so we can draw on our current memory bitmap */
102 hMemDC = CreateCompatibleDC(hDC);
103
104 if (hMemDC != NULL)
105 {
106 /* Select our memory bitmap to our memory hdc */
107 hDCBmp = (HBITMAP) SelectObject (hMemDC, hImage);
108
109 /* Get our memory bitmap information */
110 GetObject(hImage, sizeof(BITMAP), &bm);
111
112 if (!lpLockData->bHasRect)
113 {
114 BitBlt (hMemDC, 0, 0, bm.bmWidth, bm.bmHeight, hDC, 0, 0, SRCCOPY);
115 }
116 else
117 {
118 BitBlt (hMemDC, lpLockData->rArea.top, lpLockData->rArea.left, lpLockData->rArea.right, lpLockData->rArea.bottom, hDC, 0, 0, SRCCOPY);
119 }
120
121 SelectObject (hMemDC, hDCBmp);
122
123 /* Allocate memory buffer for the bitmap pixel data */
124 cbBuffer = bm.bmWidthBytes * bm.bmHeight ;
126
127 if (pixels != NULL)
128 {
129 /* Get the bitmap bits */
130 GetBitmapBits(hImage,cbBuffer,pixels);
131
132 /* Fixme HACK - check which member stores the HEL bitmap buffer */
134
135 /* Setup return value */
136 lpLockData->ddRVal = DD_OK;
137 lpLockData->lpSurfData = pixels;
138 }
139 }
140 }
141
142
143 /* Free the pixels buffer if we fail */
144 if ( (pixels != NULL) &&
145 (lpLockData->ddRVal != DD_OK) )
146 {
148 }
149
150 /* Cleanup after us */
151 if (hImage != NULL)
152 {
153 DeleteObject (hImage);
154 }
155
156 if (hMemDC != NULL)
157 {
158 DeleteDC (hMemDC);
159 }
160
162}
163
165{
166 /* This api is not documented by MS, keep it stubbed */
167 DX_STUB;
168}
169
171{
172 DX_STUB;
173}
174
176{
177 DX_STUB;
178}
179
181{
182 DX_STUB;
183}
184
186{
187 DX_STUB;
188}
189
191{
192 HDC hDC;
193 HBITMAP hImage = NULL;
194
195 HDC hMemDC = NULL;
196 HBITMAP hDCBmp = NULL;
197 BITMAP bm = {0};
198
200
201 /* Get our hdc for the active window */
203
204 if (hDC != NULL)
205 {
206 /* Create a memory bitmap to store a copy of current hdc surface */
207
208 /* fixme the rcarea are not store in the struct yet so the data will look corrupted */
209 hImage = CreateCompatibleBitmap (hDC, lpUnLockData->lpDDSurface->lpGbl->wWidth, lpUnLockData->lpDDSurface->lpGbl->wHeight);
210
211 /* Create a memory hdc so we can draw on our current memory bitmap */
212 hMemDC = CreateCompatibleDC(hDC);
213
214 if (hMemDC != NULL)
215 {
216 /* Select our memory bitmap to our memory hdc */
217 hDCBmp = (HBITMAP) SelectObject (hMemDC, hImage);
218
219 /* Get our memory bitmap information */
220 GetObject(hImage, sizeof(BITMAP), &bm);
221
222 SetBitmapBits(hImage,bm.bmWidthBytes * bm.bmHeight, lpUnLockData->lpDDSurface->lpSurfMore->lpDDRAWReserved2);
223
224 BitBlt (hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
225
226 SelectObject (hMemDC, hDCBmp);
227
228 /* Setup return value */
229 lpUnLockData->ddRVal = DD_OK;
230 }
231 }
232
233 /* Cleanup after us */
234 if (hImage != NULL)
235 {
236 DeleteObject (hImage);
237 }
238
239 if (hMemDC != NULL)
240 {
241 DeleteDC (hMemDC);
242 }
243
244 if (lpUnLockData->lpDDSurface->lpSurfMore->lpDDRAWReserved2 != NULL)
245 {
247 }
248
250}
251
253{
254 DX_STUB;
255}
256
static HDC hDC
Definition: 3dtext.c:33
DWORD CALLBACK HelDdSurfSetClipList(LPDDHAL_SETCLIPLISTDATA lpSetClipListData)
DWORD CALLBACK HelDdSurfGetFlipStatus(LPDDHAL_GETFLIPSTATUSDATA lpGetFlipStatusData)
DWORD CALLBACK HelDdSurfDestroySurface(LPDDHAL_DESTROYSURFACEDATA lpDestroySurfaceData)
DWORD CALLBACK HelDdSurfUpdateOverlay(LPDDHAL_UPDATEOVERLAYDATA lpUpDateOverLayData)
DWORD CALLBACK HelDdSurfreserved4(DWORD *lpPtr)
DWORD CALLBACK HelDdSurfSetColorKey(LPDDHAL_SETCOLORKEYDATA lpSetColorKeyData)
DWORD CALLBACK HelDdSurfFlip(LPDDHAL_FLIPDATA lpFlipData)
DWORD CALLBACK HelDdSurfUnlock(LPDDHAL_UNLOCKDATA lpUnLockData)
DWORD CALLBACK HelDdSurfSetOverlayPosition(LPDDHAL_SETOVERLAYPOSITIONDATA lpSetOverlayPositionData)
DWORD CALLBACK HelDdSurfGetBltStatus(LPDDHAL_GETBLTSTATUSDATA lpGetBltStatusData)
DWORD CALLBACK HelDdSurfLock(LPDDHAL_LOCKDATA lpLockData)
DWORD CALLBACK HelDdSurfBlt(LPDDHAL_BLTDATA lpBltData)
DWORD CALLBACK HelDdSurfSetPalette(LPDDHAL_SETPALETTEDATA lpSetPaletteData)
DWORD CALLBACK HelDdSurfAddAttachedSurface(LPDDHAL_ADDATTACHEDSURFACEDATA lpDestroySurface)
#define DDHAL_DRIVER_HANDLED
Definition: ddrawi.h:321
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
#define CONST
Definition: pedump.c:81
DWORD * PDWORD
Definition: pedump.c:68
long LONG
Definition: pedump.c:60
#define DX_STUB
Definition: rosdraw.h:224
#define DX_WINDBG_trace()
Definition: rosdraw.h:262
#define DDBLT_COLORFILL
Definition: ddraw.h:555
#define DDBLT_ROP
Definition: ddraw.h:562
#define DD_OK
Definition: ddraw.h:186
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
Definition: bl.h:1331
DWORD dwROP
Definition: ddraw.h:1274
DWORD dwFillColor
Definition: ddraw.h:1310
LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface
Definition: ddrawi.h:849
RECTL rSrc
Definition: ddrawi.h:850
DDBLTFX bltFX
Definition: ddrawi.h:853
DWORD dwFlags
Definition: ddrawi.h:851
HRESULT ddRVal
Definition: ddrawi.h:854
LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface
Definition: ddrawi.h:847
RECTL rDest
Definition: ddrawi.h:848
RECTL rArea
Definition: ddrawi.h:831
DWORD bHasRect
Definition: ddrawi.h:830
HRESULT ddRVal
Definition: ddrawi.h:833
LPVOID lpSurfData
Definition: ddrawi.h:832
LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface
Definition: ddrawi.h:829
LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface
Definition: ddrawi.h:840
HRESULT ddRVal
Definition: ddrawi.h:841
LPDDRAWI_DDRAWSURFACE_GBL lpGbl
Definition: ddrawi.h:1468
LPDDRAWI_DDRAWSURFACE_MORE lpSurfMore
Definition: ddrawi.h:1467
LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl
Definition: ddrawi.h:1431
ULONG_PTR hFocusWnd
Definition: ddrawi.h:1184
uint32_t * LPDWORD
Definition: typedefs.h:59
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG WINAPI SetBitmapBits(_In_ HBITMAP hbm, _In_ DWORD cb, _In_reads_bytes_(cb) CONST VOID *pvBits)
#define SRCCOPY
Definition: wingdi.h:333
LONG WINAPI GetBitmapBits(_In_ HBITMAP hbit, _In_ LONG cb, _Out_writes_bytes_(cb) LPVOID lpvBits)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define GetObject
Definition: wingdi.h:4468
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)