[MPlayer-dev-eng] Direct3D OSD discussion

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Nov 28 21:02:08 CET 2008


> +/** @brief Maps MPlayer alpha to D3D
> + *         0x0 -> transparent and discarded by alpha test
> + *         0x0 -> 0xFF to become opaque

You mean 0x00 and 0x01?

> +    vo_draw_alpha_l8a8(w,h,src,srca,stride,
> +        (void *)((char *)locked_rect.pBits+locked_rect.Pitch*y0+2*x0), locked_rect.Pitch);

cast to (unsigned char *) instead of (char *) and you do not have to cast to (void *)

> +    unsigned int calc_height = ((unsigned int)(OSD_TEXTURE_SIZE / aspect));

Both the cast and the outer () are quite pointless and IMO more
confusing than helpful.

> +        memset(locked_rect.pBits, 0, (locked_rect.Pitch * OSD_TEXTURE_SIZE));

the inner () seem pointless too.

> +        osd_quad_vb[2].tv =
> +            osd_quad_vb[3].tv = ((1.0f / OSD_TEXTURE_SIZE) * (OSD_TEXTURE_SIZE / aspect));

This is the same as 1.0f / aspect, though for clarity/readability it might be better
to do (float)calc_height / OSD_TEXTURE_SIZE.
I'm mostly waiting for more info on how we can solve the issue with the
clear function, but I think it is good to apply basically.
A bit unrelated: all those error checking paths are quite bad and full
of memleaks (e.g. when one function fails in preinit all resources that
were allocated before should be freed before returning), somewhen those
should be fixed - but it's nothing that should be hurried, it should be
done without making a mess of the code.



More information about the MPlayer-dev-eng mailing list