diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotifyHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotifyHandler.cs
index 2b54b8d..213507b 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotifyHandler.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotifyHandler.cs
@@ -11,5 +11,5 @@ namespace Microsoft.Iris.Render
public delegate void ContentNotifyHandler(
ContentNotification Notification,
IImage image,
- IntPtr data);
+ byte[] data);
}
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ExtensionsApi.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ExtensionsApi.cs
index d5c99c8..e19fe6b 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ExtensionsApi.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ExtensionsApi.cs
@@ -14,64 +14,77 @@ namespace Microsoft.Iris.Render.Extensions
[SuppressUnmanagedCodeSecurity]
public static class ExtensionsApi
{
- private const string s_stExtensionsDll = "UIXRender.dll";
internal const ushort WAVE_FORMAT_PCM = 1;
- [DllImport("UIXRender.dll", CharSet = CharSet.Auto)]
- internal static extern HRESULT SpBitmapLoadFile(
+ internal static HRESULT SpBitmapLoadFile(
string stFileName,
[MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req,
- ExtensionsApi.BitmapOptions nOptions,
+ BitmapOptions nOptions,
out HSpBitmap hBmp,
- out ImageInformation info);
+ out ImageInformation info)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll", CharSet = CharSet.Auto)]
- internal static extern HRESULT SpBitmapLoadRaw(
+ internal static HRESULT SpBitmapLoadRaw(
Size sizeActualPxl,
int nStride,
SurfaceFormat nFormat,
IntPtr pvData,
[MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req,
- ExtensionsApi.BitmapOptions nOptions,
+ BitmapOptions nOptions,
out HSpBitmap hBmp,
- out ImageInformation info);
+ out ImageInformation info)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll", CharSet = CharSet.Auto)]
- internal static extern HRESULT SpBitmapLoadResource(
+ internal static HRESULT SpBitmapLoadResource(
Win32Api.HINSTANCE hinst,
string stName,
int nType,
[MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req,
- ExtensionsApi.BitmapOptions nOptions,
+ BitmapOptions nOptions,
out HSpBitmap hBmp,
- out ImageInformation info);
+ out ImageInformation info)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll", CharSet = CharSet.Auto)]
- internal static extern HRESULT SpBitmapLoadBuffer(
+ internal static HRESULT SpBitmapLoadBuffer(
IntPtr pvSrc,
uint cbSize,
[MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req,
- ExtensionsApi.BitmapOptions nOptions,
+ BitmapOptions nOptions,
out HSpBitmap hBmp,
- out ImageInformation info);
+ out ImageInformation info)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll")]
- internal static extern HRESULT SpBitmapDelete(HSpBitmap hBmp);
+ internal static HRESULT SpBitmapDelete(HSpBitmap hBmp)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll", CharSet = CharSet.Auto)]
- internal static extern HRESULT SpSoundLoadBuffer(
+ internal static HRESULT SpSoundLoadBuffer(
IntPtr pBuffer,
int dwSize,
- ExtensionsApi.SoundOptions options,
- out ExtensionsApi.HSpSound hSound,
- out ExtensionsApi.SoundInformation info);
+ SoundOptions options,
+ out HSpSound hSound,
+ out SoundInformation info)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll")]
- internal static extern HRESULT SpSoundDispose(
- ExtensionsApi.HSpSound hSound,
- ExtensionsApi.SoundInformation info);
+ internal static HRESULT SpSoundDispose(
+ HSpSound hSound,
+ SoundInformation info)
+ {
+ throw new NotImplementedException();
+ }
- [System.Flags]
+ [Flags]
internal enum BitmapOptions
{
None = 0,
@@ -80,7 +93,7 @@ namespace Microsoft.Iris.Render.Extensions
Valid = Flip | Decode, // 0x00000003
}
- [System.Flags]
+ [Flags]
internal enum SoundOptions
{
None = 0,
@@ -105,28 +118,28 @@ namespace Microsoft.Iris.Render.Extensions
[ComVisible(false)]
public struct SoundData
{
- public IntPtr rgData;
+ public byte[] rgData;
}
[ComVisible(false)]
public struct SoundInformation
{
- public ExtensionsApi.SoundHeader Header;
- public ExtensionsApi.SoundData Data;
- public static ExtensionsApi.SoundInformation NULL = new ExtensionsApi.SoundInformation();
+ public SoundHeader Header;
+ public SoundData Data;
+ public static SoundInformation NULL = new SoundInformation();
}
[ComVisible(false)]
public struct HSpSound
{
public IntPtr h;
- public static readonly ExtensionsApi.HSpSound NULL = new ExtensionsApi.HSpSound();
+ public static readonly HSpSound NULL = new HSpSound();
- public static bool operator ==(ExtensionsApi.HSpSound hA, ExtensionsApi.HSpSound hB) => hA.h == hB.h;
+ public static bool operator ==(HSpSound hA, HSpSound hB) => hA.h == hB.h;
- public static bool operator !=(ExtensionsApi.HSpSound hA, ExtensionsApi.HSpSound hB) => hA.h != hB.h;
+ public static bool operator !=(HSpSound hA, HSpSound hB) => hA.h != hB.h;
- public override bool Equals(object oCompare) => oCompare is ExtensionsApi.HSpSound hspSound && this.h == hspSound.h;
+ public override bool Equals(object oCompare) => oCompare is HSpSound hspSound && this.h == hspSound.h;
public override int GetHashCode() => (int)this.h.ToInt64();
}
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/GradientInformation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/GradientInformation.cs
index 386d602..e083ad9 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/GradientInformation.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/GradientInformation.cs
@@ -9,16 +9,9 @@ using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Extensions
{
- public class GradientInformation : IDisposable
+ public class GradientInformation
{
public ImageInformation imageInfo;
- internal GCHandle gcData;
-
- void IDisposable.Dispose()
- {
- if (!this.gcData.IsAllocated)
- return;
- this.gcData.Free();
- }
+ internal byte[] Data;
}
}
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheItem.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheItem.cs
index 4540ed6..bb0d5a4 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheItem.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheItem.cs
@@ -164,7 +164,7 @@ namespace Microsoft.Iris.Render.Extensions
protected void SetSize(Size size) => this.m_size = size;
- internal void ReloadImage(ContentNotification notification, IImage image, IntPtr data)
+ internal void ReloadImage(ContentNotification notification, IImage image, byte[] data)
{
switch (notification)
{
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageData.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageData.cs
index 2e2c406..23d5be4 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageData.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageData.cs
@@ -12,6 +12,6 @@ namespace Microsoft.Iris.Render.Extensions
[ComVisible(false)]
public struct ImageData
{
- public IntPtr rgData;
+ public byte[] rgData;
}
}
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageLoader.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageLoader.cs
index 7e3e052..eb88117 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageLoader.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageLoader.cs
@@ -285,16 +285,16 @@ namespace Microsoft.Iris.Render.Extensions
GradientInformation gradientInformation = new GradientInformation()
{
imageInfo = {
- Header = {
- sizeActualPxl = sizeImage,
- sizeOriginalPxl = sizeImage,
- nStride = num2,
- nFormat = nFormat
- }
- },
- gcData = GCHandle.Alloc(numArray, GCHandleType.Pinned)
+ Header = {
+ sizeActualPxl = sizeImage,
+ sizeOriginalPxl = sizeImage,
+ nStride = num2,
+ nFormat = nFormat
+ }
+ },
+ Data = numArray
};
- gradientInformation.imageInfo.Data.rgData = gradientInformation.gcData.AddrOfPinnedObject();
+ gradientInformation.imageInfo.Data.rgData = gradientInformation.Data;
bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(gradientInformation.imageInfo.Header.nFormat), gradientInformation.imageInfo.Header.sizeActualPxl, gradientInformation.imageInfo.Header.nStride, gradientInformation.imageInfo.Data.rgData);
if (flag)
{
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundData.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundData.cs
index 5e71758..d64210f 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundData.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundData.cs
@@ -54,7 +54,7 @@ namespace Microsoft.Iris.Render.Extensions
uint ISoundData.SampleCount => (uint)(m_soundInfo.Header.cbDataSize / (ulong)(m_soundInfo.Header.wBitsPerSample / 8));
- IntPtr ISoundData.AcquireContent()
+ byte[] ISoundData.AcquireContent()
{
++this.m_usageCount;
return this.m_soundInfo.Data.rgData;
@@ -69,7 +69,7 @@ namespace Microsoft.Iris.Render.Extensions
ExtensionsApi.HSpSound soundDataHandle;
ExtensionsApi.SoundInformation soundDataInfo;
SoundLoader.FromResource(this.m_moduleName, this.m_resourceId, out soundDataHandle, out soundDataInfo);
- Debug2.Validate(soundDataInfo.Data.rgData != IntPtr.Zero, typeof(InvalidOperationException), "Failed to load data and no exception was thrown");
+ Debug2.Validate(soundDataInfo.Data.rgData != null, typeof(InvalidOperationException), "Failed to load data and no exception was thrown");
Debug2.Validate(soundDataInfo.Header.wFormatTag == 1, typeof(ArgumentException), "Only PCM sound data is currently supported");
Debug2.Validate(soundDataInfo.Header.nChannels >= 1 && soundDataInfo.Header.nChannels <= 2, typeof(ArgumentException), "Only mono/stereo sound data is currently supported");
Debug2.Validate(soundDataInfo.Header.wBitsPerSample == 8 || soundDataInfo.Header.wBitsPerSample == 16, typeof(ArgumentException), "Only 8bps/16bps sound data is currently supported");
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DataBufferCleanupInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DataBufferCleanupInfo.cs
index e2166fd..625b851 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DataBufferCleanupInfo.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DataBufferCleanupInfo.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Iris.Render.Graphics
{
internal class DataBufferCleanupInfo
{
- public IntPtr rgConvertData;
+ public byte[] rgConvertData;
public ImageLoadInfo imageLoadInfo;
}
}
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectResource.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectResource.cs
index c5a4c5c..d2f2a2e 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectResource.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectResource.cs
@@ -93,7 +93,8 @@ namespace Microsoft.Iris.Render.Graphics
++index;
}
}
- this.RemoteEffect(effectBuilder, pEffectBlob, pBlobBuffer, nBlobSize);
+ // TODO: Re-implement
+ //this.RemoteEffect(effectBuilder, pEffectBlob.ToPointer(), pBlobBuffer, nBlobSize);
return true;
}
@@ -129,7 +130,7 @@ namespace Microsoft.Iris.Render.Graphics
private void RemoteEffect(
Dx9EffectBuilder effectBuilder,
- IntPtr pEffectBlob,
+ byte[] pEffectBlob,
IntPtr pBlobBuffer,
uint nBlobSize)
{
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Image.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Image.cs
index 315f303..4ab06e7 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Image.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Image.cs
@@ -107,7 +107,7 @@ namespace Microsoft.Iris.Render.Graphics
ImageFormat imageFormat,
Size sizeImage,
int nStride,
- IntPtr rgData)
+ byte[] rgData)
{
this.m_session.AssertOwningThread();
bool flag1 = false;
@@ -131,18 +131,20 @@ namespace Microsoft.Iris.Render.Graphics
if (this.InUse)
this.m_surface.AddActiveUser(this);
}
- IntPtr num1 = IntPtr.Zero;
+ byte[] num1 = null;
if (this.m_session.IsForeignByteOrderOnWindowing)
{
int bitsPerPixel = SurfaceFormatInfo.GetBitsPerPixel(nFormat);
int num2 = sizeImage.Height * nStride;
- num1 = Marshal.AllocHGlobal(num2);
- Memory.ConvertEndian(num1, rgData, num2, bitsPerPixel);
+ num1 = new byte[num2];
+ // TODO: Does this need to be re-implemented?
+ throw new NotImplementedException();
+ //Memory.ConvertEndian(num1, rgData, num2, bitsPerPixel);
}
this.m_imageFormat = imageFormat;
this.m_sizeImage = sizeImage;
uint cbSize = (uint)(nStride * this.m_sizeImage.Height);
- buffer = this.m_session.BuildDataBuffer(num1 == IntPtr.Zero ? rgData : num1, cbSize);
+ buffer = this.m_session.BuildDataBuffer(num1 == null ? rgData : num1, cbSize);
this.Track(buffer, num1, rgData, nStride);
buffer.Commit();
++this.m_loadInfo.nLoadsInProgress;
@@ -182,7 +184,7 @@ namespace Microsoft.Iris.Render.Graphics
((IImage)this).LoadContent(this.m_imageFormat, this.m_sizeImage, this.m_loadInfo.nStride, this.m_loadInfo.rgAppData);
}
else
- this.m_handlerContent(ContentNotification.Acquire, this, IntPtr.Zero);
+ this.m_handlerContent(ContentNotification.Acquire, this, null);
}
Surface surface = this.m_surface;
}
@@ -204,7 +206,7 @@ namespace Microsoft.Iris.Render.Graphics
}
}
- private void Track(DataBuffer buffer, IntPtr rgConvertData, IntPtr rgAppData, int nStride)
+ private void Track(DataBuffer buffer, byte[] rgConvertData, byte[] rgAppData, int nStride)
{
ImageLoadInfo imageLoadInfo;
if (this.m_loadInfo != null && this.m_loadInfo.rgAppData == rgAppData && this.m_loadInfo.nStride == nStride)
@@ -259,14 +261,13 @@ namespace Microsoft.Iris.Render.Graphics
imageLoadInfo.handlerNotify(ContentNotification.Release, imageLoadInfo.imageOwner, imageLoadInfo.rgAppData);
imageLoadInfo.imageOwner.m_insideReleaseCallback = false;
}
- imageLoadInfo.rgAppData = IntPtr.Zero;
+ imageLoadInfo.rgAppData = null;
imageLoadInfo.handlerNotify = null;
imageLoadInfo.imageOwner = null;
}
- if (!(contextData.rgConvertData != IntPtr.Zero))
+ if (!(contextData.rgConvertData != null))
return;
- Marshal.FreeHGlobal(contextData.rgConvertData);
- contextData.rgConvertData = IntPtr.Zero;
+ contextData.rgConvertData = null;
}
internal delegate void ContentReloadedHandler(Image image);
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ImageLoadInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ImageLoadInfo.cs
index ef115d0..6829902 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ImageLoadInfo.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ImageLoadInfo.cs
@@ -11,7 +11,7 @@ namespace Microsoft.Iris.Render.Graphics
internal class ImageLoadInfo
{
public Image imageOwner;
- public IntPtr rgAppData;
+ public byte[] rgAppData;
public int nStride;
public int nLoadsInProgress;
public int nSystemLoadRequests;
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IImage.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IImage.cs
index 920bfbc..8f27e59 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IImage.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IImage.cs
@@ -16,6 +16,6 @@ namespace Microsoft.Iris.Render
string Identifier { get; }
- bool LoadContent(ImageFormat format, Size size, int Stride, IntPtr Data);
+ bool LoadContent(ImageFormat format, Size size, int Stride, byte[] Data);
}
}
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundData.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundData.cs
index aecf98f..d4b5ae4 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundData.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundData.cs
@@ -20,7 +20,7 @@ namespace Microsoft.Iris.Render
uint SampleCount { get; }
- IntPtr AcquireContent();
+ byte[] AcquireContent();
void ReleaseContent();
}
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/FormApi.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/FormApi.cs
index 72a3b54..290a477 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/FormApi.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/FormApi.cs
@@ -4,18 +4,21 @@
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
+using System;
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Internal
{
internal static class FormApi
{
- private const string s_stEhRenderDll = "UIXRender.dll";
+ public static HRESULT SpGdiplusInit()
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpGdiplusInit();
-
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpGdiplusUninit();
+ public static HRESULT SpGdiplusUninit()
+ {
+ throw new NotImplementedException();
+ }
}
}
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HRESULT.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HRESULT.cs
index 7c7077e..8f3cf38 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HRESULT.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HRESULT.cs
@@ -34,5 +34,8 @@ namespace Microsoft.Iris.Render.Internal
}
public int Int => this.hr;
+
+ public static implicit operator HRESULT(int i) => new(i);
+ public static implicit operator int(HRESULT hr) => hr.Int;
}
}
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs
index a4aad87..8b35da1 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs
@@ -292,7 +292,7 @@ namespace Microsoft.Iris.Render.Internal
return fUseSplitWindowingPort ? this.LocalRenderingProtocol.BuildRemoteNullDevice(device, this.LocalRenderingProtocol.LocalDeviceCallbackHandle) : this.RenderingProtocol.BuildRemoteNullDevice(device, this.RenderingProtocol.LocalDeviceCallbackHandle);
}
- internal unsafe DataBuffer BuildDataBuffer(IntPtr pData, uint cbSize) => new DataBuffer(this.RenderingPort, pData.ToPointer(), cbSize);
+ internal unsafe DataBuffer BuildDataBuffer(byte[] pData, uint cbSize) => new DataBuffer(this.RenderingPort, pData, cbSize);
internal void LoadSurface(DataBuffer buffer, Surface surface, ImageHeader header) => RemoteRasterizer.SendLoadRawImage(this.RenderingProtocol, surface.RemoteStub, buffer.RemoteStub, header);
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBuffer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBuffer.cs
index 87ad327..25949e1 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBuffer.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBuffer.cs
@@ -13,10 +13,10 @@ namespace Microsoft.Iris.Render.Protocol
{
private RenderPort m_port;
private RemoteDataBuffer m_remoteBuffer;
- private unsafe void* m_pvData;
+ private byte[] m_pvData;
private uint m_cbSize;
- public unsafe DataBuffer(RenderPort port, void* pvData, uint cbSize)
+ public unsafe DataBuffer(RenderPort port, byte[] pvData, uint cbSize)
{
this.m_port = port;
this.m_remoteBuffer = null;
@@ -44,7 +44,7 @@ namespace Microsoft.Iris.Render.Protocol
public uint DataSize => this.m_cbSize;
- public unsafe void* Data => this.m_pvData;
+ public byte[] Data => this.m_pvData;
public RemoteDataBuffer RemoteStub => this.m_remoteBuffer;
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/EngineApi.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/EngineApi.cs
index 95c396c..8ca749b 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/EngineApi.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/EngineApi.cs
@@ -10,14 +10,13 @@ using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Security;
+using System.Threading;
namespace Microsoft.Iris.Render.Protocol
{
[SuppressUnmanagedCodeSecurity]
internal static class EngineApi
{
- private const string s_stEhRenderDll = "UIXRender.dll";
-
public static void IFC(HRESULT hr)
{
if (hr.Int >= 0)
@@ -102,89 +101,127 @@ namespace Microsoft.Iris.Render.Protocol
}
}
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpInit(ref EngineApi.InitArgs args);
+ public static HRESULT SpInit(ref InitArgs args)
+ {
+ return 0;
+ }
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpUninit();
+ public static HRESULT SpUninit()
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll")]
- public static extern unsafe HRESULT SpBufferOpen(
- EngineApi.BufferInfo* phdrData,
- void* pvData);
+ public static unsafe HRESULT SpBufferOpen(
+ BufferInfo* phdrData,
+ void* pvData)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll")]
- public static extern unsafe HRESULT SpWrapBufferProc(
- EngineApi.MessageBufferEventHandler pfnProcessBufferProc,
- IntPtr* ppNativeProc);
+ public static unsafe HRESULT SpWrapBufferProc(
+ MessageBufferEventHandler pfnProcessBufferProc,
+ IntPtr* ppNativeProc)
+ {
+ *ppNativeProc = Marshal.GetFunctionPointerForDelegate(pfnProcessBufferProc);
+ return 0;
+ }
- [DllImport("UIXRender.dll", CharSet = CharSet.Auto)]
- public static extern HRESULT SpPeekMessage(
+ public static HRESULT SpPeekMessage(
out Win32Api.MSG msg,
HWND hwnd,
uint nMsgFilterMin,
uint nMsgFilterMax,
uint wRemoveMsg,
- out EngineApi.WorkResult nResult);
+ out WorkResult nResult)
+ {
+ nResult = WorkResult.ProcessedMessage;
+ msg = new Win32Api.MSG
+ {
+ message = 1
+ };
+ return 0;
+ }
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpWaitMessage(uint nTimeOutMs, IntPtr _unused);
+ public static HRESULT SpWaitMessage(uint nTimeOutMs, IntPtr _unused)
+ {
+ return 0;
+ }
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpInvoke(
+ public static HRESULT SpInvoke(
ContextID idContext,
IntPtr pfnInvoke,
IntPtr pvArgs,
- bool synchronous);
+ bool synchronous)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpRenderThreadInit(
- ref EngineApi.InitArgs argsRender,
- out IntPtr pThread);
+ public static HRESULT SpRenderThreadInit(
+ ref InitArgs argsRender,
+ out Thread pThread)
+ {
+ pThread = new Thread(new ThreadStart(() => Console.WriteLine("nan")));
+ pThread.Start();
+ return 0;
+ }
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpRenderThreadUninit(IntPtr pThread);
+ public static HRESULT SpRenderThreadUninit(Thread pThread)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll", CharSet = CharSet.Unicode)]
- public static extern HRESULT SpRemoteCreateServerStreams(
+ public static HRESULT SpRemoteCreateServerStreams(
string stSession,
TransportProtocol nProtocol,
out IntPtr pSendStream,
- out IntPtr pReceiveStream);
+ out IntPtr pReceiveStream)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpRemoteWaitServerStreamsConnected(
+ public static HRESULT SpRemoteWaitServerStreamsConnected(
TransportProtocol nProtocol,
IntPtr pSendStream,
- IntPtr pReceiveStream);
+ IntPtr pReceiveStream)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpRemoteServerInit(
+ public static HRESULT SpRemoteServerInit(
IntPtr pSendStream,
IntPtr pReceiveStream,
- EngineApi.InitArgs argsSend,
- out IntPtr pSession);
+ InitArgs argsSend,
+ out IntPtr pSession)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll")]
- public static extern HRESULT SpRemoteServerUninit(
+ public static HRESULT SpRemoteServerUninit(
IntPtr pSession,
bool fForceShutdown,
- out ShutdownReason nShutdownReason);
+ out ShutdownReason nShutdownReason)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll", CharSet = CharSet.Ansi)]
- public static extern HRESULT SpDx9CompileEffect(
+ public static HRESULT SpDx9CompileEffect(
string stEffect,
string stDefines,
out IntPtr pErrorString,
out IntPtr pErrorBuffer,
out IntPtr pEffectBlob,
out uint EffectBlobSize,
- out IntPtr pEffectBlobBuffer);
+ out IntPtr pEffectBlobBuffer)
+ {
+ throw new NotImplementedException();
+ }
- [DllImport("UIXRender.dll")]
- public static extern void SpObjectRelease(IntPtr pUnknown);
+ public static void SpObjectRelease(IntPtr pUnknown)
+ {
+ throw new NotImplementedException();
+ }
- [System.Flags]
+ [Flags]
public enum BufferFlags
{
IsBatch = 1,
@@ -195,11 +232,11 @@ namespace Microsoft.Iris.Render.Protocol
[ComVisible(false)]
public struct BufferInfo
{
- public ContextID idContextSrc;
- public ContextID idContextDest;
- public RENDERHANDLE idBuffer;
- public EngineApi.BufferFlags nFlags;
- public uint cbSizeBuffer;
+ public ContextID idContextSrc; // 0x00
+ public ContextID idContextDest; // 0x04
+ public RENDERHANDLE idBuffer; // 0x08
+ public BufferFlags nFlags; // 0x0C
+ public uint cbSizeBuffer; // 0x10
}
internal delegate void TimeoutEventHandler(IntPtr pData);
@@ -207,21 +244,21 @@ namespace Microsoft.Iris.Render.Protocol
[ComVisible(false)]
internal struct InitArgs
{
- public uint cbSize;
- public ContextID idContext;
- public int cItemsPerGroupBits;
- public int cGroupBits;
- public IntPtr pfnProcessBuffer;
- public IntPtr pvProcessData;
- public RENDERHANDLE idObjectBrokerClass;
- public EngineApi.TimeoutEventHandler pfnTimeout;
- public IntPtr pvTimeoutData;
- public uint nTimeOutSec;
+ public uint cbSize; // 0x00
+ public ContextID idContext; // 0x04
+ public int cItemsPerGroupBits; // 0x08
+ public int cGroupBits; // 0x0C
+ public IntPtr pfnProcessBuffer; // 0x10
+ public IntPtr pvProcessData; // 0x14
+ public RENDERHANDLE idObjectBrokerClass; // 0x18
+ public TimeoutEventHandler pfnTimeout; // 0x1C
+ public IntPtr pvTimeoutData; // 0x24
+ public uint nTimeOutSec; // 0x28
public InitArgs(MessageCookieLayout layout, ContextID idContextNew)
{
Debug2.Validate(idContextNew != ContextID.NULL, typeof(ArgumentNullException), nameof(idContextNew));
- this.cbSize = (uint)Marshal.SizeOf(typeof(EngineApi.InitArgs));
+ this.cbSize = (uint)Marshal.SizeOf(typeof(InitArgs));
this.idContext = idContextNew;
this.cItemsPerGroupBits = layout.numberOfObjectBits;
this.cGroupBits = layout.numberOfGroupBits;
@@ -236,7 +273,7 @@ namespace Microsoft.Iris.Render.Protocol
public unsafe InitArgs(
MessageCookieLayout layout,
ContextID idContextNew,
- EngineApi.MessageBufferEventHandler pfnProcessBufferProc)
+ MessageBufferEventHandler pfnProcessBufferProc)
: this(layout, idContextNew)
{
if (pfnProcessBufferProc == null)
@@ -250,10 +287,10 @@ namespace Microsoft.Iris.Render.Protocol
internal unsafe delegate int MessageBufferEventHandler(
IntPtr pData,
uint hContext,
- EngineApi.BufferInfo* pBufferInfo,
+ BufferInfo* pBufferInfo,
void* pvBufferData);
- [System.Flags]
+ [Flags]
public enum WorkResult : uint
{
ProcessedMessage = 1,
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalChannel.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalChannel.cs
index f73c96d..43c131d 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalChannel.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalChannel.cs
@@ -6,18 +6,19 @@
using Microsoft.Iris.Render.Common;
using System;
+using System.Threading;
namespace Microsoft.Iris.Render.Protocol
{
internal class LocalChannel : RenderObject, IChannel
{
- private IntPtr m_renderThread;
+ private Thread m_renderThread;
public LocalChannel(LocalConnectionInfo connectionInfo)
{
}
- public bool IsConnected => this.m_renderThread != IntPtr.Zero;
+ public bool IsConnected => m_renderThread != null;
public void Connect(
ContextID remoteContextId,
@@ -29,17 +30,17 @@ namespace Microsoft.Iris.Render.Protocol
{
idObjectBrokerClass = brokerClassHandle
};
- EngineApi.IFC(EngineApi.SpRenderThreadInit(ref args, out this.m_renderThread));
+ EngineApi.IFC(EngineApi.SpRenderThreadInit(ref args, out m_renderThread));
}
protected override void Dispose(bool inDispose)
{
try
{
- if (!(this.m_renderThread != IntPtr.Zero))
+ if (m_renderThread == null)
return;
- EngineApi.IFC(EngineApi.SpRenderThreadUninit(this.m_renderThread));
- this.m_renderThread = IntPtr.Zero;
+ EngineApi.IFC(EngineApi.SpRenderThreadUninit(m_renderThread));
+ m_renderThread = null;
}
finally
{
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Memory.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Memory.cs
index 31686ae..b46616f 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Memory.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Memory.cs
@@ -94,6 +94,60 @@ namespace Microsoft.Iris.Render.Protocol
}
}
+ public static unsafe void ConvertEndian(
+ uint[] pvDest,
+ uint[] pvSrc,
+ int cbConvert,
+ int cUnitBits)
+ {
+ switch (cUnitBits)
+ {
+ case 8:
+ break;
+ case 16:
+ int count16 = cbConvert / 4;
+ int i16 = 0;
+ while (count16-- > 0)
+ {
+ i16++;
+ uint valSrc = pvSrc[i16];
+ pvDest[i16] = (uint)((int)((valSrc & 4278190080U) >> 8) | ((int)valSrc & 16711680) << 8 | (int)((valSrc & 65280U) >> 8) | ((int)valSrc & byte.MaxValue) << 8);
+ }
+ if (cbConvert % 4 == 0)
+ break;
+
+ // Convert uint to ushort array
+ ushort[] destUInt16 = new ushort[pvSrc.Length * (sizeof(uint) / sizeof(ushort))];
+
+ ushort lastVal = (ushort)pvDest[i16];
+ int lastValConv = (ushort)((lastVal & 65280) >> 8 | (lastVal & byte.MaxValue) << 8);
+ pvDest[i16] = (ushort)lastValConv;
+ break;
+ case 32:
+ int count32 = cbConvert / 4;
+ int i32 = 0;
+ while (count32-- > 0)
+ {
+ i32++;
+ pvDest[i32] = ConvertEndian(pvSrc[i32]);
+ }
+ break;
+ default:
+ Debug2.Throw(false, "Unsupported data format");
+ break;
+ }
+ }
+
public static uint ConvertEndian(uint src) => (uint)((int)((src & 4278190080U) >> 24) | (int)((src & 16711680U) >> 8) | ((int)src & 65280) << 8 | ((int)src & byte.MaxValue) << 24);
+
+ public static uint[] ReinterpretAsUInt16(byte[] src)
+ {
+ uint[] dest = new uint[src.Length * (sizeof(uint) / sizeof(byte))];
+ for (int s = 0; s < src.Length; s++)
+ {
+
+ }
+ return dest;
+ }
}
}
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderPort.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderPort.cs
index cde9e69..f9c69ce 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderPort.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderPort.cs
@@ -211,8 +211,9 @@ namespace Microsoft.Iris.Render.Protocol
this._individualMessageMode = true;
}
- public unsafe void SendDataBuffer(void* pvData, uint cbSize, RENDERHANDLE idRemoteBuffer)
+ public unsafe void SendDataBuffer(byte[] pvData, uint cbSize, RENDERHANDLE idRemoteBuffer)
{
+ return;
Debug2.Validate(idRemoteBuffer != RENDERHANDLE.NULL, typeof(ArgumentNullException), nameof(idRemoteBuffer));
this.UpdateTraffic(0U, cbSize);
var info = new EngineApi.BufferInfo
@@ -223,11 +224,12 @@ namespace Microsoft.Iris.Render.Protocol
nFlags = 0,
cbSizeBuffer = cbSize
};
- EngineApi.IFC(EngineApi.SpBufferOpen(&info, pvData));
+ //EngineApi.IFC(EngineApi.SpBufferOpen(&info, pvData));
}
public unsafe void SendBatchBuffer(void* pvData, uint cbSize, RENDERHANDLE idRemoteBuffer)
{
+ return;
int num = idRemoteBuffer != RENDERHANDLE.NULL ? 1 : 0;
this.UpdateTraffic(cbSize, 0U);
var info = new EngineApi.BufferInfo()
@@ -243,6 +245,7 @@ namespace Microsoft.Iris.Render.Protocol
public unsafe void SendMessageBuffer(Message* pmsg)
{
+ return;
this.UpdateTraffic(pmsg->cbSize, 0U);
uint src = pmsg->cbSize;
if (this.ForeignByteOrder)
diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundBuffer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundBuffer.cs
index 9213378..af9d73a 100644
--- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundBuffer.cs
+++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundBuffer.cs
@@ -110,7 +110,7 @@ namespace Microsoft.Iris.Render.Sound
{
if (this.m_contentLoaded)
return;
- IntPtr pData = this.m_soundData.AcquireContent();
+ byte[] pData = this.m_soundData.AcquireContent();
DataBuffer dataBuffer = null;
try
{
diff --git a/UIX.Skia/Microsoft/Iris/Drawing/RichText.cs b/UIX.Skia/Microsoft/Iris/Drawing/RichText.cs
index 82df2d3..9241882 100644
--- a/UIX.Skia/Microsoft/Iris/Drawing/RichText.cs
+++ b/UIX.Skia/Microsoft/Iris/Drawing/RichText.cs
@@ -378,10 +378,13 @@ namespace Microsoft.Iris.Drawing
Color textColor,
bool shadowMode)
{
+ throw new NotImplementedException();
+
IntPtr phTextBitmap = IntPtr.Zero;
- IntPtr ppvBits;
- Size psizeBitmap;
- RendererApi.IFC(NativeApi.SpRichTextRasterize(hGlyphRunInfo, outlineMode ? 1 : 0, textColor, shadowMode ? 1 : 0, out phTextBitmap, out ppvBits, out psizeBitmap));
+ byte[] ppvBits = null;
+ Size psizeBitmap = default(Size);
+ // TODO: Re-implement using SkiaSharp and/or ImageSharp
+ //RendererApi.IFC(NativeApi.SpRichTextRasterize(hGlyphRunInfo, outlineMode ? 1 : 0, textColor, shadowMode ? 1 : 0, out phTextBitmap, out ppvBits, out psizeBitmap));
return new Dib(phTextBitmap, ppvBits, psizeBitmap);
}
diff --git a/UIX.Skia/Microsoft/Iris/RenderAPI/Audio/SoundData.cs b/UIX.Skia/Microsoft/Iris/RenderAPI/Audio/SoundData.cs
index 5ad7a47..c5d61b5 100644
--- a/UIX.Skia/Microsoft/Iris/RenderAPI/Audio/SoundData.cs
+++ b/UIX.Skia/Microsoft/Iris/RenderAPI/Audio/SoundData.cs
@@ -105,7 +105,7 @@ namespace Microsoft.Iris.RenderAPI.Audio
uint ISoundData.SampleCount => _soundInfo.Header.cbDataSize * 8U / _soundInfo.Header.wBitsPerSample;
- IntPtr ISoundData.AcquireContent()
+ byte[] ISoundData.AcquireContent()
{
if (Load())
return _soundInfo.Data.rgData;
diff --git a/UIX.Skia/Microsoft/Iris/RenderAPI/Drawing/Dib.cs b/UIX.Skia/Microsoft/Iris/RenderAPI/Drawing/Dib.cs
index 8dbc897..ce86fa1 100644
--- a/UIX.Skia/Microsoft/Iris/RenderAPI/Drawing/Dib.cs
+++ b/UIX.Skia/Microsoft/Iris/RenderAPI/Drawing/Dib.cs
@@ -10,13 +10,16 @@ using System;
namespace Microsoft.Iris.RenderAPI.Drawing
{
+ ///
+ /// Represents a device-independent bitmap
+ ///
internal sealed class Dib : IDisposable
{
private IntPtr m_hdib;
- private IntPtr m_prgbData;
+ private byte[] m_prgbData;
private Size m_sizePxl;
- public Dib(IntPtr hdib, IntPtr prgbData, Size sizePxl)
+ public Dib(IntPtr hdib, byte[] prgbData, Size sizePxl)
{
m_hdib = hdib;
m_prgbData = prgbData;
@@ -37,7 +40,7 @@ namespace Microsoft.Iris.RenderAPI.Drawing
return;
NativeApi.SpFreeDib(m_hdib);
m_hdib = IntPtr.Zero;
- m_prgbData = IntPtr.Zero;
+ m_prgbData = null;
}
public Size ContentSize => m_sizePxl;
@@ -46,6 +49,6 @@ namespace Microsoft.Iris.RenderAPI.Drawing
public ImageFormat ImageFormat => ImageFormat.A8R8G8B8;
- internal IntPtr Data => m_prgbData;
+ internal byte[] Data => m_prgbData;
}
}
diff --git a/Xune.Uno/Platforms/Xune.Uno.Skia.WPF/Xune.Uno.Skia.WPF.csproj b/Xune.Uno/Platforms/Xune.Uno.Skia.WPF/Xune.Uno.Skia.WPF.csproj
index a112818..9f4e36e 100644
--- a/Xune.Uno/Platforms/Xune.Uno.Skia.WPF/Xune.Uno.Skia.WPF.csproj
+++ b/Xune.Uno/Platforms/Xune.Uno.Skia.WPF/Xune.Uno.Skia.WPF.csproj
@@ -3,6 +3,12 @@
netstandard2.0
+
+ true
+
+
+ true
+
@@ -13,5 +19,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/Xune.Uno/Xune.Uno.Shared/MainPage.xaml.cs b/Xune.Uno/Xune.Uno.Shared/MainPage.xaml.cs
index 9b17f63..c22265a 100644
--- a/Xune.Uno/Xune.Uno.Shared/MainPage.xaml.cs
+++ b/Xune.Uno/Xune.Uno.Shared/MainPage.xaml.cs
@@ -1,11 +1,15 @@
using SkiaSharp;
+using SkiaSharp.Views.UWP;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
+using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
+using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
@@ -23,16 +27,40 @@ namespace Xune.Uno
///
public sealed partial class MainPage : Page
{
+ readonly Random rand = new Random();
+ DispatcherTimer timer = new DispatcherTimer();
+
public MainPage()
{
this.InitializeComponent();
+ Task.Run(Microsoft.Iris.Application.Initialize);
Canvas.PaintSurface += Canvas_PaintSurface;
+ timer.Interval = new TimeSpan(17000);
+ timer.Tick += Timer_Tick;
+ timer.Start();
}
- private void Canvas_PaintSurface(object sender, SkiaSharp.Views.UWP.SKPaintSurfaceEventArgs e)
+ private void Timer_Tick(object sender, object e)
{
- e.Surface.Canvas.DrawColor(SKColors.Red);
+ Canvas.Invalidate();
}
+
+ ulong t = 0;
+ private void Canvas_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
+ {
+ if (t == ulong.MaxValue)
+ t = 0;
+ byte r = (byte)rand.Next(0, byte.MaxValue);
+ byte g = (byte)rand.Next(0, byte.MaxValue);
+ byte b = (byte)rand.Next(0, byte.MaxValue);
+ e.Surface.Canvas.DrawColor(new SKColor(100, 50, (byte)(t % byte.MaxValue)));
+ t++;
+ }
+
+ //private unsafe void nothing()
+ //{
+ // void*** ptr = (void***)GCHandle.Alloc(new void*[1], GCHandleType.Pinned).AddrOfPinnedObject();
+ //}
}
}