[vlc-devel] [PATCH] Direct2D video output module

Laurent Aimar fenrir at elivagar.org
Sun Jul 25 13:58:18 CEST 2010


On Sun, Jul 25, 2010 at 01:19:16PM +0200, Laurent Aimar wrote:
> > +    if (sys->d2_render_target && sys->d2_bitmap) {
> > +        ID2D1HwndRenderTarget_BeginDraw(sys->d2_render_target);
> > +
> > +        ID2D1HwndRenderTarget_DrawBitmap(sys->d2_render_target,
> > +                                         sys->d2_bitmap,
> > +                                         &r_dest,
> > +                                         1.0f,
> > +                                         D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
> > +                                         NULL);
> > +
> > +        ID2D1HwndRenderTarget_EndDraw(sys->d2_render_target, NULL, NULL);
>  From msdn I see
> "Your application should create render targets once and hold onto them for the
>  life of the application or until the render target's EndDraw method returns the
>  D2DERR_RECREATE_TARGET error. When you receive this error, you need to recreate
>  the render target (and any resources it created)."
> 
>  So it seems that you need to check for EndDraw error code and recreate the
> resources when needed. You can see how d3d does it.
 d3d will be a bad example as you don't have the same constraints.
I think that you simply need to call D2D_DestroyRenderTarget and
D2D_ResizeRenderTarget.

 That makes me think that
> info.has_pictures_invalid = true;
in the open function should be changed to
> info.has_pictures_invalid = false;
as in fact you never need to recreate the picture pool.

-- 
fenrir




More information about the vlc-devel mailing list