Added managed implementations of Sprite, Visual, and Visual Container; IrisApplication gets to FullyInitialized

This commit is contained in:
Yoshi Askharoun
2021-10-06 13:24:32 -05:00
parent 3bb7bf3bd6
commit 4f90ad2127
9 changed files with 99 additions and 286 deletions
@@ -30,6 +30,20 @@ namespace Microsoft.Iris.Render
this.m_alMaps.Add(new CoordMap.CoordMapSample(flPosition, flValue, or));
}
public void InsertValue(int idx, float flPosition, float flValue, Orientation or)
{
Debug2.Validate(flPosition >= 0.0, typeof(ArgumentOutOfRangeException), "flPosition cannot be less than 0.0f");
Debug2.Validate(flValue >= 0.0, typeof(ArgumentOutOfRangeException), "flValue cannot be less than 0.0f");
Debug2.Validate(flPosition <= 1.0, typeof(ArgumentOutOfRangeException), "flPosition cannot exceed 1.0f");
Debug2.Validate(flValue <= 1.0, typeof(ArgumentOutOfRangeException), "flValue cannot exceed 1.0f");
foreach (CoordMap.CoordMapSample alMap in this.m_alMaps)
{
if (or == alMap.Orientation)
Debug2.Validate(flPosition != (double)alMap.flPosition, typeof(ArgumentException), "CoordMap cannot have two entries with the same flPosition and the same Orientation");
}
this.m_alMaps.Insert(idx, new CoordMap.CoordMapSample(flPosition, flValue, or));
}
public void Clear() => this.m_alMaps.Clear();
internal ArrayList RampSamples => this.m_alMaps;
@@ -5,6 +5,7 @@
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using Microsoft.Iris.Render.Internal;
using SkiaSharp;
using System;
using System.Runtime.InteropServices;
using System.Security;
@@ -59,7 +60,48 @@ namespace Microsoft.Iris.Render.Extensions
out HSpBitmap hBmp,
out ImageInformation info)
{
throw new NotImplementedException();
hBmp = default;
using var bitmap = SKBitmap.Decode(pvSrc);
var final = new SKBitmap(bitmap.Height, bitmap.Width);
using (var surface = new SKCanvas(final))
{
if (nOptions.HasFlag(BitmapOptions.Flip))
surface.Scale(-1, 1);
surface.DrawBitmap(bitmap, 0, 0);
}
info = new ImageInformation
{
Data = new ImageData
{
rgData = pvSrc
},
Header = new ImageHeader
{
nFormat = final.Info.ColorType.ToSurfaceFormat(),
nStride = final.Info.RowBytes
}
};
return new HRESULT(0);
}
internal static SurfaceFormat ToSurfaceFormat(this SKColorType sk)
{
switch (sk)
{
case SKColorType.Alpha8:
return SurfaceFormat.A8;
case SKColorType.Argb4444:
return SurfaceFormat.ARGB16_1555;
case SKColorType.RgbaF16:
return SurfaceFormat.RGB16_555;
case SKColorType.Unknown:
default:
return SurfaceFormat.External;
}
}
internal static HRESULT SpBitmapDelete(HSpBitmap hBmp)
@@ -15,15 +15,13 @@ namespace Microsoft.Iris.Render.Graphics
{
internal class Sprite : Visual, ISprite, IVisual, IRawInputSite, IAnimatable, ISharedRenderObject
{
private RemoteSprite m_remoteSprite;
private Effect m_effect;
private CoordMap m_coordMap;
public Sprite(RenderSession session, RenderWindowBase window, object objOwnerData)
: base(session, window, objOwnerData)
{
this.m_remoteSprite = session.BuildRemoteSprite(this, window);
this.m_remoteSprite.SendSetVisible(true);
this.m_remoteVisual = m_remoteSprite;
base.Visible = true;
}
protected override void Dispose(bool fInDispose)
@@ -36,7 +34,6 @@ namespace Microsoft.Iris.Render.Graphics
this.m_effect = null;
}
this.PropertyManager.RemoveCoordmapProp(this);
this.m_remoteSprite = null;
this.m_effect = null;
}
finally
@@ -112,7 +109,6 @@ namespace Microsoft.Iris.Render.Graphics
this.m_effect = effect;
if (this.m_effect != null)
this.m_effect.RegisterUsage(this);
this.m_remoteSprite.SendSetEffect(this.m_effect == null ? null : this.m_effect.RemoteStub);
}
}
@@ -130,7 +126,8 @@ namespace Microsoft.Iris.Render.Graphics
{
Debug2.Validate(left >= 0 && right >= 0 && top >= 0 && bottom >= 0, typeof(ArgumentNullException), "invalid nine grid params");
this.PropertyManager.RemoveCoordmapProp(this);
this.m_remoteSprite.SendSetNineGrid(left, top, right, bottom);
// TODO: Set nine grid
//this.m_remoteSprite.SendSetNineGrid(left, top, right, bottom);
this.SetPropFlag(PropId.MaxDynamicProp, true);
}
@@ -140,12 +137,12 @@ namespace Microsoft.Iris.Render.Graphics
Debug2.Validate(idxLayer < 4, typeof(ArgumentOutOfRangeException), "quick-check, currently we only support 4 layers/stages");
if (this.IsPropFlagSet(PropId.MaxDynamicProp))
{
this.m_remoteSprite.SendClearCoordMaps();
this.m_coordMap.Clear();
this.SetPropFlag(PropId.MaxDynamicProp, false);
}
if (!this.UpdateCoordMap(idxLayer, coordMap))
return;
this.m_remoteSprite.SendClearCoordMaps();
this.m_coordMap.Clear();
if (!this.IsDynamicValueSet(PropId.CoordMap))
return;
ArrayList result;
@@ -153,7 +150,7 @@ namespace Microsoft.Iris.Render.Graphics
foreach (Sprite.CoordMapEntry coordMapEntry in result)
{
foreach (CoordMap.CoordMapSample rampSample in coordMapEntry.coordMap.RampSamples)
this.m_remoteSprite.SendAddCoordMapEntry(coordMapEntry.idxLayer, rampSample.Orientation, rampSample.flPosition, rampSample.flValue);
this.m_coordMap.InsertValue(coordMapEntry.idxLayer, rampSample.flPosition, rampSample.flValue, rampSample.Orientation);
}
}
@@ -198,7 +195,7 @@ namespace Microsoft.Iris.Render.Graphics
{
if (this.IsPropFlagSet(PropId.MaxDynamicProp) || this.IsDynamicValueSet(PropId.CoordMap))
{
this.m_remoteSprite.SendClearCoordMaps();
this.m_coordMap.Clear();
this.SetPropFlag(PropId.MaxDynamicProp, false);
}
this.PropertyManager.RemoveCoordmapProp(this);
@@ -11,6 +11,7 @@ using Microsoft.Iris.Render.Internal;
using Microsoft.Iris.Render.Protocol;
using Microsoft.Iris.Render.Protocols.Splash.Rendering;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace Microsoft.Iris.Render.Graphics
@@ -21,7 +22,6 @@ namespace Microsoft.Iris.Render.Graphics
IAnimatableObject,
IAnimatable,
ISharedRenderObject,
IRenderHandleOwner,
IRawInputSite
{
private const uint k_DebugBitShift = 5;
@@ -34,10 +34,11 @@ namespace Microsoft.Iris.Render.Graphics
public static readonly string ScaleProperty = nameof(Scale);
public static readonly string SizeProperty = nameof(Size);
protected RenderWindowBase m_window;
protected RemoteVisual m_remoteVisual;
private Vector3 m_vecPosition;
private Vector2 m_vecSize;
private BitVector32 m_bvDataBits;
private List<Gradient> m_gradients;
private Visual m_parent;
private static BitVector32.Section s_bvsMouse = BitVector32.CreateSection(15);
private static BitVector32.Section s_bvsDebug = BitVector32.CreateSection(3, s_bvsMouse);
private static BitVector32.Section s_bvsValid = BitVector32.CreateSection(1, s_bvsDebug);
@@ -111,10 +112,7 @@ namespace Microsoft.Iris.Render.Graphics
this.PropertyManager.RemoveLayerProp(this);
this.PropertyManager.RemoveRotationProp(this);
this.PropertyManager.RemoveScaleProp(this);
if (this.m_remoteVisual != null)
this.m_remoteVisual.Dispose();
}
this.m_remoteVisual = null;
this.m_objOwnerData = null;
}
finally
@@ -174,7 +172,7 @@ namespace Microsoft.Iris.Render.Graphics
}
gradient.RegisterUsage(this);
result.Add(gradient);
this.m_remoteVisual.SendAddGradient(gradient.RemoteGradient);
this.m_gradients.Add(gradient);
}
protected void RemoveAllGradients()
@@ -187,15 +185,13 @@ namespace Microsoft.Iris.Render.Graphics
foreach (SharedRenderObject sharedRenderObject in result)
sharedRenderObject.UnregisterUsage(this);
result.Clear();
this.m_remoteVisual.SendClearGradients();
m_gradients.Clear();
}
internal void ChangeParent(Visual visualParent, Visual visualSibling, VisualOrder nOrder)
{
RemoteVisual remoteVisual1 = visualParent?.m_remoteVisual;
RemoteVisual remoteVisual2 = this.m_remoteVisual;
RemoteVisual remoteVisual3 = visualSibling?.m_remoteVisual;
remoteVisual2.SendChangeParent(remoteVisual1, remoteVisual3, nOrder);
// TODO: nOrder?
visualSibling.ChangeParent(visualParent);
this.ChangeParent(visualParent);
}
@@ -212,11 +208,7 @@ namespace Microsoft.Iris.Render.Graphics
this.ChangeParent(null, null, VisualOrder.First);
}
RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteVisual.RenderHandle;
void IRenderHandleOwner.OnDisconnect() => this.m_remoteVisual = null;
internal RemoteVisual RemoteStub => this.m_remoteVisual;
internal RemoteVisual RemoteStub => throw new NotImplementedException();
public object OwnerData
{
@@ -237,7 +229,6 @@ namespace Microsoft.Iris.Render.Graphics
this.m_vecPosition = value;
if (!this.FlushValues)
return;
this.m_remoteVisual.SendSetPosition(this.m_vecPosition);
}
internal Vector2 Size
@@ -254,7 +245,6 @@ namespace Microsoft.Iris.Render.Graphics
this.m_vecSize = value;
if (!this.FlushValues)
return;
this.m_remoteVisual.SendSetSize(this.m_vecSize);
}
protected float Alpha
@@ -280,7 +270,6 @@ namespace Microsoft.Iris.Render.Graphics
this.PropertyManager.SetAlphaProp(this, value);
if (!this.FlushValues)
return;
this.m_remoteVisual.SendSetAlpha(value);
}
protected Vector3 Scale
@@ -305,7 +294,6 @@ namespace Microsoft.Iris.Render.Graphics
this.PropertyManager.SetScaleProp(this, value);
if (!this.FlushValues)
return;
this.m_remoteVisual.SendSetScale(value);
}
protected AxisAngle Rotation
@@ -333,7 +321,6 @@ namespace Microsoft.Iris.Render.Graphics
aaRotation.Angle = -aaRotation.Angle;
if (!this.FlushValues)
return;
this.m_remoteVisual.SendSetRotation(aaRotation);
}
protected Vector3 CenterPointScale
@@ -357,7 +344,6 @@ namespace Microsoft.Iris.Render.Graphics
this.PropertyManager.SetCenterPointScaleProp(this, value);
if (!this.FlushValues)
return;
this.m_remoteVisual.SendSetCenterPointScale(value);
}
}
@@ -380,7 +366,6 @@ namespace Microsoft.Iris.Render.Graphics
this.PropertyManager.SetLayerProp(this, value);
if (!this.FlushValues)
return;
this.m_remoteVisual.SendSetLayer(value);
}
}
@@ -394,7 +379,6 @@ namespace Microsoft.Iris.Render.Graphics
this.SetVisible(value);
if (!this.FlushValues)
return;
this.m_remoteVisual.SendSetVisible(value);
}
}
@@ -407,7 +391,6 @@ namespace Microsoft.Iris.Render.Graphics
if (this.m_bvDataBits[s_bvsRelativeSize] == num)
return;
this.m_bvDataBits[s_bvsRelativeSize] = num;
this.m_remoteVisual.SendSetRelativeSize(value);
}
}
@@ -420,8 +403,6 @@ namespace Microsoft.Iris.Render.Graphics
{
Debug2.Validate((value & ~MouseOptions.ValidMask) == MouseOptions.None, typeof(ArgumentException), "Expected valid mouse bits");
uint nMask = (uint)this.m_bvDataBits[s_bvsMouse] ^ (uint)(short)value;
if (nMask != 0U && this.FlushValues)
this.m_remoteVisual.SendChangeDataBits((uint)value, nMask);
this.m_bvDataBits[s_bvsMouse] = (short)value;
}
}
@@ -437,8 +418,6 @@ namespace Microsoft.Iris.Render.Graphics
if (nMask != 0U)
{
uint nValue = (uint)value << 5;
if (this.m_remoteVisual.IsValid)
this.m_remoteVisual.SendChangeDataBits(nValue, nMask);
}
this.m_bvDataBits[s_bvsDebug] = (int)value;
}
@@ -503,7 +482,6 @@ namespace Microsoft.Iris.Render.Graphics
this.OwnerData = null;
this.MouseOptions = MouseOptions.None;
this.FlushValues = flushValues;
this.m_remoteVisual.SendReset();
}
private bool FlushValues
@@ -549,11 +527,11 @@ namespace Microsoft.Iris.Render.Graphics
return AnimationInputType.Float;
}
public override int GetHashCode() => this.m_remoteVisual.GetHashCode();
public override int GetHashCode() => base.GetHashCode();
public override bool Equals(object oRHS) => base.Equals(oRHS);
[System.Flags]
[Flags]
internal enum DebugBits
{
MarkForOutline = 1,
@@ -12,31 +12,18 @@ using System;
namespace Microsoft.Iris.Render.Graphics
{
internal class VisualContainer :
Visual,
IVisualContainer,
IVisual,
IRawInputSite,
IAnimatable,
ISharedRenderObject
internal class VisualContainer : Visual, IVisualContainer, IVisual, IRawInputSite, IAnimatable, ISharedRenderObject
{
private bool m_fIsRoot;
internal VisualContainer(
bool isRoot,
RenderSession session,
RenderWindowBase window,
object objOwnerData,
out RemoteVisual remoteVisual)
internal VisualContainer(bool isRoot, RenderSession session, RenderWindowBase window, object objOwnerData, out RemoteVisual remoteVisual)
: base(session, window, objOwnerData)
{
Debug2.Validate(session != null, typeof(ArgumentNullException), "Must have valid RenderSession");
session.AssertOwningThread();
Debug2.Validate(this.m_window != null, typeof(InvalidOperationException), "Parent visual should have saved our render window");
this.m_fIsRoot = isRoot;
this.m_remoteVisual = session.BuildRemoteVisualContainer(this);
this.m_remoteVisual.SendSetVisible(true);
remoteVisual = this.m_remoteVisual;
remoteVisual = null;
}
protected override void Dispose(bool fInDispose)
@@ -59,11 +46,6 @@ namespace Microsoft.Iris.Render.Graphics
private void SetCamera(ICamera camera)
{
this.PropertyManager.SetCameraProp(this, (Camera)camera);
RemoteVisualContainer remoteVisual = (RemoteVisualContainer)this.m_remoteVisual;
if (camera != null)
remoteVisual.SendSetCamera(((Camera)camera).RemoteStub);
else
remoteVisual.SendSetCamera(null);
}
bool IVisualContainer.IsRoot => this.m_fIsRoot;
@@ -144,10 +126,7 @@ namespace Microsoft.Iris.Render.Graphics
void IVisualContainer.RemoveAllGradients() => this.RemoveAllGradients();
void IVisualContainer.AddChild(
IVisual vChild,
IVisual vSibling,
VisualOrder nOrder)
void IVisualContainer.AddChild(IVisual vChild, IVisual vSibling, VisualOrder nOrder)
{
Visual visual = (Visual)vChild;
Visual visualSibling = null;
@@ -305,17 +305,17 @@ namespace Microsoft.Iris.Render.Internal
internal RemoteCamera BuildRemoteCamera(Camera camera) => this.RenderingProtocol.BuildRemoteCamera(camera);
internal RemoteVisualContainer BuildRemoteVisualContainer(Visual visual) => this.RenderingProtocol.BuildRemoteVisualContainer(visual);
internal RemoteVisualContainer BuildRemoteVisualContainer(Visual visual) => RemoteVisualContainer.Create();
internal RemoteSprite BuildRemoteSprite(Sprite sprite, RenderWindowBase window)
{
switch (window.GraphicsDeviceType)
{
case GraphicsDeviceType.Gdi:
return this.NtRenderingProtocol.BuildRemoteGdiSprite(sprite);
// TODO: return this.NtRenderingProtocol.BuildRemoteGdiSprite(sprite);
case GraphicsDeviceType.Direct3D9:
case GraphicsDeviceType.XeDirectX9:
return this.RenderingProtocol.BuildRemoteDx9Sprite(sprite);
// TODO: return this.RenderingProtocol.BuildRemoteDx9Sprite(sprite);
default:
Debug2.Throw(false, "Unrecognized device type: {0}", window.GraphicsDeviceType);
return null;
@@ -6,6 +6,7 @@
using Microsoft.Iris.Render.Common;
using Microsoft.Iris.Render.Protocol;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Protocols.Splash.Rendering
@@ -33,106 +34,18 @@ namespace Microsoft.Iris.Render.Protocols.Splash.Rendering
{
}
public unsafe void BuildClearGradients(out RenderPort _priv_portUse, out Message* _priv_pmsgUse)
{
Debug2.Throw(this.IsValid, "Non-static method call requires an instance");
_priv_portUse = this.m_renderPort;
_priv_portUse.ValidateHandle(this.m_renderHandle);
uint size = (uint)sizeof(RemoteVisual.Msg0_ClearGradients);
RemoteVisual.Msg0_ClearGradients* msg0ClearGradientsPtr = (RemoteVisual.Msg0_ClearGradients*)_priv_portUse.AllocMessageBuffer(size);
msg0ClearGradientsPtr->_priv_size = size;
msg0ClearGradientsPtr->_priv_msgid = 0U;
msg0ClearGradientsPtr->_priv_idObjectSubject = this.m_renderHandle;
if (_priv_portUse.ForeignByteOrder)
MarshalHelper.SwapByteOrder((byte*)msg0ClearGradientsPtr, ref s_priv_ByteOrder_Msg0_ClearGradients, typeof(RemoteVisual.Msg0_ClearGradients), 0, 0);
_priv_pmsgUse = (Message*)msg0ClearGradientsPtr;
}
public unsafe void SendClearGradients() => m_gradients.Clear();
public unsafe void SendClearGradients()
{
RenderPort _priv_portUse;
Message* _priv_pmsgUse;
this.BuildClearGradients(out _priv_portUse, out _priv_pmsgUse);
_priv_portUse.SendRemoteMessage(_priv_pmsgUse);
}
public unsafe void BuildAddGradient(
out RenderPort _priv_portUse,
out Message* _priv_pmsgUse,
RemoteGradient grad)
{
Debug2.Throw(this.IsValid, "Non-static method call requires an instance");
_priv_portUse = this.m_renderPort;
_priv_portUse.ValidateHandle(this.m_renderHandle);
if (grad != null)
_priv_portUse.ValidateHandleOrNull(grad.RenderHandle);
uint size = (uint)sizeof(RemoteVisual.Msg1_AddGradient);
RemoteVisual.Msg1_AddGradient* msg1AddGradientPtr = (RemoteVisual.Msg1_AddGradient*)_priv_portUse.AllocMessageBuffer(size);
msg1AddGradientPtr->_priv_size = size;
msg1AddGradientPtr->_priv_msgid = 1U;
msg1AddGradientPtr->grad = grad != null ? grad.RenderHandle : RENDERHANDLE.NULL;
msg1AddGradientPtr->_priv_idObjectSubject = this.m_renderHandle;
if (_priv_portUse.ForeignByteOrder)
MarshalHelper.SwapByteOrder((byte*)msg1AddGradientPtr, ref s_priv_ByteOrder_Msg1_AddGradient, typeof(RemoteVisual.Msg1_AddGradient), 0, 0);
_priv_pmsgUse = (Message*)msg1AddGradientPtr;
}
public unsafe void SendAddGradient(RemoteGradient grad)
{
RenderPort _priv_portUse;
Message* _priv_pmsgUse;
this.BuildAddGradient(out _priv_portUse, out _priv_pmsgUse, grad);
_priv_portUse.SendRemoteMessage(_priv_pmsgUse);
}
public unsafe void BuildSetRelativeSize(
out RenderPort _priv_portUse,
out Message* _priv_pmsgUse,
bool fRelative)
{
Debug2.Throw(this.IsValid, "Non-static method call requires an instance");
_priv_portUse = this.m_renderPort;
_priv_portUse.ValidateHandle(this.m_renderHandle);
uint size = (uint)sizeof(RemoteVisual.Msg2_SetRelativeSize);
RemoteVisual.Msg2_SetRelativeSize* msg2SetRelativeSizePtr = (RemoteVisual.Msg2_SetRelativeSize*)_priv_portUse.AllocMessageBuffer(size);
msg2SetRelativeSizePtr->_priv_size = size;
msg2SetRelativeSizePtr->_priv_msgid = 2U;
msg2SetRelativeSizePtr->fRelative = fRelative ? uint.MaxValue : 0U;
msg2SetRelativeSizePtr->_priv_idObjectSubject = this.m_renderHandle;
if (_priv_portUse.ForeignByteOrder)
MarshalHelper.SwapByteOrder((byte*)msg2SetRelativeSizePtr, ref s_priv_ByteOrder_Msg2_SetRelativeSize, typeof(RemoteVisual.Msg2_SetRelativeSize), 0, 0);
_priv_pmsgUse = (Message*)msg2SetRelativeSizePtr;
}
public unsafe void SendAddGradient(RemoteGradient grad) => m_gradients.Add(grad);
public unsafe void SendSetRelativeSize(bool fRelative)
{
RenderPort _priv_portUse;
Message* _priv_pmsgUse;
this.BuildSetRelativeSize(out _priv_portUse, out _priv_pmsgUse, fRelative);
_priv_portUse.SendRemoteMessage(_priv_pmsgUse);
}
public unsafe void BuildReset(out RenderPort _priv_portUse, out Message* _priv_pmsgUse)
{
Debug2.Throw(this.IsValid, "Non-static method call requires an instance");
_priv_portUse = this.m_renderPort;
_priv_portUse.ValidateHandle(this.m_renderHandle);
uint size = (uint)sizeof(RemoteVisual.Msg3_Reset);
RemoteVisual.Msg3_Reset* msg3ResetPtr = (RemoteVisual.Msg3_Reset*)_priv_portUse.AllocMessageBuffer(size);
msg3ResetPtr->_priv_size = size;
msg3ResetPtr->_priv_msgid = 3U;
msg3ResetPtr->_priv_idObjectSubject = this.m_renderHandle;
if (_priv_portUse.ForeignByteOrder)
MarshalHelper.SwapByteOrder((byte*)msg3ResetPtr, ref s_priv_ByteOrder_Msg3_Reset, typeof(RemoteVisual.Msg3_Reset), 0, 0);
_priv_pmsgUse = (Message*)msg3ResetPtr;
m_fRelativeSize = fRelative ? uint.MaxValue : 0;
}
public unsafe void SendReset()
{
RenderPort _priv_portUse;
Message* _priv_pmsgUse;
this.BuildReset(out _priv_portUse, out _priv_pmsgUse);
_priv_portUse.SendRemoteMessage(_priv_pmsgUse);
// TODO: Reset
}
public unsafe void BuildChangeDataBits(
@@ -158,6 +71,7 @@ namespace Microsoft.Iris.Render.Protocols.Splash.Rendering
public unsafe void SendChangeDataBits(uint nValue, uint nMask)
{
// TODO
RenderPort _priv_portUse;
Message* _priv_pmsgUse;
this.BuildChangeDataBits(out _priv_portUse, out _priv_pmsgUse, nValue, nMask);
@@ -500,39 +414,8 @@ namespace Microsoft.Iris.Render.Protocols.Splash.Rendering
public override int GetHashCode() => base.GetHashCode();
[ComVisible(false)]
private struct Msg0_ClearGradients
{
public uint _priv_size;
public uint _priv_msgid;
public RENDERHANDLE _priv_idObjectSubject;
}
[ComVisible(false)]
private struct Msg1_AddGradient
{
public uint _priv_size;
public uint _priv_msgid;
public RENDERHANDLE _priv_idObjectSubject;
public RENDERHANDLE grad;
}
[ComVisible(false)]
private struct Msg2_SetRelativeSize
{
public uint _priv_size;
public uint _priv_msgid;
public RENDERHANDLE _priv_idObjectSubject;
public uint fRelative;
}
[ComVisible(false)]
private struct Msg3_Reset
{
public uint _priv_size;
public uint _priv_msgid;
public RENDERHANDLE _priv_idObjectSubject;
}
List<RemoteGradient> m_gradients;
uint m_fRelativeSize;
[ComVisible(false)]
private struct Msg4_ChangeDataBits
@@ -12,107 +12,23 @@ namespace Microsoft.Iris.Render.Protocols.Splash.Rendering
{
internal class RemoteVisualContainer : RemoteVisual
{
private static ushort[] s_priv_ByteOrder_Msg19_Create;
private static ushort[] s_priv_ByteOrder_Msg18_SetCamera;
private RemoteCamera m_camera;
protected RemoteVisualContainer()
{
}
public static unsafe RemoteVisualContainer Create(
ProtocolSplashRendering _priv_protocolInstance,
IRenderHandleOwner _priv_owner)
{
RenderPort port = _priv_protocolInstance.Port;
RENDERHANDLE containerClassHandle = _priv_protocolInstance.VisualContainer_ClassHandle;
RemoteVisualContainer remoteVisualContainer = new RemoteVisualContainer(port, _priv_owner);
uint num = (uint)sizeof(RemoteVisualContainer.Msg19_Create);
// ISSUE: untyped stack allocation
byte* pMem = stackalloc byte[(int)num];
RemoteVisualContainer.Msg19_Create* msg19CreatePtr = (RemoteVisualContainer.Msg19_Create*)pMem;
msg19CreatePtr->_priv_size = num;
msg19CreatePtr->_priv_msgid = 19U;
msg19CreatePtr->_priv_idObjectSubject = remoteVisualContainer.m_renderHandle;
if (port.ForeignByteOrder)
MarshalHelper.SwapByteOrder(pMem, ref s_priv_ByteOrder_Msg19_Create, typeof(RemoteVisualContainer.Msg19_Create), 0, 0);
port.CreateRemoteObject(containerClassHandle, remoteVisualContainer.m_renderHandle, (Message*)msg19CreatePtr);
return remoteVisualContainer;
}
public static unsafe RemoteVisualContainer Create(ProtocolSplashRendering _priv_protocolInstance, IRenderHandleOwner _priv_owner) => Create();
public unsafe void BuildSetCamera(
out RenderPort _priv_portUse,
out Message* _priv_pmsgUse,
RemoteCamera camera)
{
Debug2.Throw(this.IsValid, "Non-static method call requires an instance");
_priv_portUse = this.m_renderPort;
_priv_portUse.ValidateHandle(this.m_renderHandle);
if (camera != null)
_priv_portUse.ValidateHandleOrNull(camera.RenderHandle);
uint size = (uint)sizeof(RemoteVisualContainer.Msg18_SetCamera);
RemoteVisualContainer.Msg18_SetCamera* msg18SetCameraPtr = (RemoteVisualContainer.Msg18_SetCamera*)_priv_portUse.AllocMessageBuffer(size);
msg18SetCameraPtr->_priv_size = size;
msg18SetCameraPtr->_priv_msgid = 18U;
msg18SetCameraPtr->camera = camera != null ? camera.RenderHandle : RENDERHANDLE.NULL;
msg18SetCameraPtr->_priv_idObjectSubject = this.m_renderHandle;
if (_priv_portUse.ForeignByteOrder)
MarshalHelper.SwapByteOrder((byte*)msg18SetCameraPtr, ref s_priv_ByteOrder_Msg18_SetCamera, typeof(RemoteVisualContainer.Msg18_SetCamera), 0, 0);
_priv_pmsgUse = (Message*)msg18SetCameraPtr;
}
public static unsafe RemoteVisualContainer Create() => new RemoteVisualContainer();
public unsafe void SendSetCamera(RemoteCamera camera)
{
RenderPort _priv_portUse;
Message* _priv_pmsgUse;
this.BuildSetCamera(out _priv_portUse, out _priv_pmsgUse, camera);
_priv_portUse.SendRemoteMessage(_priv_pmsgUse);
}
public static RemoteVisualContainer CreateFromHandle(
RenderPort port,
RENDERHANDLE handle)
{
return new RemoteVisualContainer(port, handle, true);
}
public static RemoteVisualContainer CreateFromExternalHandle(
RenderPort port,
RENDERHANDLE handle,
IRenderHandleOwner owner)
{
port.RegisterKnownHandle(owner, handle);
return new RemoteVisualContainer(port, handle, false);
}
protected RemoteVisualContainer(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose)
: base(port, handle, fFreeOnDispose)
{
}
protected RemoteVisualContainer(RenderPort port, IRenderHandleOwner owner)
: base(port, owner)
{
m_camera = camera;
}
public override bool Equals(object other) => other is RemoteVisualContainer && this.m_renderHandle == ((RemoteObject)other).m_renderHandle;
public override int GetHashCode() => base.GetHashCode();
[ComVisible(false)]
private struct Msg19_Create
{
public uint _priv_size;
public uint _priv_msgid;
public RENDERHANDLE _priv_idObjectSubject;
}
[ComVisible(false)]
private struct Msg18_SetCamera
{
public uint _priv_size;
public uint _priv_msgid;
public RENDERHANDLE _priv_idObjectSubject;
public RENDERHANDLE camera;
}
}
}
@@ -21,6 +21,7 @@ namespace Microsoft.Iris.Render
private bool isFullscreen;
private GraphicsDevice graphicsDevice;
private HWND appNotifyWindow;
private IVisualContainer visualRoot;
private Window WpfWindow { get; set; }
private WindowInteropHelper InteropHelper { get; set; }
@@ -48,6 +49,9 @@ namespace Microsoft.Iris.Render
{
if (graphicsDeviceType.FulfillsRequirement(GraphicsDeviceType.Skia))
graphicsDevice = new SkiaGraphicsDevice(session);
visualRoot = new VisualContainer(true, session, this, new Object(), out var visual);
return GraphicsDevice;
}
@@ -279,7 +283,7 @@ namespace Microsoft.Iris.Render
}
public override HWND AppNotifyWindow { set => appNotifyWindow = value; }
public override IVisualContainer VisualRoot => throw new NotImplementedException();
public override IVisualContainer VisualRoot => visualRoot;
TreeNode Root => throw new NotImplementedException();