protected internal virtual BitmapSource CopyBackBuffer()
{
SecurityHelper.DemandUnmanagedCode();
BitmapSource copy = null;
if (_pInteropDeviceBitmap != null)
{
BitmapSourceSafeMILHandle pIWICBitmapSource;
if (HRESULT.Succeeded(UnsafeNativeMethods.InteropDeviceBitmap.GetAsSoftwareBitmap(
_pInteropDeviceBitmap,
out pIWICBitmapSource
)))
{
// CachedBitmap will AddRef the bitmap
copy = new CachedBitmap(pIWICBitmapSource);
}
}
return copy;
}