VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface_gdi.c@ 20817

Last change on this file since 20817 was 19678, checked in by vboxsync, 16 years ago

opengl: update wine to 1.1.21, add d3d9.dll to build list

  • Property svn:eol-style set to native
File size: 23.7 KB
Line 
1/*
2 * 2D Surface implementation without OpenGL
3 *
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-2008 Stefan Dösinger
12 *
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.
17 *
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.
22 *
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
26 */
27
28/*
29 * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
30 * other than GPL or LGPL is available it will apply instead, Sun elects to use only
31 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
32 * a choice of LGPL license versions is made available with the language indicating
33 * that LGPLv2 or any later version may be used, or where a choice of which version
34 * of the LGPL is applied is otherwise unspecified.
35 */
36
37#include "config.h"
38#include "wine/port.h"
39#include "wined3d_private.h"
40
41#include <assert.h>
42#include <stdio.h>
43
44/* Use the d3d_surface debug channel to have one channel for all surfaces */
45WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
46
47/*****************************************************************************
48 * IWineD3DSurface::Release, GDI version
49 *
50 * In general a normal COM Release method, but the GDI version doesn't have
51 * to destroy all the GL things.
52 *
53 *****************************************************************************/
54static ULONG WINAPI IWineGDISurfaceImpl_Release(IWineD3DSurface *iface) {
55 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
56 ULONG ref = InterlockedDecrement(&This->resource.ref);
57 TRACE("(%p) : Releasing from %d\n", This, ref + 1);
58 if (ref == 0) {
59 TRACE("(%p) : cleaning up\n", This);
60
61 if(This->Flags & SFLAG_DIBSECTION) {
62 /* Release the DC */
63 SelectObject(This->hDC, This->dib.holdbitmap);
64 DeleteDC(This->hDC);
65 /* Release the DIB section */
66 DeleteObject(This->dib.DIBsection);
67 This->dib.bitmap_data = NULL;
68 This->resource.allocatedMemory = NULL;
69 }
70 if(This->Flags & SFLAG_USERPTR) IWineD3DSurface_SetMem(iface, NULL);
71
72 HeapFree(GetProcessHeap(), 0, This->palette9);
73
74 resource_cleanup((IWineD3DResource *)iface);
75
76 if(This->overlay_dest) {
77 list_remove(&This->overlay_entry);
78 }
79
80 TRACE("(%p) Released\n", This);
81 HeapFree(GetProcessHeap(), 0, This);
82
83 }
84 return ref;
85}
86
87/*****************************************************************************
88 * IWineD3DSurface::PreLoad, GDI version
89 *
90 * This call is unsupported on GDI surfaces, if it's called something went
91 * wrong in the parent library. Write an informative warning
92 *
93 *****************************************************************************/
94static void WINAPI
95IWineGDISurfaceImpl_PreLoad(IWineD3DSurface *iface)
96{
97 ERR("(%p): PreLoad is not supported on X11 surfaces!\n", iface);
98 ERR("(%p): Most likely the parent library did something wrong.\n", iface);
99 ERR("(%p): Please report to wine-devel\n", iface);
100}
101
102/*****************************************************************************
103 * IWineD3DSurface::UnLoad, GDI version
104 *
105 * This call is unsupported on GDI surfaces, if it's called something went
106 * wrong in the parent library. Write an informative warning.
107 *
108 *****************************************************************************/
109static void WINAPI IWineGDISurfaceImpl_UnLoad(IWineD3DSurface *iface)
110{
111 ERR("(%p): UnLoad is not supported on X11 surfaces!\n", iface);
112 ERR("(%p): Most likely the parent library did something wrong.\n", iface);
113 ERR("(%p): Please report to wine-devel\n", iface);
114}
115
116/*****************************************************************************
117 * IWineD3DSurface::LockRect, GDI version
118 *
119 * Locks the surface and returns a pointer to the surface memory
120 *
121 * Params:
122 * pLockedRect: Address to return the locking info at
123 * pRect: Rectangle to lock
124 * Flags: Some flags
125 *
126 * Returns:
127 * WINED3D_OK on success
128 * WINED3DERR_INVALIDCALL on errors
129 *
130 *****************************************************************************/
131static HRESULT WINAPI
132IWineGDISurfaceImpl_LockRect(IWineD3DSurface *iface,
133 WINED3DLOCKED_RECT* pLockedRect,
134 CONST RECT* pRect,
135 DWORD Flags)
136{
137 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
138
139 /* Already locked? */
140 if(This->Flags & SFLAG_LOCKED)
141 {
142 WARN("(%p) Surface already locked\n", This);
143 /* What should I return here? */
144 return WINED3DERR_INVALIDCALL;
145 }
146 This->Flags |= SFLAG_LOCKED;
147
148 if(!This->resource.allocatedMemory) {
149 /* This happens on gdi surfaces if the application set a user pointer and resets it.
150 * Recreate the DIB section
151 */
152 IWineD3DBaseSurfaceImpl_CreateDIBSection(iface);
153 This->resource.allocatedMemory = This->dib.bitmap_data;
154 }
155
156 return IWineD3DBaseSurfaceImpl_LockRect(iface, pLockedRect, pRect, Flags);
157}
158
159/*****************************************************************************
160 * IWineD3DSurface::UnlockRect, GDI version
161 *
162 * Unlocks a surface. This implementation doesn't do much, except updating
163 * the window if the front buffer is unlocked
164 *
165 * Returns:
166 * WINED3D_OK on success
167 * WINED3DERR_INVALIDCALL on failure
168 *
169 *****************************************************************************/
170static HRESULT WINAPI
171IWineGDISurfaceImpl_UnlockRect(IWineD3DSurface *iface)
172{
173 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
174 IWineD3DSwapChainImpl *swapchain = NULL;
175 TRACE("(%p)\n", This);
176
177 if (!(This->Flags & SFLAG_LOCKED))
178 {
179 WARN("trying to Unlock an unlocked surf@%p\n", This);
180 return WINEDDERR_NOTLOCKED;
181 }
182
183 /* Can be useful for debugging */
184#if 0
185 {
186 static unsigned int gen = 0;
187 char buffer[4096];
188 ++gen;
189 if ((gen % 10) == 0) {
190 snprintf(buffer, sizeof(buffer), "/tmp/surface%p_type%u_level%u_%u.ppm", This, This->glDescription.target, This->glDescription.level, gen);
191 IWineD3DSurfaceImpl_SaveSnapshot(iface, buffer);
192 }
193 /*
194 * debugging crash code
195 if (gen == 250) {
196 void** test = NULL;
197 *test = 0;
198 }
199 */
200 }
201#endif
202
203 /* Tell the swapchain to update the screen */
204 if (SUCCEEDED(IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain)))
205 {
206 x11_copy_to_screen(swapchain, &This->lockedRect);
207 IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
208 }
209
210 This->Flags &= ~SFLAG_LOCKED;
211 memset(&This->lockedRect, 0, sizeof(RECT));
212 return WINED3D_OK;
213}
214
215/*****************************************************************************
216 * IWineD3DSurface::Flip, GDI version
217 *
218 * Flips 2 flipping enabled surfaces. Determining the 2 targets is done by
219 * the parent library. This implementation changes the data pointers of the
220 * surfaces and copies the new front buffer content to the screen
221 *
222 * Params:
223 * override: Flipping target(e.g. back buffer)
224 *
225 * Returns:
226 * WINED3D_OK on success
227 *
228 *****************************************************************************/
229static HRESULT WINAPI
230IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface,
231 IWineD3DSurface *override,
232 DWORD Flags)
233{
234 IWineD3DSwapChainImpl *swapchain = NULL;
235 HRESULT hr;
236
237 if(FAILED(IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain)))
238 {
239 ERR("Flipped surface is not on a swapchain\n");
240 return WINEDDERR_NOTFLIPPABLE;
241 }
242
243 hr = IWineD3DSwapChain_Present((IWineD3DSwapChain *) swapchain, NULL, NULL, 0, NULL, 0);
244 IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
245 return hr;
246}
247
248/*****************************************************************************
249 * IWineD3DSurface::LoadTexture, GDI version
250 *
251 * This is mutually unsupported by GDI surfaces
252 *
253 * Returns:
254 * D3DERR_INVALIDCALL
255 *
256 *****************************************************************************/
257static HRESULT WINAPI
258IWineGDISurfaceImpl_LoadTexture(IWineD3DSurface *iface, BOOL srgb_mode)
259{
260 ERR("Unsupported on X11 surfaces\n");
261 return WINED3DERR_INVALIDCALL;
262}
263
264/*****************************************************************************
265 * IWineD3DSurface::SaveSnapshot, GDI version
266 *
267 * This method writes the surface's contents to the in tga format to the
268 * file specified in filename.
269 *
270 * Params:
271 * filename: File to write to
272 *
273 * Returns:
274 * WINED3DERR_INVALIDCALL if the file couldn't be opened
275 * WINED3D_OK on success
276 *
277 *****************************************************************************/
278static int get_shift(DWORD color_mask) {
279 int shift = 0;
280 while (color_mask > 0xFF) {
281 color_mask >>= 1;
282 shift += 1;
283 }
284 while ((color_mask & 0x80) == 0) {
285 color_mask <<= 1;
286 shift -= 1;
287 }
288 return shift;
289}
290
291
292static HRESULT WINAPI
293IWineGDISurfaceImpl_SaveSnapshot(IWineD3DSurface *iface,
294const char* filename)
295{
296 FILE* f = NULL;
297 UINT y = 0, x = 0;
298 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
299 static char *output = NULL;
300 static UINT size = 0;
301 const struct GlPixelFormatDesc *format_desc = This->resource.format_desc;
302
303 if (This->pow2Width > size) {
304 output = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pow2Width * 3);
305 size = This->pow2Width;
306 }
307
308
309 f = fopen(filename, "w+");
310 if (NULL == f) {
311 ERR("opening of %s failed with\n", filename);
312 return WINED3DERR_INVALIDCALL;
313 }
314 fprintf(f, "P6\n%d %d\n255\n", This->pow2Width, This->pow2Height);
315
316 if (This->resource.format_desc->format == WINED3DFMT_P8)
317 {
318 unsigned char table[256][3];
319 int i;
320
321 if (This->palette == NULL) {
322 fclose(f);
323 return WINED3DERR_INVALIDCALL;
324 }
325 for (i = 0; i < 256; i++) {
326 table[i][0] = This->palette->palents[i].peRed;
327 table[i][1] = This->palette->palents[i].peGreen;
328 table[i][2] = This->palette->palents[i].peBlue;
329 }
330 for (y = 0; y < This->pow2Height; y++) {
331 unsigned char *src = This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
332 for (x = 0; x < This->pow2Width; x++) {
333 unsigned char color = *src;
334 src += 1;
335
336 output[3 * x + 0] = table[color][0];
337 output[3 * x + 1] = table[color][1];
338 output[3 * x + 2] = table[color][2];
339 }
340 fwrite(output, 3 * This->pow2Width, 1, f);
341 }
342 } else {
343 int red_shift, green_shift, blue_shift, pix_width, alpha_shift;
344
345 pix_width = format_desc->byte_count;
346
347 red_shift = get_shift(format_desc->red_mask);
348 green_shift = get_shift(format_desc->green_mask);
349 blue_shift = get_shift(format_desc->blue_mask);
350 alpha_shift = get_shift(format_desc->alpha_mask);
351
352 for (y = 0; y < This->pow2Height; y++) {
353 const unsigned char *src = This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
354 for (x = 0; x < This->pow2Width; x++) {
355 unsigned int color;
356 unsigned int comp;
357 int i;
358
359 color = 0;
360 for (i = 0; i < pix_width; i++) {
361 color |= src[i] << (8 * i);
362 }
363 src += 1 * pix_width;
364
365 comp = color & format_desc->red_mask;
366 output[3 * x + 0] = red_shift > 0 ? comp >> red_shift : comp << -red_shift;
367 comp = color & format_desc->green_mask;
368 output[3 * x + 1] = green_shift > 0 ? comp >> green_shift : comp << -green_shift;
369 comp = color & format_desc->alpha_mask;
370 output[3 * x + 2] = alpha_shift > 0 ? comp >> alpha_shift : comp << -alpha_shift;
371 }
372 fwrite(output, 3 * This->pow2Width, 1, f);
373 }
374 }
375 fclose(f);
376 return WINED3D_OK;
377}
378
379static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
380 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
381 WINED3DLOCKED_RECT lock;
382 HRESULT hr;
383 RGBQUAD col[256];
384
385 TRACE("(%p)->(%p)\n",This,pHDC);
386
387 if(This->Flags & SFLAG_USERPTR) {
388 ERR("Not supported on surfaces with an application-provided surfaces\n");
389 return WINEDDERR_NODC;
390 }
391
392 /* Give more detailed info for ddraw */
393 if (This->Flags & SFLAG_DCINUSE)
394 return WINEDDERR_DCALREADYCREATED;
395
396 /* Can't GetDC if the surface is locked */
397 if (This->Flags & SFLAG_LOCKED)
398 return WINED3DERR_INVALIDCALL;
399
400 memset(&lock, 0, sizeof(lock)); /* To be sure */
401
402 /* Should have a DIB section already */
403
404 /* Lock the surface */
405 hr = IWineD3DSurface_LockRect(iface,
406 &lock,
407 NULL,
408 0);
409 if(FAILED(hr)) {
410 ERR("IWineD3DSurface_LockRect failed with hr = %08x\n", hr);
411 /* keep the dib section */
412 return hr;
413 }
414
415 if (This->resource.format_desc->format == WINED3DFMT_P8
416 || This->resource.format_desc->format == WINED3DFMT_A8P8)
417 {
418 unsigned int n;
419 const PALETTEENTRY *pal = NULL;
420
421 if(This->palette) {
422 pal = This->palette->palents;
423 } else {
424 IWineD3DSurfaceImpl *dds_primary;
425 IWineD3DSwapChainImpl *swapchain;
426 swapchain = (IWineD3DSwapChainImpl *)This->resource.wineD3DDevice->swapchains[0];
427 dds_primary = (IWineD3DSurfaceImpl *)swapchain->frontBuffer;
428 if (dds_primary && dds_primary->palette)
429 pal = dds_primary->palette->palents;
430 }
431
432 if (pal) {
433 for (n=0; n<256; n++) {
434 col[n].rgbRed = pal[n].peRed;
435 col[n].rgbGreen = pal[n].peGreen;
436 col[n].rgbBlue = pal[n].peBlue;
437 col[n].rgbReserved = 0;
438 }
439 SetDIBColorTable(This->hDC, 0, 256, col);
440 }
441 }
442
443 *pHDC = This->hDC;
444 TRACE("returning %p\n",*pHDC);
445 This->Flags |= SFLAG_DCINUSE;
446
447 return WINED3D_OK;
448}
449
450static HRESULT WINAPI IWineGDISurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC) {
451 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
452
453 TRACE("(%p)->(%p)\n",This,hDC);
454
455 if (!(This->Flags & SFLAG_DCINUSE))
456 return WINEDDERR_NODC;
457
458 if (This->hDC !=hDC) {
459 WARN("Application tries to release an invalid DC(%p), surface dc is %p\n", hDC, This->hDC);
460 return WINEDDERR_NODC;
461 }
462
463 /* we locked first, so unlock now */
464 IWineD3DSurface_UnlockRect(iface);
465
466 This->Flags &= ~SFLAG_DCINUSE;
467
468 return WINED3D_OK;
469}
470
471static HRESULT WINAPI IWineGDISurfaceImpl_RealizePalette(IWineD3DSurface *iface) {
472 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
473 RGBQUAD col[256];
474 IWineD3DPaletteImpl *pal = This->palette;
475 unsigned int n;
476 IWineD3DSwapChainImpl *swapchain;
477 TRACE("(%p)\n", This);
478
479 if (!pal) return WINED3D_OK;
480
481 if(This->Flags & SFLAG_DIBSECTION) {
482 TRACE("(%p): Updating the hdc's palette\n", This);
483 for (n=0; n<256; n++) {
484 col[n].rgbRed = pal->palents[n].peRed;
485 col[n].rgbGreen = pal->palents[n].peGreen;
486 col[n].rgbBlue = pal->palents[n].peBlue;
487 col[n].rgbReserved = 0;
488 }
489 SetDIBColorTable(This->hDC, 0, 256, col);
490 }
491
492 /* Update the image because of the palette change. Some games like e.g Red Alert
493 call SetEntries a lot to implement fading. */
494 /* Tell the swapchain to update the screen */
495 if (SUCCEEDED(IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain)))
496 {
497 x11_copy_to_screen(swapchain, NULL);
498 IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
499 }
500
501 return WINED3D_OK;
502}
503
504/*****************************************************************************
505 * IWineD3DSurface::PrivateSetup, GDI version
506 *
507 * Initializes the GDI surface, aka creates the DIB section we render to
508 * The DIB section creation is done by calling GetDC, which will create the
509 * section and releasing the dc to allow the app to use it. The dib section
510 * will stay until the surface is released
511 *
512 * GDI surfaces do not need to be a power of 2 in size, so the pow2 sizes
513 * are set to the real sizes to save memory. The NONPOW2 flag is unset to
514 * avoid confusion in the shared surface code.
515 *
516 * Returns:
517 * WINED3D_OK on success
518 * The return values of called methods on failure
519 *
520 *****************************************************************************/
521static HRESULT WINAPI
522IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
523{
524 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
525
526 if(This->resource.usage & WINED3DUSAGE_OVERLAY)
527 {
528 ERR("(%p) Overlays not yet supported by GDI surfaces\n", This);
529 return WINED3DERR_INVALIDCALL;
530 }
531 /* Sysmem textures have memory already allocated -
532 * release it, this avoids an unnecessary memcpy
533 */
534 HeapFree(GetProcessHeap(), 0, This->resource.heapMemory);
535 This->resource.allocatedMemory = NULL;
536 This->resource.heapMemory = NULL;
537
538 /* We don't mind the nonpow2 stuff in GDI */
539 This->pow2Width = This->currentDesc.Width;
540 This->pow2Height = This->currentDesc.Height;
541
542 IWineD3DBaseSurfaceImpl_CreateDIBSection(iface);
543 This->resource.allocatedMemory = This->dib.bitmap_data;
544
545 return WINED3D_OK;
546}
547
548static void WINAPI IWineGDISurfaceImpl_GetGlDesc(IWineD3DSurface *iface, glDescriptor **glDescription) {
549 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
550 FIXME("(%p) : Should not be called on a GDI surface\n", This);
551 *glDescription = NULL;
552}
553
554static HRESULT WINAPI IWineGDISurfaceImpl_SetMem(IWineD3DSurface *iface, void *Mem) {
555 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
556
557 /* Render targets depend on their hdc, and we can't create an hdc on a user pointer */
558 if(This->resource.usage & WINED3DUSAGE_RENDERTARGET) {
559 ERR("Not supported on render targets\n");
560 return WINED3DERR_INVALIDCALL;
561 }
562
563 if(This->Flags & (SFLAG_LOCKED | SFLAG_DCINUSE)) {
564 WARN("Surface is locked or the HDC is in use\n");
565 return WINED3DERR_INVALIDCALL;
566 }
567
568 if(Mem && Mem != This->resource.allocatedMemory) {
569 void *release = NULL;
570
571 /* Do I have to copy the old surface content? */
572 if(This->Flags & SFLAG_DIBSECTION) {
573 /* Release the DC. No need to hold the critical section for the update
574 * Thread because this thread runs only on front buffers, but this method
575 * fails for render targets in the check above.
576 */
577 SelectObject(This->hDC, This->dib.holdbitmap);
578 DeleteDC(This->hDC);
579 /* Release the DIB section */
580 DeleteObject(This->dib.DIBsection);
581 This->dib.bitmap_data = NULL;
582 This->resource.allocatedMemory = NULL;
583 This->hDC = NULL;
584 This->Flags &= ~SFLAG_DIBSECTION;
585 } else if(!(This->Flags & SFLAG_USERPTR)) {
586 release = This->resource.allocatedMemory;
587 }
588 This->resource.allocatedMemory = Mem;
589 This->Flags |= SFLAG_USERPTR | SFLAG_INSYSMEM;
590
591 /* Now free the old memory if any */
592 HeapFree(GetProcessHeap(), 0, release);
593 } else if(This->Flags & SFLAG_USERPTR) {
594 /* LockRect and GetDC will re-create the dib section and allocated memory */
595 This->resource.allocatedMemory = NULL;
596 This->Flags &= ~SFLAG_USERPTR;
597 }
598 return WINED3D_OK;
599}
600
601/***************************
602 *
603 ***************************/
604static void WINAPI IWineGDISurfaceImpl_ModifyLocation(IWineD3DSurface *iface, DWORD flag, BOOL persistent) {
605 TRACE("(%p)->(%s, %s)\n", iface,
606 flag == SFLAG_INSYSMEM ? "SFLAG_INSYSMEM" : flag == SFLAG_INDRAWABLE ? "SFLAG_INDRAWABLE" : "SFLAG_INTEXTURE",
607 persistent ? "TRUE" : "FALSE");
608 /* GDI surfaces can be in system memory only */
609 if(flag != SFLAG_INSYSMEM) {
610 ERR("GDI Surface requested in gl %s memory\n", flag == SFLAG_INDRAWABLE ? "drawable" : "texture");
611 }
612}
613
614static HRESULT WINAPI IWineGDISurfaceImpl_LoadLocation(IWineD3DSurface *iface, DWORD flag, const RECT *rect) {
615 if(flag != SFLAG_INSYSMEM) {
616 ERR("GDI Surface requested to be copied to gl %s\n", flag == SFLAG_INTEXTURE ? "texture" : "drawable");
617 } else {
618 TRACE("Surface requested in surface memory\n");
619 }
620 return WINED3D_OK;
621}
622
623static WINED3DSURFTYPE WINAPI IWineGDISurfaceImpl_GetImplType(IWineD3DSurface *iface) {
624 return SURFACE_GDI;
625}
626
627static HRESULT WINAPI IWineGDISurfaceImpl_DrawOverlay(IWineD3DSurface *iface) {
628 FIXME("GDI surfaces can't draw overlays yet\n");
629 return E_FAIL;
630}
631
632/* FIXME: This vtable should not use any IWineD3DSurface* implementation functions,
633 * only IWineD3DBaseSurface and IWineGDISurface ones.
634 */
635const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
636{
637 /* IUnknown */
638 IWineD3DBaseSurfaceImpl_QueryInterface,
639 IWineD3DBaseSurfaceImpl_AddRef,
640 IWineGDISurfaceImpl_Release,
641 /* IWineD3DResource */
642 IWineD3DBaseSurfaceImpl_GetParent,
643 IWineD3DBaseSurfaceImpl_GetDevice,
644 IWineD3DBaseSurfaceImpl_SetPrivateData,
645 IWineD3DBaseSurfaceImpl_GetPrivateData,
646 IWineD3DBaseSurfaceImpl_FreePrivateData,
647 IWineD3DBaseSurfaceImpl_SetPriority,
648 IWineD3DBaseSurfaceImpl_GetPriority,
649 IWineGDISurfaceImpl_PreLoad,
650 IWineGDISurfaceImpl_UnLoad,
651 IWineD3DBaseSurfaceImpl_GetType,
652 /* IWineD3DSurface */
653 IWineD3DBaseSurfaceImpl_GetContainer,
654 IWineD3DBaseSurfaceImpl_GetDesc,
655 IWineGDISurfaceImpl_LockRect,
656 IWineGDISurfaceImpl_UnlockRect,
657 IWineGDISurfaceImpl_GetDC,
658 IWineGDISurfaceImpl_ReleaseDC,
659 IWineGDISurfaceImpl_Flip,
660 IWineD3DBaseSurfaceImpl_Blt,
661 IWineD3DBaseSurfaceImpl_GetBltStatus,
662 IWineD3DBaseSurfaceImpl_GetFlipStatus,
663 IWineD3DBaseSurfaceImpl_IsLost,
664 IWineD3DBaseSurfaceImpl_Restore,
665 IWineD3DBaseSurfaceImpl_BltFast,
666 IWineD3DBaseSurfaceImpl_GetPalette,
667 IWineD3DBaseSurfaceImpl_SetPalette,
668 IWineGDISurfaceImpl_RealizePalette,
669 IWineD3DBaseSurfaceImpl_SetColorKey,
670 IWineD3DBaseSurfaceImpl_GetPitch,
671 IWineGDISurfaceImpl_SetMem,
672 IWineD3DBaseSurfaceImpl_SetOverlayPosition,
673 IWineD3DBaseSurfaceImpl_GetOverlayPosition,
674 IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder,
675 IWineD3DBaseSurfaceImpl_UpdateOverlay,
676 IWineD3DBaseSurfaceImpl_SetClipper,
677 IWineD3DBaseSurfaceImpl_GetClipper,
678 /* Internal use: */
679 IWineGDISurfaceImpl_LoadTexture,
680 IWineD3DBaseSurfaceImpl_BindTexture,
681 IWineGDISurfaceImpl_SaveSnapshot,
682 IWineD3DBaseSurfaceImpl_SetContainer,
683 IWineGDISurfaceImpl_GetGlDesc,
684 IWineD3DBaseSurfaceImpl_GetData,
685 IWineD3DBaseSurfaceImpl_SetFormat,
686 IWineGDISurfaceImpl_PrivateSetup,
687 IWineGDISurfaceImpl_ModifyLocation,
688 IWineGDISurfaceImpl_LoadLocation,
689 IWineGDISurfaceImpl_GetImplType,
690 IWineGDISurfaceImpl_DrawOverlay
691};
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette