wined3d: Remove broken gdi palette code.

This commit is contained in:
Stefan Dösinger 2014-05-02 13:43:24 +02:00 committed by Alexandre Julliard
parent 7839ec874f
commit 39212d2ffb
7 changed files with 12 additions and 33 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
};