[PATCH 3/3] wined3d: Remove broken gdi palette code.
Stefan Dösinger
stefan at codeweavers.com
Fri May 2 06:43:24 CDT 2014
---
dlls/ddraw/tests/ddraw1.c | 5 ++---
dlls/ddraw/tests/ddraw2.c | 5 ++---
dlls/ddraw/tests/ddraw4.c | 5 ++---
dlls/ddraw/tests/ddraw7.c | 5 ++---
dlls/wined3d/palette.c | 18 ++----------------
dlls/wined3d/surface.c | 1 -
dlls/wined3d/wined3d_private.h | 6 ++----
7 files changed, 12 insertions(+), 33 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 8400191..8113f59 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -5097,10 +5097,9 @@ static void test_palette_gdi(void)
hr = IDirectDrawSurface_GetDC(surface, &dc);
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
ddraw_palette_handle = SelectPalette(dc, GetStockObject(DEFAULT_PALETTE), FALSE);
- todo_wine ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE),
+ ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE),
"Got unexpected palette %p, expected %p.\n",
ddraw_palette_handle, GetStockObject(DEFAULT_PALETTE));
- SelectPalette(dc, ddraw_palette_handle, FALSE);
i = GetDIBColorTable(dc, 0, sizeof(rgbquad) / sizeof(*rgbquad), rgbquad);
ok(i == sizeof(rgbquad) / sizeof(*rgbquad), "Expected count 255, got %u.\n", i);
@@ -5197,7 +5196,7 @@ static void test_palette_gdi(void)
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
ddraw_palette_handle = SelectPalette(dc, GetStockObject(DEFAULT_PALETTE), FALSE);
/* Windows 2000 on the testbot assigns a different palette to the primary. Refrast? */
- todo_wine ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE) || broken(TRUE),
+ ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE) || broken(TRUE),
"Got unexpected palette %p, expected %p.\n",
ddraw_palette_handle, GetStockObject(DEFAULT_PALETTE));
SelectPalette(dc, ddraw_palette_handle, FALSE);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 8f44fda..591ad8a 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -6165,10 +6165,9 @@ static void test_palette_gdi(void)
hr = IDirectDrawSurface_GetDC(surface, &dc);
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
ddraw_palette_handle = SelectPalette(dc, GetStockObject(DEFAULT_PALETTE), FALSE);
- todo_wine ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE),
+ ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE),
"Got unexpected palette %p, expected %p.\n",
ddraw_palette_handle, GetStockObject(DEFAULT_PALETTE));
- SelectPalette(dc, ddraw_palette_handle, FALSE);
i = GetDIBColorTable(dc, 0, sizeof(rgbquad) / sizeof(*rgbquad), rgbquad);
ok(i == sizeof(rgbquad) / sizeof(*rgbquad), "Expected count 255, got %u.\n", i);
@@ -6265,7 +6264,7 @@ static void test_palette_gdi(void)
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
ddraw_palette_handle = SelectPalette(dc, GetStockObject(DEFAULT_PALETTE), FALSE);
/* Windows 2000 on the testbot assigns a different palette to the primary. Refrast? */
- todo_wine ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE) || broken(TRUE),
+ ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE) || broken(TRUE),
"Got unexpected palette %p, expected %p.\n",
ddraw_palette_handle, GetStockObject(DEFAULT_PALETTE));
SelectPalette(dc, ddraw_palette_handle, FALSE);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 0f82ed3..828e2a3 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -7067,10 +7067,9 @@ static void test_palette_gdi(void)
hr = IDirectDrawSurface4_GetDC(surface, &dc);
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
ddraw_palette_handle = SelectPalette(dc, GetStockObject(DEFAULT_PALETTE), FALSE);
- todo_wine ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE),
+ ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE),
"Got unexpected palette %p, expected %p.\n",
ddraw_palette_handle, GetStockObject(DEFAULT_PALETTE));
- SelectPalette(dc, ddraw_palette_handle, FALSE);
i = GetDIBColorTable(dc, 0, sizeof(rgbquad) / sizeof(*rgbquad), rgbquad);
ok(i == sizeof(rgbquad) / sizeof(*rgbquad), "Expected count 255, got %u.\n", i);
@@ -7167,7 +7166,7 @@ static void test_palette_gdi(void)
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
ddraw_palette_handle = SelectPalette(dc, GetStockObject(DEFAULT_PALETTE), FALSE);
/* Windows 2000 on the testbot assigns a different palette to the primary. Refrast? */
- todo_wine ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE) || broken(TRUE),
+ ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE) || broken(TRUE),
"Got unexpected palette %p, expected %p.\n",
ddraw_palette_handle, GetStockObject(DEFAULT_PALETTE));
SelectPalette(dc, ddraw_palette_handle, FALSE);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 0ac0af1..cd9c1b8 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -6789,10 +6789,9 @@ static void test_palette_gdi(void)
hr = IDirectDrawSurface7_GetDC(surface, &dc);
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
ddraw_palette_handle = SelectPalette(dc, GetStockObject(DEFAULT_PALETTE), FALSE);
- todo_wine ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE),
+ ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE),
"Got unexpected palette %p, expected %p.\n",
ddraw_palette_handle, GetStockObject(DEFAULT_PALETTE));
- SelectPalette(dc, ddraw_palette_handle, FALSE);
i = GetDIBColorTable(dc, 0, sizeof(rgbquad) / sizeof(*rgbquad), rgbquad);
ok(i == sizeof(rgbquad) / sizeof(*rgbquad), "Expected count 255, got %u.\n", i);
@@ -6889,7 +6888,7 @@ static void test_palette_gdi(void)
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
ddraw_palette_handle = SelectPalette(dc, GetStockObject(DEFAULT_PALETTE), FALSE);
/* Windows 2000 on the testbot assigns a different palette to the primary. Refrast? */
- todo_wine ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE) || broken(TRUE),
+ ok(ddraw_palette_handle == GetStockObject(DEFAULT_PALETTE) || broken(TRUE),
"Got unexpected palette %p, expected %p.\n",
ddraw_palette_handle, GetStockObject(DEFAULT_PALETTE));
SelectPalette(dc, ddraw_palette_handle, FALSE);
diff --git a/dlls/wined3d/palette.c b/dlls/wined3d/palette.c
index e659952..5572d10 100644
--- a/dlls/wined3d/palette.c
+++ b/dlls/wined3d/palette.c
@@ -45,10 +45,7 @@ ULONG CDECL wined3d_palette_decref(struct wined3d_palette *palette)
TRACE("%p decreasing refcount to %u.\n", palette, refcount);
if (!refcount)
- {
- DeleteObject(palette->hpal);
HeapFree(GetProcessHeap(), 0, palette);
- }
return refcount;
}
@@ -61,7 +58,7 @@ HRESULT CDECL wined3d_palette_get_entries(const struct wined3d_palette *palette,
if (flags)
return WINED3DERR_INVALIDCALL; /* unchecked */
- if (start > palette->palNumEntries || count > palette->palNumEntries - start)
+ if (start > palette->size || count > palette->size - start)
return WINED3DERR_INVALIDCALL;
if (palette->flags & WINED3D_PALETTE_8BIT_ENTRIES)
@@ -111,9 +108,6 @@ HRESULT CDECL wined3d_palette_set_entries(struct wined3d_palette *palette,
palette->palents[255].peGreen = 255;
palette->palents[255].peBlue = 255;
}
-
- if (palette->hpal)
- SetPaletteEntries(palette->hpal, start, count, palette->palents + start);
}
/* If the palette is attached to the render target, update all render targets */
@@ -138,19 +132,11 @@ static HRESULT wined3d_palette_init(struct wined3d_palette *palette, struct wine
palette->ref = 1;
palette->device = device;
palette->flags = flags;
-
- palette->palNumEntries = entry_count;
- palette->hpal = CreatePalette((const LOGPALETTE *)&palette->palVersion);
- if (!palette->hpal)
- {
- WARN("Failed to create palette.\n");
- return E_FAIL;
- }
+ palette->size = entry_count;
if (FAILED(hr = wined3d_palette_set_entries(palette, 0, 0, entry_count, entries)))
{
WARN("Failed to set palette entries, hr %#x.\n", hr);
- DeleteObject(palette->hpal);
return hr;
}
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 680a815..cd3b5a2 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -499,7 +499,6 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
surface->hDC = CreateCompatibleDC(0);
SelectObject(surface->hDC, surface->dib.DIBsection);
TRACE("Using wined3d palette %p.\n", surface->palette);
- SelectPalette(surface->hDC, surface->palette ? surface->palette->hpal : 0, FALSE);
surface->flags |= SFLAG_DIBSECTION;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7e67f1e..395568a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2957,10 +2957,8 @@ struct wined3d_palette
LONG ref;
struct wined3d_device *device;
- HPALETTE hpal;
- WORD palVersion; /*| */
- WORD palNumEntries; /*| LOGPALETTE */
- PALETTEENTRY palents[256]; /*| */
+ unsigned int size;
+ PALETTEENTRY palents[256];
DWORD flags;
};
--
1.8.3.2
More information about the wine-patches
mailing list