Skip to content

Commit

Permalink
Fix the entrypoint declaration for CopyMemory.
Browse files Browse the repository at this point in the history
Contributes to cefsharp#2796
  • Loading branch information
kpreisser committed Sep 4, 2019
1 parent 07ac500 commit b30cc11
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CefSharp.Wpf/Rendering/AbstractRenderHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ 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);
[DllImport("kernel32.dll", EntryPoint = "RtlMoveMemory", 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

0 comments on commit b30cc11

Please sign in to comment.