wined3d: universal surface convertor function for unsigned integer color formats(5th attempt)

Philip Nilsson pnilsson at
Sun Jul 27 14:18:02 CDT 2008

On Thu, Jul 24, 2008 at 08:14:40PM +0400, Victor Eremin wrote:
> Supports conversion between most of "unsigned color" argb/xrgb
> surface formats (D3DFMT_A8R8G8B8, D3DFMT_A8R3G3B2, etc), and
> "luminosity" color formats (D3DFMT_L8, etc),
> excluding D3DFMT_A16R16G16B16, D3DFMT_A8P8, D3DFMT_P8 and D3DFMT_A1.
> luminosity to argb/xrgb (and vice versa) conversions are not supported
>  dlls/wined3d/surface_base.c    |  218 ++++++++++++++++++++++++++++++++++++++-

I think it would be a better idea to put most of the functions in
utils.c, as they are utilities, and may have utility in other places
(for example argb_to_fmt does something similar, although I'm not sure
if more format conversion is neccessary.)

> +inline BYTE getMaskShift(DWORD mask){

Most functions here do not use camelCase.

> +void mask_erase(DWORD dstMask, BYTE pixelSize, 

I'd make all functions static that have no use outside their file to get
nicer warnings (function unused) and smaller binaries.

I wonder how static and inline interacts...

> +/*
> + * Warning: this won't convert all formats
> + */

The FIXMEs should be enough.

>  struct d3dfmt_convertor_desc convertors[] = {
> -    {WINED3DFMT_R32F,       WINED3DFMT_R16F,        convert_r32f_r16f},
> +    {WINED3DFMT_R32F,       WINED3DFMT_R16F,        convert_r32f_r16f}
>  };

I think my neckbeard just caught fire!

A lot of tests would be nice (although I guess most of the functionality
is already tested.)

I hope this is somewhat helpful.

More information about the wine-devel mailing list