On 20 May 2014 13:09, Stefan Dösinger stefan@codeweavers.com wrote:
@@ -3372,7 +3301,7 @@ static BOOL color_in_range(const struct wined3d_color_key *color_key, DWORD colo
void d3dfmt_p8_init_palette(const struct wined3d_surface *surface, BYTE table[256][4]) {
- const struct wined3d_palette *pal = surface->palette;
const struct wined3d_palette *pal = surface->swapchain ? surface->swapchain->palette : NULL; unsigned int i;
if (!pal)
This function is a bit silly. I think all callers should be able to just use palette->colors[], and avoid the extra copy. I'd guess that if no palette is set on the swapchain it should use the system palette, but perhaps it's ok to leave that undefined for now.
@@ -619,6 +625,14 @@ void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *r
TRACE("swapchain %p, rect %s.\n", swapchain, wine_dbgstr_rect(rect));
- if (swapchain->palette && (swapchain->palette != swapchain->last_gdi_blt_palette
|| swapchain->palette->changed))
- {
wined3d_palette_apply_to_dc(swapchain->palette, swapchain->front_buffer->hDC);
swapchain->last_gdi_blt_palette = swapchain->palette;
swapchain->palette->changed = FALSE;
- }
- front = swapchain->front_buffer; if (front->resource.map_count) ERR("Trying to blit a mapped surface.\n");
This is problematic in wined3d, because you can have multiple swapchains using the same palette. In practice that never happens, but that depends on knowing about everything that calls wined3d. If you really need this kind of scheme you'd have to make "palette->changed" a counter, and then iterate over all swapchains on wrap, but couldn't you just create a GDI palette for the wined3d palette, and then select that into the DC for the blit? Or just always update the palette, which is pretty much what we do now in the GL case.