wined3d: Implement r5g6b5 to x8r8g8b8 function.
Mike Ruprecht
cmaiku at gmail.com
Tue Dec 9 23:04:40 CST 2008
dlls/wined3d/surface_base.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index 9ee5c75..8596499 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -702,6 +702,25 @@ static void convert_r32f_r16f(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD
}
}
+static void convert_r5g6b5_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ unsigned int w, unsigned int h) {
+ unsigned int x, y;
+ const unsigned short *src_s;
+ unsigned int *dst_u;
+ unsigned short src_x;
+
+ TRACE("Converting %dx%d pixels, pitches %d %d\n", w, h, pitch_in, pitch_out);
+ for(y = 0; y < h; y++) {
+ src_s = (unsigned short *) (src + y * pitch_in);
+ dst_u = (unsigned int *) (dst + y * pitch_out);
+ for(x = 0; x < w; x++) {
+ src_x = *(src_s + x);
+ dst_u[x] = 0xFF000000 | (src_x & 0xF800) << 8 |
+ (src_x & 0x07E0) << 5 | (src_x & 0x001F) << 3;
+ }
+ }
+}
+
struct d3dfmt_convertor_desc {
WINED3DFORMAT from, to;
void (*convert)(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h);
@@ -710,6 +729,7 @@ struct d3dfmt_convertor_desc {
static const struct d3dfmt_convertor_desc convertors[] =
{
{WINED3DFMT_R32F, WINED3DFMT_R16F, convert_r32f_r16f},
+ {WINED3DFMT_R5G6B5, WINED3DFMT_X8R8G8B8, convert_r5g6b5_x8r8g8b8},
};
static inline const struct d3dfmt_convertor_desc *find_convertor(WINED3DFORMAT from, WINED3DFORMAT to)
More information about the wine-patches
mailing list