[MPlayer-dev-eng] [PATCH] Direct3D Much better D3D management

Diego Biurrun diego at biurrun.de
Tue Dec 2 00:46:08 CET 2008


On Tue, Dec 02, 2008 at 01:06:28AM +0200, Georgi Petrov wrote:
> > Isn't there a way to automatically do this using indent rules? Seems
> > like a lot of conversation over whitespace happens with patches.
> 
> Good point.
> 
> About those indentations - I'll switch to a different merger. This one
> does a terrible job and 2/3 of the mistakes come from it.

You are not using Subversion?

> BTW - I removed the whitespace before "(" intentionally. That's the
> coding style, right?

K & R style is generally the closest to what is preferred around here
(with 4 space indentaion instead of tabs) and is what I switched the
file to.  This means no space between function name and (.

> >random indention
> 
> Not quite. Just trying to stay within this outdated as hell 80 columns
> madness...

This has nothing to do with outdated terminal widths or anything of the
sort.  Unfortunately our brains and eyes do not follow the evolution of
display hardware.  Above a certain length readability gets hurt.

You will have noticed that newspapers and magazines use multicolumn
layout even though they have plenty of horizontal space available on
their pages.

Also, nobody ever asked you to sacrifice everything including common
sense to stay below 80 characters.  Just keep lines reasonably short,
preferably below 80 characters.  Don't chop off your hands just to cut
your fingernails.

> --- libvo/vo_direct3d.c	(revision 28056)
> +++ libvo/vo_direct3d.c	(working copy)
> @@ -185,32 +185,68 @@
>  
> +    if (FAILED(IDirect3DDevice9_CreateOffscreenPlainSurface(
> +         priv->d3d_device, priv->src_width, priv->src_height,
> +         priv->movie_src_fmt, D3DPOOL_DEFAULT, &priv->d3d_surface, NULL))) {
> +        mp_msg(MSGT_VO, MSGL_ERR,
> +        "<vo_direct3d><INFO>IDirect3D9_CreateOffscreenPlainSurface Failed.\n");
> +        return 0;

random indentation

> @@ -250,30 +273,86 @@
> +    /* Destroy the D3D Device */
> +    if (priv->d3d_device != NULL) {
> +    IDirect3DDevice9_Release(priv->d3d_device);
> +    priv->d3d_device = NULL;
> +    }

ditto

> @@ -285,9 +364,14 @@
>  
> +    /* Destroy the D3D Device */
> +    if (priv->d3d_device != NULL) {
> +    IDirect3DDevice9_Release(priv->d3d_device);
> +    priv->d3d_device = NULL;
> +    }

ditto

> @@ -543,7 +629,20 @@
>  
> -    if (!reconfigure_d3d())
> +    /* "config" may be called several times, so if this is not the first
> +     * call, we should destroy Direct3D adapter and surfaces before
> +     * calling configure_d3d, which will create them again.
> +     */
> +
> +    destroy_d3d_surfaces();

ditto

> +    if (priv->d3d_device != NULL) {
> +    IDirect3DDevice9_Release(priv->d3d_device);
> +    priv->d3d_device = NULL;
> +    }

ditto

Sorry for the harsh words, but how hard can it be to fix these issues?

Diego



More information about the MPlayer-dev-eng mailing list