[PATCH] wined3d: Implement WINED3DFMT_B8G8R8X8_UNORM to WINED3DFMT_L8_UNORM conversion.
Vijay Kiran Kamuju
infyquest at gmail.com
Sat Apr 20 15:45:48 CDT 2019
From: Stanislav Zhukov <koncord at tes3mp.com>
This is similar to bug 21629
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44888
Signed-off-by: Stanislav Zhukov <koncord at tes3mp.com>
Signed-off-by: Vijay Kiran Kamuju <infyquest at gmail.com>
---
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
More information about the wine-devel
mailing list