wined3d: add surface convertor from D3DFMT_X8R8G8B8 to D3DFMT_R5G6B5

Stefan Dösinger stefan at codeweavers.com
Sun Jul 13 09:52:53 CDT 2008


Please allign the entries in the conversion table. It seems that the spacing
isn't properly alliged(although maybe my outlook messed it up). Otherwise it
looks ok to me

Also it is generally better to attach the patch as an extra file to the mail
instead of inlining it, since mail clients often mangle the lines, thus
breaking the patch

> -----Original Message-----
> From: wine-patches-bounces at winehq.org [mailto:wine-patches-
> bounces at winehq.org] On Behalf Of Victor
> Sent: Saturday, July 12, 2008 9:54 PM
> To: wine-patches at winehq.org
> Subject: wined3d: add surface convertor from D3DFMT_X8R8G8B8 to
> D3DFMT_R5G6B5
> 
> 
> 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





More information about the wine-patches mailing list