2 * 2D Surface implementation without OpenGL
4 * Copyright 1997-2000 Marcus Meissner
5 * Copyright 1998-2000 Lionel Ulmer
6 * Copyright 2000-2001 TransGaming Technologies Inc.
7 * Copyright 2002-2005 Jason Edmeades
8 * Copyright 2002-2003 Raphael Junqueira
9 * Copyright 2004 Christian Costa
10 * Copyright 2005 Oliver Stieber
11 * Copyright 2006 Stefan Dösinger
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/port.h"
30 #include "wined3d_private.h"
35 /* Use the d3d_surface debug channel to have one channel for all surfaces */
36 WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
37 WINE_DECLARE_DEBUG_CHANNEL(fps);
39 /*****************************************************************************
42 * Helper function that blts the front buffer contents to the target window
45 * This: Surface to copy from
46 * rc: Rectangle to copy
48 *****************************************************************************/
50 x11_copy_to_screen(IWineD3DSurfaceImpl *This,
53 if(This->resource.usage & WINED3DUSAGE_RENDERTARGET)
60 TRACE("(%p)->(%p): Copying to screen\n", This, rc);
62 hSurfaceDC = This->hDC;
64 hDisplayWnd = This->resource.wineD3DDevice->ddraw_window;
65 hDisplayDC = GetDCEx(hDisplayWnd, 0, DCX_CLIPSIBLINGS|DCX_CACHE);
68 TRACE(" copying rect (%d,%d)->(%d,%d), offset (%d,%d)\n",
69 rc->left, rc->top, rc->right, rc->bottom, offset.x, offset.y);
72 /* FIXME: this doesn't work... if users really want to run
73 * X in 8bpp, then we need to call directly into display.drv
74 * (or Wine's equivalent), and force a private colormap
75 * without default entries. */
77 SelectPalette(hDisplayDC, This->palette->hpal, FALSE);
78 RealizePalette(hDisplayDC); /* sends messages => deadlocks */
82 drawrect.right = This->currentDesc.Width;
84 drawrect.bottom = This->currentDesc.Height;
87 /* TODO: Support clippers */
91 HWND hwnd = This->clipper->hWnd;
92 if (hwnd && GetClientRect(hwnd,&xrc))
94 OffsetRect(&xrc,offset.x,offset.y);
95 IntersectRect(&drawrect,&drawrect,&xrc);
101 IntersectRect(&drawrect,&drawrect,rc);
105 /* Only use this if the caller did not pass a rectangle, since
106 * due to double locking this could be the wrong one ...
108 if (This->lockedRect.left != This->lockedRect.right)
110 IntersectRect(&drawrect,&drawrect,&This->lockedRect);
115 drawrect.left-offset.x, drawrect.top-offset.y,
116 drawrect.right-drawrect.left, drawrect.bottom-drawrect.top,
118 drawrect.left, drawrect.top,
120 ReleaseDC(hDisplayWnd, hDisplayDC);
124 /*****************************************************************************
125 * IWineD3DSurface::PreLoad, GDI version
127 * This call is unsupported on GDI surfaces, if it's called something went
128 * wrong in the parent library. Write an informative warning
130 *****************************************************************************/
132 IWineGDISurfaceImpl_PreLoad(IWineD3DSurface *iface)
134 ERR("(%p): PreLoad is not supported on X11 surfaces!\n", iface);
135 ERR("(%p): Most likely the parent library did something wrong.\n", iface);
136 ERR("(%p): Please report to wine-devel\n", iface);
139 /*****************************************************************************
140 * IWineD3DSurface::LockRect, GDI version
142 * Locks the surface and returns a pointer to the surface memory
145 * pLockedRect: Address to return the locking info at
146 * pRect: Rectangle to lock
150 * WINED3D_OK on success
151 * WINED3DERR_INVALIDCALL on errors
153 *****************************************************************************/
154 static HRESULT WINAPI
155 IWineGDISurfaceImpl_LockRect(IWineD3DSurface *iface,
156 WINED3DLOCKED_RECT* pLockedRect,
160 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
162 /* Already locked? */
163 if(This->Flags & SFLAG_LOCKED)
165 ERR("(%p) Surface already locked\n", This);
166 /* What should I return here? */
167 return WINED3DERR_INVALIDCALL;
170 if (!(This->Flags & SFLAG_LOCKABLE))
172 /* This is some GL specific thing, see the OpenGL version of
173 * this method, but check for the flag and write a trace
175 TRACE("Warning: trying to lock unlockable surf@%p\n", This);
178 TRACE("(%p) : rect@%p flags(%08x), output lockedRect@%p, memory@%p\n",
179 This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
181 if(!This->resource.allocatedMemory) {
184 /* This happens on gdi surfaces if the application set a user pointer and resets it.
185 * Recreate the DIB section
187 hr = IWineD3DSurface_GetDC(iface, &hdc); /* will recursively call lockrect, do not set the LOCKED flag to this line */
188 if(hr != WINED3D_OK) return hr;
189 hr = IWineD3DSurface_ReleaseDC(iface, hdc);
190 if(hr != WINED3D_OK) return hr;
193 pLockedRect->Pitch = IWineD3DSurface_GetPitch(iface);
197 pLockedRect->pBits = This->resource.allocatedMemory;
198 This->lockedRect.left = 0;
199 This->lockedRect.top = 0;
200 This->lockedRect.right = This->currentDesc.Width;
201 This->lockedRect.bottom = This->currentDesc.Height;
203 TRACE("Locked Rect (%p) = l %d, t %d, r %d, b %d\n",
204 &This->lockedRect, This->lockedRect.left, This->lockedRect.top,
205 This->lockedRect.right, This->lockedRect.bottom);
209 TRACE("Lock Rect (%p) = l %d, t %d, r %d, b %d\n",
210 pRect, pRect->left, pRect->top, pRect->right, pRect->bottom);
212 if (This->resource.format == WINED3DFMT_DXT1)
214 /* DXT1 is half byte per pixel */
215 pLockedRect->pBits = This->resource.allocatedMemory +
216 (pLockedRect->Pitch * pRect->top) +
217 ((pRect->left * This->bytesPerPixel / 2));
221 pLockedRect->pBits = This->resource.allocatedMemory +
222 (pLockedRect->Pitch * pRect->top) +
223 (pRect->left * This->bytesPerPixel);
225 This->lockedRect.left = pRect->left;
226 This->lockedRect.top = pRect->top;
227 This->lockedRect.right = pRect->right;
228 This->lockedRect.bottom = pRect->bottom;
231 /* No dirtifying is needed for this surface implementation */
232 TRACE("returning memory@%p, pitch(%d)\n", pLockedRect->pBits, pLockedRect->Pitch);
234 This->Flags |= SFLAG_LOCKED;
238 /*****************************************************************************
239 * IWineD3DSurface::UnlockRect, GDI version
241 * Unlocks a surface. This implementation doesn't do much, except updating
242 * the window if the front buffer is unlocked
245 * WINED3D_OK on success
246 * WINED3DERR_INVALIDCALL on failure
248 *****************************************************************************/
249 static HRESULT WINAPI
250 IWineGDISurfaceImpl_UnlockRect(IWineD3DSurface *iface)
252 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
253 IWineD3DDeviceImpl *dev = (IWineD3DDeviceImpl *) This->resource.wineD3DDevice;
254 TRACE("(%p)\n", This);
256 if (!(This->Flags & SFLAG_LOCKED))
258 WARN("trying to Unlock an unlocked surf@%p\n", This);
259 return WINED3DERR_INVALIDCALL;
262 /* Can be useful for debugging */
265 static unsigned int gen = 0;
268 if ((gen % 10) == 0) {
269 snprintf(buffer, sizeof(buffer), "/tmp/surface%p_type%u_level%u_%u.ppm", This, This->glDescription.target, This->glDescription.level, gen);
270 IWineD3DSurfaceImpl_SaveSnapshot(iface, buffer);
273 * debugging crash code
282 /* Update the screen */
283 if(This == (IWineD3DSurfaceImpl *) dev->ddraw_primary)
285 x11_copy_to_screen(This, &This->lockedRect);
288 This->Flags &= ~SFLAG_LOCKED;
289 memset(&This->lockedRect, 0, sizeof(RECT));
293 /*****************************************************************************
294 * IWineD3DSurface::Flip, GDI version
296 * Flips 2 flipping enabled surfaces. Determining the 2 targets is done by
297 * the parent library. This implementation changes the data pointers of the
298 * surfaces and copies the new front buffer content to the screen
301 * override: Flipping target(e.g. back buffer)
304 * WINED3D_OK on success
306 *****************************************************************************/
307 static HRESULT WINAPI
308 IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface,
309 IWineD3DSurface *override,
312 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
313 IWineD3DSurfaceImpl *Target = (IWineD3DSurfaceImpl *) override;
314 TRACE("(%p)->(%p,%x)\n", This, override, Flags);
316 TRACE("(%p) Flipping to surface %p\n", This, Target);
320 ERR("(%p): Can't flip without a target\n", This);
321 return WINED3DERR_INVALIDCALL;
328 This->hDC = Target->hDC;
332 /* Flip the DIBsection */
335 tmp = This->dib.DIBsection;
336 This->dib.DIBsection = Target->dib.DIBsection;
337 Target->dib.DIBsection = tmp;
340 /* Flip the surface data */
344 tmp = This->dib.bitmap_data;
345 This->dib.bitmap_data = Target->dib.bitmap_data;
346 Target->dib.bitmap_data = tmp;
348 tmp = This->resource.allocatedMemory;
349 This->resource.allocatedMemory = Target->resource.allocatedMemory;
350 Target->resource.allocatedMemory = tmp;
353 /* client_memory should not be different, but just in case */
356 tmp = This->dib.client_memory;
357 This->dib.client_memory = Target->dib.client_memory;
358 Target->dib.client_memory = tmp;
361 /* Useful for debugging */
364 static unsigned int gen = 0;
367 if ((gen % 10) == 0) {
368 snprintf(buffer, sizeof(buffer), "/tmp/surface%p_type%u_level%u_%u.ppm", This, This->glDescription.target, This->glDescription.level, gen);
369 IWineD3DSurfaceImpl_SaveSnapshot(iface, buffer);
372 * debugging crash code
381 /* Update the screen */
382 x11_copy_to_screen(This, NULL);
387 static long prev_time, frames;
389 DWORD time = GetTickCount();
391 /* every 1.5 seconds */
392 if (time - prev_time > 1500) {
393 TRACE_(fps)("@ approx %.2ffps\n", 1000.0*frames/(time - prev_time));
402 /*****************************************************************************
405 * Helper function that fills a memory area with a specific color
408 * buf: memory address to start filling at
409 * width, height: Dimensions of the area to fill
410 * bpp: Bit depth of the surface
411 * lPitch: pitch of the surface
412 * color: Color to fill with
414 *****************************************************************************/
416 _Blt_ColorFill(BYTE *buf,
417 int width, int height,
418 int bpp, LONG lPitch,
426 #define COLORFILL_ROW(type) \
428 type *d = (type *) buf; \
429 for (x = 0; x < width; x++) \
430 d[x] = (type) color; \
435 case 1: COLORFILL_ROW(BYTE)
436 case 2: COLORFILL_ROW(WORD)
439 BYTE *d = (BYTE *) buf;
440 for (x = 0; x < width; x++,d+=3)
442 d[0] = (color ) & 0xFF;
443 d[1] = (color>> 8) & 0xFF;
444 d[2] = (color>>16) & 0xFF;
448 case 4: COLORFILL_ROW(DWORD)
450 FIXME("Color fill not implemented for bpp %d!\n", bpp*8);
451 return WINED3DERR_NOTAVAILABLE;
456 /* Now copy first row */
458 for (y = 1; y < height; y++)
461 memcpy(buf, first, width * bpp);
466 /*****************************************************************************
467 * IWineD3DSurface::Blt, GDI version
469 * Performs blits to a surface, eigher from a source of source-less blts
470 * This is the main functionality of DirectDraw
473 * DestRect: Destination rectangle to write to
474 * SrcSurface: Source surface, can be NULL
475 * SrcRect: Source rectangle
476 *****************************************************************************/
478 IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface,
480 IWineD3DSurface *SrcSurface,
483 WINEDDBLTFX *DDBltFx,
484 WINED3DTEXTUREFILTERTYPE Filter)
486 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
487 IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
489 HRESULT ret = WINED3D_OK;
490 WINED3DLOCKED_RECT dlock, slock;
491 WINED3DFORMAT dfmt = WINED3DFMT_UNKNOWN, sfmt = WINED3DFMT_UNKNOWN;
492 int bpp, srcheight, srcwidth, dstheight, dstwidth, width;
494 const PixelFormatDesc *sEntry, *dEntry;
496 TRACE("(%p)->(%p,%p,%p,%x,%p)\n", This, DestRect, Src, SrcRect, Flags, DDBltFx);
498 if (TRACE_ON(d3d_surface))
500 if (DestRect) TRACE("\tdestrect :%dx%d-%dx%d\n",
501 DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
502 if (SrcRect) TRACE("\tsrcrect :%dx%d-%dx%d\n",
503 SrcRect->left, SrcRect->top, SrcRect->right, SrcRect->bottom);
506 DDRAW_dump_DDBLT(Flags);
507 if (Flags & WINEDDBLT_DDFX)
510 DDRAW_dump_DDBLTFX(DDBltFx->dwDDFX);
515 if ( (This->Flags & SFLAG_LOCKED) || ((Src != NULL) && (Src->Flags & SFLAG_LOCKED)))
517 WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n");
518 return WINEDDERR_SURFACEBUSY;
521 if(Filter != WINED3DTEXF_NONE) {
522 /* Can happen when d3d9 apps do a StretchRect call which isn't handled in gl */
523 FIXME("Filters not supported in software blit\n");
528 IWineD3DSurface_LockRect(iface, &dlock, NULL, 0);
529 dfmt = This->resource.format;
532 sEntry = getFormatDescEntry(sfmt);
539 IWineD3DSurface_LockRect(SrcSurface, &slock, NULL, WINED3DLOCK_READONLY);
540 sfmt = Src->resource.format;
542 sEntry = getFormatDescEntry(sfmt);
543 dfmt = This->resource.format;
544 dEntry = getFormatDescEntry(dfmt);
545 IWineD3DSurface_LockRect(iface, &dlock,NULL,0);
548 if (!DDBltFx || !(DDBltFx->dwDDFX)) Flags &= ~WINEDDBLT_DDFX;
550 if (sEntry->isFourcc && dEntry->isFourcc)
554 FIXME("FOURCC->FOURCC copy only supported for the same type of surface\n");
555 ret = WINED3DERR_WRONGTEXTUREFORMAT;
558 memcpy(dlock.pBits, slock.pBits, This->resource.size);
562 if (sEntry->isFourcc && !dEntry->isFourcc)
564 FIXME("DXTC decompression not supported right now\n");
570 memcpy(&xdst,DestRect,sizeof(xdst));
575 xdst.bottom = This->currentDesc.Height;
577 xdst.right = This->currentDesc.Width;
582 memcpy(&xsrc,SrcRect,sizeof(xsrc));
589 xsrc.bottom = Src->currentDesc.Height;
591 xsrc.right = Src->currentDesc.Width;
595 memset(&xsrc,0,sizeof(xsrc));
599 /* First check for the validity of source / destination rectangles. This was
600 verified using a test application + by MSDN.
603 ((xsrc.bottom > Src->currentDesc.Height) || (xsrc.bottom < 0) ||
604 (xsrc.top > Src->currentDesc.Height) || (xsrc.top < 0) ||
605 (xsrc.left > Src->currentDesc.Width) || (xsrc.left < 0) ||
606 (xsrc.right > Src->currentDesc.Width) || (xsrc.right < 0) ||
607 (xsrc.right < xsrc.left) || (xsrc.bottom < xsrc.top)))
609 WARN("Application gave us bad source rectangle for Blt.\n");
610 ret = WINEDDERR_INVALIDRECT;
613 /* For the Destination rect, it can be out of bounds on the condition that a clipper
614 is set for the given surface.
616 if ((/*This->clipper == NULL*/ TRUE) &&
617 ((xdst.bottom > This->currentDesc.Height) || (xdst.bottom < 0) ||
618 (xdst.top > This->currentDesc.Height) || (xdst.top < 0) ||
619 (xdst.left > This->currentDesc.Width) || (xdst.left < 0) ||
620 (xdst.right > This->currentDesc.Width) || (xdst.right < 0) ||
621 (xdst.right < xdst.left) || (xdst.bottom < xdst.top)))
623 WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n");
624 ret = WINEDDERR_INVALIDRECT;
628 /* Now handle negative values in the rectangles. Warning: only supported for now
629 in the 'simple' cases (ie not in any stretching / rotation cases).
631 First, the case where nothing is to be done.
633 if (((xdst.bottom <= 0) || (xdst.right <= 0) ||
634 (xdst.top >= (int) This->currentDesc.Height) ||
635 (xdst.left >= (int) This->currentDesc.Width)) ||
637 ((xsrc.bottom <= 0) || (xsrc.right <= 0) ||
638 (xsrc.top >= (int) Src->currentDesc.Height) ||
639 (xsrc.left >= (int) Src->currentDesc.Width)) ))
641 TRACE("Nothing to be done !\n");
645 /* The easy case : the source-less blits.... */
649 RECT temp_rect; /* No idea if intersect rect can be the same as one of the source rect */
653 full_rect.right = This->currentDesc.Width;
654 full_rect.bottom = This->currentDesc.Height;
655 IntersectRect(&temp_rect, &full_rect, &xdst);
660 /* Only handle clipping on the destination rectangle */
661 int clip_horiz = (xdst.left < 0) || (xdst.right > (int) This->currentDesc.Width );
662 int clip_vert = (xdst.top < 0) || (xdst.bottom > (int) This->currentDesc.Height);
663 if (clip_vert || clip_horiz)
665 /* Now check if this is a special case or not... */
666 if ((((xdst.bottom - xdst.top ) != (xsrc.bottom - xsrc.top )) && clip_vert ) ||
667 (((xdst.right - xdst.left) != (xsrc.right - xsrc.left)) && clip_horiz) ||
668 (Flags & WINEDDBLT_DDFX))
670 WARN("Out of screen rectangle in special case. Not handled right now.\n");
676 if (xdst.left < 0) { xsrc.left -= xdst.left; xdst.left = 0; }
677 if (xdst.right > This->currentDesc.Width)
679 xsrc.right -= (xdst.right - (int) This->currentDesc.Width);
680 xdst.right = (int) This->currentDesc.Width;
687 xsrc.top -= xdst.top;
690 if (xdst.bottom > This->currentDesc.Height)
692 xsrc.bottom -= (xdst.bottom - (int) This->currentDesc.Height);
693 xdst.bottom = (int) This->currentDesc.Height;
696 /* And check if after clipping something is still to be done... */
697 if ((xdst.bottom <= 0) || (xdst.right <= 0) ||
698 (xdst.top >= (int) This->currentDesc.Height) ||
699 (xdst.left >= (int) This->currentDesc.Width) ||
700 (xsrc.bottom <= 0) || (xsrc.right <= 0) ||
701 (xsrc.top >= (int) Src->currentDesc.Height) ||
702 (xsrc.left >= (int) Src->currentDesc.Width))
704 TRACE("Nothing to be done after clipping !\n");
710 bpp = This->bytesPerPixel;
711 srcheight = xsrc.bottom - xsrc.top;
712 srcwidth = xsrc.right - xsrc.left;
713 dstheight = xdst.bottom - xdst.top;
714 dstwidth = xdst.right - xdst.left;
715 width = (xdst.right - xdst.left) * bpp;
717 assert(width <= dlock.Pitch);
719 dbuf = (BYTE*)dlock.pBits+(xdst.top*dlock.Pitch)+(xdst.left*bpp);
721 if (Flags & WINEDDBLT_WAIT)
723 Flags &= ~WINEDDBLT_WAIT;
725 if (Flags & WINEDDBLT_ASYNC)
727 static BOOL displayed = FALSE;
729 FIXME("Can't handle WINEDDBLT_ASYNC flag right now.\n");
731 Flags &= ~WINEDDBLT_ASYNC;
733 if (Flags & WINEDDBLT_DONOTWAIT)
735 /* WINEDDBLT_DONOTWAIT appeared in DX7 */
736 static BOOL displayed = FALSE;
738 FIXME("Can't handle WINEDDBLT_DONOTWAIT flag right now.\n");
740 Flags &= ~WINEDDBLT_DONOTWAIT;
743 /* First, all the 'source-less' blits */
744 if (Flags & WINEDDBLT_COLORFILL)
746 ret = _Blt_ColorFill(dbuf, dstwidth, dstheight, bpp,
747 dlock.Pitch, DDBltFx->u5.dwFillColor);
748 Flags &= ~WINEDDBLT_COLORFILL;
751 if (Flags & WINEDDBLT_DEPTHFILL)
753 FIXME("DDBLT_DEPTHFILL needs to be implemented!\n");
755 if (Flags & WINEDDBLT_ROP)
757 /* Catch some degenerate cases here */
758 switch(DDBltFx->dwROP)
761 ret = _Blt_ColorFill(dbuf,dstwidth,dstheight,bpp,dlock.Pitch,0);
763 case 0xAA0029: /* No-op */
766 ret = _Blt_ColorFill(dbuf,dstwidth,dstheight,bpp,dlock.Pitch,~0);
768 case SRCCOPY: /* well, we do that below ? */
771 FIXME("Unsupported raster op: %08x Pattern: %p\n", DDBltFx->dwROP, DDBltFx->u5.lpDDSPattern);
774 Flags &= ~WINEDDBLT_ROP;
776 if (Flags & WINEDDBLT_DDROPS)
778 FIXME("\tDdraw Raster Ops: %08x Pattern: %p\n", DDBltFx->dwDDROP, DDBltFx->u5.lpDDSPattern);
780 /* Now the 'with source' blits */
784 int sx, xinc, sy, yinc;
786 if (!dstwidth || !dstheight) /* hmm... stupid program ? */
788 sbase = (BYTE*)slock.pBits+(xsrc.top*slock.Pitch)+xsrc.left*bpp;
789 xinc = (srcwidth << 16) / dstwidth;
790 yinc = (srcheight << 16) / dstheight;
794 /* No effects, we can cheat here */
795 if (dstwidth == srcwidth)
797 if (dstheight == srcheight)
799 /* No stretching in either direction. This needs to be as
800 * fast as possible */
803 /* check for overlapping surfaces */
804 if (SrcSurface != iface || xdst.top < xsrc.top ||
805 xdst.right <= xsrc.left || xsrc.right <= xdst.left)
807 /* no overlap, or dst above src, so copy from top downwards */
808 for (y = 0; y < dstheight; y++)
810 memcpy(dbuf, sbuf, width);
815 else if (xdst.top > xsrc.top) /* copy from bottom upwards */
817 sbuf += (slock.Pitch*dstheight);
818 dbuf += (dlock.Pitch*dstheight);
819 for (y = 0; y < dstheight; y++)
823 memcpy(dbuf, sbuf, width);
826 else /* src and dst overlapping on the same line, use memmove */
828 for (y = 0; y < dstheight; y++)
830 memmove(dbuf, sbuf, width);
836 /* Stretching in Y direction only */
837 for (y = sy = 0; y < dstheight; y++, sy += yinc) {
838 sbuf = sbase + (sy >> 16) * slock.Pitch;
839 memcpy(dbuf, sbuf, width);
846 /* Stretching in X direction */
848 for (y = sy = 0; y < dstheight; y++, sy += yinc)
850 sbuf = sbase + (sy >> 16) * slock.Pitch;
852 if ((sy >> 16) == (last_sy >> 16))
854 /* this sourcerow is the same as last sourcerow -
855 * copy already stretched row
857 memcpy(dbuf, dbuf - dlock.Pitch, width);
861 #define STRETCH_ROW(type) { \
862 type *s = (type *) sbuf, *d = (type *) dbuf; \
863 for (x = sx = 0; x < dstwidth; x++, sx += xinc) \
864 d[x] = s[sx >> 16]; \
869 case 1: STRETCH_ROW(BYTE)
870 case 2: STRETCH_ROW(WORD)
871 case 4: STRETCH_ROW(DWORD)
875 for (x = sx = 0; x < dstwidth; x++, sx+= xinc)
880 pixel = s[0]|(s[1]<<8)|(s[2]<<16);
881 d[0] = (pixel )&0xff;
882 d[1] = (pixel>> 8)&0xff;
883 d[2] = (pixel>>16)&0xff;
889 FIXME("Stretched blit not implemented for bpp %d!\n", bpp*8);
890 ret = WINED3DERR_NOTAVAILABLE;
902 LONG dstyinc = dlock.Pitch, dstxinc = bpp;
903 DWORD keylow = 0xFFFFFFFF, keyhigh = 0, keymask = 0xFFFFFFFF;
904 DWORD destkeylow = 0x0, destkeyhigh = 0xFFFFFFFF, destkeymask = 0xFFFFFFFF;
905 if (Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYDEST | WINEDDBLT_KEYSRCOVERRIDE | WINEDDBLT_KEYDESTOVERRIDE))
907 /* The color keying flags are checked for correctness in ddraw */
908 if (Flags & WINEDDBLT_KEYSRC)
910 keylow = Src->SrcBltCKey.dwColorSpaceLowValue;
911 keyhigh = Src->SrcBltCKey.dwColorSpaceHighValue;
913 else if (Flags & WINEDDBLT_KEYSRCOVERRIDE)
915 keylow = DDBltFx->ddckSrcColorkey.dwColorSpaceLowValue;
916 keyhigh = DDBltFx->ddckSrcColorkey.dwColorSpaceHighValue;
919 if (Flags & WINEDDBLT_KEYDEST)
921 /* Destination color keys are taken from the source surface ! */
922 destkeylow = Src->DestBltCKey.dwColorSpaceLowValue;
923 destkeyhigh = Src->DestBltCKey.dwColorSpaceHighValue;
925 else if (Flags & WINEDDBLT_KEYDESTOVERRIDE)
927 destkeylow = DDBltFx->ddckDestColorkey.dwColorSpaceLowValue;
928 destkeyhigh = DDBltFx->ddckDestColorkey.dwColorSpaceHighValue;
937 keymask = sEntry->redMask |
941 Flags &= ~(WINEDDBLT_KEYSRC | WINEDDBLT_KEYDEST | WINEDDBLT_KEYSRCOVERRIDE | WINEDDBLT_KEYDESTOVERRIDE);
944 if (Flags & WINEDDBLT_DDFX)
946 LPBYTE dTopLeft, dTopRight, dBottomLeft, dBottomRight, tmp;
949 dTopRight = dbuf+((dstwidth-1)*bpp);
950 dBottomLeft = dTopLeft+((dstheight-1)*dlock.Pitch);
951 dBottomRight = dBottomLeft+((dstwidth-1)*bpp);
953 if (DDBltFx->dwDDFX & WINEDDBLTFX_ARITHSTRETCHY)
955 /* I don't think we need to do anything about this flag */
956 WARN("Flags=DDBLT_DDFX nothing done for WINEDDBLTFX_ARITHSTRETCHY\n");
958 if (DDBltFx->dwDDFX & WINEDDBLTFX_MIRRORLEFTRIGHT)
961 dTopRight = dTopLeft;
964 dBottomRight = dBottomLeft;
966 dstxinc = dstxinc *-1;
968 if (DDBltFx->dwDDFX & WINEDDBLTFX_MIRRORUPDOWN)
971 dTopLeft = dBottomLeft;
974 dTopRight = dBottomRight;
976 dstyinc = dstyinc *-1;
978 if (DDBltFx->dwDDFX & WINEDDBLTFX_NOTEARING)
980 /* I don't think we need to do anything about this flag */
981 WARN("Flags=DDBLT_DDFX nothing done for WINEDDBLTFX_NOTEARING\n");
983 if (DDBltFx->dwDDFX & WINEDDBLTFX_ROTATE180)
986 dBottomRight = dTopLeft;
989 dBottomLeft = dTopRight;
991 dstxinc = dstxinc * -1;
992 dstyinc = dstyinc * -1;
994 if (DDBltFx->dwDDFX & WINEDDBLTFX_ROTATE270)
997 dTopLeft = dBottomLeft;
998 dBottomLeft = dBottomRight;
999 dBottomRight = dTopRight;
1004 dstxinc = dstxinc * -1;
1006 if (DDBltFx->dwDDFX & WINEDDBLTFX_ROTATE90)
1009 dTopLeft = dTopRight;
1010 dTopRight = dBottomRight;
1011 dBottomRight = dBottomLeft;
1016 dstyinc = dstyinc * -1;
1018 if (DDBltFx->dwDDFX & WINEDDBLTFX_ZBUFFERBASEDEST)
1020 /* I don't think we need to do anything about this flag */
1021 WARN("Flags=WINEDDBLT_DDFX nothing done for WINEDDBLTFX_ZBUFFERBASEDEST\n");
1024 Flags &= ~(WINEDDBLT_DDFX);
1027 #define COPY_COLORKEY_FX(type) { \
1028 type *s, *d = (type *) dbuf, *dx, tmp; \
1029 for (y = sy = 0; y < dstheight; y++, sy += yinc) { \
1030 s = (type*)(sbase + (sy >> 16) * slock.Pitch); \
1032 for (x = sx = 0; x < dstwidth; x++, sx += xinc) { \
1033 tmp = s[sx >> 16]; \
1034 if (((tmp & keymask) < keylow || (tmp & keymask) > keyhigh) && \
1035 ((dx[0] & destkeymask) >= destkeylow && (dx[0] & destkeymask) <= destkeyhigh)) { \
1038 dx = (type*)(((LPBYTE)dx)+dstxinc); \
1040 d = (type*)(((LPBYTE)d)+dstyinc); \
1045 case 1: COPY_COLORKEY_FX(BYTE)
1046 case 2: COPY_COLORKEY_FX(WORD)
1047 case 4: COPY_COLORKEY_FX(DWORD)
1050 LPBYTE s,d = dbuf, dx;
1051 for (y = sy = 0; y < dstheight; y++, sy += yinc)
1053 sbuf = sbase + (sy >> 16) * slock.Pitch;
1055 for (x = sx = 0; x < dstwidth; x++, sx+= xinc)
1057 DWORD pixel, dpixel = 0;
1058 s = sbuf+3*(sx>>16);
1059 pixel = s[0]|(s[1]<<8)|(s[2]<<16);
1060 dpixel = dx[0]|(dx[1]<<8)|(dx[2]<<16);
1061 if (((pixel & keymask) < keylow || (pixel & keymask) > keyhigh) &&
1062 ((dpixel & keymask) >= destkeylow || (dpixel & keymask) <= keyhigh))
1064 dx[0] = (pixel )&0xff;
1065 dx[1] = (pixel>> 8)&0xff;
1066 dx[2] = (pixel>>16)&0xff;
1075 FIXME("%s color-keyed blit not implemented for bpp %d!\n",
1076 (Flags & WINEDDBLT_KEYSRC) ? "Source" : "Destination", bpp*8);
1077 ret = WINED3DERR_NOTAVAILABLE;
1079 #undef COPY_COLORKEY_FX
1085 if (Flags && FIXME_ON(d3d_surface))
1087 FIXME("\tUnsupported flags: %08x\n", Flags);
1091 IWineD3DSurface_UnlockRect(iface);
1092 if (SrcSurface && SrcSurface != iface) IWineD3DSurface_UnlockRect(SrcSurface);
1096 /*****************************************************************************
1097 * IWineD3DSurface::BltFast, GDI version
1099 * This is the software implementation of BltFast, as used by GDI surfaces
1100 * and as a fallback for OpenGL surfaces. This code is taken from the old
1101 * DirectDraw code, and was originally written by TransGaming.
1106 * Source: Source surface to copy from
1107 * rsrc: Source rectangle
1111 * WINED3D_OK on success
1113 *****************************************************************************/
1115 IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface,
1118 IWineD3DSurface *Source,
1122 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
1123 IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) Source;
1125 int bpp, w, h, x, y;
1126 WINED3DLOCKED_RECT dlock,slock;
1127 HRESULT ret = WINED3D_OK;
1129 RECT lock_src, lock_dst, lock_union;
1131 const PixelFormatDesc *sEntry, *dEntry;
1133 if (TRACE_ON(d3d_surface))
1135 TRACE("(%p)->(%d,%d,%p,%p,%08x)\n", This,dstx,dsty,Src,rsrc,trans);
1139 TRACE("\tsrcrect: %dx%d-%dx%d\n",rsrc->left,rsrc->top,
1140 rsrc->right,rsrc->bottom);
1144 TRACE(" srcrect: NULL\n");
1148 if ((This->Flags & SFLAG_LOCKED) ||
1149 ((Src != NULL) && (Src->Flags & SFLAG_LOCKED)))
1151 WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n");
1152 return WINEDDERR_SURFACEBUSY;
1157 WARN("rsrc is NULL!\n");
1161 rsrc->right = Src->currentDesc.Width;
1162 rsrc->bottom = Src->currentDesc.Height;
1165 /* Check source rect for validity. Copied from normal Blt. Fixes Baldur's Gate.*/
1166 if ((rsrc->bottom > Src->currentDesc.Height) || (rsrc->bottom < 0) ||
1167 (rsrc->top > Src->currentDesc.Height) || (rsrc->top < 0) ||
1168 (rsrc->left > Src->currentDesc.Width) || (rsrc->left < 0) ||
1169 (rsrc->right > Src->currentDesc.Width) || (rsrc->right < 0) ||
1170 (rsrc->right < rsrc->left) || (rsrc->bottom < rsrc->top))
1172 WARN("Application gave us bad source rectangle for BltFast.\n");
1173 return WINEDDERR_INVALIDRECT;
1176 h = rsrc->bottom - rsrc->top;
1177 if (h > This->currentDesc.Height-dsty) h = This->currentDesc.Height-dsty;
1178 if (h > Src->currentDesc.Height-rsrc->top) h=Src->currentDesc.Height-rsrc->top;
1179 if (h <= 0) return WINEDDERR_INVALIDRECT;
1181 w = rsrc->right - rsrc->left;
1182 if (w > This->currentDesc.Width-dstx) w = This->currentDesc.Width-dstx;
1183 if (w > Src->currentDesc.Width-rsrc->left) w = Src->currentDesc.Width-rsrc->left;
1184 if (w <= 0) return WINEDDERR_INVALIDRECT;
1186 /* Now compute the locking rectangle... */
1187 lock_src.left = rsrc->left;
1188 lock_src.top = rsrc->top;
1189 lock_src.right = lock_src.left + w;
1190 lock_src.bottom = lock_src.top + h;
1192 lock_dst.left = dstx;
1193 lock_dst.top = dsty;
1194 lock_dst.right = dstx + w;
1195 lock_dst.bottom = dsty + h;
1197 bpp = This->bytesPerPixel;
1199 /* We need to lock the surfaces, or we won't get refreshes when done. */
1204 UnionRect(&lock_union, &lock_src, &lock_dst);
1206 /* Lock the union of the two rectangles */
1207 ret = IWineD3DSurface_LockRect(iface, &dlock, &lock_union, 0);
1208 if(ret != WINED3D_OK) goto error;
1210 pitch = dlock.Pitch;
1211 slock.Pitch = dlock.Pitch;
1213 /* Since slock was originally copied from this surface's description, we can just reuse it */
1214 assert(This->resource.allocatedMemory != NULL);
1215 sbuf = (BYTE *)This->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp;
1216 dbuf = (BYTE *)This->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp;
1217 sEntry = getFormatDescEntry(Src->resource.format);
1222 ret = IWineD3DSurface_LockRect(Source, &slock, &lock_src, WINED3DLOCK_READONLY);
1223 if(ret != WINED3D_OK) goto error;
1224 ret = IWineD3DSurface_LockRect(iface, &dlock, &lock_dst, 0);
1225 if(ret != WINED3D_OK) goto error;
1229 TRACE("Dst is at %p, Src is at %p\n", dbuf, sbuf);
1231 sEntry = getFormatDescEntry(Src->resource.format);
1232 dEntry = getFormatDescEntry(This->resource.format);
1235 /* Handle first the FOURCC surfaces... */
1236 if (sEntry->isFourcc && dEntry->isFourcc)
1238 TRACE("Fourcc -> Fourcc copy\n");
1240 FIXME("trans arg not supported when a FOURCC surface is involved\n");
1242 FIXME("offset for destination surface is not supported\n");
1243 if (Src->resource.format != This->resource.format)
1245 FIXME("FOURCC->FOURCC copy only supported for the same type of surface\n");
1246 ret = WINED3DERR_WRONGTEXTUREFORMAT;
1249 /* FIXME: Watch out that the size is correct for FOURCC surfaces */
1250 memcpy(dbuf, sbuf, This->resource.size);
1253 if (sEntry->isFourcc && !dEntry->isFourcc)
1255 /* TODO: Use the libtxc_dxtn.so shared library to do
1256 * software decompression
1258 ERR("DXTC decompression not supported by now\n");
1262 if (trans & (WINEDDBLTFAST_SRCCOLORKEY | WINEDDBLTFAST_DESTCOLORKEY))
1264 DWORD keylow, keyhigh;
1265 TRACE("Color keyed copy\n");
1266 if (trans & WINEDDBLTFAST_SRCCOLORKEY)
1268 keylow = Src->SrcBltCKey.dwColorSpaceLowValue;
1269 keyhigh = Src->SrcBltCKey.dwColorSpaceHighValue;
1273 /* I'm not sure if this is correct */
1274 FIXME("WINEDDBLTFAST_DESTCOLORKEY not fully supported yet.\n");
1275 keylow = This->DestBltCKey.dwColorSpaceLowValue;
1276 keyhigh = This->DestBltCKey.dwColorSpaceHighValue;
1279 #define COPYBOX_COLORKEY(type) { \
1281 s = (type *) sbuf; \
1282 d = (type *) dbuf; \
1283 for (y = 0; y < h; y++) { \
1284 for (x = 0; x < w; x++) { \
1286 if (tmp < keylow || tmp > keyhigh) d[x] = tmp; \
1288 s = (type *)((BYTE *)s + slock.Pitch); \
1289 d = (type *)((BYTE *)d + dlock.Pitch); \
1295 case 1: COPYBOX_COLORKEY(BYTE)
1296 case 2: COPYBOX_COLORKEY(WORD)
1297 case 4: COPYBOX_COLORKEY(DWORD)
1304 for (y = 0; y < h; y++)
1306 for (x = 0; x < w * 3; x += 3)
1308 tmp = (DWORD)s[x] + ((DWORD)s[x + 1] << 8) + ((DWORD)s[x + 2] << 16);
1309 if (tmp < keylow || tmp > keyhigh)
1311 d[x + 0] = s[x + 0];
1312 d[x + 1] = s[x + 1];
1313 d[x + 2] = s[x + 2];
1322 FIXME("Source color key blitting not supported for bpp %d\n",bpp*8);
1323 ret = WINED3DERR_NOTAVAILABLE;
1326 #undef COPYBOX_COLORKEY
1327 TRACE("Copy Done\n");
1331 int width = w * bpp;
1332 TRACE("NO color key copy\n");
1333 for (y = 0; y < h; y++)
1335 /* This is pretty easy, a line for line memcpy */
1336 memcpy(dbuf, sbuf, width);
1337 sbuf += slock.Pitch;
1338 dbuf += dlock.Pitch;
1340 TRACE("Copy done\n");
1346 IWineD3DSurface_UnlockRect(iface);
1350 IWineD3DSurface_UnlockRect(iface);
1351 IWineD3DSurface_UnlockRect(Source);
1357 /*****************************************************************************
1358 * IWineD3DSurface::LoadTexture, GDI version
1360 * This is mutually unsupported by GDI surfaces
1363 * D3DERR_INVALIDCALL
1365 *****************************************************************************/
1367 IWineGDISurfaceImpl_LoadTexture(IWineD3DSurface *iface)
1369 ERR("Unsupported on X11 surfaces\n");
1370 return WINED3DERR_INVALIDCALL;
1373 /*****************************************************************************
1374 * IWineD3DSurface::SaveSnapshot, GDI version
1376 * This method writes the surface's contents to the in tga format to the
1377 * file specified in filename.
1380 * filename: File to write to
1383 * WINED3DERR_INVALIDCALL if the file couldn't be opened
1384 * WINED3D_OK on success
1386 *****************************************************************************/
1387 static int get_shift(DWORD color_mask) {
1389 while (color_mask > 0xFF) {
1393 while ((color_mask & 0x80) == 0) {
1402 IWineGDISurfaceImpl_SaveSnapshot(IWineD3DSurface *iface,
1403 const char* filename)
1407 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
1408 static char *output = NULL;
1409 static int size = 0;
1410 const PixelFormatDesc *formatEntry = getFormatDescEntry(This->resource.format);
1412 if (This->pow2Width > size) {
1413 output = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pow2Width * 3);
1414 size = This->pow2Width;
1418 f = fopen(filename, "w+");
1420 ERR("opening of %s failed with\n", filename);
1421 return WINED3DERR_INVALIDCALL;
1423 fprintf(f, "P6\n%d %d\n255\n", This->pow2Width, This->pow2Height);
1425 if (This->resource.format == WINED3DFMT_P8) {
1426 unsigned char table[256][3];
1429 if (This->palette == NULL) {
1431 return WINED3DERR_INVALIDCALL;
1433 for (i = 0; i < 256; i++) {
1434 table[i][0] = This->palette->palents[i].peRed;
1435 table[i][1] = This->palette->palents[i].peGreen;
1436 table[i][2] = This->palette->palents[i].peBlue;
1438 for (y = 0; y < This->pow2Height; y++) {
1439 unsigned char *src = (unsigned char *) This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
1440 for (x = 0; x < This->pow2Width; x++) {
1441 unsigned char color = *src;
1444 output[3 * x + 0] = table[color][0];
1445 output[3 * x + 1] = table[color][1];
1446 output[3 * x + 2] = table[color][2];
1448 fwrite(output, 3 * This->pow2Width, 1, f);
1451 int red_shift, green_shift, blue_shift, pix_width;
1453 pix_width = This->bytesPerPixel;
1455 red_shift = get_shift(formatEntry->redMask);
1456 green_shift = get_shift(formatEntry->greenMask);
1457 blue_shift = get_shift(formatEntry->blueMask);
1459 for (y = 0; y < This->pow2Height; y++) {
1460 unsigned char *src = (unsigned char *) This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
1461 for (x = 0; x < This->pow2Width; x++) {
1467 for (i = 0; i < pix_width; i++) {
1468 color |= src[i] << (8 * i);
1470 src += 1 * pix_width;
1472 comp = color & formatEntry->redMask;
1473 output[3 * x + 0] = red_shift > 0 ? comp >> red_shift : comp << -red_shift;
1474 comp = color & formatEntry->greenMask;
1475 output[3 * x + 1] = green_shift > 0 ? comp >> green_shift : comp << -green_shift;
1476 comp = color & formatEntry->blueMask;
1477 output[3 * x + 2] = blue_shift > 0 ? comp >> blue_shift : comp << -blue_shift;
1479 fwrite(output, 3 * This->pow2Width, 1, f);
1486 /*****************************************************************************
1487 * IWineD3DSurface::PrivateSetup, GDI version
1489 * Initializes the GDI surface, aka creates the DIB section we render to
1490 * The DIB section creation is done by calling GetDC, which will create the
1491 * section and releasing the dc to allow the app to use it. The dib section
1492 * will stay until the surface is released
1494 * GDI surfaces do not need to be a power of 2 in size, so the pow2 sizes
1495 * are set to the real sizes to save memory. The NONPOW2 flag is unset to
1496 * avoid confusion in the shared surface code.
1499 * WINED3D_OK on success
1500 * The return values of called methods on failure
1502 *****************************************************************************/
1504 IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
1506 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
1509 long oldsize = This->resource.size;
1511 if(This->resource.usage & WINED3DUSAGE_OVERLAY)
1513 ERR("(%p) Overlays not yet supported by GDI surfaces\n", This);
1514 return WINED3DERR_INVALIDCALL;
1516 /* Sysmem textures have memory already allocated -
1517 * release it, this avoids an unnecessary memcpy
1519 HeapFree(GetProcessHeap(), 0, This->resource.allocatedMemory);
1520 This->resource.allocatedMemory = NULL;
1522 /* We don't mind the nonpow2 stuff in GDI */
1523 This->resource.size = IWineD3DSurface_GetPitch(iface) * This->currentDesc.Height;
1524 This->pow2Width = This->currentDesc.Width;
1525 This->pow2Height = This->currentDesc.Height;
1526 This->Flags &= ~SFLAG_NONPOW2;
1528 /* Adjust the opengl mem counter */
1529 globalChangeGlRam(This->resource.size - oldsize);
1531 /* Call GetDC to create a DIB section. We will use that
1532 * DIB section for rendering
1534 * Release the DC afterwards to allow the app to use it
1536 hr = IWineD3DSurface_GetDC(iface, &hdc);
1539 ERR("(%p) IWineD3DSurface::GetDC failed with hr %08x\n", This, hr);
1542 hr = IWineD3DSurface_ReleaseDC(iface, hdc);
1545 ERR("(%p) IWineD3DSurface::ReleaseDC failed with hr %08x\n", This, hr);
1552 const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
1555 IWineD3DSurfaceImpl_QueryInterface,
1556 IWineD3DSurfaceImpl_AddRef,
1557 IWineD3DSurfaceImpl_Release,
1558 /* IWineD3DResource */
1559 IWineD3DSurfaceImpl_GetParent,
1560 IWineD3DSurfaceImpl_GetDevice,
1561 IWineD3DSurfaceImpl_SetPrivateData,
1562 IWineD3DSurfaceImpl_GetPrivateData,
1563 IWineD3DSurfaceImpl_FreePrivateData,
1564 IWineD3DSurfaceImpl_SetPriority,
1565 IWineD3DSurfaceImpl_GetPriority,
1566 IWineGDISurfaceImpl_PreLoad,
1567 IWineD3DSurfaceImpl_GetType,
1568 /* IWineD3DSurface */
1569 IWineD3DSurfaceImpl_GetContainer,
1570 IWineD3DSurfaceImpl_GetDesc,
1571 IWineGDISurfaceImpl_LockRect,
1572 IWineGDISurfaceImpl_UnlockRect,
1573 IWineD3DSurfaceImpl_GetDC,
1574 IWineD3DSurfaceImpl_ReleaseDC,
1575 IWineGDISurfaceImpl_Flip,
1576 IWineGDISurfaceImpl_Blt,
1577 IWineD3DSurfaceImpl_GetBltStatus,
1578 IWineD3DSurfaceImpl_GetFlipStatus,
1579 IWineD3DSurfaceImpl_IsLost,
1580 IWineD3DSurfaceImpl_Restore,
1581 IWineGDISurfaceImpl_BltFast,
1582 IWineD3DSurfaceImpl_GetPalette,
1583 IWineD3DSurfaceImpl_SetPalette,
1584 IWineD3DSurfaceImpl_RealizePalette,
1585 IWineD3DSurfaceImpl_SetColorKey,
1586 IWineD3DSurfaceImpl_GetPitch,
1587 IWineD3DSurfaceImpl_SetMem,
1588 IWineD3DSurfaceImpl_SetOverlayPosition,
1589 IWineD3DSurfaceImpl_GetOverlayPosition,
1590 IWineD3DSurfaceImpl_UpdateOverlayZOrder,
1591 IWineD3DSurfaceImpl_UpdateOverlay,
1592 IWineD3DSurfaceImpl_SetClipper,
1593 IWineD3DSurfaceImpl_GetClipper,
1595 IWineD3DSurfaceImpl_AddDirtyRect,
1596 IWineGDISurfaceImpl_LoadTexture,
1597 IWineGDISurfaceImpl_SaveSnapshot,
1598 IWineD3DSurfaceImpl_SetContainer,
1599 IWineD3DSurfaceImpl_SetGlTextureDesc,
1600 IWineD3DSurfaceImpl_GetGlDesc,
1601 IWineD3DSurfaceImpl_GetData,
1602 IWineD3DSurfaceImpl_SetFormat,
1603 IWineGDISurfaceImpl_PrivateSetup