From: Vijay Kiran Kamuju Subject: [PATCH] wined3d: Implement WINED3DFMT_B8G8R8X8_UNORM to WINED3DFMT_L8_UNORM conversion. Message-Id: <20190420204548.2739-1-infyquest@gmail.com> Date: Sat, 20 Apr 2019 22:45:48 +0200 From: Stanislav Zhukov This is similar to bug 21629 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44888 Signed-off-by: Stanislav Zhukov Signed-off-by: Vijay Kiran Kamuju --- dlls/wined3d/surface.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 48ca35bb3b3..7ef187ca966 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -574,6 +574,25 @@ static void convert_yuy2_r5g6b5(const BYTE *src, BYTE *dst, } } +static void convert_x8r8g8b8_l8(const BYTE *src, BYTE *dst, + DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) +{ + unsigned int x, y; + + TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out); + + for (y = 0; y < h; ++y) + { + const DWORD *src_line = (const DWORD *)(src + y * pitch_in); + BYTE *dst_line = (BYTE *)(dst + y * pitch_out); + + for (x = 0; x < w; ++x) + { + dst_line[x] = src_line[x] & 0x000000ff; + } + } +} + struct d3dfmt_converter_desc { enum wined3d_format_id from, to; @@ -588,6 +607,7 @@ static const struct d3dfmt_converter_desc converters[] = {WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_B8G8R8A8_UNORM, convert_a8r8g8b8_x8r8g8b8}, {WINED3DFMT_YUY2, WINED3DFMT_B8G8R8X8_UNORM, convert_yuy2_x8r8g8b8}, {WINED3DFMT_YUY2, WINED3DFMT_B5G6R5_UNORM, convert_yuy2_r5g6b5}, + {WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_L8_UNORM, convert_x8r8g8b8_l8}, }; static inline const struct d3dfmt_converter_desc *find_converter(enum wined3d_format_id from, -- 2.17.0