Added ddraw HAL and gamma ramp stuff to implementation structures.

Added a parameter and return value to flip_data and flip_update.
This commit is contained in:
Ove Kaaven 2001-04-16 19:06:13 +00:00 committed by Alexandre Julliard
parent 6cba8bf47f
commit 01b9436018
10 changed files with 65 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/* Copyright 2000 TransGaming Technologies Inc. */ /* Copyright 2000-2001 TransGaming Technologies Inc. */
#ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H #ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
#define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H #define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
@ -11,6 +11,7 @@
#include "winuser.h" #include "winuser.h"
#include "ddraw.h" #include "ddraw.h"
#include "ddcomimpl.h" #include "ddcomimpl.h"
#include "ddrawi.h"
/* XXX Put this somewhere proper. */ /* XXX Put this somewhere proper. */
#define DD_STRUCT_INIT(x) \ #define DD_STRUCT_INIT(x) \
@ -68,6 +69,9 @@ struct IDirectDrawImpl
IDirectDrawSurfaceImpl* primary_surface; IDirectDrawSurfaceImpl* primary_surface;
DDRAWI_DIRECTDRAW_LCL local;
DDCAPS caps;
HWND window; HWND window;
DWORD cooperative_level; DWORD cooperative_level;
WNDPROC original_wndproc; WNDPROC original_wndproc;
@ -84,6 +88,8 @@ struct IDirectDrawImpl
/* Called when the refcount goes to 0. */ /* Called when the refcount goes to 0. */
void (*final_release)(IDirectDrawImpl *This); void (*final_release)(IDirectDrawImpl *This);
HRESULT (*set_exclusive_mode)(IDirectDrawImpl *This, DWORD dwExcl);
HRESULT (*create_palette)(IDirectDrawImpl* This, DWORD dwFlags, HRESULT (*create_palette)(IDirectDrawImpl* This, DWORD dwFlags,
LPDIRECTDRAWPALETTE* ppPalette, LPDIRECTDRAWPALETTE* ppPalette,
LPUNKNOWN pUnkOuter); LPUNKNOWN pUnkOuter);
@ -144,6 +150,9 @@ struct IDirectDrawPaletteImpl
ICOM_VFIELD_MULTI(IDirectDrawPalette); ICOM_VFIELD_MULTI(IDirectDrawPalette);
DWORD ref; DWORD ref;
DDRAWI_DDRAWPALETTE_LCL local;
DDRAWI_DDRAWPALETTE_GBL global;
/* IDirectDrawPalette fields */ /* IDirectDrawPalette fields */
DWORD flags; DWORD flags;
HPALETTE hpal; HPALETTE hpal;
@ -187,6 +196,7 @@ struct IDirectDrawSurfaceImpl
/* IUnknown fields */ /* IUnknown fields */
ICOM_VFIELD_MULTI(IDirectDrawSurface7); ICOM_VFIELD_MULTI(IDirectDrawSurface7);
ICOM_VFIELD_MULTI(IDirectDrawSurface3); ICOM_VFIELD_MULTI(IDirectDrawSurface3);
ICOM_VFIELD_MULTI(IDirectDrawGammaControl);
DWORD ref; DWORD ref;
struct IDirectDrawSurfaceImpl* attached; /* attached surfaces */ struct IDirectDrawSurfaceImpl* attached; /* attached surfaces */
@ -202,6 +212,14 @@ struct IDirectDrawSurfaceImpl
IDirectDrawPaletteImpl* palette; /* strong ref */ IDirectDrawPaletteImpl* palette; /* strong ref */
IDirectDrawClipperImpl* clipper; /* strong ref */ IDirectDrawClipperImpl* clipper; /* strong ref */
DDRAWI_DDRAWSURFACE_LCL local;
DDRAWI_DDRAWSURFACE_MORE more;
/* FIXME: since Flip should swap the GBL structures, they should
* probably not be embedded into the IDirectDrawSurfaceImpl structure... */
LPDDRAWI_DDRAWSURFACE_GBL_MORE gmore;
DDRAWI_DDRAWSURFACE_GBL global;
DDRAWI_DDRAWSURFACE_GBL_MORE global_more;
DDSURFACEDESC2 surface_desc; DDSURFACEDESC2 surface_desc;
HDC hDC; HDC hDC;
@ -210,20 +228,24 @@ struct IDirectDrawSurfaceImpl
HRESULT (*duplicate_surface)(IDirectDrawSurfaceImpl* src, HRESULT (*duplicate_surface)(IDirectDrawSurfaceImpl* src,
LPDIRECTDRAWSURFACE7* dst); LPDIRECTDRAWSURFACE7* dst);
void (*final_release)(IDirectDrawSurfaceImpl *This); void (*final_release)(IDirectDrawSurfaceImpl *This);
HRESULT (*late_allocate)(IDirectDrawSurfaceImpl *This);
BOOL (*attach)(IDirectDrawSurfaceImpl *This, IDirectDrawSurfaceImpl *to); BOOL (*attach)(IDirectDrawSurfaceImpl *This, IDirectDrawSurfaceImpl *to);
BOOL (*detach)(IDirectDrawSurfaceImpl *This); BOOL (*detach)(IDirectDrawSurfaceImpl *This);
void (*lock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect); void (*lock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect);
void (*unlock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect); void (*unlock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect);
void (*lose_surface)(IDirectDrawSurfaceImpl* This); void (*lose_surface)(IDirectDrawSurfaceImpl* This);
void (*flip_data)(IDirectDrawSurfaceImpl* front, BOOL (*flip_data)(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back); IDirectDrawSurfaceImpl* back,
void (*flip_update)(IDirectDrawSurfaceImpl* front); DWORD dwFlags);
void (*flip_update)(IDirectDrawSurfaceImpl* front, DWORD dwFlags);
HRESULT (*get_dc)(IDirectDrawSurfaceImpl* This, HDC* phDC); HRESULT (*get_dc)(IDirectDrawSurfaceImpl* This, HDC* phDC);
HRESULT (*release_dc)(IDirectDrawSurfaceImpl* This, HDC hDC); HRESULT (*release_dc)(IDirectDrawSurfaceImpl* This, HDC hDC);
void (*set_palette)(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* pal); void (*set_palette)(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* pal);
void (*update_palette)(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* pal, void (*update_palette)(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* pal,
DWORD dwStart, DWORD dwCount, LPPALETTEENTRY palent); DWORD dwStart, DWORD dwCount, LPPALETTEENTRY palent);
HWND (*get_display_window)(IDirectDrawSurfaceImpl *This); HWND (*get_display_window)(IDirectDrawSurfaceImpl *This);
HRESULT (*get_gamma_ramp)(IDirectDrawSurfaceImpl *This, DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp);
HRESULT (*set_gamma_ramp)(IDirectDrawSurfaceImpl *This, DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp);
struct PrivateData* private_data; struct PrivateData* private_data;
@ -249,6 +271,7 @@ struct IDirectDrawSurfaceImpl
/***************************************************************************** /*****************************************************************************
* Driver initialisation functions. * Driver initialisation functions.
*/ */
BOOL DDRAW_HAL_Init(HINSTANCE, DWORD, LPVOID);
BOOL DDRAW_User_Init(HINSTANCE, DWORD, LPVOID); BOOL DDRAW_User_Init(HINSTANCE, DWORD, LPVOID);
typedef struct { typedef struct {

View File

@ -159,8 +159,9 @@ HRESULT XF86DGA2_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* Thi
&This->surface_desc, ppDup, NULL); &This->surface_desc, ppDup, NULL);
} }
void XF86DGA2_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front, BOOL XF86DGA2_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back) IDirectDrawSurfaceImpl* back,
DWORD dwFlags)
{ {
XF86DGA2_PRIV_VAR(front_priv, front); XF86DGA2_PRIV_VAR(front_priv, front);
XF86DGA2_PRIV_VAR(back_priv, back); XF86DGA2_PRIV_VAR(back_priv, back);
@ -178,10 +179,10 @@ void XF86DGA2_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
back_priv->xf86dga2.fb_addr = tmp; back_priv->xf86dga2.fb_addr = tmp;
} }
DIB_DirectDrawSurface_flip_data(front, back); return DIB_DirectDrawSurface_flip_data(front, back, dwFlags);
} }
void XF86DGA2_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This) void XF86DGA2_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This, DWORD dwFlags)
{ {
XF86DGA2_PRIV_VAR(priv, This); XF86DGA2_PRIV_VAR(priv, This);

View File

@ -42,9 +42,10 @@ void XF86DGA2_DirectDrawSurface_update_palette(IDirectDrawSurfaceImpl* This,
LPPALETTEENTRY palent); LPPALETTEENTRY palent);
HRESULT XF86DGA2_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* This, HRESULT XF86DGA2_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* This,
LPDIRECTDRAWSURFACE7* ppDup); LPDIRECTDRAWSURFACE7* ppDup);
void XF86DGA2_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front, BOOL XF86DGA2_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back); IDirectDrawSurfaceImpl* back,
void XF86DGA2_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This); DWORD dwFlags);
void XF86DGA2_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This, DWORD dwFlags);
HWND XF86DGA2_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl* This); HWND XF86DGA2_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl* This);
#endif #endif

