From 4e7b62a46da52e1cbc9cffd4ebc3b46c06f16edd Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 13 Dec 2013 09:07:49 +0100 Subject: [PATCH] wined3d: Get rid of unused palette flags. --- dlls/ddraw/palette.c | 10 +++++++++- dlls/wined3d/palette.c | 8 ++++---- dlls/wined3d/surface.c | 11 +---------- include/wine/wined3d.h | 15 +++------------ 4 files changed, 17 insertions(+), 27 deletions(-) diff --git a/dlls/ddraw/palette.c b/dlls/ddraw/palette.c index 214c91231db..d04f42606e0 100644 --- a/dlls/ddraw/palette.c +++ b/dlls/ddraw/palette.c @@ -257,6 +257,7 @@ HRESULT ddraw_palette_init(struct ddraw_palette *palette, struct ddraw *ddraw, DWORD flags, PALETTEENTRY *entries) { unsigned int entry_count; + DWORD wined3d_flags = 0; HRESULT hr; if ((entry_count = palette_size(flags)) == ~0u) @@ -265,12 +266,19 @@ HRESULT ddraw_palette_init(struct ddraw_palette *palette, return DDERR_INVALIDPARAMS; } + if (flags & DDPCAPS_8BITENTRIES) + wined3d_flags |= WINED3D_PALETTE_8BIT_ENTRIES; + if (flags & DDPCAPS_ALLOW256) + wined3d_flags |= WINED3D_PALETTE_ALLOW_256; + if (flags & DDPCAPS_ALPHA) + wined3d_flags |= WINED3D_PALETTE_ALPHA; + palette->IDirectDrawPalette_iface.lpVtbl = &ddraw_palette_vtbl; palette->ref = 1; palette->flags = flags; if (FAILED(hr = wined3d_palette_create(ddraw->wined3d_device, - flags, entry_count, entries, &palette->wineD3DPalette))) + wined3d_flags, entry_count, entries, &palette->wineD3DPalette))) { WARN("Failed to create wined3d palette, hr %#x.\n", hr); return hr; diff --git a/dlls/wined3d/palette.c b/dlls/wined3d/palette.c index 27e6b245b6f..e659952bca0 100644 --- a/dlls/wined3d/palette.c +++ b/dlls/wined3d/palette.c @@ -64,7 +64,7 @@ HRESULT CDECL wined3d_palette_get_entries(const struct wined3d_palette *palette, if (start > palette->palNumEntries || count > palette->palNumEntries - start) return WINED3DERR_INVALIDCALL; - if (palette->flags & WINEDDPCAPS_8BITENTRIES) + if (palette->flags & WINED3D_PALETTE_8BIT_ENTRIES) { BYTE *entry = (BYTE *)entries; unsigned int i; @@ -87,7 +87,7 @@ HRESULT CDECL wined3d_palette_set_entries(struct wined3d_palette *palette, palette, flags, start, count, entries); TRACE("Palette flags: %#x.\n", palette->flags); - if (palette->flags & WINEDDPCAPS_8BITENTRIES) + if (palette->flags & WINED3D_PALETTE_8BIT_ENTRIES) { const BYTE *entry = (const BYTE *)entries; unsigned int i; @@ -100,9 +100,9 @@ HRESULT CDECL wined3d_palette_set_entries(struct wined3d_palette *palette, memcpy(palette->palents + start, entries, count * sizeof(*palette->palents)); /* When WINEDDCAPS_ALLOW256 isn't set we need to override entry 0 with black and 255 with white */ - if (!(palette->flags & WINEDDPCAPS_ALLOW256)) + if (!(palette->flags & WINED3D_PALETTE_ALLOW_256)) { - TRACE("WINEDDPCAPS_ALLOW256 set, overriding palette entry 0 with black and 255 with white\n"); + TRACE("WINED3D_PALETTE_ALLOW_256 not set, overriding palette entry 0 with black and 255 with white.\n"); palette->palents[0].peRed = 0; palette->palents[0].peGreen = 0; palette->palents[0].peBlue = 0; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index ec9ac6c3bef..8c40516be91 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -2498,18 +2498,9 @@ void CDECL wined3d_surface_set_palette(struct wined3d_surface *surface, struct w return; } - if (surface->palette && (surface->resource.usage & WINED3DUSAGE_RENDERTARGET)) - surface->palette->flags &= ~WINEDDPCAPS_PRIMARYSURFACE; - surface->palette = palette; - if (palette) - { - if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET) - palette->flags |= WINEDDPCAPS_PRIMARYSURFACE; - surface->surface_ops->surface_realize_palette(surface); - } } HRESULT CDECL wined3d_surface_set_color_key(struct wined3d_surface *surface, @@ -3777,7 +3768,7 @@ void d3dfmt_p8_init_palette(const struct wined3d_surface *surface, BYTE table[25 table[i][3] = i; else if (colorkey && color_in_range(&surface->src_blt_color_key, i)) table[i][3] = 0x00; - else if (pal->flags & WINEDDPCAPS_ALPHA) + else if (pal->flags & WINED3D_PALETTE_ALPHA) table[i][3] = pal->palents[i].peFlags; else table[i][3] = 0xff; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 52f8e52ba2b..47dde0661c2 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1481,18 +1481,9 @@ enum wined3d_display_rotation #define WINEDDCAPS2_STEREO 0x02000000 #define WINEDDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL 0x04000000 -/* DDCAPS.d */ -#define WINEDDPCAPS_4BIT 0x00000001 -#define WINEDDPCAPS_8BITENTRIES 0x00000002 -#define WINEDDPCAPS_8BIT 0x00000004 -#define WINEDDPCAPS_INITIALIZE 0x00000008 -#define WINEDDPCAPS_PRIMARYSURFACE 0x00000010 -#define WINEDDPCAPS_PRIMARYSURFACELEFT 0x00000020 -#define WINEDDPCAPS_ALLOW256 0x00000040 -#define WINEDDPCAPS_VSYNC 0x00000080 -#define WINEDDPCAPS_1BIT 0x00000100 -#define WINEDDPCAPS_2BIT 0x00000200 -#define WINEDDPCAPS_ALPHA 0x00000400 +#define WINED3D_PALETTE_8BIT_ENTRIES 0x00000001 +#define WINED3D_PALETTE_ALLOW_256 0x00000002 +#define WINED3D_PALETTE_ALPHA 0x00000004 #define WINED3D_SURFACE_MAPPABLE 0x00000001 #define WINED3D_SURFACE_DISCARD 0x00000002