Remove SetBitmapHelper method - call code inline for now

This commit is contained in:
amaitland
2014-12-16 20:24:04 +10:00
parent 2824f3b225
commit 7c1bc144b6
+16 -21
View File
@@ -1235,7 +1235,22 @@ namespace CefSharp.Wpf
var img = bitmapInfo.IsPopup ? popupImage : image;
// Now update the WPF image
SetBitmapHelper(bitmapInfo, img, bytesPerPixel);
var bitmap = bitmapInfo.InteropBitmap as InteropBitmap;
if (bitmap == null)
{
img.Source = null;
GC.Collect(1);
var stride = bitmapInfo.Width * bytesPerPixel;
bitmap = (InteropBitmap)Imaging.CreateBitmapSourceFromMemorySection(bitmapInfo.FileMappingHandle,
bitmapInfo.Width, bitmapInfo.Height, PixelFormat, stride, 0);
img.Source = bitmap;
}
bitmap.Invalidate();
bitmapInfo.InteropBitmap = bitmap;
}
}
@@ -1247,26 +1262,6 @@ namespace CefSharp.Wpf
return pixelPosition;
}
private static void SetBitmapHelper(BitmapInfo bitmapInfo, Image img, int bytesPerPixel)
{
var bitmap = bitmapInfo.InteropBitmap as InteropBitmap;
if (bitmap == null)
{
img.Source = null;
GC.Collect(1);
var stride = bitmapInfo.Width * bytesPerPixel;
bitmap = (InteropBitmap)Imaging.CreateBitmapSourceFromMemorySection(bitmapInfo.FileMappingHandle,
bitmapInfo.Width, bitmapInfo.Height, PixelFormat, stride, 0);
img.Source = bitmap;
}
bitmap.Invalidate();
bitmapInfo.InteropBitmap = bitmap;
}
public void ViewSource()
{
managedCefBrowserAdapter.ViewSource();