View File

@ -662,14 +662,14 @@ error:
/* EnumAttachedSurfaces: generic */ /* EnumAttachedSurfaces: generic */
/* EnumOverlayZOrders: generic, unimplemented */ /* EnumOverlayZOrders: generic, unimplemented */
void DIB_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front, BOOL DIB_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back) IDirectDrawSurfaceImpl* back,
DWORD dwFlags)
{ {
DIB_DirectDrawSurfaceImpl* front_priv = front->private; DIB_DirectDrawSurfaceImpl* front_priv = front->private;
DIB_DirectDrawSurfaceImpl* back_priv = back->private; DIB_DirectDrawSurfaceImpl* back_priv = back->private;
TRACE("(%p,%p)\n",front,back); TRACE("(%p,%p)\n",front,back);
Main_DirectDrawSurface_flip_data(front, back);
{ {
HBITMAP tmp; HBITMAP tmp;
@ -696,6 +696,8 @@ void DIB_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
front_priv->dib.client_memory = back_priv->dib.client_memory; front_priv->dib.client_memory = back_priv->dib.client_memory;
back_priv->dib.client_memory = tmp; back_priv->dib.client_memory = tmp;
} }
return Main_DirectDrawSurface_flip_data(front, back, dwFlags);
} }
/* Flip: generic */ /* Flip: generic */

