wined3d: add surface convertor from D3DFMT_X8R8G8B8 to D3DFMT_R5G6B5
Victor
ErV2005 at rambler.ru
Sat Jul 12 21:54:10 CDT 2008
removes "cannot convert" FIXMEs in "Ancient Evil" game.
---
dlls/wined3d/surface_base.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index 183cd2b..d74ec42 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -636,6 +636,23 @@ void convert_r32f_r16f(BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, un
}
}
+inline WORD x8r8g8b8_to_x5r6g5(DWORD xrgb){
+ return ((xrgb & 0xFF) >> 3) | ((xrgb & 0xFF00) >> 10) |
+ ((xrgb & 0xFF0000) >> 19);
+}
+
+void convert_x8r8g8b8_x5r6g5(BYTE* src, BYTE* dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h){
+ unsigned int x, y;
+ DWORD* srcp;
+ WORD* destp;
+ for (y = 0; y < h; y++, src+= pitch_in, dst += pitch_out){
+ srcp = (DWORD*)src;
+ destp = (WORD*)dst;
+ for (x = 0; x < w; x++)
+ destp[x] = x8r8g8b8_to_x5r6g5(srcp[x]);
+ }
+}
+
struct d3dfmt_convertor_desc {
WINED3DFORMAT from, to;
void (*convert)(BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h);
@@ -643,6 +660,7 @@ struct d3dfmt_convertor_desc {
struct d3dfmt_convertor_desc convertors[] = {
{WINED3DFMT_R32F, WINED3DFMT_R16F, convert_r32f_r16f},
+ {WINED3DFMT_X8R8G8B8, WINED3DFMT_R5G6B5, convert_x8r8g8b8_x5r6g5}
};
static inline struct d3dfmt_convertor_desc *find_convertor(WINED3DFORMAT from, WINED3DFORMAT to) {
--
1.5.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: This is a digitally signed message part.
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20080713/7b657cd9/attachment.pgp
More information about the wine-patches
mailing list