Exemple #1
0
 public IDrawingContextImpl CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer)
 {
     var target =  _externalRenderTargetProvider.GetOrCreateRenderTarget();
     _externalRenderTargetProvider.BeforeDrawing();
     return new DrawingContextImpl(visualBrushRenderer, null, target, null, () =>
     {
         try
         {
             _externalRenderTargetProvider.AfterDrawing();
         }
         catch (SharpDXException ex) when ((uint) ex.HResult == 0x8899000C) // D2DERR_RECREATE_TARGET
         {
             _externalRenderTargetProvider.DestroyRenderTarget();
         }
     });
 }
Exemple #2
0
 public IDrawingContextImpl CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer)
 {
     _target = _target ?? _externalRenderTargetProvider.CreateRenderTarget();
     _externalRenderTargetProvider.BeforeDrawing();
     return(new DrawingContextImpl(visualBrushRenderer, _target, _dwFactory, null, () =>
     {
         try
         {
             _externalRenderTargetProvider.AfterDrawing();
         }
         catch (SharpDXException ex) when((uint)ex.HResult == 0x8899000C)   // D2DERR_RECREATE_TARGET
         {
             _target?.Dispose();
             _target = null;
         }
     }));
 }