View File

@ -34,8 +34,9 @@ DIB_DirectDrawSurface_Create(IDirectDrawImpl *pDD,
IUnknown *pUnkOuter); IUnknown *pUnkOuter);
void DIB_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl* This); void DIB_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl* This);
void DIB_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front, BOOL DIB_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back); IDirectDrawSurfaceImpl* back,
DWORD dwFlags);
void DIB_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This, void DIB_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This,
IDirectDrawPaletteImpl* pal); IDirectDrawPaletteImpl* pal);

View File

@ -316,8 +316,9 @@ Main_DirectDrawSurface_EnumOverlayZOrders(LPDIRECTDRAWSURFACE7 iface,
return DD_OK; return DD_OK;
} }
void Main_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front, BOOL Main_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back) IDirectDrawSurfaceImpl* back,
DWORD dwFlags)
{ {
/* uniqueness_value? */ /* uniqueness_value? */
/* This is necessary. But is it safe? */ /* This is necessary. But is it safe? */
@ -332,6 +333,8 @@ void Main_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
front->dc_in_use = back->dc_in_use; front->dc_in_use = back->dc_in_use;
back->dc_in_use = tmp; back->dc_in_use = tmp;
} }
return TRUE;
} }
HRESULT WINAPI HRESULT WINAPI
@ -398,8 +401,8 @@ Main_DirectDrawSurface_Flip(LPDIRECTDRAWSURFACE7 iface,
} }
TRACE("flip to backbuffer: %p\n",target); TRACE("flip to backbuffer: %p\n",target);
This->flip_data(This, target); if (This->flip_data(This, target, dwFlags))
This->flip_update(This); This->flip_update(This, dwFlags);
return DD_OK; return DD_OK;
} }

View File

@ -57,8 +57,9 @@ Main_DirectDrawSurface_update_palette(IDirectDrawSurfaceImpl* This,
HWND HWND
Main_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl* This); Main_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl* This);
void Main_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front, BOOL Main_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back); IDirectDrawSurfaceImpl* back,
DWORD dwFlags);
#define CHECK_LOST(This) \ #define CHECK_LOST(This) \
do { \ do { \

View File

@ -6,9 +6,9 @@
#include "ddraw.h" #include "ddraw.h"
#include "winerror.h" #include "winerror.h"
#include "ddcomimpl.h"
#include "dsurface/main.h" #include "dsurface/main.h"
#include "dsurface/thunks.h" #include "dsurface/thunks.h"
#include "ddcomimpl.h"
#define CONVERT(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \ #define CONVERT(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
IDirectDrawSurface3, \ IDirectDrawSurface3, \

View File

@ -205,8 +205,9 @@ HRESULT User_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* This,
&This->surface_desc, ppDup, NULL); &This->surface_desc, ppDup, NULL);
} }
void User_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front, BOOL User_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back) IDirectDrawSurfaceImpl* back,
DWORD dwFlags)
{ {
USER_PRIV_VAR(front_priv, front); USER_PRIV_VAR(front_priv, front);
USER_PRIV_VAR(back_priv, back); USER_PRIV_VAR(back_priv, back);
@ -218,10 +219,10 @@ void User_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
back_priv->user.cached_dc = tmp; back_priv->user.cached_dc = tmp;
} }
DIB_DirectDrawSurface_flip_data(front, back); return DIB_DirectDrawSurface_flip_data(front, back, dwFlags);
} }
void User_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This) void User_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This, DWORD dwFlags)
{ {
#ifdef SYNC_UPDATE #ifdef SYNC_UPDATE
assert(This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE); assert(This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE);

View File

@ -46,9 +46,11 @@ void User_DirectDrawSurface_update_palette(IDirectDrawSurfaceImpl* This,
LPPALETTEENTRY palent); LPPALETTEENTRY palent);
HRESULT User_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* This, HRESULT User_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* This,
LPDIRECTDRAWSURFACE7* ppDup); LPDIRECTDRAWSURFACE7* ppDup);
void User_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front, BOOL User_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back); IDirectDrawSurfaceImpl* back,
void User_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This); DWORD dwFlags);
void User_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This,
DWORD dwFlags);
HWND User_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl* This); HWND User_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl* This);
HRESULT User_DirectDrawSurface_get_dc(IDirectDrawSurfaceImpl* This, HDC* phDC); HRESULT User_DirectDrawSurface_get_dc(IDirectDrawSurfaceImpl* This, HDC* phDC);