Commit c1cca63e authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Always store the palette index in the alpha component.

parent eb4d5c7a
......@@ -3064,6 +3064,7 @@ DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface, c
{WINED3DFMT_R8G8B8X8_UNORM, 255.0f, 255.0f, 255.0f, 255.0f, 0, 8, 16, 24},
{WINED3DFMT_B10G10R10A2_UNORM, 1023.0f, 1023.0f, 1023.0f, 3.0f, 20, 10, 0, 30},
{WINED3DFMT_R10G10B10A2_UNORM, 1023.0f, 1023.0f, 1023.0f, 3.0f, 0, 10, 20, 30},
{WINED3DFMT_P8_UINT, 0.0f, 0.0f, 0.0f, 255.0f, 0, 0, 0, 0},
};
const struct wined3d_format *format = surface->resource.format;
unsigned int i;
......@@ -3087,40 +3088,6 @@ DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface, c
return ret;
}
if (format->id == WINED3DFMT_P8_UINT)
{
const RGBQUAD *e;
BYTE r, g, b, a;
if (!surface->palette)
{
WARN("Surface doesn't have a palette, returning 0.\n");
return 0;
}
r = (BYTE)((color->r * 255.0f) + 0.5f);
g = (BYTE)((color->g * 255.0f) + 0.5f);
b = (BYTE)((color->b * 255.0f) + 0.5f);
a = (BYTE)((color->a * 255.0f) + 0.5f);
e = &surface->palette->colors[a];
if (e->rgbRed == r && e->rgbGreen == g && e->rgbBlue == b)
return a;
WARN("Alpha didn't match index, searching full palette.\n");
for (i = 0; i < 256; ++i)
{
e = &surface->palette->colors[i];
if (e->rgbRed == r && e->rgbGreen == g && e->rgbBlue == b)
return i;
}
FIXME("Unable to convert color to palette index.\n");
return 0;
}
FIXME("Conversion for format %s not implemented.\n", debug_d3dformat(format->id));
return 0;
......
......@@ -2636,11 +2636,6 @@ struct wined3d_swapchain
HWND backup_wnd;
};
static inline BOOL swapchain_is_p8(const struct wined3d_swapchain *swapchain)
{
return swapchain->desc.backbuffer_format == WINED3DFMT_P8_UINT;
}
void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *rect) DECLSPEC_HIDDEN;
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment