[wined3d] drawprint tidyup initilization of strided data.

Dimi Paun dimi at lattica.com
Thu Jul 21 14:50:21 CDT 2005


> +#define SET_STRIDED (_usage, _name) \
> +case _usage: \
> +strided->u.s._name.lpData   = data; \
> +strided->u.s._name.dwType   = element->Type; \
> +strided->u.s._name.dwStride = stride; \
> +break;
> +
> +#define SET_STRIDED_(_usage, _name) \
> +case _usage: \
> +strided->u.s._name.lpData   = data; \
> +strided->u.s._name.dwType   = element->Type; \
> +strided->u.s._name.dwStride = stride; \

This is pretty ugly: the resulting code doesn't look like C.
In fact, it looks rather magical.For example, why pass in _usage
as a param to the macro, just to get rid of the
    case _usage:
which you actually want outside the macro for readability.

Also, accessing the magic strided, data, element, stride
directly is very weird, and problematic. The casual user
wouldn't know what hit him :)

I say let it be as is. If you really want the macro, something
like this would be better:

+#define SET_STRIDED_(_strided, _name, _data, _element, _stride) \
+_strided->u.s._name.lpData   = _data; \
+_strided->u.s._name.dwType   = _element->Type; \
+_strided->u.s._name.dwStride = _stride;


-- 
Dimi Paun <dimi at lattica.com>
Lattica, Inc.



More information about the wine-devel mailing list