Commit af462957 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Implement IWineD3DSurface::GetDC and IWineD3DSurface::ReleaseDC.

parent f09dfe93
...@@ -2061,3 +2061,184 @@ WINED3DFORMAT pixelformat_for_depth(DWORD depth) { ...@@ -2061,3 +2061,184 @@ WINED3DFORMAT pixelformat_for_depth(DWORD depth) {
default: return WINED3DFMT_UNKNOWN; default: return WINED3DFMT_UNKNOWN;
} }
} }
LONG get_bitmask_red(WINED3DFORMAT fmt)
{
switch (fmt) {
case WINED3DFMT_R8G8B8:
case WINED3DFMT_A8R8G8B8:
case WINED3DFMT_X8R8G8B8:
return 0x00ff0000;
case WINED3DFMT_X1R5G5B5:
case WINED3DFMT_A1R5G5B5:
return 0x7C00;
case WINED3DFMT_A4R4G4B4:
case WINED3DFMT_X4R4G4B4:
return 0xF00;
case WINED3DFMT_R3G3B2:
case WINED3DFMT_A8R3G3B2:
return 0xE0;
case WINED3DFMT_A2R10G10B10:
return 0x3F0000;
break;
case WINED3DFMT_A2B10G10R10:
return 0x3FF;
case WINED3DFMT_A8B8G8R8:
case WINED3DFMT_X8B8G8R8:
return 0xff;
case WINED3DFMT_R5G6B5:
return 0xF800;
case WINED3DFMT_P8:
/* No fixed mask for this format */
return 0;
#if 0
case WINED3DFMT_A16B16G16R16:
return 0x00000000ffff;
break;
#endif
default:
ERR("Unknown bitmask for format %d\n", fmt);
return 0;
}
}
LONG get_bitmask_green(WINED3DFORMAT fmt)
{
switch (fmt) {
case WINED3DFMT_R8G8B8:
case WINED3DFMT_A8R8G8B8:
case WINED3DFMT_X8R8G8B8:
return 0x0000ff00;
case WINED3DFMT_X1R5G5B5:
case WINED3DFMT_A1R5G5B5:
return 0x3E0;
case WINED3DFMT_A4R4G4B4:
case WINED3DFMT_X4R4G4B4:
return 0xF0;
case WINED3DFMT_R3G3B2:
case WINED3DFMT_A8R3G3B2:
return 0x1C;
case WINED3DFMT_A2B10G10R10:
return 0xFFC00;
case WINED3DFMT_A8B8G8R8:
case WINED3DFMT_X8B8G8R8:
return 0xFF00;
break;
case WINED3DFMT_A2R10G10B10:
return 0xFFC00;
break;
case WINED3DFMT_R5G6B5:
return 0x7E0;
case WINED3DFMT_P8:
/* No fixed mask for this format */
return 0;
#if 0
case WINED3DFMT_A16B16G16R16:
return 0x0000ffff0000;
break;
#endif
default:
ERR("Unknown bitmask for format %d\n", fmt);
return 0;
}
}
LONG get_bitmask_blue(WINED3DFORMAT fmt)
{
switch (fmt) {
case WINED3DFMT_R8G8B8:
case WINED3DFMT_A8R8G8B8:
case WINED3DFMT_X8R8G8B8:
return 0x000000ff;
case WINED3DFMT_X1R5G5B5:
case WINED3DFMT_A1R5G5B5:
return 0x1f;
case WINED3DFMT_A4R4G4B4:
case WINED3DFMT_X4R4G4B4:
return 0xF;
case WINED3DFMT_R3G3B2:
case WINED3DFMT_A8R3G3B2:
return 0x3;
case WINED3DFMT_A2B10G10R10:
return 0x3F0000;
case WINED3DFMT_A8B8G8R8:
case WINED3DFMT_X8B8G8R8:
return 0xFF0000;
case WINED3DFMT_A2R10G10B10:
return 0x3FF;
case WINED3DFMT_R5G6B5:
return 0x1F;
case WINED3DFMT_P8:
/* No fixed mask for this format */
return 0;
#if 0
case WINED3DFMT_A16B16G16R16:
return 0xffff00000000;
break;
#endif
default:
ERR("Unknown bitmask for format %d\n", fmt);
return 0;
}
}
LONG get_bitmask_alpha(WINED3DFORMAT fmt)
{
switch (fmt) {
case WINED3DFMT_A8R8G8B8:
return 0xff000000;
case WINED3DFMT_A1R5G5B5:
return 0x8000;
case WINED3DFMT_A4R4G4B4:
return 0xF000;
case WINED3DFMT_A8R3G3B2:
return 0xff00;
case WINED3DFMT_A2B10G10R10:
return 0xb0000000;
case WINED3DFMT_A8B8G8R8:
return 0xFF000000;
case WINED3DFMT_A2R10G10B10:
return 0xb0000000;
default:
return 0;
}
}
...@@ -786,6 +786,16 @@ typedef struct _WINED3DSURFACET_DESC ...@@ -786,6 +786,16 @@ typedef struct _WINED3DSURFACET_DESC
} WINED3DSURFACET_DESC; } WINED3DSURFACET_DESC;
/***************************************************************************** /*****************************************************************************
* Structure for DIB Surfaces (GetDC and GDI surfaces)
*/
typedef struct wineD3DSurface_DIB {
HBITMAP DIBsection;
void* bitmap_data;
HGDIOBJ holdbitmap;
BOOL client_memory;
} wineD3DSurface_DIB;
/*****************************************************************************
* IWineD3DSurface implementation structure * IWineD3DSurface implementation structure
*/ */
struct IWineD3DSurfaceImpl struct IWineD3DSurfaceImpl
...@@ -819,6 +829,10 @@ struct IWineD3DSurfaceImpl ...@@ -819,6 +829,10 @@ struct IWineD3DSurfaceImpl
RECT dirtyRect; RECT dirtyRect;
glDescriptor glDescription; glDescriptor glDescription;
/* For GetDC */
wineD3DSurface_DIB dib;
HDC hDC;
}; };
extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl; extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;
...@@ -837,6 +851,8 @@ extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl; ...@@ -837,6 +851,8 @@ extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;
#define SFLAG_NONPOW2 0x0400 /* Surface sizes are not a power of 2 */ #define SFLAG_NONPOW2 0x0400 /* Surface sizes are not a power of 2 */
#define SFLAG_DYNLOCK 0x0800 /* Surface is often locked by the app */ #define SFLAG_DYNLOCK 0x0800 /* Surface is often locked by the app */
#define SFLAG_DYNCHANGE 0x1800 /* Surface contents are changed very often, implies DYNLOCK */ #define SFLAG_DYNCHANGE 0x1800 /* Surface contents are changed very often, implies DYNLOCK */
#define SFLAG_DCINUSE 0x2000 /* Set between GetDC and ReleaseDC calls */
#define SFLAG_NEWDC 0x4000 /* To inform LockRect about a new dc */
/* In some conditions the surface memory must not be freed: /* In some conditions the surface memory must not be freed:
* SFLAG_OVERSIZE: Not all data can be kept in GL * SFLAG_OVERSIZE: Not all data can be kept in GL
...@@ -1299,5 +1315,9 @@ DWORD IWineD3DPaletteImpl_Size(DWORD dwFlags); ...@@ -1299,5 +1315,9 @@ DWORD IWineD3DPaletteImpl_Size(DWORD dwFlags);
/* DirectDraw utility functions */ /* DirectDraw utility functions */
extern WINED3DFORMAT pixelformat_for_depth(DWORD depth); extern WINED3DFORMAT pixelformat_for_depth(DWORD depth);
LONG get_bitmask_red(WINED3DFORMAT fmt);
LONG get_bitmask_green(WINED3DFORMAT fmt);
LONG get_bitmask_blue(WINED3DFORMAT fmt);
LONG get_bitmask_alpha(WINED3DFORMAT fmt);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment