diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs
index d0f0aaff21..13dccf7714 100644
--- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs
+++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs
@@ -64,6 +64,21 @@ namespace Avalonia.Direct2D1.Media
BitmapCreateCacheOption.CacheOnLoad);
}
+ ///
+ /// Initialize a new instance of the class
+ /// with a bitmap backed by GPU memory.
+ ///
+ /// The GPU bitmap.
+ ///
+ /// This bitmap must be either from the same render target,
+ /// or if the render target is a ,
+ /// the device associated with this context, to be renderable.
+ ///
+ public BitmapImpl(SharpDX.Direct2D1.Bitmap d2DBitmap)
+ {
+ _direct2D = d2DBitmap;
+ }
+
///
/// Gets the width of the bitmap, in pixels.
///
@@ -77,14 +92,13 @@ namespace Avalonia.Direct2D1.Media
public virtual void Dispose()
{
WicImpl.Dispose();
+ _direct2D?.Dispose();
}
///
/// Gets the WIC implementation of the bitmap.
///
- public Bitmap WicImpl
- {
- get; }
+ public Bitmap WicImpl { get; }
///
/// Gets a Direct2D bitmap to use on the specified render target.