Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CefSharp.Wpf/Rendering/AbstractRenderHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ namespace CefSharp.Wpf.Rendering
/// <seealso cref="CefSharp.Wpf.IRenderHandler" />
public abstract class AbstractRenderHandler : IDisposable, IRenderHandler
{
[DllImport("kernel32.dll", EntryPoint = "CopyMemory", SetLastError = false)]
protected static extern void CopyMemory(IntPtr dest, IntPtr src, uint count);
// Note: In contrast to RtlMoveMemory, RtlCopyMemory requires that the buffers do not overlap.
[DllImport("kernel32.dll", EntryPoint = "RtlCopyMemory", SetLastError = false)]
protected static extern void CopyMemory(IntPtr dest, IntPtr src, UIntPtr count);

internal static readonly PixelFormat PixelFormat = PixelFormats.Pbgra32;
internal static int BytesPerPixel = PixelFormat.BitsPerPixel / 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected override void CreateOrUpdateBitmap(bool isPopup, Rect dirtyRect, IntPt

//TODO: Performance analysis to determine which is the fastest memory copy function
//NativeMethodWrapper.CopyMemoryUsingHandle(viewAccessor.SafeMemoryMappedViewHandle.DangerousGetHandle(), buffer, numberOfBytes);
CopyMemory(viewAccessor.SafeMemoryMappedViewHandle.DangerousGetHandle(), buffer, (uint)numberOfBytes);
CopyMemory(viewAccessor.SafeMemoryMappedViewHandle.DangerousGetHandle(), buffer, (UIntPtr)(uint)numberOfBytes);

//Take a reference to the backBufferHandle, once we're on the UI thread we need to check if it's still valid
var backBufferHandle = mappedFile.SafeMemoryMappedFileHandle;
Expand Down
2 changes: 1 addition & 1 deletion CefSharp.Wpf/Rendering/InteropBitmapRenderHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected override void CreateOrUpdateBitmap(bool isPopup, Rect dirtyRect, IntPt

//TODO: Performance analysis to determine which is the fastest memory copy function
//NativeMethodWrapper.CopyMemoryUsingHandle(viewAccessor.SafeMemoryMappedViewHandle.DangerousGetHandle(), buffer, numberOfBytes);
CopyMemory(viewAccessor.SafeMemoryMappedViewHandle.DangerousGetHandle(), buffer, (uint)numberOfBytes);
CopyMemory(viewAccessor.SafeMemoryMappedViewHandle.DangerousGetHandle(), buffer, (UIntPtr)(uint)numberOfBytes);

//Take a reference to the backBufferHandle, once we're on the UI thread we need to check if it's still valid
var backBufferHandle = mappedFile.SafeMemoryMappedFileHandle;
Expand Down
2 changes: 1 addition & 1 deletion CefSharp.Wpf/Rendering/WritableBitmapRenderHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected override void CreateOrUpdateBitmap(bool isPopup, Rect dirtyRect, IntPt

//TODO: Performance analysis to determine which is the fastest memory copy function
//NativeMethodWrapper.CopyMemoryUsingHandle(viewAccessor.SafeMemoryMappedViewHandle.DangerousGetHandle(), buffer, numberOfBytes);
CopyMemory(viewAccessor.SafeMemoryMappedViewHandle.DangerousGetHandle(), buffer, (uint)numberOfBytes);
CopyMemory(viewAccessor.SafeMemoryMappedViewHandle.DangerousGetHandle(), buffer, (UIntPtr)(uint)numberOfBytes);

//Take a reference to the sourceBuffer that's used to update our WritableBitmap,
//once we're on the UI thread we need to check if it's still valid
Expand Down