Henri Verbeet : wined3d: Get rid of unused palette flags.

Alexandre Julliard julliard at winehq.org
Fri Dec 13 12:46:28 CST 2013


Module: wine
Branch: master
Commit: 4e7b62a46da52e1cbc9cffd4ebc3b46c06f16edd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4e7b62a46da52e1cbc9cffd4ebc3b46c06f16edd

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Dec 13 09:07:49 2013 +0100

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 214c912..d04f426 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 27e6b24..e659952 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 ec9ac6c..8c40516 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 52f8e52..47dde06 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




More information about the wine-cvs mailing list