1 /* DIBSection DirectDrawSurface driver
3 * Copyright 1997-2000 Marcus Meissner
4 * Copyright 1998-2000 Lionel Ulmer
5 * Copyright 2000-2001 TransGaming Technologies Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #define NONAMELESSUNION
29 #define NONAMELESSSTRUCT
32 #include "wine/debug.h"
33 #include "ddraw_private.h"
34 #include "dsurface/main.h"
35 #include "dsurface/dib.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(ddraw
);
39 static ICOM_VTABLE(IDirectDrawSurface7
) DIB_IDirectDrawSurface7_VTable
;
41 /* Return the width of a DIB bitmap in bytes. DIB bitmap data is 32-bit aligned. */
42 inline static int get_dib_width_bytes( int width
, int depth
)
48 case 1: words
= (width
+ 31) / 32; break;
49 case 4: words
= (width
+ 7) / 8; break;
50 case 8: words
= (width
+ 3) / 4; break;
52 case 16: words
= (width
+ 1) / 2; break;
53 case 24: words
= (width
* 3 + 3)/4; break;
55 WARN("(%d): Unsupported depth\n", depth
);
57 case 32: words
= width
; break;
63 static HRESULT
create_dib(IDirectDrawSurfaceImpl
* This
)
68 DIB_DirectDrawSurfaceImpl
* priv
= This
->private;
70 assert(This
->surface_desc
.lpSurface
!= NULL
);
72 switch (This
->surface_desc
.u4
.ddpfPixelFormat
.u1
.dwRGBBitCount
)
76 /* Allocate extra space to store the RGB bit masks. */
77 b_info
= (BITMAPINFO
*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
78 sizeof(BITMAPINFOHEADER
)
83 b_info
= (BITMAPINFO
*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
84 sizeof(BITMAPINFOHEADER
));
88 /* Allocate extra space for a palette. */
89 b_info
= (BITMAPINFO
*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
90 sizeof(BITMAPINFOHEADER
)
92 * (1 << This
->surface_desc
.u4
.ddpfPixelFormat
.u1
.dwRGBBitCount
));
96 b_info
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
97 b_info
->bmiHeader
.biWidth
= This
->surface_desc
.dwWidth
;
98 b_info
->bmiHeader
.biHeight
= -This
->surface_desc
.dwHeight
;
99 b_info
->bmiHeader
.biPlanes
= 1;
100 b_info
->bmiHeader
.biBitCount
= This
->surface_desc
.u4
.ddpfPixelFormat
.u1
.dwRGBBitCount
;
102 if ((This
->surface_desc
.u4
.ddpfPixelFormat
.u1
.dwRGBBitCount
!= 16)
103 && (This
->surface_desc
.u4
.ddpfPixelFormat
.u1
.dwRGBBitCount
!= 32))
104 b_info
->bmiHeader
.biCompression
= BI_RGB
;
106 b_info
->bmiHeader
.biCompression
= BI_BITFIELDS
;
108 b_info
->bmiHeader
.biSizeImage
109 = (This
->surface_desc
.u4
.ddpfPixelFormat
.u1
.dwRGBBitCount
/ 8)
110 * This
->surface_desc
.dwWidth
* This
->surface_desc
.dwHeight
;
112 b_info
->bmiHeader
.biXPelsPerMeter
= 0;
113 b_info
->bmiHeader
.biYPelsPerMeter
= 0;
114 b_info
->bmiHeader
.biClrUsed
= 0;
115 b_info
->bmiHeader
.biClrImportant
= 0;
117 if (!This
->surface_desc
.u1
.lPitch
) {
118 /* This can't happen, right? */
119 /* or use GDI_GetObj to get it from the created DIB? */
120 This
->surface_desc
.u1
.lPitch
= get_dib_width_bytes(b_info
->bmiHeader
.biWidth
, b_info
->bmiHeader
.biBitCount
);
121 This
->surface_desc
.dwFlags
|= DDSD_PITCH
;
124 switch (This
->surface_desc
.u4
.ddpfPixelFormat
.u1
.dwRGBBitCount
)
129 DWORD
*masks
= (DWORD
*) &(b_info
->bmiColors
);
132 masks
[0] = This
->surface_desc
.u4
.ddpfPixelFormat
.u2
.dwRBitMask
;
133 masks
[1] = This
->surface_desc
.u4
.ddpfPixelFormat
.u3
.dwGBitMask
;
134 masks
[2] = This
->surface_desc
.u4
.ddpfPixelFormat
.u4
.dwBBitMask
;
140 usage
= DIB_RGB_COLORS
;
144 /* Don't know palette */
149 ddc
= CreateDCA("DISPLAY", NULL
, NULL
, NULL
);
152 HeapFree(GetProcessHeap(), 0, b_info
);
153 return HRESULT_FROM_WIN32(GetLastError());
157 = DIB_CreateDIBSection(ddc
, b_info
, usage
, &(priv
->dib
.bitmap_data
), 0,
158 (DWORD
)This
->surface_desc
.lpSurface
,
159 This
->surface_desc
.u1
.lPitch
);
161 if (!priv
->dib
.DIBsection
) {
162 ERR("CreateDIBSection failed!\n");
163 HeapFree(GetProcessHeap(), 0, b_info
);
164 return HRESULT_FROM_WIN32(GetLastError());
167 TRACE("DIBSection at : %p\n", priv
->dib
.bitmap_data
);
169 if (!This
->surface_desc
.lpSurface
) {
170 This
->surface_desc
.lpSurface
= priv
->dib
.bitmap_data
;
171 This
->surface_desc
.dwFlags
|= DDSD_LPSURFACE
;
174 HeapFree(GetProcessHeap(), 0, b_info
);
176 /* I don't think it's worth checking for this. */
177 if (priv
->dib
.bitmap_data
!= This
->surface_desc
.lpSurface
)
178 ERR("unexpected error creating DirectDrawSurface DIB section\n");
180 /* this seems like a good place to put the handle for HAL driver use */
181 This
->global_more
.hKernelSurface
= (ULONG_PTR
)priv
->dib
.DIBsection
;
186 void DIB_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl
* This
)
188 DIB_DirectDrawSurfaceImpl
* priv
= This
->private;
190 DeleteObject(priv
->dib
.DIBsection
);
192 if (!priv
->dib
.client_memory
)
193 VirtualFree(This
->surface_desc
.lpSurface
, 0, MEM_RELEASE
);
195 Main_DirectDrawSurface_final_release(This
);
198 HRESULT
DIB_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl
* This
,
199 LPDIRECTDRAWSURFACE7
* ppDup
)
201 return DIB_DirectDrawSurface_Create(This
->ddraw_owner
,
202 &This
->surface_desc
, ppDup
, NULL
);
205 HRESULT
DIB_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl
*This
,
206 IDirectDrawImpl
*pDD
,
207 const DDSURFACEDESC2
*pDDSD
)
210 DIB_DirectDrawSurfaceImpl
* priv
= This
->private;
212 TRACE("(%p)->(%p,%p)\n",This
,pDD
,pDDSD
);
213 hr
= Main_DirectDrawSurface_Construct(This
, pDD
, pDDSD
);
214 if (FAILED(hr
)) return hr
;
216 ICOM_INIT_INTERFACE(This
, IDirectDrawSurface7
,
217 DIB_IDirectDrawSurface7_VTable
);
219 This
->final_release
= DIB_DirectDrawSurface_final_release
;
220 This
->duplicate_surface
= DIB_DirectDrawSurface_duplicate_surface
;
221 This
->flip_data
= DIB_DirectDrawSurface_flip_data
;
223 This
->get_dc
= DIB_DirectDrawSurface_get_dc
;
224 This
->release_dc
= DIB_DirectDrawSurface_release_dc
;
227 This
->set_palette
= DIB_DirectDrawSurface_set_palette
;
228 This
->update_palette
= DIB_DirectDrawSurface_update_palette
;
230 TRACE("(%ldx%ld, pitch=%ld)\n",
231 This
->surface_desc
.dwWidth
, This
->surface_desc
.dwHeight
,
232 This
->surface_desc
.u1
.lPitch
);
233 /* XXX load dwWidth and dwHeight from pDD if they are not specified? */
235 if (This
->surface_desc
.dwFlags
& DDSD_LPSURFACE
)
237 /* "Client memory": it is managed by the application. */
238 /* XXX What if lPitch is not set? Use dwWidth or fail? */
240 priv
->dib
.client_memory
= TRUE
;
244 if (!(This
->surface_desc
.dwFlags
& DDSD_PITCH
))
246 int pitch
= This
->surface_desc
.u1
.lPitch
;
248 pitch
+= 8 - (pitch
% 8);
250 /* XXX else: how should lPitch be verified? */
252 This
->surface_desc
.dwFlags
|= DDSD_PITCH
|DDSD_LPSURFACE
;
254 This
->surface_desc
.lpSurface
255 = VirtualAlloc(NULL
, This
->surface_desc
.u1
.lPitch
256 * This
->surface_desc
.dwHeight
+ 4, /* The + 4 here is for dumb games reading after the end of the surface
257 when reading the last byte / half using word access */
258 MEM_COMMIT
, PAGE_READWRITE
);
260 if (This
->surface_desc
.lpSurface
== NULL
)
262 Main_DirectDrawSurface_final_release(This
);
263 return HRESULT_FROM_WIN32(GetLastError());
266 priv
->dib
.client_memory
= FALSE
;
269 hr
= create_dib(This
);
272 if (!priv
->dib
.client_memory
)
273 VirtualFree(This
->surface_desc
.lpSurface
, 0, MEM_RELEASE
);
275 Main_DirectDrawSurface_final_release(This
);
284 HRESULT
DIB_DirectDrawSurface_Create(IDirectDrawImpl
*pDD
,
285 const DDSURFACEDESC2
*pDDSD
,
286 LPDIRECTDRAWSURFACE7
*ppSurf
,
289 IDirectDrawSurfaceImpl
* This
;
291 assert(pUnkOuter
== NULL
);
293 This
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
294 sizeof(*This
) + sizeof(DIB_DirectDrawSurfaceImpl
));
295 if (This
== NULL
) return E_OUTOFMEMORY
;
297 This
->private = (DIB_DirectDrawSurfaceImpl
*)(This
+1);
299 hr
= DIB_DirectDrawSurface_Construct(This
, pDD
, pDDSD
);
301 HeapFree(GetProcessHeap(), 0, This
);
303 *ppSurf
= ICOM_INTERFACE(This
, IDirectDrawSurface7
);
309 /* AddAttachedSurface: generic */
310 /* AddOverlayDirtyRect: generic, unimplemented */
312 static HRESULT
_Blt_ColorFill(
313 LPBYTE buf
, int width
, int height
, int bpp
, LONG lPitch
, DWORD color
320 #define COLORFILL_ROW(type) { \
321 type *d = (type *) buf; \
322 for (x = 0; x < width; x++) \
323 d[x] = (type) color; \
328 case 1: COLORFILL_ROW(BYTE
)
329 case 2: COLORFILL_ROW(WORD
)
330 case 3: { BYTE
*d
= (BYTE
*) buf
;
331 for (x
= 0; x
< width
; x
++,d
+=3) {
332 d
[0] = (color
) & 0xFF;
333 d
[1] = (color
>> 8) & 0xFF;
334 d
[2] = (color
>>16) & 0xFF;
337 case 4: COLORFILL_ROW(DWORD
)
339 FIXME("Color fill not implemented for bpp %d!\n", bpp
*8);
340 return DDERR_UNSUPPORTED
;
345 /* Now copy first row */
347 for (y
= 1; y
< height
; y
++) {
349 memcpy(buf
, first
, width
* bpp
);
355 DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface
, LPRECT rdst
,
356 LPDIRECTDRAWSURFACE7 src
, LPRECT rsrc
,
357 DWORD dwFlags
, LPDDBLTFX lpbltfx
)
359 ICOM_THIS(IDirectDrawSurfaceImpl
,iface
);
361 DDSURFACEDESC2 ddesc
,sdesc
;
363 int bpp
, srcheight
, srcwidth
, dstheight
, dstwidth
, width
;
367 TRACE("(%p)->(%p,%p,%p,%08lx,%p)\n", This
,rdst
,src
,rsrc
,dwFlags
,lpbltfx
);
369 if (TRACE_ON(ddraw
)) {
370 if (rdst
) TRACE("\tdestrect :%ldx%ld-%ldx%ld\n",rdst
->left
,rdst
->top
,rdst
->right
,rdst
->bottom
);
371 if (rsrc
) TRACE("\tsrcrect :%ldx%ld-%ldx%ld\n",rsrc
->left
,rsrc
->top
,rsrc
->right
,rsrc
->bottom
);
373 DDRAW_dump_DDBLT(dwFlags
);
374 if (dwFlags
& DDBLT_DDFX
) {
376 DDRAW_dump_DDBLTFX(lpbltfx
->dwDDFX
);
380 /* First, check if the possible override function handles this case */
381 if (This
->aux_blt
!= NULL
) {
382 if (This
->aux_blt(This
, rdst
, src
, rsrc
, dwFlags
, lpbltfx
) == DD_OK
) return DD_OK
;
385 DD_STRUCT_INIT(&ddesc
);
386 DD_STRUCT_INIT(&sdesc
);
388 sdesc
.dwSize
= sizeof(sdesc
);
389 if (src
) IDirectDrawSurface7_Lock(src
, NULL
, &sdesc
, DDLOCK_READONLY
, 0);
390 ddesc
.dwSize
= sizeof(ddesc
);
391 IDirectDrawSurface7_Lock(iface
,NULL
,&ddesc
,DDLOCK_WRITEONLY
,0);
394 memcpy(&xdst
,rdst
,sizeof(xdst
));
397 xdst
.bottom
= ddesc
.dwHeight
;
399 xdst
.right
= ddesc
.dwWidth
;
403 memcpy(&xsrc
,rsrc
,sizeof(xsrc
));
407 xsrc
.bottom
= sdesc
.dwHeight
;
409 xsrc
.right
= sdesc
.dwWidth
;
411 memset(&xsrc
,0,sizeof(xsrc
));
415 /* First check for the validity of source / destination rectangles. This was
416 verified using a test application + by MSDN.
419 ((xsrc
.bottom
> sdesc
.dwHeight
) || (xsrc
.bottom
< 0) ||
420 (xsrc
.top
> sdesc
.dwHeight
) || (xsrc
.top
< 0) ||
421 (xsrc
.left
> sdesc
.dwWidth
) || (xsrc
.left
< 0) ||
422 (xsrc
.right
> sdesc
.dwWidth
) || (xsrc
.right
< 0) ||
423 (xsrc
.right
< xsrc
.left
) || (xsrc
.bottom
< xsrc
.top
))) {
424 WARN("Application gave us bad source rectangle for Blt.\n");
425 return DDERR_INVALIDRECT
;
427 /* For the Destination rect, it can be out of bounds on the condition that a clipper
428 is set for the given surface.
430 if ((This
->clipper
== NULL
) &&
431 ((xdst
.bottom
> ddesc
.dwHeight
) || (xdst
.bottom
< 0) ||
432 (xdst
.top
> ddesc
.dwHeight
) || (xdst
.top
< 0) ||
433 (xdst
.left
> ddesc
.dwWidth
) || (xdst
.left
< 0) ||
434 (xdst
.right
> ddesc
.dwWidth
) || (xdst
.right
< 0) ||
435 (xdst
.right
< xdst
.left
) || (xdst
.bottom
< xdst
.top
))) {
436 WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n");
437 return DDERR_INVALIDRECT
;
440 /* Now handle negative values in the rectangles. Warning: only supported for now
441 in the 'simple' cases (ie not in any stretching / rotation cases).
443 First, the case where nothing is to be done.
445 if (((xdst
.bottom
<= 0) || (xdst
.right
<= 0) || (xdst
.top
>= (int) ddesc
.dwHeight
) || (xdst
.left
>= (int) ddesc
.dwWidth
)) ||
447 ((xsrc
.bottom
<= 0) || (xsrc
.right
<= 0) || (xsrc
.top
>= (int) sdesc
.dwHeight
) || (xsrc
.left
>= (int) sdesc
.dwWidth
))))
449 TRACE("Nothing to be done !\n");
453 /* The easy case : the source-less blits.... */
456 RECT temp_rect
; /* No idea if intersect rect can be the same as one of the source rect */
460 full_rect
.right
= ddesc
.dwWidth
;
461 full_rect
.bottom
= ddesc
.dwHeight
;
462 IntersectRect(&temp_rect
, &full_rect
, &xdst
);
465 /* Only handle clipping on the destination rectangle */
466 int clip_horiz
= (xdst
.left
< 0) || (xdst
.right
> (int) ddesc
.dwWidth
);
467 int clip_vert
= (xdst
.top
< 0) || (xdst
.bottom
> (int) ddesc
.dwHeight
);
468 if (clip_vert
|| clip_horiz
) {
469 /* Now check if this is a special case or not... */
470 if ((((xdst
.bottom
- xdst
.top
) != (xsrc
.bottom
- xsrc
.top
)) && clip_vert
) ||
471 (((xdst
.right
- xdst
.left
) != (xsrc
.right
- xsrc
.left
)) && clip_horiz
) ||
472 (dwFlags
& DDBLT_DDFX
)) {
473 WARN("Out of screen rectangle in special case. Not handled right now.\n");
478 if (xdst
.left
< 0) { xsrc
.left
-= xdst
.left
; xdst
.left
= 0; }
479 if (xdst
.right
> ddesc
.dwWidth
) { xsrc
.right
-= (xdst
.right
- (int) ddesc
.dwWidth
); xdst
.right
= (int) ddesc
.dwWidth
; }
482 if (xdst
.top
< 0) { xsrc
.top
-= xdst
.top
; xdst
.top
= 0; }
483 if (xdst
.bottom
> ddesc
.dwHeight
) { xsrc
.bottom
-= (xdst
.bottom
- (int) ddesc
.dwHeight
); xdst
.bottom
= (int) ddesc
.dwHeight
; }
485 /* And check if after clipping something is still to be done... */
486 if ((xdst
.bottom
<= 0) || (xdst
.right
<= 0) || (xdst
.top
>= (int) ddesc
.dwHeight
) || (xdst
.left
>= (int) ddesc
.dwWidth
) ||
487 (xsrc
.bottom
<= 0) || (xsrc
.right
<= 0) || (xsrc
.top
>= (int) sdesc
.dwHeight
) || (xsrc
.left
>= (int) sdesc
.dwWidth
)) {
488 TRACE("Nothing to be done after clipping !\n");
494 bpp
= GET_BPP(ddesc
);
495 srcheight
= xsrc
.bottom
- xsrc
.top
;
496 srcwidth
= xsrc
.right
- xsrc
.left
;
497 dstheight
= xdst
.bottom
- xdst
.top
;
498 dstwidth
= xdst
.right
- xdst
.left
;
499 width
= (xdst
.right
- xdst
.left
) * bpp
;
501 assert(width
<= ddesc
.u1
.lPitch
);
503 dbuf
= (BYTE
*)ddesc
.lpSurface
+(xdst
.top
*ddesc
.u1
.lPitch
)+(xdst
.left
*bpp
);
505 if (dwFlags
& (DDBLT_WAIT
|DDBLT_ASYNC
))
507 static BOOL displayed
= FALSE
;
510 FIXME("dwFlags DDBLT_WAIT and/or DDBLT_ASYNC: can't handle right now.\n");
513 dwFlags
&= ~(DDBLT_WAIT
|DDBLT_ASYNC
);
516 /* First, all the 'source-less' blits */
517 if (dwFlags
& DDBLT_COLORFILL
) {
518 ret
= _Blt_ColorFill(dbuf
, dstwidth
, dstheight
, bpp
,
519 ddesc
.u1
.lPitch
, lpbltfx
->u5
.dwFillColor
);
520 dwFlags
&= ~DDBLT_COLORFILL
;
523 if (dwFlags
& DDBLT_DEPTHFILL
)
524 FIXME("DDBLT_DEPTHFILL needs to be implemented!\n");
525 if (dwFlags
& DDBLT_ROP
) {
526 /* Catch some degenerate cases here */
527 switch(lpbltfx
->dwROP
) {
529 ret
= _Blt_ColorFill(dbuf
,dstwidth
,dstheight
,bpp
,ddesc
.u1
.lPitch
,0);
531 case 0xAA0029: /* No-op */
534 ret
= _Blt_ColorFill(dbuf
,dstwidth
,dstheight
,bpp
,ddesc
.u1
.lPitch
,~0);
536 case SRCCOPY
: /* well, we do that below ? */
539 FIXME("Unsupported raster op: %08lx Pattern: %p\n", lpbltfx
->dwROP
, lpbltfx
->u5
.lpDDSPattern
);
542 dwFlags
&= ~DDBLT_ROP
;
544 if (dwFlags
& DDBLT_DDROPS
) {
545 FIXME("\tDdraw Raster Ops: %08lx Pattern: %p\n", lpbltfx
->dwDDROP
, lpbltfx
->u5
.lpDDSPattern
);
547 /* Now the 'with source' blits */
550 int sx
, xinc
, sy
, yinc
;
552 if (!dstwidth
|| !dstheight
) /* hmm... stupid program ? */
554 sbase
= (BYTE
*)sdesc
.lpSurface
+(xsrc
.top
*sdesc
.u1
.lPitch
)+xsrc
.left
*bpp
;
555 xinc
= (srcwidth
<< 16) / dstwidth
;
556 yinc
= (srcheight
<< 16) / dstheight
;
559 /* No effects, we can cheat here */
560 if (dstwidth
== srcwidth
) {
561 if (dstheight
== srcheight
) {
562 /* No stretching in either direction. This needs to be as
563 * fast as possible */
566 /* check for overlapping surfaces */
567 if (src
!= iface
|| xdst
.top
< xsrc
.top
||
568 xdst
.right
<= xsrc
.left
|| xsrc
.right
<= xdst
.left
)
570 /* no overlap, or dst above src, so copy from top downwards */
571 for (y
= 0; y
< dstheight
; y
++)
573 memcpy(dbuf
, sbuf
, width
);
574 sbuf
+= sdesc
.u1
.lPitch
;
575 dbuf
+= ddesc
.u1
.lPitch
;
578 else if (xdst
.top
> xsrc
.top
) /* copy from bottom upwards */
580 sbuf
+= (sdesc
.u1
.lPitch
*dstheight
);
581 dbuf
+= (ddesc
.u1
.lPitch
*dstheight
);
582 for (y
= 0; y
< dstheight
; y
++)
584 sbuf
-= sdesc
.u1
.lPitch
;
585 dbuf
-= ddesc
.u1
.lPitch
;
586 memcpy(dbuf
, sbuf
, width
);
589 else /* src and dst overlapping on the same line, use memmove */
591 for (y
= 0; y
< dstheight
; y
++)
593 memmove(dbuf
, sbuf
, width
);
594 sbuf
+= sdesc
.u1
.lPitch
;
595 dbuf
+= ddesc
.u1
.lPitch
;
599 /* Stretching in Y direction only */
600 for (y
= sy
= 0; y
< dstheight
; y
++, sy
+= yinc
) {
601 sbuf
= sbase
+ (sy
>> 16) * sdesc
.u1
.lPitch
;
602 memcpy(dbuf
, sbuf
, width
);
603 dbuf
+= ddesc
.u1
.lPitch
;
607 /* Stretching in X direction */
609 for (y
= sy
= 0; y
< dstheight
; y
++, sy
+= yinc
) {
610 sbuf
= sbase
+ (sy
>> 16) * sdesc
.u1
.lPitch
;
612 if ((sy
>> 16) == (last_sy
>> 16)) {
613 /* this sourcerow is the same as last sourcerow -
614 * copy already stretched row
616 memcpy(dbuf
, dbuf
- ddesc
.u1
.lPitch
, width
);
618 #define STRETCH_ROW(type) { \
619 type *s = (type *) sbuf, *d = (type *) dbuf; \
620 for (x = sx = 0; x < dstwidth; x++, sx += xinc) \
621 d[x] = s[sx >> 16]; \
625 case 1: STRETCH_ROW(BYTE
)
626 case 2: STRETCH_ROW(WORD
)
627 case 4: STRETCH_ROW(DWORD
)
630 for (x
= sx
= 0; x
< dstwidth
; x
++, sx
+= xinc
) {
634 pixel
= s
[0]|(s
[1]<<8)|(s
[2]<<16);
635 d
[0] = (pixel
)&0xff;
636 d
[1] = (pixel
>> 8)&0xff;
637 d
[2] = (pixel
>>16)&0xff;
643 FIXME("Stretched blit not implemented for bpp %d!\n", bpp
*8);
644 ret
= DDERR_UNSUPPORTED
;
649 dbuf
+= ddesc
.u1
.lPitch
;
654 LONG dstyinc
= ddesc
.u1
.lPitch
, dstxinc
= bpp
;
655 DWORD keylow
= 0, keyhigh
= 0;
656 if (dwFlags
& (DDBLT_KEYSRC
| DDBLT_KEYDEST
| DDBLT_KEYSRCOVERRIDE
| DDBLT_KEYDESTOVERRIDE
)) {
658 if (dwFlags
& DDBLT_KEYSRC
) {
659 keylow
= sdesc
.ddckCKSrcBlt
.dwColorSpaceLowValue
;
660 keyhigh
= sdesc
.ddckCKSrcBlt
.dwColorSpaceHighValue
;
661 } else if (dwFlags
& DDBLT_KEYDEST
){
662 keylow
= ddesc
.ddckCKDestBlt
.dwColorSpaceLowValue
;
663 keyhigh
= ddesc
.ddckCKDestBlt
.dwColorSpaceHighValue
;
664 } else if (dwFlags
& DDBLT_KEYSRCOVERRIDE
) {
665 keylow
= lpbltfx
->ddckSrcColorkey
.dwColorSpaceLowValue
;
666 keyhigh
= lpbltfx
->ddckSrcColorkey
.dwColorSpaceHighValue
;
668 keylow
= lpbltfx
->ddckDestColorkey
.dwColorSpaceLowValue
;
669 keyhigh
= lpbltfx
->ddckDestColorkey
.dwColorSpaceHighValue
;
671 dwFlags
&= ~(DDBLT_KEYSRC
| DDBLT_KEYDEST
| DDBLT_KEYSRCOVERRIDE
| DDBLT_KEYDESTOVERRIDE
);
674 if (dwFlags
& DDBLT_DDFX
) {
675 LPBYTE dTopLeft
, dTopRight
, dBottomLeft
, dBottomRight
, tmp
;
678 dTopRight
= dbuf
+((dstwidth
-1)*bpp
);
679 dBottomLeft
= dTopLeft
+((dstheight
-1)*ddesc
.u1
.lPitch
);
680 dBottomRight
= dBottomLeft
+((dstwidth
-1)*bpp
);
682 if (lpbltfx
->dwDDFX
& DDBLTFX_ARITHSTRETCHY
){
683 /* I don't think we need to do anything about this flag */
684 WARN("dwflags=DDBLT_DDFX nothing done for DDBLTFX_ARITHSTRETCHY\n");
686 if (lpbltfx
->dwDDFX
& DDBLTFX_MIRRORLEFTRIGHT
) {
688 dTopRight
= dTopLeft
;
691 dBottomRight
= dBottomLeft
;
693 dstxinc
= dstxinc
*-1;
695 if (lpbltfx
->dwDDFX
& DDBLTFX_MIRRORUPDOWN
) {
697 dTopLeft
= dBottomLeft
;
700 dTopRight
= dBottomRight
;
702 dstyinc
= dstyinc
*-1;
704 if (lpbltfx
->dwDDFX
& DDBLTFX_NOTEARING
) {
705 /* I don't think we need to do anything about this flag */
706 WARN("dwflags=DDBLT_DDFX nothing done for DDBLTFX_NOTEARING\n");
708 if (lpbltfx
->dwDDFX
& DDBLTFX_ROTATE180
) {
710 dBottomRight
= dTopLeft
;
713 dBottomLeft
= dTopRight
;
715 dstxinc
= dstxinc
* -1;
716 dstyinc
= dstyinc
* -1;
718 if (lpbltfx
->dwDDFX
& DDBLTFX_ROTATE270
) {
720 dTopLeft
= dBottomLeft
;
721 dBottomLeft
= dBottomRight
;
722 dBottomRight
= dTopRight
;
727 dstxinc
= dstxinc
* -1;
729 if (lpbltfx
->dwDDFX
& DDBLTFX_ROTATE90
) {
731 dTopLeft
= dTopRight
;
732 dTopRight
= dBottomRight
;
733 dBottomRight
= dBottomLeft
;
738 dstyinc
= dstyinc
* -1;
740 if (lpbltfx
->dwDDFX
& DDBLTFX_ZBUFFERBASEDEST
) {
741 /* I don't think we need to do anything about this flag */
742 WARN("dwflags=DDBLT_DDFX nothing done for DDBLTFX_ZBUFFERBASEDEST\n");
745 dwFlags
&= ~(DDBLT_DDFX
);
748 #define COPY_COLORKEY_FX(type) { \
749 type *s = (type *) sbuf, *d = (type *) dbuf, *dx, tmp; \
750 for (y = sy = 0; y < dstheight; y++, sy += yinc) { \
751 (LPBYTE)s = sbase + (sy >> 16) * sdesc.u1.lPitch; \
753 for (x = sx = 0; x < dstwidth; x++, sx += xinc) { \
755 if (tmp < keylow || tmp > keyhigh) dx[0] = tmp; \
756 (LPBYTE)dx += dstxinc; \
758 (LPBYTE)d += dstyinc; \
763 case 1: COPY_COLORKEY_FX(BYTE
)
764 case 2: COPY_COLORKEY_FX(WORD
)
765 case 4: COPY_COLORKEY_FX(DWORD
)
766 case 3: {LPBYTE s
,d
= dbuf
, dx
;
767 for (y
= sy
= 0; y
< dstheight
; y
++, sy
+= yinc
) {
768 sbuf
= sbase
+ (sy
>> 16) * sdesc
.u1
.lPitch
;
770 for (x
= sx
= 0; x
< dstwidth
; x
++, sx
+= xinc
) {
773 pixel
= s
[0]|(s
[1]<<8)|(s
[2]<<16);
774 if (pixel
< keylow
|| pixel
> keyhigh
){
775 dx
[0] = (pixel
)&0xff;
776 dx
[1] = (pixel
>> 8)&0xff;
777 dx
[2] = (pixel
>>16)&0xff;
785 FIXME("%s color-keyed blit not implemented for bpp %d!\n",
786 (dwFlags
& DDBLT_KEYSRC
) ? "Source" : "Destination", bpp
*8);
787 ret
= DDERR_UNSUPPORTED
;
789 #undef COPY_COLORKEY_FX
795 if (dwFlags
&& FIXME_ON(ddraw
)) {
796 FIXME("\tUnsupported flags: ");
797 DDRAW_dump_DDBLT(dwFlags
);
801 IDirectDrawSurface7_Unlock(iface
,NULL
);
802 if (src
) IDirectDrawSurface7_Unlock(src
,NULL
);
806 /* BltBatch: generic, unimplemented */
809 DIB_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface
, DWORD dstx
,
810 DWORD dsty
, LPDIRECTDRAWSURFACE7 src
,
811 LPRECT rsrc
, DWORD trans
)
813 ICOM_THIS(IDirectDrawSurfaceImpl
,iface
);
815 DDSURFACEDESC2 ddesc
,sdesc
;
819 RECT lock_src
, lock_dst
;
821 if (TRACE_ON(ddraw
)) {
822 TRACE("(%p)->(%ld,%ld,%p,%p,%08lx)\n",
823 This
,dstx
,dsty
,src
,rsrc
,trans
827 DDRAW_dump_DDBLTFAST(trans
);
829 TRACE("\tsrcrect: %ldx%ld-%ldx%ld\n",rsrc
->left
,rsrc
->top
,rsrc
->right
,rsrc
->bottom
);
831 TRACE(" srcrect: NULL\n");
834 /* First, check if the possible override function handles this case */
835 if (This
->aux_bltfast
!= NULL
) {
836 if (This
->aux_bltfast(This
, dstx
, dsty
, src
, rsrc
, trans
) == DD_OK
) return DD_OK
;
839 /* Get the surface description without locking to first compute the width / height */
840 ddesc
= This
->surface_desc
;
841 sdesc
= (ICOM_OBJECT(IDirectDrawSurfaceImpl
, IDirectDrawSurface7
, src
))->surface_desc
;
844 WARN("rsrc is NULL!\n");
846 rsrc
->left
= rsrc
->top
= 0;
847 rsrc
->right
= sdesc
.dwWidth
;
848 rsrc
->bottom
= sdesc
.dwHeight
;
851 h
=rsrc
->bottom
-rsrc
->top
;
852 if (h
>ddesc
.dwHeight
-dsty
) h
=ddesc
.dwHeight
-dsty
;
853 if (h
>sdesc
.dwHeight
-rsrc
->top
) h
=sdesc
.dwHeight
-rsrc
->top
;
854 if (h
<=0) return DDERR_INVALIDRECT
;
856 w
=rsrc
->right
-rsrc
->left
;
857 if (w
>ddesc
.dwWidth
-dstx
) w
=ddesc
.dwWidth
-dstx
;
858 if (w
>sdesc
.dwWidth
-rsrc
->left
) w
=sdesc
.dwWidth
-rsrc
->left
;
859 if (w
<=0) return DDERR_INVALIDRECT
;
861 /* Now compute the locking rectangle... */
862 lock_src
.left
= rsrc
->left
;
863 lock_src
.top
= rsrc
->top
;
864 lock_src
.right
= lock_src
.left
+ w
;
865 lock_src
.bottom
= lock_src
.top
+ h
;
867 lock_dst
.left
= dstx
;
869 lock_dst
.right
= dstx
+ w
;
870 lock_dst
.bottom
= dsty
+ h
;
872 /* We need to lock the surfaces, or we won't get refreshes when done. */
873 sdesc
.dwSize
= sizeof(sdesc
);
874 IDirectDrawSurface7_Lock(src
, &lock_src
, &sdesc
, DDLOCK_READONLY
, 0);
875 ddesc
.dwSize
= sizeof(ddesc
);
876 IDirectDrawSurface7_Lock(iface
, &lock_dst
, &ddesc
, DDLOCK_WRITEONLY
, 0);
878 bpp
= GET_BPP(This
->surface_desc
);
879 sbuf
= (BYTE
*) sdesc
.lpSurface
;
880 dbuf
= (BYTE
*) ddesc
.lpSurface
;
882 if (trans
& (DDBLTFAST_SRCCOLORKEY
| DDBLTFAST_DESTCOLORKEY
)) {
883 DWORD keylow
, keyhigh
;
884 if (trans
& DDBLTFAST_SRCCOLORKEY
) {
885 keylow
= sdesc
.ddckCKSrcBlt
.dwColorSpaceLowValue
;
886 keyhigh
= sdesc
.ddckCKSrcBlt
.dwColorSpaceHighValue
;
888 /* I'm not sure if this is correct */
889 FIXME("DDBLTFAST_DESTCOLORKEY not fully supported yet.\n");
890 keylow
= ddesc
.ddckCKDestBlt
.dwColorSpaceLowValue
;
891 keyhigh
= ddesc
.ddckCKDestBlt
.dwColorSpaceHighValue
;
894 #define COPYBOX_COLORKEY(type) { \
896 s = (type *) sdesc.lpSurface; \
897 d = (type *) ddesc.lpSurface; \
898 for (y = 0; y < h; y++) { \
899 for (x = 0; x < w; x++) { \
901 if (tmp < keylow || tmp > keyhigh) d[x] = tmp; \
903 (LPBYTE)s += sdesc.u1.lPitch; \
904 (LPBYTE)d += ddesc.u1.lPitch; \
910 case 1: COPYBOX_COLORKEY(BYTE
)
911 case 2: COPYBOX_COLORKEY(WORD
)
912 case 4: COPYBOX_COLORKEY(DWORD
)
914 FIXME("Source color key blitting not supported for bpp %d\n",bpp
*8);
915 ret
= DDERR_UNSUPPORTED
;
918 #undef COPYBOX_COLORKEY
922 for (y
= 0; y
< h
; y
++) {
923 memcpy(dbuf
, sbuf
, width
);
924 sbuf
+= sdesc
.u1
.lPitch
;
925 dbuf
+= ddesc
.u1
.lPitch
;
930 IDirectDrawSurface7_Unlock(iface
, &lock_dst
);
931 IDirectDrawSurface7_Unlock(src
, &lock_src
);
935 /* ChangeUniquenessValue: generic */
936 /* DeleteAttachedSurface: generic */
937 /* EnumAttachedSurfaces: generic */
938 /* EnumOverlayZOrders: generic, unimplemented */
940 BOOL
DIB_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl
* front
,
941 IDirectDrawSurfaceImpl
* back
,
944 DIB_DirectDrawSurfaceImpl
* front_priv
= front
->private;
945 DIB_DirectDrawSurfaceImpl
* back_priv
= back
->private;
947 TRACE("(%p,%p)\n",front
,back
);
951 tmp
= front_priv
->dib
.DIBsection
;
952 front_priv
->dib
.DIBsection
= back_priv
->dib
.DIBsection
;
953 back_priv
->dib
.DIBsection
= tmp
;
958 tmp
= front_priv
->dib
.bitmap_data
;
959 front_priv
->dib
.bitmap_data
= back_priv
->dib
.bitmap_data
;
960 back_priv
->dib
.bitmap_data
= tmp
;
962 tmp
= front
->surface_desc
.lpSurface
;
963 front
->surface_desc
.lpSurface
= back
->surface_desc
.lpSurface
;
964 back
->surface_desc
.lpSurface
= tmp
;
967 /* client_memory should not be different, but just in case */
970 tmp
= front_priv
->dib
.client_memory
;
971 front_priv
->dib
.client_memory
= back_priv
->dib
.client_memory
;
972 back_priv
->dib
.client_memory
= tmp
;
975 return Main_DirectDrawSurface_flip_data(front
, back
, dwFlags
);
979 /* FreePrivateData: generic */
980 /* GetAttachedSurface: generic */
981 /* GetBltStatus: generic */
982 /* GetCaps: generic (Returns the caps from This->surface_desc.) */
983 /* GetClipper: generic */
984 /* GetColorKey: generic */
986 HRESULT
DIB_DirectDrawSurface_alloc_dc(IDirectDrawSurfaceImpl
* This
, HDC
* phDC
)
988 DIB_PRIV_VAR(priv
, This
);
991 TRACE("Grabbing a DC for surface: %p\n", This
);
993 hDC
= CreateCompatibleDC(0);
994 priv
->dib
.holdbitmap
= SelectObject(hDC
, priv
->dib
.DIBsection
);
996 SelectPalette(hDC
, This
->palette
->hpal
, FALSE
);
1003 HRESULT
DIB_DirectDrawSurface_free_dc(IDirectDrawSurfaceImpl
* This
, HDC hDC
)
1005 DIB_PRIV_VAR(priv
, This
);
1007 TRACE("Releasing DC for surface: %p\n", This
);
1009 SelectObject(hDC
, priv
->dib
.holdbitmap
);
1015 HRESULT
DIB_DirectDrawSurface_get_dc(IDirectDrawSurfaceImpl
* This
, HDC
* phDC
)
1017 return DIB_DirectDrawSurface_alloc_dc(This
, phDC
);
1020 HRESULT
DIB_DirectDrawSurface_release_dc(IDirectDrawSurfaceImpl
* This
, HDC hDC
)
1022 return DIB_DirectDrawSurface_free_dc(This
, hDC
);
1025 /* GetDDInterface: generic */
1026 /* GetFlipStatus: generic */
1027 /* GetLOD: generic */
1028 /* GetOverlayPosition: generic */
1029 /* GetPalette: generic */
1030 /* GetPixelFormat: generic */
1031 /* GetPriority: generic */
1032 /* GetPrivateData: generic */
1033 /* GetSurfaceDesc: generic */
1034 /* GetUniquenessValue: generic */
1035 /* Initialize: generic */
1036 /* IsLost: generic */
1037 /* Lock: generic with callback? */
1038 /* PageLock: generic */
1039 /* PageUnlock: generic */
1042 DIB_DirectDrawSurface_Restore(LPDIRECTDRAWSURFACE7 iface
)
1044 TRACE("(%p)\n",iface
);
1045 return DD_OK
; /* ??? */
1048 /* SetClipper: generic */
1049 /* SetColorKey: generic */
1050 /* SetLOD: generic */
1051 /* SetOverlayPosition: generic */
1053 void DIB_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl
* This
,
1054 IDirectDrawPaletteImpl
* pal
)
1057 if (This
->surface_desc
.ddsCaps
.dwCaps
& DDSCAPS_PRIMARYSURFACE
)
1058 This
->update_palette(This
, pal
,
1059 0, pal
->palNumEntries
,
1063 void DIB_DirectDrawSurface_update_palette(IDirectDrawSurfaceImpl
* This
,
1064 IDirectDrawPaletteImpl
* pal
,
1065 DWORD dwStart
, DWORD dwCount
,
1066 LPPALETTEENTRY palent
)
1072 TRACE("updating primary palette\n");
1073 for (n
=0; n
<dwCount
; n
++) {
1074 col
[n
].rgbRed
= palent
[n
].peRed
;
1075 col
[n
].rgbGreen
= palent
[n
].peGreen
;
1076 col
[n
].rgbBlue
= palent
[n
].peBlue
;
1077 col
[n
].rgbReserved
= 0;
1079 This
->get_dc(This
, &dc
);
1080 SetDIBColorTable(dc
, dwStart
, dwCount
, col
);
1081 This
->release_dc(This
, dc
);
1083 /* Propagate change to backbuffers if there are any */
1084 /* Basically this is a modification of the Flip code to find the backbuffer */
1085 /* and duplicate the palette update there as well */
1086 if ((This
->surface_desc
.ddsCaps
.dwCaps
&(DDSCAPS_FLIP
|DDSCAPS_FRONTBUFFER
))
1087 == (DDSCAPS_FLIP
|DDSCAPS_FRONTBUFFER
))
1089 static DDSCAPS2 back_caps
= { DDSCAPS_BACKBUFFER
};
1090 LPDIRECTDRAWSURFACE7 tgt
;
1092 HRESULT hr
= IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(This
,IDirectDrawSurface7
),
1096 IDirectDrawSurfaceImpl
* target
= ICOM_OBJECT(IDirectDrawSurfaceImpl
,
1097 IDirectDrawSurface7
,tgt
);
1098 IDirectDrawSurface7_Release(tgt
);
1099 target
->get_dc(target
, &dc
);
1100 SetDIBColorTable(dc
, dwStart
, dwCount
, col
);
1101 target
->release_dc(target
, dc
);
1106 /* SetPalette: generic */
1107 /* SetPriority: generic */
1108 /* SetPrivateData: generic */
1111 DIB_DirectDrawSurface_SetSurfaceDesc(LPDIRECTDRAWSURFACE7 iface
,
1112 LPDDSURFACEDESC2 pDDSD
, DWORD dwFlags
)
1114 ICOM_THIS(IDirectDrawSurfaceImpl
,iface
);
1115 DIB_PRIV_VAR(priv
, This
);
1117 DWORD flags
= pDDSD
->dwFlags
;
1119 if (TRACE_ON(ddraw
)) {
1120 TRACE("(%p)->(%p,%08lx)\n",iface
,pDDSD
,dwFlags
);
1121 DDRAW_dump_surface_desc(pDDSD
);
1124 if (pDDSD
->dwFlags
& DDSD_PIXELFORMAT
) {
1125 flags
&= ~DDSD_PIXELFORMAT
;
1126 if (flags
& DDSD_LPSURFACE
) {
1127 This
->surface_desc
.u4
.ddpfPixelFormat
= pDDSD
->u4
.ddpfPixelFormat
;
1129 FIXME("Change of pixel format without surface re-allocation is not supported !\n");
1132 if (pDDSD
->dwFlags
& DDSD_LPSURFACE
) {
1133 HBITMAP oldbmp
= priv
->dib
.DIBsection
;
1134 LPVOID oldsurf
= This
->surface_desc
.lpSurface
;
1135 BOOL oldc
= priv
->dib
.client_memory
;
1137 flags
&= ~DDSD_LPSURFACE
;
1139 TRACE("new lpSurface=%p\n",pDDSD
->lpSurface
);
1140 This
->surface_desc
.lpSurface
= pDDSD
->lpSurface
;
1141 priv
->dib
.client_memory
= TRUE
;
1143 hr
= create_dib(This
);
1146 priv
->dib
.DIBsection
= oldbmp
;
1147 This
->surface_desc
.lpSurface
= oldsurf
;
1148 priv
->dib
.client_memory
= oldc
;
1152 DeleteObject(oldbmp
);
1155 VirtualFree(oldsurf
, 0, MEM_RELEASE
);
1158 WARN("Unhandled flags : %08lx\n", flags
);
1163 /* Unlock: ???, need callback */
1164 /* UpdateOverlay: generic */
1165 /* UpdateOverlayDisplay: generic */
1166 /* UpdateOverlayZOrder: generic */
1168 static ICOM_VTABLE(IDirectDrawSurface7
) DIB_IDirectDrawSurface7_VTable
=
1170 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1171 Main_DirectDrawSurface_QueryInterface
,
1172 Main_DirectDrawSurface_AddRef
,
1173 Main_DirectDrawSurface_Release
,
1174 Main_DirectDrawSurface_AddAttachedSurface
,
1175 Main_DirectDrawSurface_AddOverlayDirtyRect
,
1176 DIB_DirectDrawSurface_Blt
,
1177 Main_DirectDrawSurface_BltBatch
,
1178 DIB_DirectDrawSurface_BltFast
,
1179 Main_DirectDrawSurface_DeleteAttachedSurface
,
1180 Main_DirectDrawSurface_EnumAttachedSurfaces
,
1181 Main_DirectDrawSurface_EnumOverlayZOrders
,
1182 Main_DirectDrawSurface_Flip
,
1183 Main_DirectDrawSurface_GetAttachedSurface
,
1184 Main_DirectDrawSurface_GetBltStatus
,
1185 Main_DirectDrawSurface_GetCaps
,
1186 Main_DirectDrawSurface_GetClipper
,
1187 Main_DirectDrawSurface_GetColorKey
,
1188 Main_DirectDrawSurface_GetDC
,
1189 Main_DirectDrawSurface_GetFlipStatus
,
1190 Main_DirectDrawSurface_GetOverlayPosition
,
1191 Main_DirectDrawSurface_GetPalette
,
1192 Main_DirectDrawSurface_GetPixelFormat
,
1193 Main_DirectDrawSurface_GetSurfaceDesc
,
1194 Main_DirectDrawSurface_Initialize
,
1195 Main_DirectDrawSurface_IsLost
,
1196 Main_DirectDrawSurface_Lock
,
1197 Main_DirectDrawSurface_ReleaseDC
,
1198 DIB_DirectDrawSurface_Restore
,
1199 Main_DirectDrawSurface_SetClipper
,
1200 Main_DirectDrawSurface_SetColorKey
,
1201 Main_DirectDrawSurface_SetOverlayPosition
,
1202 Main_DirectDrawSurface_SetPalette
,
1203 Main_DirectDrawSurface_Unlock
,
1204 Main_DirectDrawSurface_UpdateOverlay
,
1205 Main_DirectDrawSurface_UpdateOverlayDisplay
,
1206 Main_DirectDrawSurface_UpdateOverlayZOrder
,
1207 Main_DirectDrawSurface_GetDDInterface
,
1208 Main_DirectDrawSurface_PageLock
,
1209 Main_DirectDrawSurface_PageUnlock
,
1210 DIB_DirectDrawSurface_SetSurfaceDesc
,
1211 Main_DirectDrawSurface_SetPrivateData
,
1212 Main_DirectDrawSurface_GetPrivateData
,
1213 Main_DirectDrawSurface_FreePrivateData
,
1214 Main_DirectDrawSurface_GetUniquenessValue
,
1215 Main_DirectDrawSurface_ChangeUniquenessValue
,
1216 Main_DirectDrawSurface_SetPriority
,
1217 Main_DirectDrawSurface_GetPriority
,
1218 Main_DirectDrawSurface_SetLOD
,
1219 Main_DirectDrawSurface_GetLOD