aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/NativeMethods.cs
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2018-02-20 16:45:00 +0200
committerAvi Levkovich <avi@twine-s.com>2018-02-20 16:45:00 +0200
commit6c208c90bc45aff4a7fa214356a42fe7757c5e6f (patch)
tree0d77bc6a0ecfbb53cf42c5462ee19212197ee1bd /Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/NativeMethods.cs
parentb0823127f152fe97a6e8fce29e427c7f3db9cf5a (diff)
parent1a573aaa346ec4b8bd58a0e35ab9df571a09b855 (diff)
downloadTango-6c208c90bc45aff4a7fa214356a42fe7757c5e6f.tar.gz
Tango-6c208c90bc45aff4a7fa214356a42fe7757c5e6f.zip
MERGE
Diffstat (limited to 'Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/NativeMethods.cs')
-rw-r--r--Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/NativeMethods.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/NativeMethods.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/NativeMethods.cs
new file mode 100644
index 000000000..59b2b7bcc
--- /dev/null
+++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/NativeMethods.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Runtime;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Media.Imaging
+{
+ internal static class NativeMethods
+ {
+ [TargetedPatchingOptOut("Internal method only, inlined across NGen boundaries for performance reasons")]
+ internal static unsafe void CopyUnmanagedMemory(byte* srcPtr, int srcOffset, byte* dstPtr, int dstOffset, int count)
+ {
+ srcPtr += srcOffset;
+ dstPtr += dstOffset;
+
+ memcpy(dstPtr, srcPtr, count);
+ }
+
+ [TargetedPatchingOptOut("Internal method only, inlined across NGen boundaries for performance reasons")]
+ internal static void SetUnmanagedMemory(IntPtr dst, int filler, int count)
+ {
+ memset(dst, filler, count);
+ }
+
+ // Win32 memory copy function
+ //[DllImport("ntdll.dll")]
+ [DllImport("msvcrt.dll", EntryPoint = "memcpy", CallingConvention = CallingConvention.Cdecl, SetLastError = false)]
+ private static extern unsafe byte* memcpy(
+ byte* dst,
+ byte* src,
+ int count);
+
+ // Win32 memory set function
+ //[DllImport("ntdll.dll")]
+ //[DllImport("coredll.dll", EntryPoint = "memset", SetLastError = false)]
+ [DllImport("msvcrt.dll", EntryPoint = "memset", CallingConvention = CallingConvention.Cdecl, SetLastError = false)]
+ private static extern void memset(
+ IntPtr dst,
+ int filler,
+ int count);
+ }
+}