diff --git a/UIX.RenderApi.Skia/Cn/CodeGenNameAttribute.cs b/UIX.RenderApi.Skia/Cn/CodeGenNameAttribute.cs index d273ade..8b60d5b 100644 --- a/UIX.RenderApi.Skia/Cn/CodeGenNameAttribute.cs +++ b/UIX.RenderApi.Skia/Cn/CodeGenNameAttribute.cs @@ -9,12 +9,12 @@ using System.Diagnostics; namespace Cn { - [Conditional("NEVER")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] - public class CodeGenNameAttribute : Attribute - { - public string Name; + [Conditional("NEVER")] + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] + public class CodeGenNameAttribute : Attribute + { + public string Name; - public CodeGenNameAttribute(string stName) => this.Name = stName; - } + public CodeGenNameAttribute(string stName) => this.Name = stName; + } } diff --git a/UIX.RenderApi.Skia/Cn/DisposeMethodAttribute.cs b/UIX.RenderApi.Skia/Cn/DisposeMethodAttribute.cs index e384cec..ece9e75 100644 --- a/UIX.RenderApi.Skia/Cn/DisposeMethodAttribute.cs +++ b/UIX.RenderApi.Skia/Cn/DisposeMethodAttribute.cs @@ -9,9 +9,9 @@ using System.Diagnostics; namespace Cn { - [Conditional("NEVER")] - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] - public class DisposeMethodAttribute : Attribute - { - } + [Conditional("NEVER")] + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] + public class DisposeMethodAttribute : Attribute + { + } } diff --git a/UIX.RenderApi.Skia/Cn/GCCollectSafeAttribute.cs b/UIX.RenderApi.Skia/Cn/GCCollectSafeAttribute.cs index 323412d..41f4932 100644 --- a/UIX.RenderApi.Skia/Cn/GCCollectSafeAttribute.cs +++ b/UIX.RenderApi.Skia/Cn/GCCollectSafeAttribute.cs @@ -9,9 +9,9 @@ using System.Diagnostics; namespace Cn { - [Conditional("NEVER")] - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] - public class GCCollectSafeAttribute : Attribute - { - } + [Conditional("NEVER")] + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] + public class GCCollectSafeAttribute : Attribute + { + } } diff --git a/UIX.RenderApi.Skia/Cn/PartialCollectAttribute.cs b/UIX.RenderApi.Skia/Cn/PartialCollectAttribute.cs index 2272709..8122f89 100644 --- a/UIX.RenderApi.Skia/Cn/PartialCollectAttribute.cs +++ b/UIX.RenderApi.Skia/Cn/PartialCollectAttribute.cs @@ -9,9 +9,9 @@ using System.Diagnostics; namespace Cn { - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] - [Conditional("NEVER")] - public class PartialCollectAttribute : Attribute - { - } + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] + [Conditional("NEVER")] + public class PartialCollectAttribute : Attribute + { + } } diff --git a/UIX.RenderApi.Skia/Cn/ReflectionAttribute.cs b/UIX.RenderApi.Skia/Cn/ReflectionAttribute.cs index 661616b..f0a8422 100644 --- a/UIX.RenderApi.Skia/Cn/ReflectionAttribute.cs +++ b/UIX.RenderApi.Skia/Cn/ReflectionAttribute.cs @@ -9,9 +9,9 @@ using System.Diagnostics; namespace Cn { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] - [Conditional("NEVER")] - public class ReflectionAttribute : Attribute - { - } + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] + [Conditional("NEVER")] + public class ReflectionAttribute : Attribute + { + } } diff --git a/UIX.RenderApi.Skia/Cn/TypeInitializeDependencyAttribute.cs b/UIX.RenderApi.Skia/Cn/TypeInitializeDependencyAttribute.cs index d096d61..7c46446 100644 --- a/UIX.RenderApi.Skia/Cn/TypeInitializeDependencyAttribute.cs +++ b/UIX.RenderApi.Skia/Cn/TypeInitializeDependencyAttribute.cs @@ -9,12 +9,12 @@ using System.Diagnostics; namespace Cn { - [Conditional("NEVER")] - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)] - public class TypeInitializeDependencyAttribute : Attribute - { - public Type Type; + [Conditional("NEVER")] + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)] + public class TypeInitializeDependencyAttribute : Attribute + { + public Type Type; - public TypeInitializeDependencyAttribute(Type type) => this.Type = type; - } + public TypeInitializeDependencyAttribute(Type type) => this.Type = type; + } } diff --git a/UIX.RenderApi.Skia/IVector.cs b/UIX.RenderApi.Skia/IVector.cs index 080d075..0fbd92c 100644 --- a/UIX.RenderApi.Skia/IVector.cs +++ b/UIX.RenderApi.Skia/IVector.cs @@ -6,7 +6,7 @@ public interface IVector { - int Count { get; } + int Count { get; } - object this[int index] { get; } + object this[int index] { get; } } diff --git a/UIX.RenderApi.Skia/KeyValueEntry.cs b/UIX.RenderApi.Skia/KeyValueEntry.cs index 26cc11f..fa69ed3 100644 --- a/UIX.RenderApi.Skia/KeyValueEntry.cs +++ b/UIX.RenderApi.Skia/KeyValueEntry.cs @@ -6,16 +6,16 @@ public struct KeyValueEntry { - private object _key; - private object _value; + private object _key; + private object _value; - public KeyValueEntry(object key, object value) - { - this._key = key; - this._value = value; - } + public KeyValueEntry(object key, object value) + { + this._key = key; + this._value = value; + } - public object Key => this._key; + public object Key => this._key; - public object Value => this._value; + public object Value => this._value; } diff --git a/UIX.RenderApi.Skia/KeyValueEntry`2.cs b/UIX.RenderApi.Skia/KeyValueEntry`2.cs index 4aad7f1..5958e7f 100644 --- a/UIX.RenderApi.Skia/KeyValueEntry`2.cs +++ b/UIX.RenderApi.Skia/KeyValueEntry`2.cs @@ -6,16 +6,16 @@ public struct KeyValueEntry { - private K _key; - private V _value; + private K _key; + private V _value; - public KeyValueEntry(K key, V value) - { - this._key = key; - this._value = value; - } + public KeyValueEntry(K key, V value) + { + this._key = key; + this._value = value; + } - public K Key => this._key; + public K Key => this._key; - public V Value => this._value; + public V Value => this._value; } diff --git a/UIX.RenderApi.Skia/Map.cs b/UIX.RenderApi.Skia/Map.cs index 8a24107..bab5b28 100644 --- a/UIX.RenderApi.Skia/Map.cs +++ b/UIX.RenderApi.Skia/Map.cs @@ -9,321 +9,321 @@ using System.Collections.Generic; public class Map { - private int[] _buckets; - private Map.Entry[] _entries; - private int _count; - private int _version; - private int _freeList; - private int _freeCount; - - public Map() - : this(0) - { - } - - public Map(int capacity) - { - if (capacity <= 0) - return; - this.Initialize(capacity); - } - - public int Count => this._count - this._freeCount; - - public Map.KeyCollection Keys => new Map.KeyCollection(this); - - public Map.ValueCollection Values => new Map.ValueCollection(this); - - public object this[object key] - { - get - { - int entry = this.FindEntry(key); - return entry >= 0 ? this._entries[entry].value : (object) null; - } - set => this.Insert(key, value, false); - } - - public void Add(object key, object value) => this.Insert(key, value, true); - - public void Clear() - { - if (this._count <= 0) - return; - for (int index = 0; index < this._buckets.Length; ++index) - this._buckets[index] = -1; - Array.Clear((Array) this._entries, 0, this._count); - this._freeList = -1; - this._count = 0; - this._freeCount = 0; - } - - public bool ContainsKey(object key) => this.FindEntry(key) >= 0; - - public Map.Enumerator GetEnumerator() => new Map.Enumerator(this); - - private int FindEntry(object key) - { - if (this._buckets != null) - { - int num = this.GetKeyHashCode(key) & int.MaxValue; - for (int index = this._buckets[num % this._buckets.Length]; index >= 0; index = this._entries[index].next) - { - if (this._entries[index].hashCode == num && this.KeyEquals(this._entries[index].key, key)) - return index; - } - } - return -1; - } - - private void Initialize(int capacity) - { - int prime = HashHelpers.GetPrime(capacity); - this._buckets = new int[prime]; - for (int index = 0; index < this._buckets.Length; ++index) - this._buckets[index] = -1; - this._entries = new Map.Entry[prime]; - this._freeList = -1; - } - - private void Insert(object key, object value, bool add) - { - if (this._buckets == null) - this.Initialize(0); - int num = this.GetKeyHashCode(key) & int.MaxValue; - for (int index = this._buckets[num % this._buckets.Length]; index >= 0; index = this._entries[index].next) - { - if (this._entries[index].hashCode == num && this.KeyEquals(this._entries[index].key, key)) - { - if (add) - throw new ArgumentException("Adding duplicate entry to Dictionary"); - this._entries[index].value = value; - ++this._version; - return; - } - } - int index1; - if (this._freeCount > 0) - { - index1 = this._freeList; - this._freeList = this._entries[index1].next; - --this._freeCount; - } - else - { - if (this._count == this._entries.Length) - this.Resize(); - index1 = this._count; - ++this._count; - } - int index2 = num % this._buckets.Length; - this._entries[index1].hashCode = num; - this._entries[index1].next = this._buckets[index2]; - this._entries[index1].key = key; - this._entries[index1].value = value; - this._buckets[index2] = index1; - ++this._version; - } - - private void Resize() - { - int prime = HashHelpers.GetPrime(this._count * 2); - int[] numArray = new int[prime]; - for (int index = 0; index < numArray.Length; ++index) - numArray[index] = -1; - Map.Entry[] entryArray = new Map.Entry[prime]; - Array.Copy((Array) this._entries, 0, (Array) entryArray, 0, this._count); - for (int index1 = 0; index1 < this._count; ++index1) - { - int index2 = entryArray[index1].hashCode % prime; - entryArray[index1].next = numArray[index2]; - numArray[index2] = index1; - } - this._buckets = numArray; - this._entries = entryArray; - } - - public bool Remove(object key) - { - if (this._buckets != null) - { - int num = this.GetKeyHashCode(key) & int.MaxValue; - int index1 = num % this._buckets.Length; - int index2 = -1; - for (int index3 = this._buckets[index1]; index3 >= 0; index3 = this._entries[index3].next) - { - if (this._entries[index3].hashCode == num && this.KeyEquals(this._entries[index3].key, key)) - { - if (index2 < 0) - this._buckets[index1] = this._entries[index3].next; - else - this._entries[index2].next = this._entries[index3].next; - this._entries[index3].hashCode = -1; - this._entries[index3].next = this._freeList; - this._entries[index3].key = (object) null; - this._entries[index3].value = (object) null; - this._freeList = index3; - ++this._freeCount; - ++this._version; - return true; - } - index2 = index3; - } - } - return false; - } - - public bool TryGetValue(object key, out object value) - { - int entry = this.FindEntry(key); - if (entry >= 0) - { - value = this._entries[entry].value; - return true; - } - value = (object) null; - return false; - } - - private bool KeyEquals(object x, object y) => x.Equals(y); - - private int GetKeyHashCode(object obj) => obj.GetHashCode(); - - public struct Enumerator - { - private Map _dictionary; + private int[] _buckets; + private Map.Entry[] _entries; + private int _count; private int _version; - private int _index; - private KeyValueEntry _current; + private int _freeList; + private int _freeCount; - internal Enumerator(Map dictionary) + public Map() + : this(0) { - this._dictionary = dictionary; - this._version = this._dictionary._version; - this._index = 0; - this._current = new KeyValueEntry((object) null, (object) null); } - public bool MoveNext() + public Map(int capacity) { - if (this._version != this._dictionary._version) - throw new InvalidOperationException("Dictionary was modified while enumerating"); - for (; (uint) this._index < (uint) this._dictionary._count; ++this._index) - { - if (this._dictionary._entries[this._index].hashCode >= 0) + if (capacity <= 0) + return; + this.Initialize(capacity); + } + + public int Count => this._count - this._freeCount; + + public Map.KeyCollection Keys => new Map.KeyCollection(this); + + public Map.ValueCollection Values => new Map.ValueCollection(this); + + public object this[object key] + { + get { - this._current = new KeyValueEntry(this._dictionary._entries[this._index].key, this._dictionary._entries[this._index].value); - ++this._index; - return true; + int entry = this.FindEntry(key); + return entry >= 0 ? this._entries[entry].value : (object)null; } - } - this._index = this._dictionary._count + 1; - this._current = new KeyValueEntry((object) null, (object) null); - return false; + set => this.Insert(key, value, false); } - public KeyValueEntry Current => this._current; - } + public void Add(object key, object value) => this.Insert(key, value, true); - public struct KeyCollection - { - private Map _dictionary; + public void Clear() + { + if (this._count <= 0) + return; + for (int index = 0; index < this._buckets.Length; ++index) + this._buckets[index] = -1; + Array.Clear((Array)this._entries, 0, this._count); + this._freeList = -1; + this._count = 0; + this._freeCount = 0; + } - public KeyCollection(Map dictionary) => this._dictionary = dictionary != null ? dictionary : throw new ArgumentNullException(nameof (dictionary)); + public bool ContainsKey(object key) => this.FindEntry(key) >= 0; - public Map.KeyCollection.Enumerator GetEnumerator() => new Map.KeyCollection.Enumerator(this._dictionary); + public Map.Enumerator GetEnumerator() => new Map.Enumerator(this); - public int Count => this._dictionary.Count; + private int FindEntry(object key) + { + if (this._buckets != null) + { + int num = this.GetKeyHashCode(key) & int.MaxValue; + for (int index = this._buckets[num % this._buckets.Length]; index >= 0; index = this._entries[index].next) + { + if (this._entries[index].hashCode == num && this.KeyEquals(this._entries[index].key, key)) + return index; + } + } + return -1; + } + + private void Initialize(int capacity) + { + int prime = HashHelpers.GetPrime(capacity); + this._buckets = new int[prime]; + for (int index = 0; index < this._buckets.Length; ++index) + this._buckets[index] = -1; + this._entries = new Map.Entry[prime]; + this._freeList = -1; + } + + private void Insert(object key, object value, bool add) + { + if (this._buckets == null) + this.Initialize(0); + int num = this.GetKeyHashCode(key) & int.MaxValue; + for (int index = this._buckets[num % this._buckets.Length]; index >= 0; index = this._entries[index].next) + { + if (this._entries[index].hashCode == num && this.KeyEquals(this._entries[index].key, key)) + { + if (add) + throw new ArgumentException("Adding duplicate entry to Dictionary"); + this._entries[index].value = value; + ++this._version; + return; + } + } + int index1; + if (this._freeCount > 0) + { + index1 = this._freeList; + this._freeList = this._entries[index1].next; + --this._freeCount; + } + else + { + if (this._count == this._entries.Length) + this.Resize(); + index1 = this._count; + ++this._count; + } + int index2 = num % this._buckets.Length; + this._entries[index1].hashCode = num; + this._entries[index1].next = this._buckets[index2]; + this._entries[index1].key = key; + this._entries[index1].value = value; + this._buckets[index2] = index1; + ++this._version; + } + + private void Resize() + { + int prime = HashHelpers.GetPrime(this._count * 2); + int[] numArray = new int[prime]; + for (int index = 0; index < numArray.Length; ++index) + numArray[index] = -1; + Map.Entry[] entryArray = new Map.Entry[prime]; + Array.Copy((Array)this._entries, 0, (Array)entryArray, 0, this._count); + for (int index1 = 0; index1 < this._count; ++index1) + { + int index2 = entryArray[index1].hashCode % prime; + entryArray[index1].next = numArray[index2]; + numArray[index2] = index1; + } + this._buckets = numArray; + this._entries = entryArray; + } + + public bool Remove(object key) + { + if (this._buckets != null) + { + int num = this.GetKeyHashCode(key) & int.MaxValue; + int index1 = num % this._buckets.Length; + int index2 = -1; + for (int index3 = this._buckets[index1]; index3 >= 0; index3 = this._entries[index3].next) + { + if (this._entries[index3].hashCode == num && this.KeyEquals(this._entries[index3].key, key)) + { + if (index2 < 0) + this._buckets[index1] = this._entries[index3].next; + else + this._entries[index2].next = this._entries[index3].next; + this._entries[index3].hashCode = -1; + this._entries[index3].next = this._freeList; + this._entries[index3].key = (object)null; + this._entries[index3].value = (object)null; + this._freeList = index3; + ++this._freeCount; + ++this._version; + return true; + } + index2 = index3; + } + } + return false; + } + + public bool TryGetValue(object key, out object value) + { + int entry = this.FindEntry(key); + if (entry >= 0) + { + value = this._entries[entry].value; + return true; + } + value = (object)null; + return false; + } + + private bool KeyEquals(object x, object y) => x.Equals(y); + + private int GetKeyHashCode(object obj) => obj.GetHashCode(); public struct Enumerator { - private Map _dictionary; - private int _index; - private int _version; - private object _currentKey; + private Map _dictionary; + private int _version; + private int _index; + private KeyValueEntry _current; - internal Enumerator(Map dictionary) - { - this._dictionary = dictionary; - this._version = dictionary._version; - this._index = 0; - this._currentKey = (object) null; - } - - public bool MoveNext() - { - if (this._version != this._dictionary._version) - throw new InvalidOperationException("Dictionary was modified while enumerating"); - for (; (uint) this._index < (uint) this._dictionary._count; ++this._index) + internal Enumerator(Map dictionary) { - if (this._dictionary._entries[this._index].hashCode >= 0) - { - this._currentKey = this._dictionary._entries[this._index].key; - ++this._index; - return true; - } + this._dictionary = dictionary; + this._version = this._dictionary._version; + this._index = 0; + this._current = new KeyValueEntry((object)null, (object)null); } - this._index = this._dictionary._count + 1; - this._currentKey = (object) null; - return false; - } - public object Current => this._currentKey; + public bool MoveNext() + { + if (this._version != this._dictionary._version) + throw new InvalidOperationException("Dictionary was modified while enumerating"); + for (; (uint)this._index < (uint)this._dictionary._count; ++this._index) + { + if (this._dictionary._entries[this._index].hashCode >= 0) + { + this._current = new KeyValueEntry(this._dictionary._entries[this._index].key, this._dictionary._entries[this._index].value); + ++this._index; + return true; + } + } + this._index = this._dictionary._count + 1; + this._current = new KeyValueEntry((object)null, (object)null); + return false; + } + + public KeyValueEntry Current => this._current; } - } - public struct ValueCollection - { - private Map _dictionary; - - public ValueCollection(Map dictionary) => this._dictionary = dictionary != null ? dictionary : throw new ArgumentNullException(nameof (dictionary)); - - public Map.ValueCollection.Enumerator GetEnumerator() => new Map.ValueCollection.Enumerator(this._dictionary); - - public int Count => this._dictionary.Count; - - public struct Enumerator + public struct KeyCollection { - private Map _dictionary; - private int _index; - private int _version; - private object _currentValue; + private Map _dictionary; - internal Enumerator(Map dictionary) - { - this._dictionary = dictionary; - this._version = dictionary._version; - this._index = 0; - this._currentValue = (object) null; - } + public KeyCollection(Map dictionary) => this._dictionary = dictionary != null ? dictionary : throw new ArgumentNullException(nameof(dictionary)); - public bool MoveNext() - { - if (this._version != this._dictionary._version) - throw new InvalidOperationException("Dictionary was modified while enumerating"); - for (; (uint) this._index < (uint) this._dictionary._count; ++this._index) + public Map.KeyCollection.Enumerator GetEnumerator() => new Map.KeyCollection.Enumerator(this._dictionary); + + public int Count => this._dictionary.Count; + + public struct Enumerator { - if (this._dictionary._entries[this._index].hashCode >= 0) - { - this._currentValue = this._dictionary._entries[this._index].value; - ++this._index; - return true; - } + private Map _dictionary; + private int _index; + private int _version; + private object _currentKey; + + internal Enumerator(Map dictionary) + { + this._dictionary = dictionary; + this._version = dictionary._version; + this._index = 0; + this._currentKey = (object)null; + } + + public bool MoveNext() + { + if (this._version != this._dictionary._version) + throw new InvalidOperationException("Dictionary was modified while enumerating"); + for (; (uint)this._index < (uint)this._dictionary._count; ++this._index) + { + if (this._dictionary._entries[this._index].hashCode >= 0) + { + this._currentKey = this._dictionary._entries[this._index].key; + ++this._index; + return true; + } + } + this._index = this._dictionary._count + 1; + this._currentKey = (object)null; + return false; + } + + public object Current => this._currentKey; } - this._index = this._dictionary._count + 1; - this._currentValue = (object) null; - return false; - } - - public object Current => this._currentValue; } - } - private struct Entry - { - public int hashCode; - public int next; - public object key; - public object value; - } + public struct ValueCollection + { + private Map _dictionary; + + public ValueCollection(Map dictionary) => this._dictionary = dictionary != null ? dictionary : throw new ArgumentNullException(nameof(dictionary)); + + public Map.ValueCollection.Enumerator GetEnumerator() => new Map.ValueCollection.Enumerator(this._dictionary); + + public int Count => this._dictionary.Count; + + public struct Enumerator + { + private Map _dictionary; + private int _index; + private int _version; + private object _currentValue; + + internal Enumerator(Map dictionary) + { + this._dictionary = dictionary; + this._version = dictionary._version; + this._index = 0; + this._currentValue = (object)null; + } + + public bool MoveNext() + { + if (this._version != this._dictionary._version) + throw new InvalidOperationException("Dictionary was modified while enumerating"); + for (; (uint)this._index < (uint)this._dictionary._count; ++this._index) + { + if (this._dictionary._entries[this._index].hashCode >= 0) + { + this._currentValue = this._dictionary._entries[this._index].value; + ++this._index; + return true; + } + } + this._index = this._dictionary._count + 1; + this._currentValue = (object)null; + return false; + } + + public object Current => this._currentValue; + } + } + + private struct Entry + { + public int hashCode; + public int next; + public object key; + public object value; + } } diff --git a/UIX.RenderApi.Skia/Map`2.cs b/UIX.RenderApi.Skia/Map`2.cs index b4821dc..884a095 100644 --- a/UIX.RenderApi.Skia/Map`2.cs +++ b/UIX.RenderApi.Skia/Map`2.cs @@ -9,321 +9,321 @@ using System.Collections.Generic; public class Map { - private int[] _buckets; - private Map.Entry[] _entries; - private int _count; - private int _version; - private int _freeList; - private int _freeCount; - - public Map() - : this(0) - { - } - - public Map(int capacity) - { - if (capacity <= 0) - return; - this.Initialize(capacity); - } - - public int Count => this._count - this._freeCount; - - public Map.KeyCollection Keys => new Map.KeyCollection(this); - - public Map.ValueCollection Values => new Map.ValueCollection(this); - - public V this[K key] - { - get - { - int entry = this.FindEntry(key); - return entry >= 0 ? this._entries[entry].value : default (V); - } - set => this.Insert(key, value, false); - } - - public void Add(K key, V value) => this.Insert(key, value, true); - - public void Clear() - { - if (this._count <= 0) - return; - for (int index = 0; index < this._buckets.Length; ++index) - this._buckets[index] = -1; - Array.Clear((Array) this._entries, 0, this._count); - this._freeList = -1; - this._count = 0; - this._freeCount = 0; - } - - public bool ContainsKey(K key) => this.FindEntry(key) >= 0; - - public Map.Enumerator GetEnumerator() => new Map.Enumerator(this); - - private int FindEntry(K key) - { - if (this._buckets != null) - { - int num = this.GetKeyHashCode(key) & int.MaxValue; - for (int index = this._buckets[num % this._buckets.Length]; index >= 0; index = this._entries[index].next) - { - if (this._entries[index].hashCode == num && this.KeyEquals(this._entries[index].key, key)) - return index; - } - } - return -1; - } - - private void Initialize(int capacity) - { - int prime = HashHelpers.GetPrime(capacity); - this._buckets = new int[prime]; - for (int index = 0; index < this._buckets.Length; ++index) - this._buckets[index] = -1; - this._entries = new Map.Entry[prime]; - this._freeList = -1; - } - - private void Insert(K key, V value, bool add) - { - if (this._buckets == null) - this.Initialize(0); - int num = this.GetKeyHashCode(key) & int.MaxValue; - for (int index = this._buckets[num % this._buckets.Length]; index >= 0; index = this._entries[index].next) - { - if (this._entries[index].hashCode == num && this.KeyEquals(this._entries[index].key, key)) - { - if (add) - throw new ArgumentException("Adding duplicate entry to Dictionary"); - this._entries[index].value = value; - ++this._version; - return; - } - } - int index1; - if (this._freeCount > 0) - { - index1 = this._freeList; - this._freeList = this._entries[index1].next; - --this._freeCount; - } - else - { - if (this._count == this._entries.Length) - this.Resize(); - index1 = this._count; - ++this._count; - } - int index2 = num % this._buckets.Length; - this._entries[index1].hashCode = num; - this._entries[index1].next = this._buckets[index2]; - this._entries[index1].key = key; - this._entries[index1].value = value; - this._buckets[index2] = index1; - ++this._version; - } - - private void Resize() - { - int prime = HashHelpers.GetPrime(this._count * 2); - int[] numArray = new int[prime]; - for (int index = 0; index < numArray.Length; ++index) - numArray[index] = -1; - Map.Entry[] entryArray = new Map.Entry[prime]; - Array.Copy((Array) this._entries, 0, (Array) entryArray, 0, this._count); - for (int index1 = 0; index1 < this._count; ++index1) - { - int index2 = entryArray[index1].hashCode % prime; - entryArray[index1].next = numArray[index2]; - numArray[index2] = index1; - } - this._buckets = numArray; - this._entries = entryArray; - } - - public bool Remove(K key) - { - if (this._buckets != null) - { - int num = this.GetKeyHashCode(key) & int.MaxValue; - int index1 = num % this._buckets.Length; - int index2 = -1; - for (int index3 = this._buckets[index1]; index3 >= 0; index3 = this._entries[index3].next) - { - if (this._entries[index3].hashCode == num && this.KeyEquals(this._entries[index3].key, key)) - { - if (index2 < 0) - this._buckets[index1] = this._entries[index3].next; - else - this._entries[index2].next = this._entries[index3].next; - this._entries[index3].hashCode = -1; - this._entries[index3].next = this._freeList; - this._entries[index3].key = default (K); - this._entries[index3].value = default (V); - this._freeList = index3; - ++this._freeCount; - ++this._version; - return true; - } - index2 = index3; - } - } - return false; - } - - public bool TryGetValue(K key, out V value) - { - int entry = this.FindEntry(key); - if (entry >= 0) - { - value = this._entries[entry].value; - return true; - } - value = default (V); - return false; - } - - private bool KeyEquals(K x, K y) => x.Equals((object) y); - - private int GetKeyHashCode(K obj) => obj.GetHashCode(); - - public struct Enumerator - { - private Map _dictionary; + private int[] _buckets; + private Map.Entry[] _entries; + private int _count; private int _version; - private int _index; - private KeyValueEntry _current; + private int _freeList; + private int _freeCount; - internal Enumerator(Map dictionary) + public Map() + : this(0) { - this._dictionary = dictionary; - this._version = this._dictionary._version; - this._index = 0; - this._current = new KeyValueEntry(default (K), default (V)); } - public bool MoveNext() + public Map(int capacity) { - if (this._version != this._dictionary._version) - throw new InvalidOperationException("Dictionary was modified while enumerating"); - for (; (uint) this._index < (uint) this._dictionary._count; ++this._index) - { - if (this._dictionary._entries[this._index].hashCode >= 0) + if (capacity <= 0) + return; + this.Initialize(capacity); + } + + public int Count => this._count - this._freeCount; + + public Map.KeyCollection Keys => new Map.KeyCollection(this); + + public Map.ValueCollection Values => new Map.ValueCollection(this); + + public V this[K key] + { + get { - this._current = new KeyValueEntry(this._dictionary._entries[this._index].key, this._dictionary._entries[this._index].value); - ++this._index; - return true; + int entry = this.FindEntry(key); + return entry >= 0 ? this._entries[entry].value : default(V); } - } - this._index = this._dictionary._count + 1; - this._current = new KeyValueEntry(default (K), default (V)); - return false; + set => this.Insert(key, value, false); } - public KeyValueEntry Current => this._current; - } + public void Add(K key, V value) => this.Insert(key, value, true); - public struct KeyCollection - { - private Map _dictionary; + public void Clear() + { + if (this._count <= 0) + return; + for (int index = 0; index < this._buckets.Length; ++index) + this._buckets[index] = -1; + Array.Clear((Array)this._entries, 0, this._count); + this._freeList = -1; + this._count = 0; + this._freeCount = 0; + } - public KeyCollection(Map dictionary) => this._dictionary = dictionary != null ? dictionary : throw new ArgumentNullException(nameof (dictionary)); + public bool ContainsKey(K key) => this.FindEntry(key) >= 0; - public Map.KeyCollection.Enumerator GetEnumerator() => new Map.KeyCollection.Enumerator(this._dictionary); + public Map.Enumerator GetEnumerator() => new Map.Enumerator(this); - public int Count => this._dictionary.Count; + private int FindEntry(K key) + { + if (this._buckets != null) + { + int num = this.GetKeyHashCode(key) & int.MaxValue; + for (int index = this._buckets[num % this._buckets.Length]; index >= 0; index = this._entries[index].next) + { + if (this._entries[index].hashCode == num && this.KeyEquals(this._entries[index].key, key)) + return index; + } + } + return -1; + } + + private void Initialize(int capacity) + { + int prime = HashHelpers.GetPrime(capacity); + this._buckets = new int[prime]; + for (int index = 0; index < this._buckets.Length; ++index) + this._buckets[index] = -1; + this._entries = new Map.Entry[prime]; + this._freeList = -1; + } + + private void Insert(K key, V value, bool add) + { + if (this._buckets == null) + this.Initialize(0); + int num = this.GetKeyHashCode(key) & int.MaxValue; + for (int index = this._buckets[num % this._buckets.Length]; index >= 0; index = this._entries[index].next) + { + if (this._entries[index].hashCode == num && this.KeyEquals(this._entries[index].key, key)) + { + if (add) + throw new ArgumentException("Adding duplicate entry to Dictionary"); + this._entries[index].value = value; + ++this._version; + return; + } + } + int index1; + if (this._freeCount > 0) + { + index1 = this._freeList; + this._freeList = this._entries[index1].next; + --this._freeCount; + } + else + { + if (this._count == this._entries.Length) + this.Resize(); + index1 = this._count; + ++this._count; + } + int index2 = num % this._buckets.Length; + this._entries[index1].hashCode = num; + this._entries[index1].next = this._buckets[index2]; + this._entries[index1].key = key; + this._entries[index1].value = value; + this._buckets[index2] = index1; + ++this._version; + } + + private void Resize() + { + int prime = HashHelpers.GetPrime(this._count * 2); + int[] numArray = new int[prime]; + for (int index = 0; index < numArray.Length; ++index) + numArray[index] = -1; + Map.Entry[] entryArray = new Map.Entry[prime]; + Array.Copy((Array)this._entries, 0, (Array)entryArray, 0, this._count); + for (int index1 = 0; index1 < this._count; ++index1) + { + int index2 = entryArray[index1].hashCode % prime; + entryArray[index1].next = numArray[index2]; + numArray[index2] = index1; + } + this._buckets = numArray; + this._entries = entryArray; + } + + public bool Remove(K key) + { + if (this._buckets != null) + { + int num = this.GetKeyHashCode(key) & int.MaxValue; + int index1 = num % this._buckets.Length; + int index2 = -1; + for (int index3 = this._buckets[index1]; index3 >= 0; index3 = this._entries[index3].next) + { + if (this._entries[index3].hashCode == num && this.KeyEquals(this._entries[index3].key, key)) + { + if (index2 < 0) + this._buckets[index1] = this._entries[index3].next; + else + this._entries[index2].next = this._entries[index3].next; + this._entries[index3].hashCode = -1; + this._entries[index3].next = this._freeList; + this._entries[index3].key = default(K); + this._entries[index3].value = default(V); + this._freeList = index3; + ++this._freeCount; + ++this._version; + return true; + } + index2 = index3; + } + } + return false; + } + + public bool TryGetValue(K key, out V value) + { + int entry = this.FindEntry(key); + if (entry >= 0) + { + value = this._entries[entry].value; + return true; + } + value = default(V); + return false; + } + + private bool KeyEquals(K x, K y) => x.Equals((object)y); + + private int GetKeyHashCode(K obj) => obj.GetHashCode(); public struct Enumerator { - private Map _dictionary; - private int _index; - private int _version; - private K _currentKey; + private Map _dictionary; + private int _version; + private int _index; + private KeyValueEntry _current; - internal Enumerator(Map dictionary) - { - this._dictionary = dictionary; - this._version = dictionary._version; - this._index = 0; - this._currentKey = default (K); - } - - public bool MoveNext() - { - if (this._version != this._dictionary._version) - throw new InvalidOperationException("Dictionary was modified while enumerating"); - for (; (uint) this._index < (uint) this._dictionary._count; ++this._index) + internal Enumerator(Map dictionary) { - if (this._dictionary._entries[this._index].hashCode >= 0) - { - this._currentKey = this._dictionary._entries[this._index].key; - ++this._index; - return true; - } + this._dictionary = dictionary; + this._version = this._dictionary._version; + this._index = 0; + this._current = new KeyValueEntry(default(K), default(V)); } - this._index = this._dictionary._count + 1; - this._currentKey = default (K); - return false; - } - public K Current => this._currentKey; + public bool MoveNext() + { + if (this._version != this._dictionary._version) + throw new InvalidOperationException("Dictionary was modified while enumerating"); + for (; (uint)this._index < (uint)this._dictionary._count; ++this._index) + { + if (this._dictionary._entries[this._index].hashCode >= 0) + { + this._current = new KeyValueEntry(this._dictionary._entries[this._index].key, this._dictionary._entries[this._index].value); + ++this._index; + return true; + } + } + this._index = this._dictionary._count + 1; + this._current = new KeyValueEntry(default(K), default(V)); + return false; + } + + public KeyValueEntry Current => this._current; } - } - public struct ValueCollection - { - private Map _dictionary; - - public ValueCollection(Map dictionary) => this._dictionary = dictionary != null ? dictionary : throw new ArgumentNullException(nameof (dictionary)); - - public Map.ValueCollection.Enumerator GetEnumerator() => new Map.ValueCollection.Enumerator(this._dictionary); - - public int Count => this._dictionary.Count; - - public struct Enumerator + public struct KeyCollection { - private Map _dictionary; - private int _index; - private int _version; - private V _currentValue; + private Map _dictionary; - internal Enumerator(Map dictionary) - { - this._dictionary = dictionary; - this._version = dictionary._version; - this._index = 0; - this._currentValue = default (V); - } + public KeyCollection(Map dictionary) => this._dictionary = dictionary != null ? dictionary : throw new ArgumentNullException(nameof(dictionary)); - public bool MoveNext() - { - if (this._version != this._dictionary._version) - throw new InvalidOperationException("Dictionary was modified while enumerating"); - for (; (uint) this._index < (uint) this._dictionary._count; ++this._index) + public Map.KeyCollection.Enumerator GetEnumerator() => new Map.KeyCollection.Enumerator(this._dictionary); + + public int Count => this._dictionary.Count; + + public struct Enumerator { - if (this._dictionary._entries[this._index].hashCode >= 0) - { - this._currentValue = this._dictionary._entries[this._index].value; - ++this._index; - return true; - } + private Map _dictionary; + private int _index; + private int _version; + private K _currentKey; + + internal Enumerator(Map dictionary) + { + this._dictionary = dictionary; + this._version = dictionary._version; + this._index = 0; + this._currentKey = default(K); + } + + public bool MoveNext() + { + if (this._version != this._dictionary._version) + throw new InvalidOperationException("Dictionary was modified while enumerating"); + for (; (uint)this._index < (uint)this._dictionary._count; ++this._index) + { + if (this._dictionary._entries[this._index].hashCode >= 0) + { + this._currentKey = this._dictionary._entries[this._index].key; + ++this._index; + return true; + } + } + this._index = this._dictionary._count + 1; + this._currentKey = default(K); + return false; + } + + public K Current => this._currentKey; } - this._index = this._dictionary._count + 1; - this._currentValue = default (V); - return false; - } - - public V Current => this._currentValue; } - } - private struct Entry - { - public int hashCode; - public int next; - public K key; - public V value; - } + public struct ValueCollection + { + private Map _dictionary; + + public ValueCollection(Map dictionary) => this._dictionary = dictionary != null ? dictionary : throw new ArgumentNullException(nameof(dictionary)); + + public Map.ValueCollection.Enumerator GetEnumerator() => new Map.ValueCollection.Enumerator(this._dictionary); + + public int Count => this._dictionary.Count; + + public struct Enumerator + { + private Map _dictionary; + private int _index; + private int _version; + private V _currentValue; + + internal Enumerator(Map dictionary) + { + this._dictionary = dictionary; + this._version = dictionary._version; + this._index = 0; + this._currentValue = default(V); + } + + public bool MoveNext() + { + if (this._version != this._dictionary._version) + throw new InvalidOperationException("Dictionary was modified while enumerating"); + for (; (uint)this._index < (uint)this._dictionary._count; ++this._index) + { + if (this._dictionary._entries[this._index].hashCode >= 0) + { + this._currentValue = this._dictionary._entries[this._index].value; + ++this._index; + return true; + } + } + this._index = this._dictionary._count + 1; + this._currentValue = default(V); + return false; + } + + public V Current => this._currentValue; + } + } + + private struct Entry + { + public int hashCode; + public int next; + public K key; + public V value; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/Cursor.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/Cursor.cs index cbce884..6953757 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/Cursor.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/Cursor.cs @@ -6,82 +6,82 @@ namespace Microsoft.Iris.Input { - public class Cursor - { - public const int NoneResourceId = 1; - public const int MoveResourceId = 2; - public const int CopyResourceId = 3; - public static readonly Cursor Arrow = new Cursor(32512, CursorID.Arrow); - public static readonly Cursor AppStarting = new Cursor(32550, CursorID.AppStarting); - public static readonly Cursor Crosshair = new Cursor(32515, CursorID.Crosshair); - public static readonly Cursor Default = Cursor.Arrow; - public static readonly Cursor Hand = new Cursor(32649, CursorID.Hand); - public static readonly Cursor Help = new Cursor(32651, CursorID.Help); - public static readonly Cursor IBeam = new Cursor(32513, CursorID.IBeam); - public static readonly Cursor No = new Cursor(32648, CursorID.No); - public static readonly Cursor Size = new Cursor(32646, CursorID.Size); - public static readonly Cursor SizeNS = new Cursor(32645, CursorID.SizeNS); - public static readonly Cursor SizeWE = new Cursor(32644, CursorID.SizeWE); - public static readonly Cursor SizeNWSE = new Cursor(32642, CursorID.SizeNWSE); - public static readonly Cursor SizeNESW = new Cursor(32643, CursorID.SizeNESW); - public static readonly Cursor WaitCursor = new Cursor(32514, CursorID.Wait); - public static readonly Cursor UpArrow = new Cursor(32516, CursorID.UpArrow); - public static readonly Cursor NullCursor = new Cursor(0, CursorID.None); - public static readonly Cursor Cancel = new Cursor(1, CursorID.Cancel); - public static readonly Cursor Move = new Cursor(2, CursorID.Move); - public static readonly Cursor Copy = new Cursor(3, CursorID.Copy); - private int m_idResource; - private CursorID m_idCursor; - - public Cursor(int idResource, CursorID idCursor) + public class Cursor { - this.m_idResource = idResource; - this.m_idCursor = idCursor; + public const int NoneResourceId = 1; + public const int MoveResourceId = 2; + public const int CopyResourceId = 3; + public static readonly Cursor Arrow = new Cursor(32512, CursorID.Arrow); + public static readonly Cursor AppStarting = new Cursor(32550, CursorID.AppStarting); + public static readonly Cursor Crosshair = new Cursor(32515, CursorID.Crosshair); + public static readonly Cursor Default = Cursor.Arrow; + public static readonly Cursor Hand = new Cursor(32649, CursorID.Hand); + public static readonly Cursor Help = new Cursor(32651, CursorID.Help); + public static readonly Cursor IBeam = new Cursor(32513, CursorID.IBeam); + public static readonly Cursor No = new Cursor(32648, CursorID.No); + public static readonly Cursor Size = new Cursor(32646, CursorID.Size); + public static readonly Cursor SizeNS = new Cursor(32645, CursorID.SizeNS); + public static readonly Cursor SizeWE = new Cursor(32644, CursorID.SizeWE); + public static readonly Cursor SizeNWSE = new Cursor(32642, CursorID.SizeNWSE); + public static readonly Cursor SizeNESW = new Cursor(32643, CursorID.SizeNESW); + public static readonly Cursor WaitCursor = new Cursor(32514, CursorID.Wait); + public static readonly Cursor UpArrow = new Cursor(32516, CursorID.UpArrow); + public static readonly Cursor NullCursor = new Cursor(0, CursorID.None); + public static readonly Cursor Cancel = new Cursor(1, CursorID.Cancel); + public static readonly Cursor Move = new Cursor(2, CursorID.Move); + public static readonly Cursor Copy = new Cursor(3, CursorID.Copy); + private int m_idResource; + private CursorID m_idCursor; + + public Cursor(int idResource, CursorID idCursor) + { + this.m_idResource = idResource; + this.m_idCursor = idCursor; + } + + public int ResourceId => this.m_idResource; + + public CursorID CursorID => this.m_idCursor; + + public static Cursor GetCursor(CursorID cursor) + { + switch (cursor) + { + case CursorID.Arrow: + return Cursor.Arrow; + case CursorID.Cancel: + return Cursor.Cancel; + case CursorID.Copy: + return Cursor.Copy; + case CursorID.Crosshair: + return Cursor.Crosshair; + case CursorID.IBeam: + return Cursor.IBeam; + case CursorID.Hand: + return Cursor.Hand; + case CursorID.Move: + return Cursor.Move; + case CursorID.No: + return Cursor.No; + case CursorID.None: + return Cursor.NullCursor; + case CursorID.Size: + return Cursor.Size; + case CursorID.SizeNS: + return Cursor.SizeNS; + case CursorID.SizeWE: + return Cursor.SizeWE; + case CursorID.SizeNWSE: + return Cursor.SizeNWSE; + case CursorID.SizeNESW: + return Cursor.SizeNESW; + case CursorID.UpArrow: + return Cursor.UpArrow; + case CursorID.Wait: + return Cursor.WaitCursor; + default: + return (Cursor)null; + } + } } - - public int ResourceId => this.m_idResource; - - public CursorID CursorID => this.m_idCursor; - - public static Cursor GetCursor(CursorID cursor) - { - switch (cursor) - { - case CursorID.Arrow: - return Cursor.Arrow; - case CursorID.Cancel: - return Cursor.Cancel; - case CursorID.Copy: - return Cursor.Copy; - case CursorID.Crosshair: - return Cursor.Crosshair; - case CursorID.IBeam: - return Cursor.IBeam; - case CursorID.Hand: - return Cursor.Hand; - case CursorID.Move: - return Cursor.Move; - case CursorID.No: - return Cursor.No; - case CursorID.None: - return Cursor.NullCursor; - case CursorID.Size: - return Cursor.Size; - case CursorID.SizeNS: - return Cursor.SizeNS; - case CursorID.SizeWE: - return Cursor.SizeWE; - case CursorID.SizeNWSE: - return Cursor.SizeNWSE; - case CursorID.SizeNESW: - return Cursor.SizeNESW; - case CursorID.UpArrow: - return Cursor.UpArrow; - case CursorID.Wait: - return Cursor.WaitCursor; - default: - return (Cursor) null; - } - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/CursorID.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/CursorID.cs index 969a0ba..8a949ab 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/CursorID.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/CursorID.cs @@ -6,26 +6,26 @@ namespace Microsoft.Iris.Input { - public enum CursorID - { - NotSpecified, - AppStarting, - Arrow, - Cancel, - Copy, - Crosshair, - IBeam, - Hand, - Help, - Move, - No, - None, - Size, - SizeNS, - SizeWE, - SizeNWSE, - SizeNESW, - UpArrow, - Wait, - } + public enum CursorID + { + NotSpecified, + AppStarting, + Arrow, + Cancel, + Copy, + Crosshair, + IBeam, + Hand, + Help, + Move, + No, + None, + Size, + SizeNS, + SizeWE, + SizeNWSE, + SizeNESW, + UpArrow, + Wait, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/IRawInputSite.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/IRawInputSite.cs index 659ea71..8d7a226 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/IRawInputSite.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/IRawInputSite.cs @@ -6,8 +6,8 @@ namespace Microsoft.Iris.Input { - public interface IRawInputSite - { - object OwnerData { get; } - } + public interface IRawInputSite + { + object OwnerData { get; } + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputDeviceType.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputDeviceType.cs index 38fb643..308022f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputDeviceType.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputDeviceType.cs @@ -6,11 +6,11 @@ namespace Microsoft.Iris.Input { - public enum InputDeviceType - { - None, - Keyboard, - Mouse, - Other, - } + public enum InputDeviceType + { + None, + Keyboard, + Mouse, + Other, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputHandlerFlags.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputHandlerFlags.cs index c28e855..b7b6751 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputHandlerFlags.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputHandlerFlags.cs @@ -8,15 +8,15 @@ using System; namespace Microsoft.Iris.Input { - [Flags] - public enum InputHandlerFlags - { - None = 0, - Keyboard = 1, - Mouse = 2, - Drag = 4, - Hid = 8, - AppCommand = 16, // 0x00000010 - All = AppCommand | Hid | Drag | Mouse | Keyboard, // 0x0000001F - } + [Flags] + public enum InputHandlerFlags + { + None = 0, + Keyboard = 1, + Mouse = 2, + Drag = 4, + Hid = 8, + AppCommand = 16, // 0x00000010 + All = AppCommand | Hid | Drag | Mouse | Keyboard, // 0x0000001F + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputModifiers.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputModifiers.cs index c70bb6a..26be9f5 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputModifiers.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/InputModifiers.cs @@ -8,22 +8,22 @@ using System; namespace Microsoft.Iris.Input { - [Flags] - public enum InputModifiers - { - None = 0, - ControlKey = 1, - ShiftKey = 2, - AltKey = 4, - WindowsKey = 8, - LeftMouse = 16, // 0x00000010 - RightMouse = 32, // 0x00000020 - MiddleMouse = 64, // 0x00000040 - XMouse1 = 128, // 0x00000080 - XMouse2 = 256, // 0x00000100 - DoubleClick = 512, // 0x00000200 - AllKeys = WindowsKey | AltKey | ShiftKey | ControlKey, // 0x0000000F - AllButtons = XMouse2 | XMouse1 | MiddleMouse | RightMouse | LeftMouse, // 0x000001F0 - AllMouse = AllButtons | DoubleClick, // 0x000003F0 - } + [Flags] + public enum InputModifiers + { + None = 0, + ControlKey = 1, + ShiftKey = 2, + AltKey = 4, + WindowsKey = 8, + LeftMouse = 16, // 0x00000010 + RightMouse = 32, // 0x00000020 + MiddleMouse = 64, // 0x00000040 + XMouse1 = 128, // 0x00000080 + XMouse2 = 256, // 0x00000100 + DoubleClick = 512, // 0x00000200 + AllKeys = WindowsKey | AltKey | ShiftKey | ControlKey, // 0x0000000F + AllButtons = XMouse2 | XMouse1 | MiddleMouse | RightMouse | LeftMouse, // 0x000001F0 + AllMouse = AllButtons | DoubleClick, // 0x000003F0 + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/KeyAction.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/KeyAction.cs index 7e97c46..6b7ed7c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/KeyAction.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/KeyAction.cs @@ -6,11 +6,11 @@ namespace Microsoft.Iris.Input { - public enum KeyAction - { - None, - Up, - Down, - Character, - } + public enum KeyAction + { + None, + Up, + Down, + Character, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/KeyboardMessageId.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/KeyboardMessageId.cs index 350fbc3..90f7cba 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/KeyboardMessageId.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/KeyboardMessageId.cs @@ -6,13 +6,13 @@ namespace Microsoft.Iris.Input { - public enum KeyboardMessageId - { - Down, - Up, - Char, - SysDown, - SysUp, - SysChar, - } + public enum KeyboardMessageId + { + Down, + Up, + Char, + SysDown, + SysUp, + SysChar, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/Keys.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/Keys.cs index 19cf11f..2bf799a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/Keys.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/Keys.cs @@ -6,226 +6,226 @@ namespace Microsoft.Iris.Input { - public enum Keys - { - Modifiers = -65536, // 0xFFFF0000 - None = 0, - LButton = 1, - RButton = 2, - Cancel = 3, - MButton = 4, - XButton1 = 5, - XButton2 = 6, - Back = 8, - Tab = 9, - LineFeed = 10, // 0x0000000A - Clear = 12, // 0x0000000C - Enter = 13, // 0x0000000D - Return = 13, // 0x0000000D - ShiftKey = 16, // 0x00000010 - ControlKey = 17, // 0x00000011 - Menu = 18, // 0x00000012 - Pause = 19, // 0x00000013 - Capital = 20, // 0x00000014 - CapsLock = 20, // 0x00000014 - HangulMode = 21, // 0x00000015 - KanaMode = 21, // 0x00000015 - JunjaMode = 23, // 0x00000017 - FinalMode = 24, // 0x00000018 - HanjaMode = 25, // 0x00000019 - KanjiMode = 25, // 0x00000019 - Escape = 27, // 0x0000001B - IMEConvert = 28, // 0x0000001C - IMENonconvert = 29, // 0x0000001D - IMEAccept = 30, // 0x0000001E - IMEModeChange = 31, // 0x0000001F - Space = 32, // 0x00000020 - PageUp = 33, // 0x00000021 - Prior = 33, // 0x00000021 - Next = 34, // 0x00000022 - PageDown = 34, // 0x00000022 - End = 35, // 0x00000023 - Home = 36, // 0x00000024 - Left = 37, // 0x00000025 - Up = 38, // 0x00000026 - Right = 39, // 0x00000027 - Down = 40, // 0x00000028 - Select = 41, // 0x00000029 - Print = 42, // 0x0000002A - Execute = 43, // 0x0000002B - PrintScreen = 44, // 0x0000002C - Snapshot = 44, // 0x0000002C - Insert = 45, // 0x0000002D - Delete = 46, // 0x0000002E - D0 = 48, // 0x00000030 - D1 = 49, // 0x00000031 - D2 = 50, // 0x00000032 - D3 = 51, // 0x00000033 - D4 = 52, // 0x00000034 - D5 = 53, // 0x00000035 - D6 = 54, // 0x00000036 - D7 = 55, // 0x00000037 - D8 = 56, // 0x00000038 - D9 = 57, // 0x00000039 - A = 65, // 0x00000041 - B = 66, // 0x00000042 - C = 67, // 0x00000043 - D = 68, // 0x00000044 - E = 69, // 0x00000045 - F = 70, // 0x00000046 - G = 71, // 0x00000047 - H = 72, // 0x00000048 - I = 73, // 0x00000049 - J = 74, // 0x0000004A - K = 75, // 0x0000004B - L = 76, // 0x0000004C - M = 77, // 0x0000004D - N = 78, // 0x0000004E - O = 79, // 0x0000004F - P = 80, // 0x00000050 - Q = 81, // 0x00000051 - R = 82, // 0x00000052 - S = 83, // 0x00000053 - T = 84, // 0x00000054 - U = 85, // 0x00000055 - V = 86, // 0x00000056 - W = 87, // 0x00000057 - X = 88, // 0x00000058 - Y = 89, // 0x00000059 - Z = 90, // 0x0000005A - LWin = 91, // 0x0000005B - RWin = 92, // 0x0000005C - Apps = 93, // 0x0000005D - NumPad0 = 96, // 0x00000060 - NumPad1 = 97, // 0x00000061 - NumPad2 = 98, // 0x00000062 - NumPad3 = 99, // 0x00000063 - NumPad4 = 100, // 0x00000064 - NumPad5 = 101, // 0x00000065 - NumPad6 = 102, // 0x00000066 - NumPad7 = 103, // 0x00000067 - NumPad8 = 104, // 0x00000068 - NumPad9 = 105, // 0x00000069 - Multiply = 106, // 0x0000006A - Add = 107, // 0x0000006B - Separator = 108, // 0x0000006C - Subtract = 109, // 0x0000006D - Decimal = 110, // 0x0000006E - Divide = 111, // 0x0000006F - F1 = 112, // 0x00000070 - F2 = 113, // 0x00000071 - F3 = 114, // 0x00000072 - F4 = 115, // 0x00000073 - F5 = 116, // 0x00000074 - F6 = 117, // 0x00000075 - F7 = 118, // 0x00000076 - F8 = 119, // 0x00000077 - F9 = 120, // 0x00000078 - F10 = 121, // 0x00000079 - F11 = 122, // 0x0000007A - F12 = 123, // 0x0000007B - F13 = 124, // 0x0000007C - F14 = 125, // 0x0000007D - F15 = 126, // 0x0000007E - F16 = 127, // 0x0000007F - F17 = 128, // 0x00000080 - F18 = 129, // 0x00000081 - F19 = 130, // 0x00000082 - F20 = 131, // 0x00000083 - F21 = 132, // 0x00000084 - F22 = 133, // 0x00000085 - F23 = 134, // 0x00000086 - F24 = 135, // 0x00000087 - NumLock = 144, // 0x00000090 - Scroll = 145, // 0x00000091 - LShiftKey = 160, // 0x000000A0 - RShiftKey = 161, // 0x000000A1 - LControlKey = 162, // 0x000000A2 - RControlKey = 163, // 0x000000A3 - LMenu = 164, // 0x000000A4 - RMenu = 165, // 0x000000A5 - BrowserBack = 166, // 0x000000A6 - BrowserForward = 167, // 0x000000A7 - BrowserRefresh = 168, // 0x000000A8 - BrowserStop = 169, // 0x000000A9 - BrowserSearch = 170, // 0x000000AA - BrowserFavorites = 171, // 0x000000AB - BrowserHome = 172, // 0x000000AC - VolumeMute = 173, // 0x000000AD - VolumeDown = 174, // 0x000000AE - VolumeUp = 175, // 0x000000AF - MediaNextTrack = 176, // 0x000000B0 - MediaPreviousTrack = 177, // 0x000000B1 - MediaStop = 178, // 0x000000B2 - MediaPlayPause = 179, // 0x000000B3 - LaunchMail = 180, // 0x000000B4 - SelectMedia = 181, // 0x000000B5 - LaunchApplication1 = 182, // 0x000000B6 - LaunchApplication2 = 183, // 0x000000B7 - OemSemicolon = 186, // 0x000000BA - OemPlus = 187, // 0x000000BB - OemComma = 188, // 0x000000BC - OemMinus = 189, // 0x000000BD - OemPeriod = 190, // 0x000000BE - OemQuestion = 191, // 0x000000BF - OemTilde = 192, // 0x000000C0 - OemOpenBrackets = 219, // 0x000000DB - OemPipe = 220, // 0x000000DC - OemCloseBrackets = 221, // 0x000000DD - OemQuotes = 222, // 0x000000DE - Oem8 = 223, // 0x000000DF - OemBackslash = 226, // 0x000000E2 - ProcessKey = 229, // 0x000000E5 - DBEKatakana = 241, // 0x000000F1 - DBEHiragana = 242, // 0x000000F2 - DBESBCSChar = 243, // 0x000000F3 - DBEDBCSChar = 244, // 0x000000F4 - DBERoman = 245, // 0x000000F5 - Attn = 246, // 0x000000F6 - DBENoroman = 246, // 0x000000F6 - Crsel = 247, // 0x000000F7 - Excel = 248, // 0x000000F8 - EraseEof = 249, // 0x000000F9 - Play = 250, // 0x000000FA - Zoom = 251, // 0x000000FB - NoName = 252, // 0x000000FC - Pa1 = 253, // 0x000000FD - OemClear = 254, // 0x000000FE - GamePadA = 22528, // 0x00005800 - GamePadB = 22529, // 0x00005801 - GamePadX = 22530, // 0x00005802 - GamePadY = 22531, // 0x00005803 - GamePadRShoulder = 22532, // 0x00005804 - GamePadLShoulder = 22533, // 0x00005805 - GamePadLTrigger = 22534, // 0x00005806 - GamePadRTrigger = 22535, // 0x00005807 - GamePadDPadUp = 22544, // 0x00005810 - GamePadDPadDown = 22545, // 0x00005811 - GamePadDPadLeft = 22546, // 0x00005812 - GamePadDPadRight = 22547, // 0x00005813 - GamePadStart = 22548, // 0x00005814 - GamePadLThumbPress = 22550, // 0x00005816 - GamePadRThumbPress = 22551, // 0x00005817 - GamePadLThumbUp = 22560, // 0x00005820 - GamePadLThumbDown = 22561, // 0x00005821 - GamePadLThumbRight = 22562, // 0x00005822 - GamePadLThumbLeft = 22563, // 0x00005823 - GamePadLThumbUpLeft = 22564, // 0x00005824 - GamePadLThumbUpRight = 22565, // 0x00005825 - GamePadLThumbDownRight = 22566, // 0x00005826 - GamePadLThumbDownLeft = 22567, // 0x00005827 - GamePadRThumbUp = 22576, // 0x00005830 - GamePadRThumbDown = 22577, // 0x00005831 - GamePadRThumbRight = 22578, // 0x00005832 - GamePadRThumbLeft = 22579, // 0x00005833 - GamePadRThumbUpLeft = 22580, // 0x00005834 - GamePadRThumbUpRight = 22581, // 0x00005835 - GamePadRThumbDownRight = 22582, // 0x00005836 - GamePadRThumbDownLeft = 22583, // 0x00005837 - GamePadBack = 22597, // 0x00005845 - KeyCode = 65535, // 0x0000FFFF - Shift = 65536, // 0x00010000 - Control = 131072, // 0x00020000 - Alt = 262144, // 0x00040000 - } + public enum Keys + { + Modifiers = -65536, // 0xFFFF0000 + None = 0, + LButton = 1, + RButton = 2, + Cancel = 3, + MButton = 4, + XButton1 = 5, + XButton2 = 6, + Back = 8, + Tab = 9, + LineFeed = 10, // 0x0000000A + Clear = 12, // 0x0000000C + Enter = 13, // 0x0000000D + Return = 13, // 0x0000000D + ShiftKey = 16, // 0x00000010 + ControlKey = 17, // 0x00000011 + Menu = 18, // 0x00000012 + Pause = 19, // 0x00000013 + Capital = 20, // 0x00000014 + CapsLock = 20, // 0x00000014 + HangulMode = 21, // 0x00000015 + KanaMode = 21, // 0x00000015 + JunjaMode = 23, // 0x00000017 + FinalMode = 24, // 0x00000018 + HanjaMode = 25, // 0x00000019 + KanjiMode = 25, // 0x00000019 + Escape = 27, // 0x0000001B + IMEConvert = 28, // 0x0000001C + IMENonconvert = 29, // 0x0000001D + IMEAccept = 30, // 0x0000001E + IMEModeChange = 31, // 0x0000001F + Space = 32, // 0x00000020 + PageUp = 33, // 0x00000021 + Prior = 33, // 0x00000021 + Next = 34, // 0x00000022 + PageDown = 34, // 0x00000022 + End = 35, // 0x00000023 + Home = 36, // 0x00000024 + Left = 37, // 0x00000025 + Up = 38, // 0x00000026 + Right = 39, // 0x00000027 + Down = 40, // 0x00000028 + Select = 41, // 0x00000029 + Print = 42, // 0x0000002A + Execute = 43, // 0x0000002B + PrintScreen = 44, // 0x0000002C + Snapshot = 44, // 0x0000002C + Insert = 45, // 0x0000002D + Delete = 46, // 0x0000002E + D0 = 48, // 0x00000030 + D1 = 49, // 0x00000031 + D2 = 50, // 0x00000032 + D3 = 51, // 0x00000033 + D4 = 52, // 0x00000034 + D5 = 53, // 0x00000035 + D6 = 54, // 0x00000036 + D7 = 55, // 0x00000037 + D8 = 56, // 0x00000038 + D9 = 57, // 0x00000039 + A = 65, // 0x00000041 + B = 66, // 0x00000042 + C = 67, // 0x00000043 + D = 68, // 0x00000044 + E = 69, // 0x00000045 + F = 70, // 0x00000046 + G = 71, // 0x00000047 + H = 72, // 0x00000048 + I = 73, // 0x00000049 + J = 74, // 0x0000004A + K = 75, // 0x0000004B + L = 76, // 0x0000004C + M = 77, // 0x0000004D + N = 78, // 0x0000004E + O = 79, // 0x0000004F + P = 80, // 0x00000050 + Q = 81, // 0x00000051 + R = 82, // 0x00000052 + S = 83, // 0x00000053 + T = 84, // 0x00000054 + U = 85, // 0x00000055 + V = 86, // 0x00000056 + W = 87, // 0x00000057 + X = 88, // 0x00000058 + Y = 89, // 0x00000059 + Z = 90, // 0x0000005A + LWin = 91, // 0x0000005B + RWin = 92, // 0x0000005C + Apps = 93, // 0x0000005D + NumPad0 = 96, // 0x00000060 + NumPad1 = 97, // 0x00000061 + NumPad2 = 98, // 0x00000062 + NumPad3 = 99, // 0x00000063 + NumPad4 = 100, // 0x00000064 + NumPad5 = 101, // 0x00000065 + NumPad6 = 102, // 0x00000066 + NumPad7 = 103, // 0x00000067 + NumPad8 = 104, // 0x00000068 + NumPad9 = 105, // 0x00000069 + Multiply = 106, // 0x0000006A + Add = 107, // 0x0000006B + Separator = 108, // 0x0000006C + Subtract = 109, // 0x0000006D + Decimal = 110, // 0x0000006E + Divide = 111, // 0x0000006F + F1 = 112, // 0x00000070 + F2 = 113, // 0x00000071 + F3 = 114, // 0x00000072 + F4 = 115, // 0x00000073 + F5 = 116, // 0x00000074 + F6 = 117, // 0x00000075 + F7 = 118, // 0x00000076 + F8 = 119, // 0x00000077 + F9 = 120, // 0x00000078 + F10 = 121, // 0x00000079 + F11 = 122, // 0x0000007A + F12 = 123, // 0x0000007B + F13 = 124, // 0x0000007C + F14 = 125, // 0x0000007D + F15 = 126, // 0x0000007E + F16 = 127, // 0x0000007F + F17 = 128, // 0x00000080 + F18 = 129, // 0x00000081 + F19 = 130, // 0x00000082 + F20 = 131, // 0x00000083 + F21 = 132, // 0x00000084 + F22 = 133, // 0x00000085 + F23 = 134, // 0x00000086 + F24 = 135, // 0x00000087 + NumLock = 144, // 0x00000090 + Scroll = 145, // 0x00000091 + LShiftKey = 160, // 0x000000A0 + RShiftKey = 161, // 0x000000A1 + LControlKey = 162, // 0x000000A2 + RControlKey = 163, // 0x000000A3 + LMenu = 164, // 0x000000A4 + RMenu = 165, // 0x000000A5 + BrowserBack = 166, // 0x000000A6 + BrowserForward = 167, // 0x000000A7 + BrowserRefresh = 168, // 0x000000A8 + BrowserStop = 169, // 0x000000A9 + BrowserSearch = 170, // 0x000000AA + BrowserFavorites = 171, // 0x000000AB + BrowserHome = 172, // 0x000000AC + VolumeMute = 173, // 0x000000AD + VolumeDown = 174, // 0x000000AE + VolumeUp = 175, // 0x000000AF + MediaNextTrack = 176, // 0x000000B0 + MediaPreviousTrack = 177, // 0x000000B1 + MediaStop = 178, // 0x000000B2 + MediaPlayPause = 179, // 0x000000B3 + LaunchMail = 180, // 0x000000B4 + SelectMedia = 181, // 0x000000B5 + LaunchApplication1 = 182, // 0x000000B6 + LaunchApplication2 = 183, // 0x000000B7 + OemSemicolon = 186, // 0x000000BA + OemPlus = 187, // 0x000000BB + OemComma = 188, // 0x000000BC + OemMinus = 189, // 0x000000BD + OemPeriod = 190, // 0x000000BE + OemQuestion = 191, // 0x000000BF + OemTilde = 192, // 0x000000C0 + OemOpenBrackets = 219, // 0x000000DB + OemPipe = 220, // 0x000000DC + OemCloseBrackets = 221, // 0x000000DD + OemQuotes = 222, // 0x000000DE + Oem8 = 223, // 0x000000DF + OemBackslash = 226, // 0x000000E2 + ProcessKey = 229, // 0x000000E5 + DBEKatakana = 241, // 0x000000F1 + DBEHiragana = 242, // 0x000000F2 + DBESBCSChar = 243, // 0x000000F3 + DBEDBCSChar = 244, // 0x000000F4 + DBERoman = 245, // 0x000000F5 + Attn = 246, // 0x000000F6 + DBENoroman = 246, // 0x000000F6 + Crsel = 247, // 0x000000F7 + Excel = 248, // 0x000000F8 + EraseEof = 249, // 0x000000F9 + Play = 250, // 0x000000FA + Zoom = 251, // 0x000000FB + NoName = 252, // 0x000000FC + Pa1 = 253, // 0x000000FD + OemClear = 254, // 0x000000FE + GamePadA = 22528, // 0x00005800 + GamePadB = 22529, // 0x00005801 + GamePadX = 22530, // 0x00005802 + GamePadY = 22531, // 0x00005803 + GamePadRShoulder = 22532, // 0x00005804 + GamePadLShoulder = 22533, // 0x00005805 + GamePadLTrigger = 22534, // 0x00005806 + GamePadRTrigger = 22535, // 0x00005807 + GamePadDPadUp = 22544, // 0x00005810 + GamePadDPadDown = 22545, // 0x00005811 + GamePadDPadLeft = 22546, // 0x00005812 + GamePadDPadRight = 22547, // 0x00005813 + GamePadStart = 22548, // 0x00005814 + GamePadLThumbPress = 22550, // 0x00005816 + GamePadRThumbPress = 22551, // 0x00005817 + GamePadLThumbUp = 22560, // 0x00005820 + GamePadLThumbDown = 22561, // 0x00005821 + GamePadLThumbRight = 22562, // 0x00005822 + GamePadLThumbLeft = 22563, // 0x00005823 + GamePadLThumbUpLeft = 22564, // 0x00005824 + GamePadLThumbUpRight = 22565, // 0x00005825 + GamePadLThumbDownRight = 22566, // 0x00005826 + GamePadLThumbDownLeft = 22567, // 0x00005827 + GamePadRThumbUp = 22576, // 0x00005830 + GamePadRThumbDown = 22577, // 0x00005831 + GamePadRThumbRight = 22578, // 0x00005832 + GamePadRThumbLeft = 22579, // 0x00005833 + GamePadRThumbUpLeft = 22580, // 0x00005834 + GamePadRThumbUpRight = 22581, // 0x00005835 + GamePadRThumbDownRight = 22582, // 0x00005836 + GamePadRThumbDownLeft = 22583, // 0x00005837 + GamePadBack = 22597, // 0x00005845 + KeyCode = 65535, // 0x0000FFFF + Shift = 65536, // 0x00010000 + Control = 131072, // 0x00020000 + Alt = 262144, // 0x00040000 + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/MouseButtons.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/MouseButtons.cs index 7a3aca3..96df6f9 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/MouseButtons.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/MouseButtons.cs @@ -8,16 +8,16 @@ using System; namespace Microsoft.Iris.Input { - [Flags] - public enum MouseButtons - { - None = 0, - Left = 1, - Right = 2, - Middle = 4, - XButton1 = 8, - XButton2 = 16, // 0x00000010 - Primary = Left, // 0x00000001 - Secondary = XButton2 | XButton1 | Middle | Right, // 0x0000001E - } + [Flags] + public enum MouseButtons + { + None = 0, + Left = 1, + Right = 2, + Middle = 4, + XButton1 = 8, + XButton2 = 16, // 0x00000010 + Primary = Left, // 0x00000001 + Secondary = XButton2 | XButton1 | Middle | Right, // 0x0000001E + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawDragData.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawDragData.cs index 7c8c597..bf2f72f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawDragData.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawDragData.cs @@ -9,20 +9,20 @@ using System; namespace Microsoft.Iris.Input { - [Serializable] - public struct RawDragData - { - public IVisual _visCapture; - public int _positionX; - public int _positionY; - public IntPtr _pDataStream; - - public RawDragData(IVisual visCapture, int positionX, int positionY, IntPtr pDataStream) + [Serializable] + public struct RawDragData { - this._visCapture = visCapture; - this._positionX = positionX; - this._positionY = positionY; - this._pDataStream = pDataStream; + public IVisual _visCapture; + public int _positionX; + public int _positionY; + public IntPtr _pDataStream; + + public RawDragData(IVisual visCapture, int positionX, int positionY, IntPtr pDataStream) + { + this._visCapture = visCapture; + this._positionX = positionX; + this._positionY = positionY; + this._pDataStream = pDataStream; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawHidData.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawHidData.cs index fccab93..170ac8b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawHidData.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawHidData.cs @@ -8,24 +8,24 @@ using System; namespace Microsoft.Iris.Input { - [Serializable] - public struct RawHidData - { - public uint _commandCode; - public uint _usagePage; - public KeyAction _action; - public InputDeviceType _deviceType; - - public RawHidData( - uint commandCode, - uint usagePage, - KeyAction action, - InputDeviceType deviceType) + [Serializable] + public struct RawHidData { - this._commandCode = commandCode; - this._usagePage = usagePage; - this._action = action; - this._deviceType = deviceType; + public uint _commandCode; + public uint _usagePage; + public KeyAction _action; + public InputDeviceType _deviceType; + + public RawHidData( + uint commandCode, + uint usagePage, + KeyAction action, + InputDeviceType deviceType) + { + this._commandCode = commandCode; + this._usagePage = usagePage; + this._action = action; + this._deviceType = deviceType; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawKeyboardData.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawKeyboardData.cs index 09b9cfd..403dd4c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawKeyboardData.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawKeyboardData.cs @@ -8,27 +8,27 @@ using System; namespace Microsoft.Iris.Input { - [Serializable] - public struct RawKeyboardData - { - public Keys _virtualKey; - public int _scanCode; - public uint _repCount; - public InputDeviceType _deviceType; - public ushort _flags; - - public RawKeyboardData( - Keys virtualKey, - int scanCode, - uint repCount, - ushort flags, - InputDeviceType deviceType) + [Serializable] + public struct RawKeyboardData { - this._virtualKey = virtualKey; - this._scanCode = scanCode; - this._repCount = repCount; - this._deviceType = deviceType; - this._flags = flags; + public Keys _virtualKey; + public int _scanCode; + public uint _repCount; + public InputDeviceType _deviceType; + public ushort _flags; + + public RawKeyboardData( + Keys virtualKey, + int scanCode, + uint repCount, + ushort flags, + InputDeviceType deviceType) + { + this._virtualKey = virtualKey; + this._scanCode = scanCode; + this._repCount = repCount; + this._deviceType = deviceType; + this._flags = flags; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawMouseData.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawMouseData.cs index 757f8b4..7136930 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawMouseData.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Input/RawMouseData.cs @@ -9,48 +9,48 @@ using System; namespace Microsoft.Iris.Input { - [Serializable] - public struct RawMouseData - { - public IVisual _visCapture; - public IVisual _visNatural; - public int _positionX; - public int _positionY; - public int _naturalX; - public int _naturalY; - public int _physicalX; - public int _physicalY; - public int _screenX; - public int _screenY; - public MouseButtons _button; - public int _wheelDelta; - - public RawMouseData( - IVisual visCapture, - IVisual visNatural, - int positionX, - int positionY, - int naturalX, - int naturalY, - int physicalX, - int physicalY, - int screenX, - int screenY, - MouseButtons button, - int wheelDelta) + [Serializable] + public struct RawMouseData { - this._visCapture = visCapture; - this._visNatural = visNatural; - this._positionX = positionX; - this._positionY = positionY; - this._naturalX = naturalX; - this._naturalY = naturalY; - this._physicalX = physicalX; - this._physicalY = physicalY; - this._screenX = screenX; - this._screenY = screenY; - this._button = button; - this._wheelDelta = wheelDelta; + public IVisual _visCapture; + public IVisual _visNatural; + public int _positionX; + public int _positionY; + public int _naturalX; + public int _naturalY; + public int _physicalX; + public int _physicalY; + public int _screenX; + public int _screenY; + public MouseButtons _button; + public int _wheelDelta; + + public RawMouseData( + IVisual visCapture, + IVisual visNatural, + int positionX, + int positionY, + int naturalX, + int naturalY, + int physicalX, + int physicalY, + int screenX, + int screenY, + MouseButtons button, + int wheelDelta) + { + this._visCapture = visCapture; + this._visNatural = visNatural; + this._positionX = positionX; + this._positionY = positionY; + this._naturalX = naturalX; + this._naturalY = naturalY; + this._physicalX = physicalX; + this._physicalY = physicalY; + this._screenX = screenX; + this._screenY = screenY; + this._button = button; + this._wheelDelta = wheelDelta; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Libraries/OS/RegistryKey.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Libraries/OS/RegistryKey.cs index b0aa57d..9b9b92b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Libraries/OS/RegistryKey.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Libraries/OS/RegistryKey.cs @@ -10,105 +10,105 @@ using System.Security; namespace Microsoft.Iris.Libraries.OS { - [SuppressUnmanagedCodeSecurity] - internal class RegistryKey - { - private IntPtr _hkey; - public static IntPtr HKEY_CLASSES_ROOT = new IntPtr(int.MinValue); - public static IntPtr HKEY_CURRENT_USER = new IntPtr(-2147483647); - public static IntPtr HKEY_LOCAL_MACHINE = new IntPtr(-2147483646); - - private RegistryKey(IntPtr hkey) => this._hkey = hkey; - - ~RegistryKey() => this.Close(); - - public static RegistryKey Open(IntPtr hive, string path) => RegistryKey.OpenWorker(hive, path); - - private static RegistryKey OpenWorker(IntPtr parentKey, string path) + [SuppressUnmanagedCodeSecurity] + internal class RegistryKey { - RegistryKey registryKey = (RegistryKey) null; - IntPtr phkResult; - if (Win32Api.RegOpenKeyExW(parentKey, path, 0, 131097, out phkResult) == 0) - registryKey = new RegistryKey(phkResult); - return registryKey; - } + private IntPtr _hkey; + public static IntPtr HKEY_CLASSES_ROOT = new IntPtr(int.MinValue); + public static IntPtr HKEY_CURRENT_USER = new IntPtr(-2147483647); + public static IntPtr HKEY_LOCAL_MACHINE = new IntPtr(-2147483646); - public RegistryKey OpenSubKey(string path) => RegistryKey.OpenWorker(this._hkey, path); + private RegistryKey(IntPtr hkey) => this._hkey = hkey; - public bool ReadByte(string valueName, out byte value) - { - bool flag = false; - value = (byte) 0; - int num = 0; - if (this.ReadInt(valueName, out num) && num >= 0 && num <= (int) byte.MaxValue) - { - value = (byte) num; - flag = true; - } - return flag; - } + ~RegistryKey() => this.Close(); - public bool ReadBool(string valueName, out bool value) - { - bool flag = false; - value = false; - int num = 0; - if (this.ReadInt(valueName, out num)) - { - value = num != 0; - flag = true; - } - return flag; - } + public static RegistryKey Open(IntPtr hive, string path) => RegistryKey.OpenWorker(hive, path); - public bool ReadInt(string valueName, out int value) - { - bool flag = false; - value = 0; - int lpcbData = 4; - int lpType; - int lpData; - if (Win32Api.RegQueryValueExW(this._hkey, valueName, IntPtr.Zero, out lpType, out lpData, ref lpcbData) == 0 && lpType == 4) - { - value = lpData; - flag = true; - } - return flag; - } + private static RegistryKey OpenWorker(IntPtr parentKey, string path) + { + RegistryKey registryKey = (RegistryKey)null; + IntPtr phkResult; + if (Win32Api.RegOpenKeyExW(parentKey, path, 0, 131097, out phkResult) == 0) + registryKey = new RegistryKey(phkResult); + return registryKey; + } - public bool ReadString(string valueName, out string value) - { - bool flag = false; - value = (string) null; - int lpcbData = 0; - int lpType; - if (Win32Api.RegQueryValueExW(this._hkey, valueName, IntPtr.Zero, out lpType, (char[]) null, ref lpcbData) == 0 && lpType == 1) - flag = this.ReadStringValueWorker(valueName, lpcbData, out value); - return flag; - } + public RegistryKey OpenSubKey(string path) => RegistryKey.OpenWorker(this._hkey, path); - private bool ReadStringValueWorker(string valueName, int dataBytes, out string value) - { - value = (string) null; - bool flag = false; - int length = dataBytes / 2; - char[] lpData = new char[length]; - int lpType; - if (Win32Api.RegQueryValueExW(this._hkey, valueName, IntPtr.Zero, out lpType, lpData, ref dataBytes) == 0 && lpType == 1) - { - if (lpData[length - 1] == char.MinValue) - --length; - value = new string(lpData, 0, length); - flag = true; - } - return flag; - } + public bool ReadByte(string valueName, out byte value) + { + bool flag = false; + value = (byte)0; + int num = 0; + if (this.ReadInt(valueName, out num) && num >= 0 && num <= (int)byte.MaxValue) + { + value = (byte)num; + flag = true; + } + return flag; + } - public void Close() - { - Win32Api.RegCloseKey(this._hkey); - this._hkey = IntPtr.Zero; - GC.SuppressFinalize((object) this); + public bool ReadBool(string valueName, out bool value) + { + bool flag = false; + value = false; + int num = 0; + if (this.ReadInt(valueName, out num)) + { + value = num != 0; + flag = true; + } + return flag; + } + + public bool ReadInt(string valueName, out int value) + { + bool flag = false; + value = 0; + int lpcbData = 4; + int lpType; + int lpData; + if (Win32Api.RegQueryValueExW(this._hkey, valueName, IntPtr.Zero, out lpType, out lpData, ref lpcbData) == 0 && lpType == 4) + { + value = lpData; + flag = true; + } + return flag; + } + + public bool ReadString(string valueName, out string value) + { + bool flag = false; + value = (string)null; + int lpcbData = 0; + int lpType; + if (Win32Api.RegQueryValueExW(this._hkey, valueName, IntPtr.Zero, out lpType, (char[])null, ref lpcbData) == 0 && lpType == 1) + flag = this.ReadStringValueWorker(valueName, lpcbData, out value); + return flag; + } + + private bool ReadStringValueWorker(string valueName, int dataBytes, out string value) + { + value = (string)null; + bool flag = false; + int length = dataBytes / 2; + char[] lpData = new char[length]; + int lpType; + if (Win32Api.RegQueryValueExW(this._hkey, valueName, IntPtr.Zero, out lpType, lpData, ref dataBytes) == 0 && lpType == 1) + { + if (lpData[length - 1] == char.MinValue) + --length; + value = new string(lpData, 0, length); + flag = true; + } + return flag; + } + + public void Close() + { + Win32Api.RegCloseKey(this._hkey); + this._hkey = IntPtr.Zero; + GC.SuppressFinalize((object)this); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Library/InvariantString.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Library/InvariantString.cs index 2e24543..84a818b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Library/InvariantString.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Library/InvariantString.cs @@ -10,190 +10,190 @@ using System.Globalization; namespace Microsoft.Iris.Library { - public static class InvariantString - { - public static string Format(string format, object param) => string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param); - - public static string Format(string format, object[] param) => throw new Exception("Should never format with object array. Use one of the dedicated format methods"); - - public static string Format(string format, object param1, object param2) => string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param1, param2); - - public static string Format(string format, object param1, object param2, object param3) => string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param1, param2, param3); - - public static string Format( - string format, - object param1, - object param2, - object param3, - object param4) + public static class InvariantString { - return string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param1, param2, param3, param4); - } + public static string Format(string format, object param) => string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param); - public static string Format( - string format, - object param1, - object param2, - object param3, - object param4, - object param5) - { - return string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5); - } + public static string Format(string format, object[] param) => throw new Exception("Should never format with object array. Use one of the dedicated format methods"); - public static string Format( - string format, - object param1, - object param2, - object param3, - object param4, - object param5, - object param6) - { - return string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6); - } + public static string Format(string format, object param1, object param2) => string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2); - public static string Format( - string format, - object param1, - object param2, - object param3, - object param4, - object param5, - object param6, - object param7) - { - return string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7); - } + public static string Format(string format, object param1, object param2, object param3) => string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3); - public static string Format( - string format, - object param1, - object param2, - object param3, - object param4, - object param5, - object param6, - object param7, - object param8) - { - return string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8); - } - - public static string Format( - string format, - object param1, - object param2, - object param3, - object param4, - object param5, - object param6, - object param7, - object param8, - object param9) - { - return string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9); - } - - public static string Format( - string format, - object param1, - object param2, - object param3, - object param4, - object param5, - object param6, - object param7, - object param8, - object param9, - object param10) - { - return string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); - } - - public static string Format( - string format, - object param1, - object param2, - object param3, - object param4, - object param5, - object param6, - object param7, - object param8, - object param9, - object param10, - object param11) - { - return string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11); - } - - public static bool Equals(string leftName, string rightName) => string.Compare(leftName, rightName, StringComparison.Ordinal) == 0; - - public static bool EqualsI(string leftName, string rightName) => string.Compare(leftName, rightName, StringComparison.OrdinalIgnoreCase) == 0; - - public static bool StartsWith(string valueName, string prefixName) => valueName.StartsWith(prefixName, StringComparison.Ordinal); - - public static bool StartsWithI(string valueName, string prefixName) => valueName.StartsWith(prefixName, StringComparison.OrdinalIgnoreCase); - - public static bool EndsWith(string valueName, string suffixName) => valueName.EndsWith(suffixName, StringComparison.Ordinal); - - public static bool EndsWithI(string valueName, string suffixName) => valueName.EndsWith(suffixName, StringComparison.OrdinalIgnoreCase); - - public static string ValueToString(ushort v, string formatName) => v.ToString(formatName, (IFormatProvider) CultureInfo.InvariantCulture); - - public static IEqualityComparer OrdinalIgnoreCaseComparer => (IEqualityComparer) InvariantString.OrdinalIgnoreCaseStringComparer.Instance; - - public static IEqualityComparer OrdinalComparer => (IEqualityComparer) InvariantString.OrdinalStringComparer.Instance; - - public class OrdinalStringComparer : IEqualityComparer - { - private static InvariantString.OrdinalStringComparer _instance; - - private OrdinalStringComparer() - { - } - - public static InvariantString.OrdinalStringComparer Instance - { - get + public static string Format( + string format, + object param1, + object param2, + object param3, + object param4) { - if (InvariantString.OrdinalStringComparer._instance == null) - InvariantString.OrdinalStringComparer._instance = new InvariantString.OrdinalStringComparer(); - return InvariantString.OrdinalStringComparer._instance; + return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4); } - } - public int Compare(string x, string y) => string.Compare(x, y, StringComparison.Ordinal); - - public int GetHashCode(string obj) => obj.GetHashCode(); - - public bool Equals(string x, string y) => this.Compare(x, y) == 0; - } - - public class OrdinalIgnoreCaseStringComparer : IEqualityComparer - { - private static InvariantString.OrdinalIgnoreCaseStringComparer _instance; - - private OrdinalIgnoreCaseStringComparer() - { - } - - public static InvariantString.OrdinalIgnoreCaseStringComparer Instance - { - get + public static string Format( + string format, + object param1, + object param2, + object param3, + object param4, + object param5) { - if (InvariantString.OrdinalIgnoreCaseStringComparer._instance == null) - InvariantString.OrdinalIgnoreCaseStringComparer._instance = new InvariantString.OrdinalIgnoreCaseStringComparer(); - return InvariantString.OrdinalIgnoreCaseStringComparer._instance; + return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5); } - } - public int Compare(string x, string y) => string.Compare(x, y, StringComparison.OrdinalIgnoreCase); + public static string Format( + string format, + object param1, + object param2, + object param3, + object param4, + object param5, + object param6) + { + return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6); + } - public int GetHashCode(string obj) => obj.ToLowerInvariant().GetHashCode(); + public static string Format( + string format, + object param1, + object param2, + object param3, + object param4, + object param5, + object param6, + object param7) + { + return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7); + } - public bool Equals(string x, string y) => this.Compare(x, y) == 0; + public static string Format( + string format, + object param1, + object param2, + object param3, + object param4, + object param5, + object param6, + object param7, + object param8) + { + return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8); + } + + public static string Format( + string format, + object param1, + object param2, + object param3, + object param4, + object param5, + object param6, + object param7, + object param8, + object param9) + { + return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9); + } + + public static string Format( + string format, + object param1, + object param2, + object param3, + object param4, + object param5, + object param6, + object param7, + object param8, + object param9, + object param10) + { + return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); + } + + public static string Format( + string format, + object param1, + object param2, + object param3, + object param4, + object param5, + object param6, + object param7, + object param8, + object param9, + object param10, + object param11) + { + return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11); + } + + public static bool Equals(string leftName, string rightName) => string.Compare(leftName, rightName, StringComparison.Ordinal) == 0; + + public static bool EqualsI(string leftName, string rightName) => string.Compare(leftName, rightName, StringComparison.OrdinalIgnoreCase) == 0; + + public static bool StartsWith(string valueName, string prefixName) => valueName.StartsWith(prefixName, StringComparison.Ordinal); + + public static bool StartsWithI(string valueName, string prefixName) => valueName.StartsWith(prefixName, StringComparison.OrdinalIgnoreCase); + + public static bool EndsWith(string valueName, string suffixName) => valueName.EndsWith(suffixName, StringComparison.Ordinal); + + public static bool EndsWithI(string valueName, string suffixName) => valueName.EndsWith(suffixName, StringComparison.OrdinalIgnoreCase); + + public static string ValueToString(ushort v, string formatName) => v.ToString(formatName, (IFormatProvider)CultureInfo.InvariantCulture); + + public static IEqualityComparer OrdinalIgnoreCaseComparer => (IEqualityComparer)InvariantString.OrdinalIgnoreCaseStringComparer.Instance; + + public static IEqualityComparer OrdinalComparer => (IEqualityComparer)InvariantString.OrdinalStringComparer.Instance; + + public class OrdinalStringComparer : IEqualityComparer + { + private static InvariantString.OrdinalStringComparer _instance; + + private OrdinalStringComparer() + { + } + + public static InvariantString.OrdinalStringComparer Instance + { + get + { + if (InvariantString.OrdinalStringComparer._instance == null) + InvariantString.OrdinalStringComparer._instance = new InvariantString.OrdinalStringComparer(); + return InvariantString.OrdinalStringComparer._instance; + } + } + + public int Compare(string x, string y) => string.Compare(x, y, StringComparison.Ordinal); + + public int GetHashCode(string obj) => obj.GetHashCode(); + + public bool Equals(string x, string y) => this.Compare(x, y) == 0; + } + + public class OrdinalIgnoreCaseStringComparer : IEqualityComparer + { + private static InvariantString.OrdinalIgnoreCaseStringComparer _instance; + + private OrdinalIgnoreCaseStringComparer() + { + } + + public static InvariantString.OrdinalIgnoreCaseStringComparer Instance + { + get + { + if (InvariantString.OrdinalIgnoreCaseStringComparer._instance == null) + InvariantString.OrdinalIgnoreCaseStringComparer._instance = new InvariantString.OrdinalIgnoreCaseStringComparer(); + return InvariantString.OrdinalIgnoreCaseStringComparer._instance; + } + } + + public int Compare(string x, string y) => string.Compare(x, y, StringComparison.OrdinalIgnoreCase); + + public int GetHashCode(string obj) => obj.ToLowerInvariant().GetHashCode(); + + public bool Equals(string x, string y) => this.Compare(x, y) == 0; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/OS/Libraries/Win32Api.cs b/UIX.RenderApi.Skia/Microsoft/Iris/OS/Libraries/Win32Api.cs index 80b4fa0..81234b7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/OS/Libraries/Win32Api.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/OS/Libraries/Win32Api.cs @@ -10,56 +10,56 @@ using System.Security; namespace Microsoft.Iris.OS.Libraries { - [SuppressUnmanagedCodeSecurity] - internal sealed class Win32Api - { - public const uint ERROR_SUCCESS = 0; - public const uint ERROR_FILE_NOT_FOUND = 2; - public const uint ERROR_PATH_NOT_FOUND = 3; - public const uint ERROR_ACCESS_DENIED = 5; - public const uint ERROR_INVALID_HANDLE = 6; - public const uint ERROR_NOT_ENOUGH_MEMORY = 8; - public const uint ERROR_OUTOFMEMORY = 14; - public const uint ERROR_NOT_SUPPORTED = 50; - public const uint ERROR_INVALID_PARAMETER = 87; - public const uint ERROR_CALL_NOT_IMPLEMENTED = 120; - public const uint ERROR_MORE_DATA = 234; - public const uint ERROR_SERVICE_ALREADY_RUNNING = 1056; - public const uint ERROR_NOT_FOUND = 1168; - public const uint ERROR_NO_MATCH = 1169; - public const uint ERROR_SET_NOT_FOUND = 1170; - public const uint ERROR_SERVICE_DATABASE_LOCKED = 1055; - public const int KEY_READ = 131097; - public const int REG_SZ = 1; - public const int REG_DWORD = 4; + [SuppressUnmanagedCodeSecurity] + internal sealed class Win32Api + { + public const uint ERROR_SUCCESS = 0; + public const uint ERROR_FILE_NOT_FOUND = 2; + public const uint ERROR_PATH_NOT_FOUND = 3; + public const uint ERROR_ACCESS_DENIED = 5; + public const uint ERROR_INVALID_HANDLE = 6; + public const uint ERROR_NOT_ENOUGH_MEMORY = 8; + public const uint ERROR_OUTOFMEMORY = 14; + public const uint ERROR_NOT_SUPPORTED = 50; + public const uint ERROR_INVALID_PARAMETER = 87; + public const uint ERROR_CALL_NOT_IMPLEMENTED = 120; + public const uint ERROR_MORE_DATA = 234; + public const uint ERROR_SERVICE_ALREADY_RUNNING = 1056; + public const uint ERROR_NOT_FOUND = 1168; + public const uint ERROR_NO_MATCH = 1169; + public const uint ERROR_SET_NOT_FOUND = 1170; + public const uint ERROR_SERVICE_DATABASE_LOCKED = 1055; + public const int KEY_READ = 131097; + public const int REG_SZ = 1; + public const int REG_DWORD = 4; - [DllImport("Advapi32.dll", CharSet = CharSet.Unicode)] - public static extern int RegOpenKeyExW( - IntPtr hkey, - string lpSubKey, - int options, - int securityMask, - out IntPtr result); + [DllImport("Advapi32.dll", CharSet = CharSet.Unicode)] + public static extern int RegOpenKeyExW( + IntPtr hkey, + string lpSubKey, + int options, + int securityMask, + out IntPtr result); - [DllImport("Advapi32.dll", CharSet = CharSet.Unicode)] - public static extern int RegQueryValueExW( - IntPtr hKey, - string lpValueName, - IntPtr reserved, - out int lpType, - char[] lpData, - ref int lpcbData); + [DllImport("Advapi32.dll", CharSet = CharSet.Unicode)] + public static extern int RegQueryValueExW( + IntPtr hKey, + string lpValueName, + IntPtr reserved, + out int lpType, + char[] lpData, + ref int lpcbData); - [DllImport("Advapi32.dll", CharSet = CharSet.Unicode)] - public static extern int RegQueryValueExW( - IntPtr hKey, - string lpValueName, - IntPtr reserved, - out int lpType, - out int lpData, - ref int lpcbData); + [DllImport("Advapi32.dll", CharSet = CharSet.Unicode)] + public static extern int RegQueryValueExW( + IntPtr hKey, + string lpValueName, + IntPtr reserved, + out int lpType, + out int lpData, + ref int lpcbData); - [DllImport("Advapi32.dll")] - public static extern int RegCloseKey(IntPtr hkey); - } + [DllImport("Advapi32.dll")] + public static extern int RegCloseKey(IntPtr hkey); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ActivationChangeHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ActivationChangeHandler.cs index 103cfaa..145b664 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ActivationChangeHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ActivationChangeHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void ActivationChangeHandler(); + public delegate void ActivationChangeHandler(); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AlphaOperation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AlphaOperation.cs index e55484f..702a64a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AlphaOperation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AlphaOperation.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render { - public enum AlphaOperation - { - Add, - Subtract, - Multiply, - Source1, - Source2, - } + public enum AlphaOperation + { + Add, + Subtract, + Multiply, + Source1, + Source2, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/Animation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/Animation.cs index 7bee5c8..bffb144 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/Animation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/Animation.cs @@ -10,64 +10,64 @@ using Microsoft.Iris.Render.Protocols.Splash.Rendering; namespace Microsoft.Iris.Render.Animation { - internal abstract class Animation : - SharedRenderObject, - IAnimation, - ISharedRenderObject, - IAnimationCallback - { - public static readonly string OutputProperty = "Output"; - public static readonly string PlayMethod = "Play"; - public static readonly string PauseMethod = "Pause"; - public static readonly string ResetMethod = "Reset"; - public static readonly string FinishMethod = "Finish"; - public static readonly string NotifyMethod = "AsyncNotify"; - - internal Animation() + internal abstract class Animation : + SharedRenderObject, + IAnimation, + ISharedRenderObject, + IAnimationCallback { + public static readonly string OutputProperty = "Output"; + public static readonly string PlayMethod = "Play"; + public static readonly string PauseMethod = "Pause"; + public static readonly string ResetMethod = "Reset"; + public static readonly string FinishMethod = "Finish"; + public static readonly string NotifyMethod = "AsyncNotify"; + + internal Animation() + { + } + + public abstract int RepeatCount { get; set; } + + public abstract bool IsPlaying { get; } + + public abstract bool IsActive { get; } + + public abstract bool AutoReset { get; set; } + + public abstract AnimationResetBehavior ResetBehavior { get; set; } + + public abstract void Play(); + + public abstract void Pause(); + + public abstract void Reset(); + + public abstract void InstantAdvance(float advanceTime); + + public abstract void InstantFinish(); + + void IAnimationCallback.AsyncNotify(RENDERHANDLE target, int nCookie) + { + if (this.AsyncNotifyEvent == null) + return; + this.AsyncNotifyEvent(nCookie); + } + + public event AsyncNotifyHandler AsyncNotifyEvent; + + protected enum AnimatableProperties : uint + { + Output = 1, + } + + protected enum ActivatableMethods : uint + { + Play = 1, + Pause = 2, + Reset = 3, + Finish = 4, + Notify = 5, + } } - - public abstract int RepeatCount { get; set; } - - public abstract bool IsPlaying { get; } - - public abstract bool IsActive { get; } - - public abstract bool AutoReset { get; set; } - - public abstract AnimationResetBehavior ResetBehavior { get; set; } - - public abstract void Play(); - - public abstract void Pause(); - - public abstract void Reset(); - - public abstract void InstantAdvance(float advanceTime); - - public abstract void InstantFinish(); - - void IAnimationCallback.AsyncNotify(RENDERHANDLE target, int nCookie) - { - if (this.AsyncNotifyEvent == null) - return; - this.AsyncNotifyEvent(nCookie); - } - - public event AsyncNotifyHandler AsyncNotifyEvent; - - protected enum AnimatableProperties : uint - { - Output = 1, - } - - protected enum ActivatableMethods : uint - { - Play = 1, - Pause = 2, - Reset = 3, - Finish = 4, - Notify = 5, - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationGroup.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationGroup.cs index bce2fc6..c748ee1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationGroup.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationGroup.cs @@ -8,40 +8,40 @@ using System; namespace Microsoft.Iris.Render.Animation { - internal class AnimationGroup : Microsoft.Iris.Render.Animation.Animation, IAnimationGroup, IAnimation, ISharedRenderObject - { - internal AnimationGroup(AnimationSystem owner) => throw new NotImplementedException("Not implemented yet"); - - public override int RepeatCount + internal class AnimationGroup : Microsoft.Iris.Render.Animation.Animation, IAnimationGroup, IAnimation, ISharedRenderObject { - get => throw new NotImplementedException(); - set => throw new NotImplementedException(); + internal AnimationGroup(AnimationSystem owner) => throw new NotImplementedException("Not implemented yet"); + + public override int RepeatCount + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + public override bool IsPlaying => throw new NotImplementedException(); + + public override bool IsActive => throw new NotImplementedException(); + + public override bool AutoReset + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + public override AnimationResetBehavior ResetBehavior + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + public override void Play() => throw new NotImplementedException(); + + public override void Pause() => throw new NotImplementedException(); + + public override void Reset() => throw new NotImplementedException(); + + public override void InstantAdvance(float advanceTime) => throw new NotImplementedException(); + + public override void InstantFinish() => throw new NotImplementedException(); } - - public override bool IsPlaying => throw new NotImplementedException(); - - public override bool IsActive => throw new NotImplementedException(); - - public override bool AutoReset - { - get => throw new NotImplementedException(); - set => throw new NotImplementedException(); - } - - public override AnimationResetBehavior ResetBehavior - { - get => throw new NotImplementedException(); - set => throw new NotImplementedException(); - } - - public override void Play() => throw new NotImplementedException(); - - public override void Pause() => throw new NotImplementedException(); - - public override void Reset() => throw new NotImplementedException(); - - public override void InstantAdvance(float advanceTime) => throw new NotImplementedException(); - - public override void InstantFinish() => throw new NotImplementedException(); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationInputProvider.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationInputProvider.cs index 4b3455a..cc5c57e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationInputProvider.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationInputProvider.cs @@ -12,89 +12,89 @@ using System; namespace Microsoft.Iris.Render.Animation { - internal class AnimationInputProvider : - SharedRenderObject, - IAnimationInputProvider, - IAnimatable, - ISharedRenderObject, - IRenderHandleOwner - { - private RemoteAnimationInputProvider m_remoteObject; - private ExternalAnimationInput m_externalInput; - - internal AnimationInputProvider( - object objUser, - RenderSession session, - ExternalAnimationInput externalInput) + internal class AnimationInputProvider : + SharedRenderObject, + IAnimationInputProvider, + IAnimatable, + ISharedRenderObject, + IRenderHandleOwner { - Debug2.Validate(externalInput != null, typeof (ArgumentNullException), nameof (externalInput)); - this.m_remoteObject = session.BuildRemoteAnimationInputProvider(this, externalInput.UniqueId); - this.m_externalInput = externalInput; - this.RegisterUsage(objUser); + private RemoteAnimationInputProvider m_remoteObject; + private ExternalAnimationInput m_externalInput; + + internal AnimationInputProvider( + object objUser, + RenderSession session, + ExternalAnimationInput externalInput) + { + Debug2.Validate(externalInput != null, typeof(ArgumentNullException), nameof(externalInput)); + this.m_remoteObject = session.BuildRemoteAnimationInputProvider(this, externalInput.UniqueId); + this.m_externalInput = externalInput; + this.RegisterUsage(objUser); + } + + protected override void Dispose(bool inDispose) + { + try + { + if (inDispose && this.m_remoteObject != null) + this.m_remoteObject.Dispose(); + this.m_remoteObject = (RemoteAnimationInputProvider)null; + this.m_externalInput = (ExternalAnimationInput)null; + } + finally + { + base.Dispose(inDispose); + } + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteAnimationInputProvider)null; + + void IAnimationInputProvider.PublishFloat( + string propertyName, + float value) + { + this.m_remoteObject.SendPublishFloat(((IAnimatableObject)this.m_externalInput).GetPropertyId(propertyName), value); + } + + void IAnimationInputProvider.PublishVector2( + string propertyName, + Vector2 value) + { + this.m_remoteObject.SendPublishVector2(((IAnimatableObject)this.m_externalInput).GetPropertyId(propertyName), value); + } + + void IAnimationInputProvider.PublishVector3( + string propertyName, + Vector3 value) + { + this.m_remoteObject.SendPublishVector3(((IAnimatableObject)this.m_externalInput).GetPropertyId(propertyName), value); + } + + void IAnimationInputProvider.PublishVector4( + string propertyName, + Vector4 value) + { + this.m_remoteObject.SendPublishVector4(((IAnimatableObject)this.m_externalInput).GetPropertyId(propertyName), value); + } + + void IAnimationInputProvider.PublishQuaternion( + string propertyName, + Quaternion value) + { + this.m_remoteObject.SendPublishQuaternion(((IAnimatableObject)this.m_externalInput).GetPropertyId(propertyName), value); + } + + void IAnimationInputProvider.RevokeFloat(string propertyName) => this.m_remoteObject.SendRevokeFloat(((IAnimatableObject)this.m_externalInput).GetPropertyId(propertyName)); + + void IAnimationInputProvider.RevokeVector2(string propertyName) => this.m_remoteObject.SendRevokeVector2(((IAnimatableObject)this.m_externalInput).GetPropertyId(propertyName)); + + void IAnimationInputProvider.RevokeVector3(string propertyName) => this.m_remoteObject.SendRevokeVector3(((IAnimatableObject)this.m_externalInput).GetPropertyId(propertyName)); + + void IAnimationInputProvider.RevokeVector4(string propertyName) => this.m_remoteObject.SendRevokeVector4(((IAnimatableObject)this.m_externalInput).GetPropertyId(propertyName)); + + void IAnimationInputProvider.RevokeQuaternion(string propertyName) => this.m_remoteObject.SendRevokeQuaternion(((IAnimatableObject)this.m_externalInput).GetPropertyId(propertyName)); } - - protected override void Dispose(bool inDispose) - { - try - { - if (inDispose && this.m_remoteObject != null) - this.m_remoteObject.Dispose(); - this.m_remoteObject = (RemoteAnimationInputProvider) null; - this.m_externalInput = (ExternalAnimationInput) null; - } - finally - { - base.Dispose(inDispose); - } - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteAnimationInputProvider) null; - - void IAnimationInputProvider.PublishFloat( - string propertyName, - float value) - { - this.m_remoteObject.SendPublishFloat(((IAnimatableObject) this.m_externalInput).GetPropertyId(propertyName), value); - } - - void IAnimationInputProvider.PublishVector2( - string propertyName, - Vector2 value) - { - this.m_remoteObject.SendPublishVector2(((IAnimatableObject) this.m_externalInput).GetPropertyId(propertyName), value); - } - - void IAnimationInputProvider.PublishVector3( - string propertyName, - Vector3 value) - { - this.m_remoteObject.SendPublishVector3(((IAnimatableObject) this.m_externalInput).GetPropertyId(propertyName), value); - } - - void IAnimationInputProvider.PublishVector4( - string propertyName, - Vector4 value) - { - this.m_remoteObject.SendPublishVector4(((IAnimatableObject) this.m_externalInput).GetPropertyId(propertyName), value); - } - - void IAnimationInputProvider.PublishQuaternion( - string propertyName, - Quaternion value) - { - this.m_remoteObject.SendPublishQuaternion(((IAnimatableObject) this.m_externalInput).GetPropertyId(propertyName), value); - } - - void IAnimationInputProvider.RevokeFloat(string propertyName) => this.m_remoteObject.SendRevokeFloat(((IAnimatableObject) this.m_externalInput).GetPropertyId(propertyName)); - - void IAnimationInputProvider.RevokeVector2(string propertyName) => this.m_remoteObject.SendRevokeVector2(((IAnimatableObject) this.m_externalInput).GetPropertyId(propertyName)); - - void IAnimationInputProvider.RevokeVector3(string propertyName) => this.m_remoteObject.SendRevokeVector3(((IAnimatableObject) this.m_externalInput).GetPropertyId(propertyName)); - - void IAnimationInputProvider.RevokeVector4(string propertyName) => this.m_remoteObject.SendRevokeVector4(((IAnimatableObject) this.m_externalInput).GetPropertyId(propertyName)); - - void IAnimationInputProvider.RevokeQuaternion(string propertyName) => this.m_remoteObject.SendRevokeQuaternion(((IAnimatableObject) this.m_externalInput).GetPropertyId(propertyName)); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationSystem.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationSystem.cs index 41816a7..0c95718 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationSystem.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationSystem.cs @@ -12,119 +12,119 @@ using System; namespace Microsoft.Iris.Render.Animation { - internal class AnimationSystem : SharedRenderObject, IAnimationSystem, IRenderHandleOwner - { - private RenderSession m_ownerSession; - private RemoteAnimationManager m_remoteObject; - private int m_nUpdatesPerSecond; - private float m_flSpeedAdjustment; - private bool m_backCompat; - - internal AnimationSystem(RenderSession ownerSession) + internal class AnimationSystem : SharedRenderObject, IAnimationSystem, IRenderHandleOwner { - this.m_ownerSession = ownerSession; - this.m_remoteObject = ownerSession.BuildRemoteAnimationManager(this); - this.m_flSpeedAdjustment = 1f; - this.m_backCompat = false; - this.RegisterUsage((object) ownerSession); + private RenderSession m_ownerSession; + private RemoteAnimationManager m_remoteObject; + private int m_nUpdatesPerSecond; + private float m_flSpeedAdjustment; + private bool m_backCompat; + + internal AnimationSystem(RenderSession ownerSession) + { + this.m_ownerSession = ownerSession; + this.m_remoteObject = ownerSession.BuildRemoteAnimationManager(this); + this.m_flSpeedAdjustment = 1f; + this.m_backCompat = false; + this.RegisterUsage((object)ownerSession); + } + + protected override void Dispose(bool inDispose) + { + try + { + if (inDispose && this.m_remoteObject != null) + this.m_remoteObject.Dispose(); + this.m_ownerSession = (RenderSession)null; + this.m_remoteObject = (RemoteAnimationManager)null; + } + finally + { + base.Dispose(inDispose); + } + } + + internal RenderSession Session => this.m_ownerSession; + + public bool BackCompat + { + get => this.m_backCompat; + set => this.m_backCompat = value; + } + + IKeyframeAnimation IAnimationSystem.CreateKeyframeAnimation( + object objUser, + AnimationInput initialValue) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + Debug2.Validate(initialValue != null, typeof(ArgumentNullException), nameof(initialValue)); + KeyframeAnimation keyframeAnimation = new KeyframeAnimation(this, initialValue); + keyframeAnimation.RegisterUsage(objUser); + return (IKeyframeAnimation)keyframeAnimation; + } + + IAnimationGroup IAnimationSystem.CreateAnimationGroup( + object objUser) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + AnimationGroup animationGroup = new AnimationGroup(this); + animationGroup.RegisterUsage(objUser); + return (IAnimationGroup)animationGroup; + } + + void IAnimationSystem.PulseTimeAdvance(int nAdvanceMs) => this.PulseTimeAdvance(nAdvanceMs); + + int IAnimationSystem.UpdatesPerSecond + { + get => this.m_nUpdatesPerSecond; + set + { + if (value == this.m_nUpdatesPerSecond) + return; + this.m_nUpdatesPerSecond = value; + this.m_remoteObject.SendSetAnimationRate(this.m_nUpdatesPerSecond); + } + } + + float IAnimationSystem.SpeedAdjustment + { + get => this.m_flSpeedAdjustment; + set + { + if (Math2.WithinEpsilon(this.m_flSpeedAdjustment, value)) + return; + this.m_flSpeedAdjustment = value; + this.m_remoteObject.SendSetGlobalSpeedAdjustment(this.m_flSpeedAdjustment); + } + } + + IExternalAnimationInput IAnimationSystem.CreateExternalAnimationInput( + object objUser, + IAnimationPropertyMap propertyMap) + { + return (IExternalAnimationInput)new ExternalAnimationInput(objUser, this.m_ownerSession, propertyMap); + } + + void IAnimationSystem.PauseAnimations() => this.m_remoteObject.SendSetGlobalSpeedAdjustment(0.0f); + + void IAnimationSystem.StepAnimations(int nAdvanceMs) => this.PulseTimeAdvance(nAdvanceMs); + + void IAnimationSystem.ResumeAnimations() => this.m_remoteObject.SendSetGlobalSpeedAdjustment(this.m_flSpeedAdjustment); + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteAnimationManager)null; + + protected override void Invariant() + { + Debug2.Validate(this.m_remoteObject.IsValid, typeof(InvalidOperationException), "RemoteAnimationManager must be connected"); + this.m_ownerSession.AssertOwningThread(); + } + + private void PulseTimeAdvance(int nAdvanceMs) + { + Debug2.Validate(nAdvanceMs > 0, typeof(ArgumentOutOfRangeException), "advanceTime"); + this.m_remoteObject.SendPulseTimeAdvance(nAdvanceMs); + } } - - protected override void Dispose(bool inDispose) - { - try - { - if (inDispose && this.m_remoteObject != null) - this.m_remoteObject.Dispose(); - this.m_ownerSession = (RenderSession) null; - this.m_remoteObject = (RemoteAnimationManager) null; - } - finally - { - base.Dispose(inDispose); - } - } - - internal RenderSession Session => this.m_ownerSession; - - public bool BackCompat - { - get => this.m_backCompat; - set => this.m_backCompat = value; - } - - IKeyframeAnimation IAnimationSystem.CreateKeyframeAnimation( - object objUser, - AnimationInput initialValue) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - Debug2.Validate(initialValue != null, typeof (ArgumentNullException), nameof (initialValue)); - KeyframeAnimation keyframeAnimation = new KeyframeAnimation(this, initialValue); - keyframeAnimation.RegisterUsage(objUser); - return (IKeyframeAnimation) keyframeAnimation; - } - - IAnimationGroup IAnimationSystem.CreateAnimationGroup( - object objUser) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - AnimationGroup animationGroup = new AnimationGroup(this); - animationGroup.RegisterUsage(objUser); - return (IAnimationGroup) animationGroup; - } - - void IAnimationSystem.PulseTimeAdvance(int nAdvanceMs) => this.PulseTimeAdvance(nAdvanceMs); - - int IAnimationSystem.UpdatesPerSecond - { - get => this.m_nUpdatesPerSecond; - set - { - if (value == this.m_nUpdatesPerSecond) - return; - this.m_nUpdatesPerSecond = value; - this.m_remoteObject.SendSetAnimationRate(this.m_nUpdatesPerSecond); - } - } - - float IAnimationSystem.SpeedAdjustment - { - get => this.m_flSpeedAdjustment; - set - { - if (Math2.WithinEpsilon(this.m_flSpeedAdjustment, value)) - return; - this.m_flSpeedAdjustment = value; - this.m_remoteObject.SendSetGlobalSpeedAdjustment(this.m_flSpeedAdjustment); - } - } - - IExternalAnimationInput IAnimationSystem.CreateExternalAnimationInput( - object objUser, - IAnimationPropertyMap propertyMap) - { - return (IExternalAnimationInput) new ExternalAnimationInput(objUser, this.m_ownerSession, propertyMap); - } - - void IAnimationSystem.PauseAnimations() => this.m_remoteObject.SendSetGlobalSpeedAdjustment(0.0f); - - void IAnimationSystem.StepAnimations(int nAdvanceMs) => this.PulseTimeAdvance(nAdvanceMs); - - void IAnimationSystem.ResumeAnimations() => this.m_remoteObject.SendSetGlobalSpeedAdjustment(this.m_flSpeedAdjustment); - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteAnimationManager) null; - - protected override void Invariant() - { - Debug2.Validate(this.m_remoteObject.IsValid, typeof (InvalidOperationException), "RemoteAnimationManager must be connected"); - this.m_ownerSession.AssertOwningThread(); - } - - private void PulseTimeAdvance(int nAdvanceMs) - { - Debug2.Validate(nAdvanceMs > 0, typeof (ArgumentOutOfRangeException), "advanceTime"); - this.m_remoteObject.SendPulseTimeAdvance(nAdvanceMs); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationTarget.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationTarget.cs index 9137463..5fb09e1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationTarget.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/AnimationTarget.cs @@ -9,42 +9,42 @@ using System.Threading; namespace Microsoft.Iris.Render.Animation { - internal class AnimationTarget : RenderObject - { - private static int s_targetIdSeed; - private int m_targetId; - private IAnimatableObject m_object; - private string m_property; - - internal AnimationTarget(IAnimatableObject targetObject, string targetPropertyName) + internal class AnimationTarget : RenderObject { - int propertyType = (int) targetObject.GetPropertyType(targetPropertyName); - targetObject.RegisterUsage((object) this); - this.m_targetId = Interlocked.Increment(ref AnimationTarget.s_targetIdSeed); - this.m_object = targetObject; - this.m_property = targetPropertyName; + private static int s_targetIdSeed; + private int m_targetId; + private IAnimatableObject m_object; + private string m_property; + + internal AnimationTarget(IAnimatableObject targetObject, string targetPropertyName) + { + int propertyType = (int)targetObject.GetPropertyType(targetPropertyName); + targetObject.RegisterUsage((object)this); + this.m_targetId = Interlocked.Increment(ref AnimationTarget.s_targetIdSeed); + this.m_object = targetObject; + this.m_property = targetPropertyName; + } + + protected override void Dispose(bool fInDispose) + { + try + { + if (fInDispose) + this.m_object.UnregisterUsage((object)this); + this.m_object = (IAnimatableObject)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + internal int TargetId => this.m_targetId; + + internal IAnimatableObject TargetObject => this.m_object; + + internal string TargetPropertyName => this.m_property; + + internal AnimationInputType TargetPropertyType => this.m_object.GetPropertyType(this.m_property); } - - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) - this.m_object.UnregisterUsage((object) this); - this.m_object = (IAnimatableObject) null; - } - finally - { - base.Dispose(fInDispose); - } - } - - internal int TargetId => this.m_targetId; - - internal IAnimatableObject TargetObject => this.m_object; - - internal string TargetPropertyName => this.m_property; - - internal AnimationInputType TargetPropertyType => this.m_object.GetPropertyType(this.m_property); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/ExternalAnimationInput.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/ExternalAnimationInput.cs index b69d526..7512d89 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/ExternalAnimationInput.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/ExternalAnimationInput.cs @@ -12,74 +12,74 @@ using System; namespace Microsoft.Iris.Render.Animation { - internal class ExternalAnimationInput : - SharedRenderObject, - IExternalAnimationInput, - IAnimatableObject, - IAnimatable, - ISharedRenderObject, - IRenderHandleOwner - { - private static uint s_uniqueIdSeed = 1; - private uint m_uniqueId; - private RemoteExternalAnimationInput m_remoteObject; - private IAnimationPropertyMap m_propertyMap; - private RenderSession m_session; - - public ExternalAnimationInput( - object objUser, - RenderSession session, - IAnimationPropertyMap propertyMap) + internal class ExternalAnimationInput : + SharedRenderObject, + IExternalAnimationInput, + IAnimatableObject, + IAnimatable, + ISharedRenderObject, + IRenderHandleOwner { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - Debug2.Validate(propertyMap != null, typeof (ArgumentNullException), nameof (propertyMap)); - this.m_uniqueId = ExternalAnimationInput.s_uniqueIdSeed++; - this.m_propertyMap = propertyMap; - this.m_session = session; - this.m_remoteObject = session.BuildRemoteExternalAnimationInput(this, this.m_uniqueId); - this.RegisterUsage(objUser); + private static uint s_uniqueIdSeed = 1; + private uint m_uniqueId; + private RemoteExternalAnimationInput m_remoteObject; + private IAnimationPropertyMap m_propertyMap; + private RenderSession m_session; + + public ExternalAnimationInput( + object objUser, + RenderSession session, + IAnimationPropertyMap propertyMap) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + Debug2.Validate(propertyMap != null, typeof(ArgumentNullException), nameof(propertyMap)); + this.m_uniqueId = ExternalAnimationInput.s_uniqueIdSeed++; + this.m_propertyMap = propertyMap; + this.m_session = session; + this.m_remoteObject = session.BuildRemoteExternalAnimationInput(this, this.m_uniqueId); + this.RegisterUsage(objUser); + } + + protected override void Dispose(bool inDispose) + { + try + { + if (inDispose && this.m_remoteObject != null) + this.m_remoteObject.Dispose(); + this.m_remoteObject = (RemoteExternalAnimationInput)null; + this.m_propertyMap = (IAnimationPropertyMap)null; + this.m_session = (RenderSession)null; + } + finally + { + base.Dispose(inDispose); + } + } + + public uint UniqueId => this.m_uniqueId; + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() + { + this.m_uniqueId = 0U; + this.m_remoteObject = (RemoteExternalAnimationInput)null; + } + + RENDERHANDLE IAnimatableObject.GetObjectId() => this.m_remoteObject.RenderHandle; + + uint IAnimatableObject.GetPropertyId(string propertyName) => this.m_propertyMap.GetPropertyId(propertyName); + + AnimationInputType IAnimatableObject.GetPropertyType( + string propertyName) + { + return this.m_propertyMap.GetPropertyType(propertyName); + } + + IAnimationInputProvider IExternalAnimationInput.CreateProvider( + object objUser) + { + return (IAnimationInputProvider)new AnimationInputProvider(objUser, this.m_session, this); + } } - - protected override void Dispose(bool inDispose) - { - try - { - if (inDispose && this.m_remoteObject != null) - this.m_remoteObject.Dispose(); - this.m_remoteObject = (RemoteExternalAnimationInput) null; - this.m_propertyMap = (IAnimationPropertyMap) null; - this.m_session = (RenderSession) null; - } - finally - { - base.Dispose(inDispose); - } - } - - public uint UniqueId => this.m_uniqueId; - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() - { - this.m_uniqueId = 0U; - this.m_remoteObject = (RemoteExternalAnimationInput) null; - } - - RENDERHANDLE IAnimatableObject.GetObjectId() => this.m_remoteObject.RenderHandle; - - uint IAnimatableObject.GetPropertyId(string propertyName) => this.m_propertyMap.GetPropertyId(propertyName); - - AnimationInputType IAnimatableObject.GetPropertyType( - string propertyName) - { - return this.m_propertyMap.GetPropertyType(propertyName); - } - - IAnimationInputProvider IExternalAnimationInput.CreateProvider( - object objUser) - { - return (IAnimationInputProvider) new AnimationInputProvider(objUser, this.m_session, this); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/IActivatableObject.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/IActivatableObject.cs index 2431fde..e53006e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/IActivatableObject.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/IActivatableObject.cs @@ -8,10 +8,10 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Animation { - internal interface IActivatableObject : IActivatable - { - RENDERHANDLE GetObjectId(); + internal interface IActivatableObject : IActivatable + { + RENDERHANDLE GetObjectId(); - uint GetMethodId(string methodName); - } + uint GetMethodId(string methodName); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/IAnimatableObject.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/IAnimatableObject.cs index 16ddd8a..f83b046 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/IAnimatableObject.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/IAnimatableObject.cs @@ -8,12 +8,12 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Animation { - internal interface IAnimatableObject : IAnimatable, ISharedRenderObject - { - RENDERHANDLE GetObjectId(); + internal interface IAnimatableObject : IAnimatable, ISharedRenderObject + { + RENDERHANDLE GetObjectId(); - uint GetPropertyId(string propertyName); + uint GetPropertyId(string propertyName); - AnimationInputType GetPropertyType(string propertyName); - } + AnimationInputType GetPropertyType(string propertyName); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/KeyframeAnimation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/KeyframeAnimation.cs index d76a399..41b70f8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/KeyframeAnimation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/KeyframeAnimation.cs @@ -11,557 +11,557 @@ using System; namespace Microsoft.Iris.Render.Animation { - internal class KeyframeAnimation : - Microsoft.Iris.Render.Animation.Animation, - IKeyframeAnimation, - IAnimation, - IRenderHandleOwner, - IAnimatableObject, - IAnimatable, - ISharedRenderObject, - IActivatableObject, - IActivatable - { - private static LinearInterpolation s_defaultInterpolation = new LinearInterpolation(); - private AnimationSystem m_animationSystem; - private RemoteAnimation m_remoteObject; - private AnimationInput m_reference; - private AnimationInput m_scale; - private AnimationInputType m_animationType; - private Vector m_keyframeList; - private Vector m_targetList; - private int m_repeatCount; - private bool m_isActive; - private bool m_isPlaying; - private bool m_autoReset; - private AnimationResetBehavior m_resetBehavior; - - internal KeyframeAnimation(AnimationSystem owner, AnimationInput initialValue) + internal class KeyframeAnimation : + Microsoft.Iris.Render.Animation.Animation, + IKeyframeAnimation, + IAnimation, + IRenderHandleOwner, + IAnimatableObject, + IAnimatable, + ISharedRenderObject, + IActivatableObject, + IActivatable { - this.m_animationSystem = owner; - this.m_reference = (AnimationInput) null; - this.m_scale = (AnimationInput) null; - this.m_animationType = initialValue.InputType; - this.m_keyframeList = new Vector(); - this.m_repeatCount = 0; - this.m_autoReset = false; - this.m_resetBehavior = AnimationResetBehavior.LeaveCurrent; - this.m_animationSystem.RegisterUsage((object) this); - this.m_remoteObject = owner.Session.BuildRemoteAnimation(this, this.m_animationType); - if (this.m_animationSystem.BackCompat) - return; - this.AddKeyframe(new AnimationKeyframe(0.0f, initialValue, (AnimationInterpolation) KeyframeAnimation.s_defaultInterpolation)); - } + private static LinearInterpolation s_defaultInterpolation = new LinearInterpolation(); + private AnimationSystem m_animationSystem; + private RemoteAnimation m_remoteObject; + private AnimationInput m_reference; + private AnimationInput m_scale; + private AnimationInputType m_animationType; + private Vector m_keyframeList; + private Vector m_targetList; + private int m_repeatCount; + private bool m_isActive; + private bool m_isPlaying; + private bool m_autoReset; + private AnimationResetBehavior m_resetBehavior; - protected override void Dispose(bool inDispose) - { - try - { - if (inDispose) + internal KeyframeAnimation(AnimationSystem owner, AnimationInput initialValue) { - this.RemoveAllEvents(); - this.RemoveAllTargets(); - if (this.m_keyframeList != null) - { - foreach (AnimationKeyframe keyframe in this.m_keyframeList) - keyframe.Value.UnregisterUsage((object) this); - this.m_keyframeList.Clear(); - } - if (this.m_remoteObject != null) - this.m_remoteObject.Dispose(); - this.m_animationSystem.UnregisterUsage((object) this); + this.m_animationSystem = owner; + this.m_reference = (AnimationInput)null; + this.m_scale = (AnimationInput)null; + this.m_animationType = initialValue.InputType; + this.m_keyframeList = new Vector(); + this.m_repeatCount = 0; + this.m_autoReset = false; + this.m_resetBehavior = AnimationResetBehavior.LeaveCurrent; + this.m_animationSystem.RegisterUsage((object)this); + this.m_remoteObject = owner.Session.BuildRemoteAnimation(this, this.m_animationType); + if (this.m_animationSystem.BackCompat) + return; + this.AddKeyframe(new AnimationKeyframe(0.0f, initialValue, (AnimationInterpolation)KeyframeAnimation.s_defaultInterpolation)); } - this.m_remoteObject = (RemoteAnimation) null; - this.m_reference = (AnimationInput) null; - this.m_keyframeList = (Vector) null; - this.m_targetList = (Vector) null; - this.m_animationSystem = (AnimationSystem) null; - } - finally - { - base.Dispose(inDispose); - } - } - public override int RepeatCount - { - get => this.m_repeatCount; - set - { - if (this.m_repeatCount == value) - return; - this.m_remoteObject.SendSetRepeatCount(value); - this.m_repeatCount = value; - } - } - - public override bool IsPlaying => this.m_isPlaying; - - public override bool IsActive => this.m_isActive; - - public override bool AutoReset - { - get => this.m_autoReset; - set - { - if (this.m_autoReset == value) - return; - this.m_autoReset = value; - this.m_remoteObject.SendSetAutoReset(value); - } - } - - public override AnimationResetBehavior ResetBehavior - { - get => this.m_resetBehavior; - set - { - if (this.m_resetBehavior == value) - return; - this.m_resetBehavior = value; - this.m_remoteObject.SendSetResetBehavior(value); - } - } - - public override void Play() - { - this.m_isActive = true; - this.m_isPlaying = true; - this.m_remoteObject.SendPlay(); - } - - public override void Pause() - { - if (this.m_isActive) - this.m_isPlaying = false; - this.m_remoteObject.SendPause(); - } - - public override void Reset() - { - this.m_isActive = false; - this.m_isPlaying = false; - this.m_remoteObject.SendReset(); - } - - public override void InstantAdvance(float advanceTime) - { - Debug2.Validate((double) advanceTime >= 0.0, typeof (ArgumentOutOfRangeException), nameof (advanceTime)); - this.m_remoteObject.SendInstantAdvance(advanceTime); - } - - public override void InstantFinish() => this.m_remoteObject.SendInstantFinish(); - - public AnimationInputType Type => this.m_animationType; - - public AnimationInput InitialValue => this.GetKeyframe(0).Value; - - public int KeyframeCount => this.m_keyframeList.Count; - - public AnimationInput Reference - { - get => this.m_reference; - set - { - this.SendInput(-1, value); - this.m_reference = value; - } - } - - public AnimationInput Scale - { - get => this.m_scale; - set - { - this.SendInput(-2, value); - this.m_scale = value; - } - } - - void IKeyframeAnimation.AddKeyframe(AnimationKeyframe keyframe) - { - Debug2.Validate(keyframe != null, typeof (ArgumentNullException), nameof (keyframe)); - this.AddKeyframe(keyframe); - } - - internal void AddKeyframe(AnimationKeyframe keyframe) - { - this.m_keyframeList.Add((object) keyframe); - this.m_remoteObject.SendAddKeyframe(this.m_keyframeList.Count - 1, keyframe.Time); - this.SetKeyframe(this.m_keyframeList.Count - 1, keyframe, false); - } - - AnimationKeyframe IKeyframeAnimation.GetKeyframe( - int keyframeIndex) - { - Debug2.Validate(keyframeIndex >= 0 || keyframeIndex < this.m_keyframeList.Count, typeof (ArgumentOutOfRangeException), nameof (keyframeIndex)); - return this.GetKeyframe(keyframeIndex); - } - - internal AnimationKeyframe GetKeyframe(int keyframeIndex) => this.m_keyframeList[keyframeIndex] as AnimationKeyframe; - - void IKeyframeAnimation.SetKeyframe( - int keyframeIndex, - AnimationKeyframe keyframe) - { - Debug2.Validate(keyframe != null, typeof (ArgumentNullException), nameof (keyframe)); - Debug2.Validate(keyframeIndex >= 0 || keyframeIndex < this.m_keyframeList.Count, typeof (ArgumentOutOfRangeException), nameof (keyframeIndex)); - if (keyframeIndex == 0 && !this.m_animationSystem.BackCompat) - Debug2.Validate((double) keyframe.Time == 0.0, typeof (ArgumentException), "Cannot change the time for keyframe 0"); - this.SetKeyframe(keyframeIndex, keyframe, true); - } - - internal void SetKeyframe(int keyframeIndex, AnimationKeyframe keyframe, bool replaceKeyframe) - { - keyframe.Value.RegisterUsage((object) this); - if (replaceKeyframe) - { - AnimationKeyframe keyframe1 = (AnimationKeyframe) this.m_keyframeList[keyframeIndex]; - this.m_keyframeList.RemoveAt(keyframeIndex); - this.m_keyframeList.Insert(keyframeIndex, (object) keyframe); - keyframe1.Value.UnregisterUsage((object) this); - } - this.m_remoteObject.SendSetKeyframeTime(keyframeIndex, keyframe.Time); - this.SendInput(keyframeIndex, keyframe.Value); - this.SendInterpolation(keyframeIndex, keyframe.Interpolation); - } - - void IKeyframeAnimation.AddTarget( - IAnimatable targetObject, - string targetPropertyName) - { - Debug2.Validate(targetObject is IAnimatableObject, typeof (ArgumentException), nameof (targetObject)); - this.AddTarget((IAnimatableObject) targetObject, targetPropertyName, (string) null); - } - - void IKeyframeAnimation.AddTarget( - IAnimatable targetObject, - string targetPropertyName, - string targetMask) - { - Debug2.Validate(targetObject is IAnimatableObject, typeof (ArgumentException), nameof (targetObject)); - this.AddTarget((IAnimatableObject) targetObject, targetPropertyName, targetMask); - } - - internal void AddTarget( - IAnimatableObject targetObject, - string targetPropertyName, - string targetMaskSpec) - { - Debug2.Validate(targetObject != null, typeof (ArgumentNullException), nameof (targetObject)); - Debug2.Validate(targetPropertyName != null, typeof (ArgumentNullException), nameof (targetPropertyName)); - Debug2.Validate(!(targetObject is IAnimation), typeof (ArgumentException), "Animations can't be set as animation targets"); - AnimationTarget target = new AnimationTarget(targetObject, targetPropertyName); - AnimationTypeMask sourceMask = AnimationTypeMask.FromString(targetMaskSpec); - if (!sourceMask.CanMapFromType(this.m_animationType)) - throw new ArgumentException(string.Format("Mask cannot be applied to a {0} animation", (object) this.m_animationType)); - if (!sourceMask.CanMapToType(target.TargetPropertyType)) - throw new ArgumentException(string.Format("Mask cannot be applied to a property of type {0}", (object) target.TargetPropertyType)); - uint propertyInfo = this.GeneratePropertyInfo(target.TargetPropertyType, sourceMask); - this.m_remoteObject.SendAddTarget(target.TargetId, target.TargetObject.GetObjectId(), target.TargetObject.GetPropertyId(target.TargetPropertyName), propertyInfo); - if (this.m_targetList == null) - this.m_targetList = new Vector(); - this.m_targetList.Add((object) new KeyframeAnimation.AnimationTargetInfo(target, targetMaskSpec)); - } - - void IKeyframeAnimation.RemoveTarget( - IAnimatable targetObject, - string targetPropertyName, - string targetMaskSpec) - { - Debug2.Validate(targetObject != null, typeof (ArgumentNullException), nameof (targetObject)); - Debug2.Validate(targetPropertyName != null, typeof (ArgumentNullException), nameof (targetPropertyName)); - KeyframeAnimation.AnimationTargetInfo animationTargetInfo = (KeyframeAnimation.AnimationTargetInfo) null; - if (this.m_targetList != null) - { - foreach (KeyframeAnimation.AnimationTargetInfo target in this.m_targetList) + protected override void Dispose(bool inDispose) { - if (target.Target.TargetObject == targetObject && target.Target.TargetPropertyName == targetPropertyName && string.Compare(target.MaskSpec, targetMaskSpec, StringComparison.OrdinalIgnoreCase) == 0) - { - animationTargetInfo = target; - break; - } + try + { + if (inDispose) + { + this.RemoveAllEvents(); + this.RemoveAllTargets(); + if (this.m_keyframeList != null) + { + foreach (AnimationKeyframe keyframe in this.m_keyframeList) + keyframe.Value.UnregisterUsage((object)this); + this.m_keyframeList.Clear(); + } + if (this.m_remoteObject != null) + this.m_remoteObject.Dispose(); + this.m_animationSystem.UnregisterUsage((object)this); + } + this.m_remoteObject = (RemoteAnimation)null; + this.m_reference = (AnimationInput)null; + this.m_keyframeList = (Vector)null; + this.m_targetList = (Vector)null; + this.m_animationSystem = (AnimationSystem)null; + } + finally + { + base.Dispose(inDispose); + } + } + + public override int RepeatCount + { + get => this.m_repeatCount; + set + { + if (this.m_repeatCount == value) + return; + this.m_remoteObject.SendSetRepeatCount(value); + this.m_repeatCount = value; + } + } + + public override bool IsPlaying => this.m_isPlaying; + + public override bool IsActive => this.m_isActive; + + public override bool AutoReset + { + get => this.m_autoReset; + set + { + if (this.m_autoReset == value) + return; + this.m_autoReset = value; + this.m_remoteObject.SendSetAutoReset(value); + } + } + + public override AnimationResetBehavior ResetBehavior + { + get => this.m_resetBehavior; + set + { + if (this.m_resetBehavior == value) + return; + this.m_resetBehavior = value; + this.m_remoteObject.SendSetResetBehavior(value); + } + } + + public override void Play() + { + this.m_isActive = true; + this.m_isPlaying = true; + this.m_remoteObject.SendPlay(); + } + + public override void Pause() + { + if (this.m_isActive) + this.m_isPlaying = false; + this.m_remoteObject.SendPause(); + } + + public override void Reset() + { + this.m_isActive = false; + this.m_isPlaying = false; + this.m_remoteObject.SendReset(); + } + + public override void InstantAdvance(float advanceTime) + { + Debug2.Validate((double)advanceTime >= 0.0, typeof(ArgumentOutOfRangeException), nameof(advanceTime)); + this.m_remoteObject.SendInstantAdvance(advanceTime); + } + + public override void InstantFinish() => this.m_remoteObject.SendInstantFinish(); + + public AnimationInputType Type => this.m_animationType; + + public AnimationInput InitialValue => this.GetKeyframe(0).Value; + + public int KeyframeCount => this.m_keyframeList.Count; + + public AnimationInput Reference + { + get => this.m_reference; + set + { + this.SendInput(-1, value); + this.m_reference = value; + } + } + + public AnimationInput Scale + { + get => this.m_scale; + set + { + this.SendInput(-2, value); + this.m_scale = value; + } + } + + void IKeyframeAnimation.AddKeyframe(AnimationKeyframe keyframe) + { + Debug2.Validate(keyframe != null, typeof(ArgumentNullException), nameof(keyframe)); + this.AddKeyframe(keyframe); + } + + internal void AddKeyframe(AnimationKeyframe keyframe) + { + this.m_keyframeList.Add((object)keyframe); + this.m_remoteObject.SendAddKeyframe(this.m_keyframeList.Count - 1, keyframe.Time); + this.SetKeyframe(this.m_keyframeList.Count - 1, keyframe, false); + } + + AnimationKeyframe IKeyframeAnimation.GetKeyframe( + int keyframeIndex) + { + Debug2.Validate(keyframeIndex >= 0 || keyframeIndex < this.m_keyframeList.Count, typeof(ArgumentOutOfRangeException), nameof(keyframeIndex)); + return this.GetKeyframe(keyframeIndex); + } + + internal AnimationKeyframe GetKeyframe(int keyframeIndex) => this.m_keyframeList[keyframeIndex] as AnimationKeyframe; + + void IKeyframeAnimation.SetKeyframe( + int keyframeIndex, + AnimationKeyframe keyframe) + { + Debug2.Validate(keyframe != null, typeof(ArgumentNullException), nameof(keyframe)); + Debug2.Validate(keyframeIndex >= 0 || keyframeIndex < this.m_keyframeList.Count, typeof(ArgumentOutOfRangeException), nameof(keyframeIndex)); + if (keyframeIndex == 0 && !this.m_animationSystem.BackCompat) + Debug2.Validate((double)keyframe.Time == 0.0, typeof(ArgumentException), "Cannot change the time for keyframe 0"); + this.SetKeyframe(keyframeIndex, keyframe, true); + } + + internal void SetKeyframe(int keyframeIndex, AnimationKeyframe keyframe, bool replaceKeyframe) + { + keyframe.Value.RegisterUsage((object)this); + if (replaceKeyframe) + { + AnimationKeyframe keyframe1 = (AnimationKeyframe)this.m_keyframeList[keyframeIndex]; + this.m_keyframeList.RemoveAt(keyframeIndex); + this.m_keyframeList.Insert(keyframeIndex, (object)keyframe); + keyframe1.Value.UnregisterUsage((object)this); + } + this.m_remoteObject.SendSetKeyframeTime(keyframeIndex, keyframe.Time); + this.SendInput(keyframeIndex, keyframe.Value); + this.SendInterpolation(keyframeIndex, keyframe.Interpolation); + } + + void IKeyframeAnimation.AddTarget( + IAnimatable targetObject, + string targetPropertyName) + { + Debug2.Validate(targetObject is IAnimatableObject, typeof(ArgumentException), nameof(targetObject)); + this.AddTarget((IAnimatableObject)targetObject, targetPropertyName, (string)null); + } + + void IKeyframeAnimation.AddTarget( + IAnimatable targetObject, + string targetPropertyName, + string targetMask) + { + Debug2.Validate(targetObject is IAnimatableObject, typeof(ArgumentException), nameof(targetObject)); + this.AddTarget((IAnimatableObject)targetObject, targetPropertyName, targetMask); + } + + internal void AddTarget( + IAnimatableObject targetObject, + string targetPropertyName, + string targetMaskSpec) + { + Debug2.Validate(targetObject != null, typeof(ArgumentNullException), nameof(targetObject)); + Debug2.Validate(targetPropertyName != null, typeof(ArgumentNullException), nameof(targetPropertyName)); + Debug2.Validate(!(targetObject is IAnimation), typeof(ArgumentException), "Animations can't be set as animation targets"); + AnimationTarget target = new AnimationTarget(targetObject, targetPropertyName); + AnimationTypeMask sourceMask = AnimationTypeMask.FromString(targetMaskSpec); + if (!sourceMask.CanMapFromType(this.m_animationType)) + throw new ArgumentException(string.Format("Mask cannot be applied to a {0} animation", (object)this.m_animationType)); + if (!sourceMask.CanMapToType(target.TargetPropertyType)) + throw new ArgumentException(string.Format("Mask cannot be applied to a property of type {0}", (object)target.TargetPropertyType)); + uint propertyInfo = this.GeneratePropertyInfo(target.TargetPropertyType, sourceMask); + this.m_remoteObject.SendAddTarget(target.TargetId, target.TargetObject.GetObjectId(), target.TargetObject.GetPropertyId(target.TargetPropertyName), propertyInfo); + if (this.m_targetList == null) + this.m_targetList = new Vector(); + this.m_targetList.Add((object)new KeyframeAnimation.AnimationTargetInfo(target, targetMaskSpec)); + } + + void IKeyframeAnimation.RemoveTarget( + IAnimatable targetObject, + string targetPropertyName, + string targetMaskSpec) + { + Debug2.Validate(targetObject != null, typeof(ArgumentNullException), nameof(targetObject)); + Debug2.Validate(targetPropertyName != null, typeof(ArgumentNullException), nameof(targetPropertyName)); + KeyframeAnimation.AnimationTargetInfo animationTargetInfo = (KeyframeAnimation.AnimationTargetInfo)null; + if (this.m_targetList != null) + { + foreach (KeyframeAnimation.AnimationTargetInfo target in this.m_targetList) + { + if (target.Target.TargetObject == targetObject && target.Target.TargetPropertyName == targetPropertyName && string.Compare(target.MaskSpec, targetMaskSpec, StringComparison.OrdinalIgnoreCase) == 0) + { + animationTargetInfo = target; + break; + } + } + } + if (animationTargetInfo == null) + return; + this.m_remoteObject.SendRemoveTarget(animationTargetInfo.Target.TargetId); + this.m_targetList.Remove((object)animationTargetInfo); + animationTargetInfo.Target.Dispose(); + } + + void IKeyframeAnimation.RemoveAllTargets() => this.RemoveAllTargets(); + + internal void RemoveAllTargets() + { + if (this.m_targetList == null) + return; + foreach (KeyframeAnimation.AnimationTargetInfo target in this.m_targetList) + { + this.m_remoteObject.SendRemoveTarget(target.Target.TargetId); + target.Target.Dispose(); + } + this.m_targetList.Clear(); + } + + void IKeyframeAnimation.AddStageEvent( + AnimationStage animationStage, + AnimationEvent animationEvent) + { + Debug2.Validate(animationEvent != null, typeof(ArgumentNullException), nameof(animationEvent)); + Debug2.Validate(animationStage < AnimationStage.Count, typeof(ArgumentException), "invalid animation stage"); + RENDERHANDLE targetObjectId = animationEvent.TargetObjectId; + if (!(targetObjectId != RENDERHANDLE.NULL)) + return; + this.m_remoteObject.SendAddStageEvent(animationEvent.EventId, animationStage, targetObjectId, animationEvent.TargetMethodId, animationEvent.TargetMethodArg, animationEvent.InitialActivation, animationEvent.AllowRepeat); + } + + void IKeyframeAnimation.AddTimeEvent( + float absoluteTime, + AnimationEvent animationEvent) + { + Debug2.Validate(animationEvent != null, typeof(ArgumentNullException), nameof(animationEvent)); + Debug2.Validate((double)absoluteTime >= 0.0, typeof(ArgumentException), "absoluteTime value must be >= 0.0f"); + RENDERHANDLE targetObjectId = animationEvent.TargetObjectId; + if (!(targetObjectId != RENDERHANDLE.NULL)) + return; + this.m_remoteObject.SendAddTimeEvent(animationEvent.EventId, absoluteTime, targetObjectId, animationEvent.TargetMethodId, animationEvent.TargetMethodArg, animationEvent.InitialActivation, animationEvent.AllowRepeat); + } + + void IKeyframeAnimation.AddProgressEvent( + float progress, + AnimationEvent animationEvent) + { + Debug2.Validate(animationEvent != null, typeof(ArgumentNullException), nameof(animationEvent)); + Debug2.Validate((double)progress >= 0.0 && (double)progress <= 1.0, typeof(ArgumentException), "'progress' value must be between 0.0f and 1.0f"); + RENDERHANDLE targetObjectId = animationEvent.TargetObjectId; + if (!(targetObjectId != RENDERHANDLE.NULL)) + return; + this.m_remoteObject.SendAddProgressEvent(animationEvent.EventId, progress, targetObjectId, animationEvent.TargetMethodId, animationEvent.TargetMethodArg, animationEvent.InitialActivation, animationEvent.AllowRepeat); + } + + void IKeyframeAnimation.AddValueEvent( + ValueEventCondition condition, + AnimationInput reference, + AnimationEvent animationEvent) + { + Debug2.Validate(animationEvent != null, typeof(ArgumentNullException), nameof(animationEvent)); + Debug2.Validate(reference != null, typeof(ArgumentNullException), nameof(reference)); + Debug2.Validate(condition < ValueEventCondition.Count, typeof(ArgumentNullException), nameof(condition)); + RENDERHANDLE targetObjectId = animationEvent.TargetObjectId; + if (!(targetObjectId != RENDERHANDLE.NULL)) + return; + this.SendInput(-3, reference); + this.m_remoteObject.SendAddValueEvent(animationEvent.EventId, condition, targetObjectId, animationEvent.TargetMethodId, animationEvent.TargetMethodArg, animationEvent.InitialActivation, animationEvent.AllowRepeat); + } + + void IKeyframeAnimation.RemoveEvent(AnimationEvent animationEvent) + { + Debug2.Validate(animationEvent != null, typeof(ArgumentNullException), nameof(animationEvent)); + this.m_remoteObject.SendRemoveEvent(animationEvent.EventId); + } + + void IKeyframeAnimation.RemoveAllEvents() => this.RemoveAllEvents(); + + internal void RemoveAllEvents() => this.m_remoteObject.SendRemoveAllEvents(); + + RENDERHANDLE IAnimatableObject.GetObjectId() => ((IRenderHandleOwner)this).RenderHandle; + + uint IAnimatableObject.GetPropertyId(string propertyName) + { + if (string.Compare(propertyName, Microsoft.Iris.Render.Animation.Animation.OutputProperty, StringComparison.OrdinalIgnoreCase) == 0) + return 1; + Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported property: {0}", (object)propertyName); + return 0; + } + + AnimationInputType IAnimatableObject.GetPropertyType( + string propertyName) + { + if (string.Compare(propertyName, Microsoft.Iris.Render.Animation.Animation.OutputProperty, StringComparison.OrdinalIgnoreCase) == 0) + return this.Type; + Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported property: {0}", (object)propertyName); + return AnimationInputType.Float; + } + + RENDERHANDLE IActivatableObject.GetObjectId() => ((IRenderHandleOwner)this).RenderHandle; + + uint IActivatableObject.GetMethodId(string methodName) + { + if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.PlayMethod, StringComparison.OrdinalIgnoreCase) == 0) + return 1; + if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.PauseMethod, StringComparison.OrdinalIgnoreCase) == 0) + return 2; + if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.ResetMethod, StringComparison.OrdinalIgnoreCase) == 0) + return 3; + if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.FinishMethod, StringComparison.OrdinalIgnoreCase) == 0) + return 4; + if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.NotifyMethod, StringComparison.OrdinalIgnoreCase) == 0) + return 5; + Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported method: {0}", (object)methodName); + return 0; + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteAnimation)null; + + private void SendInput(int keyframeIndex, AnimationInput input) + { + Debug2.Validate(input != null, typeof(ArgumentNullException), "keyframe.Value.InputType"); + Debug2.Validate(input.InputType == this.m_animationType, typeof(ArgumentException), "keyframe.Value.InputType"); + Debug2.Validate(input.InputType == AnimationInputType.Float || input.InputType == AnimationInputType.Vector2 || (input.InputType == AnimationInputType.Vector3 || input.InputType == AnimationInputType.Vector4) || input.InputType == AnimationInputType.Quaternion, typeof(ArgumentException), "keyframe.Value.InputType"); + int num; + switch (input) + { + case ConstantAnimationInput _: + case ContinuousAnimationInput _: + case CapturedAnimationInput _: + num = 1; + break; + default: + num = input is BinaryOperation ? 1 : 0; + break; + } + System.Type exceptionType = typeof(ArgumentException); + Debug2.Validate(num != 0, exceptionType, "Invalid animation input in keyframe"); + this.m_remoteObject.SendBeginAnimationInput(keyframeIndex); + this.SendInputWorker(keyframeIndex, input); + this.m_remoteObject.SendEndAnimationInput(keyframeIndex); + } + + private void SendInputWorker(int keyframeIndex, AnimationInput input) + { + switch (input) + { + case ConstantAnimationInput _: + ConstantAnimationInput constantAnimationInput = (ConstantAnimationInput)input; + switch (constantAnimationInput.InputType) + { + case AnimationInputType.Float: + this.m_remoteObject.SendSetFloat(keyframeIndex, (float)constantAnimationInput.RawValue); + return; + case AnimationInputType.Vector2: + this.m_remoteObject.SendSetVector2(keyframeIndex, (Vector2)constantAnimationInput.RawValue); + return; + case AnimationInputType.Vector3: + this.m_remoteObject.SendSetVector3(keyframeIndex, (Vector3)constantAnimationInput.RawValue); + return; + case AnimationInputType.Vector4: + this.m_remoteObject.SendSetVector4(keyframeIndex, (Vector4)constantAnimationInput.RawValue); + return; + case AnimationInputType.Quaternion: + this.m_remoteObject.SendSetQuaternion(keyframeIndex, (Quaternion)constantAnimationInput.RawValue); + return; + default: + Debug2.Throw(false, "Unexpected constant input type"); + return; + } + case CapturedAnimationInput _: + uint propertyInfo1 = this.GeneratePropertyInfo(input.SourceType, input.SourceMask); + CapturedAnimationInput capturedAnimationInput = (CapturedAnimationInput)input; + this.m_remoteObject.SendSetCaptured(keyframeIndex, capturedAnimationInput.ObjectId, capturedAnimationInput.PropertyId, propertyInfo1, capturedAnimationInput.RefreshOnRepeat); + break; + case ContinuousAnimationInput _: + uint propertyInfo2 = this.GeneratePropertyInfo(input.SourceType, input.SourceMask); + ContinuousAnimationInput continuousAnimationInput = (ContinuousAnimationInput)input; + this.m_remoteObject.SendSetContinuous(keyframeIndex, continuousAnimationInput.ObjectId, continuousAnimationInput.PropertyId, propertyInfo2); + break; + case BinaryOperation _: + BinaryOperation binaryOperation = (BinaryOperation)input; + this.SendInputWorker(keyframeIndex, binaryOperation.LeftOperand); + this.SendInputWorker(keyframeIndex, binaryOperation.RightOperand); + this.m_remoteObject.SendSetBinaryOperation(keyframeIndex, binaryOperation.Operation); + break; + default: + Debug2.Throw(false, "Unexpected animation input type!"); + break; + } + } + + private void SendInterpolation(int keyframeIndex, AnimationInterpolation interpolation) + { + int num; + switch (interpolation) + { + case LinearInterpolation _: + case ExponentialInterpolation _: + case LogarithmicInterpolation _: + case SCurveInterpolation _: + case SineInterpolation _: + case CosineInterpolation _: + case BezierInterpolation _: + case EaseInInterpolation _: + num = 1; + break; + default: + num = interpolation is EaseOutInterpolation ? 1 : 0; + break; + } + System.Type exceptionType = typeof(ArgumentException); + Debug2.Validate(num != 0, exceptionType, "Invalid interpolation in keyframe"); + int idxKeyframe = !this.m_animationSystem.BackCompat ? (keyframeIndex > 0 ? keyframeIndex - 1 : 0) : keyframeIndex; + switch (interpolation) + { + case LinearInterpolation _: + this.m_remoteObject.SendSetLinear(idxKeyframe, interpolation.UseSphericalCombination); + break; + case ExponentialInterpolation _: + ExponentialInterpolation exponentialInterpolation = (ExponentialInterpolation)interpolation; + this.m_remoteObject.SendSetExponential(idxKeyframe, interpolation.UseSphericalCombination, exponentialInterpolation.Weight); + break; + case LogarithmicInterpolation _: + LogarithmicInterpolation logarithmicInterpolation = (LogarithmicInterpolation)interpolation; + this.m_remoteObject.SendSetLogarithmic(idxKeyframe, interpolation.UseSphericalCombination, logarithmicInterpolation.Weight); + break; + case SCurveInterpolation _: + SCurveInterpolation scurveInterpolation = (SCurveInterpolation)interpolation; + this.m_remoteObject.SendSetSCurve(idxKeyframe, interpolation.UseSphericalCombination, scurveInterpolation.Weight); + break; + case SineInterpolation _: + this.m_remoteObject.SendSetSine(idxKeyframe, interpolation.UseSphericalCombination); + break; + case CosineInterpolation _: + this.m_remoteObject.SendSetCosine(idxKeyframe, interpolation.UseSphericalCombination); + break; + case BezierInterpolation _: + BezierInterpolation bezierInterpolation = (BezierInterpolation)interpolation; + this.m_remoteObject.SendSetBezier(idxKeyframe, interpolation.UseSphericalCombination, bezierInterpolation.ControlPoint1, bezierInterpolation.ControlPoint2); + break; + case EaseInInterpolation _: + EaseInInterpolation easeInInterpolation = (EaseInInterpolation)interpolation; + this.m_remoteObject.SendSetEaseIn(idxKeyframe, interpolation.UseSphericalCombination, easeInInterpolation.Weight, easeInInterpolation.Handle); + break; + case EaseOutInterpolation _: + EaseOutInterpolation outInterpolation = (EaseOutInterpolation)interpolation; + this.m_remoteObject.SendSetEaseOut(idxKeyframe, interpolation.UseSphericalCombination, outInterpolation.Weight, outInterpolation.Handle); + break; + default: + Debug2.Throw(false, "Unexpected interpolation!"); + break; + } + } + + private uint GeneratePropertyInfo(AnimationInputType sourceType, AnimationTypeMask sourceMask) => (uint)((int)(sourceType & (AnimationInputType.Vector4 | AnimationInputType.Quaternion)) << 19 | ((int)sourceMask.ChannelCount & 7) << 16 | (int)sourceMask.MaskCode & (int)ushort.MaxValue); + + private enum KeyframeSlots + { + ValueEvent = -3, // 0xFFFFFFFD + Scale = -2, // 0xFFFFFFFE + Reference = -1, // 0xFFFFFFFF + Default = 0, + } + + private class AnimationTargetInfo + { + internal AnimationTarget Target; + internal string MaskSpec; + + internal AnimationTargetInfo(AnimationTarget target, string maskSpec) + { + this.Target = target; + this.MaskSpec = maskSpec; + } } - } - if (animationTargetInfo == null) - return; - this.m_remoteObject.SendRemoveTarget(animationTargetInfo.Target.TargetId); - this.m_targetList.Remove((object) animationTargetInfo); - animationTargetInfo.Target.Dispose(); } - - void IKeyframeAnimation.RemoveAllTargets() => this.RemoveAllTargets(); - - internal void RemoveAllTargets() - { - if (this.m_targetList == null) - return; - foreach (KeyframeAnimation.AnimationTargetInfo target in this.m_targetList) - { - this.m_remoteObject.SendRemoveTarget(target.Target.TargetId); - target.Target.Dispose(); - } - this.m_targetList.Clear(); - } - - void IKeyframeAnimation.AddStageEvent( - AnimationStage animationStage, - AnimationEvent animationEvent) - { - Debug2.Validate(animationEvent != null, typeof (ArgumentNullException), nameof (animationEvent)); - Debug2.Validate(animationStage < AnimationStage.Count, typeof (ArgumentException), "invalid animation stage"); - RENDERHANDLE targetObjectId = animationEvent.TargetObjectId; - if (!(targetObjectId != RENDERHANDLE.NULL)) - return; - this.m_remoteObject.SendAddStageEvent(animationEvent.EventId, animationStage, targetObjectId, animationEvent.TargetMethodId, animationEvent.TargetMethodArg, animationEvent.InitialActivation, animationEvent.AllowRepeat); - } - - void IKeyframeAnimation.AddTimeEvent( - float absoluteTime, - AnimationEvent animationEvent) - { - Debug2.Validate(animationEvent != null, typeof (ArgumentNullException), nameof (animationEvent)); - Debug2.Validate((double) absoluteTime >= 0.0, typeof (ArgumentException), "absoluteTime value must be >= 0.0f"); - RENDERHANDLE targetObjectId = animationEvent.TargetObjectId; - if (!(targetObjectId != RENDERHANDLE.NULL)) - return; - this.m_remoteObject.SendAddTimeEvent(animationEvent.EventId, absoluteTime, targetObjectId, animationEvent.TargetMethodId, animationEvent.TargetMethodArg, animationEvent.InitialActivation, animationEvent.AllowRepeat); - } - - void IKeyframeAnimation.AddProgressEvent( - float progress, - AnimationEvent animationEvent) - { - Debug2.Validate(animationEvent != null, typeof (ArgumentNullException), nameof (animationEvent)); - Debug2.Validate((double) progress >= 0.0 && (double) progress <= 1.0, typeof (ArgumentException), "'progress' value must be between 0.0f and 1.0f"); - RENDERHANDLE targetObjectId = animationEvent.TargetObjectId; - if (!(targetObjectId != RENDERHANDLE.NULL)) - return; - this.m_remoteObject.SendAddProgressEvent(animationEvent.EventId, progress, targetObjectId, animationEvent.TargetMethodId, animationEvent.TargetMethodArg, animationEvent.InitialActivation, animationEvent.AllowRepeat); - } - - void IKeyframeAnimation.AddValueEvent( - ValueEventCondition condition, - AnimationInput reference, - AnimationEvent animationEvent) - { - Debug2.Validate(animationEvent != null, typeof (ArgumentNullException), nameof (animationEvent)); - Debug2.Validate(reference != null, typeof (ArgumentNullException), nameof (reference)); - Debug2.Validate(condition < ValueEventCondition.Count, typeof (ArgumentNullException), nameof (condition)); - RENDERHANDLE targetObjectId = animationEvent.TargetObjectId; - if (!(targetObjectId != RENDERHANDLE.NULL)) - return; - this.SendInput(-3, reference); - this.m_remoteObject.SendAddValueEvent(animationEvent.EventId, condition, targetObjectId, animationEvent.TargetMethodId, animationEvent.TargetMethodArg, animationEvent.InitialActivation, animationEvent.AllowRepeat); - } - - void IKeyframeAnimation.RemoveEvent(AnimationEvent animationEvent) - { - Debug2.Validate(animationEvent != null, typeof (ArgumentNullException), nameof (animationEvent)); - this.m_remoteObject.SendRemoveEvent(animationEvent.EventId); - } - - void IKeyframeAnimation.RemoveAllEvents() => this.RemoveAllEvents(); - - internal void RemoveAllEvents() => this.m_remoteObject.SendRemoveAllEvents(); - - RENDERHANDLE IAnimatableObject.GetObjectId() => ((IRenderHandleOwner) this).RenderHandle; - - uint IAnimatableObject.GetPropertyId(string propertyName) - { - if (string.Compare(propertyName, Microsoft.Iris.Render.Animation.Animation.OutputProperty, StringComparison.OrdinalIgnoreCase) == 0) - return 1; - Debug2.Validate(false, typeof (ArgumentException), (object) "Unsupported property: {0}", (object) propertyName); - return 0; - } - - AnimationInputType IAnimatableObject.GetPropertyType( - string propertyName) - { - if (string.Compare(propertyName, Microsoft.Iris.Render.Animation.Animation.OutputProperty, StringComparison.OrdinalIgnoreCase) == 0) - return this.Type; - Debug2.Validate(false, typeof (ArgumentException), (object) "Unsupported property: {0}", (object) propertyName); - return AnimationInputType.Float; - } - - RENDERHANDLE IActivatableObject.GetObjectId() => ((IRenderHandleOwner) this).RenderHandle; - - uint IActivatableObject.GetMethodId(string methodName) - { - if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.PlayMethod, StringComparison.OrdinalIgnoreCase) == 0) - return 1; - if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.PauseMethod, StringComparison.OrdinalIgnoreCase) == 0) - return 2; - if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.ResetMethod, StringComparison.OrdinalIgnoreCase) == 0) - return 3; - if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.FinishMethod, StringComparison.OrdinalIgnoreCase) == 0) - return 4; - if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.NotifyMethod, StringComparison.OrdinalIgnoreCase) == 0) - return 5; - Debug2.Validate(false, typeof (ArgumentException), (object) "Unsupported method: {0}", (object) methodName); - return 0; - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteAnimation) null; - - private void SendInput(int keyframeIndex, AnimationInput input) - { - Debug2.Validate(input != null, typeof (ArgumentNullException), "keyframe.Value.InputType"); - Debug2.Validate(input.InputType == this.m_animationType, typeof (ArgumentException), "keyframe.Value.InputType"); - Debug2.Validate(input.InputType == AnimationInputType.Float || input.InputType == AnimationInputType.Vector2 || (input.InputType == AnimationInputType.Vector3 || input.InputType == AnimationInputType.Vector4) || input.InputType == AnimationInputType.Quaternion, typeof (ArgumentException), "keyframe.Value.InputType"); - int num; - switch (input) - { - case ConstantAnimationInput _: - case ContinuousAnimationInput _: - case CapturedAnimationInput _: - num = 1; - break; - default: - num = input is BinaryOperation ? 1 : 0; - break; - } - System.Type exceptionType = typeof (ArgumentException); - Debug2.Validate(num != 0, exceptionType, "Invalid animation input in keyframe"); - this.m_remoteObject.SendBeginAnimationInput(keyframeIndex); - this.SendInputWorker(keyframeIndex, input); - this.m_remoteObject.SendEndAnimationInput(keyframeIndex); - } - - private void SendInputWorker(int keyframeIndex, AnimationInput input) - { - switch (input) - { - case ConstantAnimationInput _: - ConstantAnimationInput constantAnimationInput = (ConstantAnimationInput) input; - switch (constantAnimationInput.InputType) - { - case AnimationInputType.Float: - this.m_remoteObject.SendSetFloat(keyframeIndex, (float) constantAnimationInput.RawValue); - return; - case AnimationInputType.Vector2: - this.m_remoteObject.SendSetVector2(keyframeIndex, (Vector2) constantAnimationInput.RawValue); - return; - case AnimationInputType.Vector3: - this.m_remoteObject.SendSetVector3(keyframeIndex, (Vector3) constantAnimationInput.RawValue); - return; - case AnimationInputType.Vector4: - this.m_remoteObject.SendSetVector4(keyframeIndex, (Vector4) constantAnimationInput.RawValue); - return; - case AnimationInputType.Quaternion: - this.m_remoteObject.SendSetQuaternion(keyframeIndex, (Quaternion) constantAnimationInput.RawValue); - return; - default: - Debug2.Throw(false, "Unexpected constant input type"); - return; - } - case CapturedAnimationInput _: - uint propertyInfo1 = this.GeneratePropertyInfo(input.SourceType, input.SourceMask); - CapturedAnimationInput capturedAnimationInput = (CapturedAnimationInput) input; - this.m_remoteObject.SendSetCaptured(keyframeIndex, capturedAnimationInput.ObjectId, capturedAnimationInput.PropertyId, propertyInfo1, capturedAnimationInput.RefreshOnRepeat); - break; - case ContinuousAnimationInput _: - uint propertyInfo2 = this.GeneratePropertyInfo(input.SourceType, input.SourceMask); - ContinuousAnimationInput continuousAnimationInput = (ContinuousAnimationInput) input; - this.m_remoteObject.SendSetContinuous(keyframeIndex, continuousAnimationInput.ObjectId, continuousAnimationInput.PropertyId, propertyInfo2); - break; - case BinaryOperation _: - BinaryOperation binaryOperation = (BinaryOperation) input; - this.SendInputWorker(keyframeIndex, binaryOperation.LeftOperand); - this.SendInputWorker(keyframeIndex, binaryOperation.RightOperand); - this.m_remoteObject.SendSetBinaryOperation(keyframeIndex, binaryOperation.Operation); - break; - default: - Debug2.Throw(false, "Unexpected animation input type!"); - break; - } - } - - private void SendInterpolation(int keyframeIndex, AnimationInterpolation interpolation) - { - int num; - switch (interpolation) - { - case LinearInterpolation _: - case ExponentialInterpolation _: - case LogarithmicInterpolation _: - case SCurveInterpolation _: - case SineInterpolation _: - case CosineInterpolation _: - case BezierInterpolation _: - case EaseInInterpolation _: - num = 1; - break; - default: - num = interpolation is EaseOutInterpolation ? 1 : 0; - break; - } - System.Type exceptionType = typeof (ArgumentException); - Debug2.Validate(num != 0, exceptionType, "Invalid interpolation in keyframe"); - int idxKeyframe = !this.m_animationSystem.BackCompat ? (keyframeIndex > 0 ? keyframeIndex - 1 : 0) : keyframeIndex; - switch (interpolation) - { - case LinearInterpolation _: - this.m_remoteObject.SendSetLinear(idxKeyframe, interpolation.UseSphericalCombination); - break; - case ExponentialInterpolation _: - ExponentialInterpolation exponentialInterpolation = (ExponentialInterpolation) interpolation; - this.m_remoteObject.SendSetExponential(idxKeyframe, interpolation.UseSphericalCombination, exponentialInterpolation.Weight); - break; - case LogarithmicInterpolation _: - LogarithmicInterpolation logarithmicInterpolation = (LogarithmicInterpolation) interpolation; - this.m_remoteObject.SendSetLogarithmic(idxKeyframe, interpolation.UseSphericalCombination, logarithmicInterpolation.Weight); - break; - case SCurveInterpolation _: - SCurveInterpolation scurveInterpolation = (SCurveInterpolation) interpolation; - this.m_remoteObject.SendSetSCurve(idxKeyframe, interpolation.UseSphericalCombination, scurveInterpolation.Weight); - break; - case SineInterpolation _: - this.m_remoteObject.SendSetSine(idxKeyframe, interpolation.UseSphericalCombination); - break; - case CosineInterpolation _: - this.m_remoteObject.SendSetCosine(idxKeyframe, interpolation.UseSphericalCombination); - break; - case BezierInterpolation _: - BezierInterpolation bezierInterpolation = (BezierInterpolation) interpolation; - this.m_remoteObject.SendSetBezier(idxKeyframe, interpolation.UseSphericalCombination, bezierInterpolation.ControlPoint1, bezierInterpolation.ControlPoint2); - break; - case EaseInInterpolation _: - EaseInInterpolation easeInInterpolation = (EaseInInterpolation) interpolation; - this.m_remoteObject.SendSetEaseIn(idxKeyframe, interpolation.UseSphericalCombination, easeInInterpolation.Weight, easeInInterpolation.Handle); - break; - case EaseOutInterpolation _: - EaseOutInterpolation outInterpolation = (EaseOutInterpolation) interpolation; - this.m_remoteObject.SendSetEaseOut(idxKeyframe, interpolation.UseSphericalCombination, outInterpolation.Weight, outInterpolation.Handle); - break; - default: - Debug2.Throw(false, "Unexpected interpolation!"); - break; - } - } - - private uint GeneratePropertyInfo(AnimationInputType sourceType, AnimationTypeMask sourceMask) => (uint) ((int) (sourceType & (AnimationInputType.Vector4 | AnimationInputType.Quaternion)) << 19 | ((int) sourceMask.ChannelCount & 7) << 16 | (int) sourceMask.MaskCode & (int) ushort.MaxValue); - - private enum KeyframeSlots - { - ValueEvent = -3, // 0xFFFFFFFD - Scale = -2, // 0xFFFFFFFE - Reference = -1, // 0xFFFFFFFF - Default = 0, - } - - private class AnimationTargetInfo - { - internal AnimationTarget Target; - internal string MaskSpec; - - internal AnimationTargetInfo(AnimationTarget target, string maskSpec) - { - this.Target = target; - this.MaskSpec = maskSpec; - } - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/ObjectAnimationInput.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/ObjectAnimationInput.cs index 8070f6f..4007299 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/ObjectAnimationInput.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Animation/ObjectAnimationInput.cs @@ -10,52 +10,52 @@ using System; namespace Microsoft.Iris.Render.Animation { - public abstract class ObjectAnimationInput : AnimationInput - { - private IAnimatableObject m_object; - private string m_propertyName; - - protected ObjectAnimationInput( - IAnimatable sourceObject, - string sourcePropertyName, - string sourceMaskSpec) + public abstract class ObjectAnimationInput : AnimationInput { - Debug2.Validate(sourceObject is IAnimatableObject, typeof (ArgumentException), nameof (sourceObject)); - Debug2.Validate(sourcePropertyName != null, typeof (ArgumentException), nameof (sourcePropertyName)); - AnimationTypeMask sourceMask = AnimationTypeMask.FromString(sourceMaskSpec); - this.m_object = (IAnimatableObject) sourceObject; - this.m_propertyName = sourcePropertyName; - this.CommonCreate(this.m_object.GetPropertyType(this.m_propertyName), sourceMask); + private IAnimatableObject m_object; + private string m_propertyName; + + protected ObjectAnimationInput( + IAnimatable sourceObject, + string sourcePropertyName, + string sourceMaskSpec) + { + Debug2.Validate(sourceObject is IAnimatableObject, typeof(ArgumentException), nameof(sourceObject)); + Debug2.Validate(sourcePropertyName != null, typeof(ArgumentException), nameof(sourcePropertyName)); + AnimationTypeMask sourceMask = AnimationTypeMask.FromString(sourceMaskSpec); + this.m_object = (IAnimatableObject)sourceObject; + this.m_propertyName = sourcePropertyName; + this.CommonCreate(this.m_object.GetPropertyType(this.m_propertyName), sourceMask); + } + + protected ObjectAnimationInput(IAnimation sourceAnimation, string sourceMaskSpec) + { + Debug2.Validate(sourceAnimation is IAnimatableObject, typeof(ArgumentException), nameof(sourceAnimation)); + AnimationTypeMask sourceMask = AnimationTypeMask.FromString(sourceMaskSpec); + this.m_object = (IAnimatableObject)sourceAnimation; + this.m_propertyName = Microsoft.Iris.Render.Animation.Animation.OutputProperty; + this.CommonCreate(this.m_object.GetPropertyType(this.m_propertyName), sourceMask); + } + + internal RENDERHANDLE ObjectId => this.m_object.GetObjectId(); + + internal uint PropertyId => this.m_object.GetPropertyId(this.m_propertyName); + + internal override void RegisterUsage(object user) + { + Debug2.Validate(this.m_object != null, typeof(ObjectDisposedException), "Source object doesn't exist anymore"); + this.m_object.RegisterUsage(user); + base.RegisterUsage(user); + } + + internal override void UnregisterUsage(object user) + { + Debug2.Validate(this.m_object != null, typeof(ObjectDisposedException), "Source object doesn't exist anymore"); + bool flag = this.m_object.UsageCount == 1; + this.m_object.UnregisterUsage(user); + if (flag) + this.m_object = (IAnimatableObject)null; + base.UnregisterUsage(user); + } } - - protected ObjectAnimationInput(IAnimation sourceAnimation, string sourceMaskSpec) - { - Debug2.Validate(sourceAnimation is IAnimatableObject, typeof (ArgumentException), nameof (sourceAnimation)); - AnimationTypeMask sourceMask = AnimationTypeMask.FromString(sourceMaskSpec); - this.m_object = (IAnimatableObject) sourceAnimation; - this.m_propertyName = Microsoft.Iris.Render.Animation.Animation.OutputProperty; - this.CommonCreate(this.m_object.GetPropertyType(this.m_propertyName), sourceMask); - } - - internal RENDERHANDLE ObjectId => this.m_object.GetObjectId(); - - internal uint PropertyId => this.m_object.GetPropertyId(this.m_propertyName); - - internal override void RegisterUsage(object user) - { - Debug2.Validate(this.m_object != null, typeof (ObjectDisposedException), "Source object doesn't exist anymore"); - this.m_object.RegisterUsage(user); - base.RegisterUsage(user); - } - - internal override void UnregisterUsage(object user) - { - Debug2.Validate(this.m_object != null, typeof (ObjectDisposedException), "Source object doesn't exist anymore"); - bool flag = this.m_object.UsageCount == 1; - this.m_object.UnregisterUsage(user); - if (flag) - this.m_object = (IAnimatableObject) null; - base.UnregisterUsage(user); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationEvent.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationEvent.cs index 82557f7..c382655 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationEvent.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationEvent.cs @@ -11,55 +11,55 @@ using System; namespace Microsoft.Iris.Render { - public class AnimationEvent - { - private static int s_eventIdSeed = 1; - private uint m_eventId; - private IActivatableObject m_eventTarget; - private string m_eventMethodName; - private uint m_eventMethodArg; - private bool m_allowRepeat; - private bool m_initialActivation; - - public AnimationEvent(IActivatable eventTarget, string eventMethodName) - : this(eventTarget, eventMethodName, 0U) + public class AnimationEvent { + private static int s_eventIdSeed = 1; + private uint m_eventId; + private IActivatableObject m_eventTarget; + private string m_eventMethodName; + private uint m_eventMethodArg; + private bool m_allowRepeat; + private bool m_initialActivation; + + public AnimationEvent(IActivatable eventTarget, string eventMethodName) + : this(eventTarget, eventMethodName, 0U) + { + } + + public AnimationEvent(IActivatable eventTarget, string eventMethodName, uint eventMethodArg) + { + Debug2.Validate(eventTarget != null, typeof(ArgumentNullException), nameof(eventTarget)); + Debug2.Validate(eventTarget is IActivatableObject, typeof(ArgumentException), nameof(eventTarget)); + Debug2.Validate(eventMethodName != null, typeof(ArgumentNullException), nameof(eventMethodName)); + this.m_eventId = AnimationEvent.AllocateEventId(); + this.m_eventTarget = (IActivatableObject)eventTarget; + this.m_eventMethodName = eventMethodName; + this.m_eventMethodArg = eventMethodArg; + this.m_allowRepeat = false; + } + + ~AnimationEvent() => this.m_eventTarget = (IActivatableObject)null; + + internal uint EventId => this.m_eventId; + + internal RENDERHANDLE TargetObjectId => this.m_eventTarget.GetObjectId(); + + internal uint TargetMethodId => this.m_eventTarget.GetMethodId(this.m_eventMethodName); + + internal uint TargetMethodArg => this.m_eventMethodArg; + + public bool AllowRepeat + { + get => this.m_allowRepeat; + set => this.m_allowRepeat = value; + } + + public bool InitialActivation + { + get => this.m_initialActivation; + set => this.m_initialActivation = value; + } + + private static uint AllocateEventId() => (uint)AnimationEvent.s_eventIdSeed++; } - - public AnimationEvent(IActivatable eventTarget, string eventMethodName, uint eventMethodArg) - { - Debug2.Validate(eventTarget != null, typeof (ArgumentNullException), nameof (eventTarget)); - Debug2.Validate(eventTarget is IActivatableObject, typeof (ArgumentException), nameof (eventTarget)); - Debug2.Validate(eventMethodName != null, typeof (ArgumentNullException), nameof (eventMethodName)); - this.m_eventId = AnimationEvent.AllocateEventId(); - this.m_eventTarget = (IActivatableObject) eventTarget; - this.m_eventMethodName = eventMethodName; - this.m_eventMethodArg = eventMethodArg; - this.m_allowRepeat = false; - } - - ~AnimationEvent() => this.m_eventTarget = (IActivatableObject) null; - - internal uint EventId => this.m_eventId; - - internal RENDERHANDLE TargetObjectId => this.m_eventTarget.GetObjectId(); - - internal uint TargetMethodId => this.m_eventTarget.GetMethodId(this.m_eventMethodName); - - internal uint TargetMethodArg => this.m_eventMethodArg; - - public bool AllowRepeat - { - get => this.m_allowRepeat; - set => this.m_allowRepeat = value; - } - - public bool InitialActivation - { - get => this.m_initialActivation; - set => this.m_initialActivation = value; - } - - private static uint AllocateEventId() => (uint) AnimationEvent.s_eventIdSeed++; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInput.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInput.cs index 281a3c9..bd5f2ea 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInput.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInput.cs @@ -9,69 +9,69 @@ using System; namespace Microsoft.Iris.Render { - public abstract class AnimationInput - { - private AnimationInputType m_sourceType; - private AnimationInputType m_inputType; - private AnimationTypeMask m_sourceMask; - - protected void CommonCreate(AnimationInputType sourceType, AnimationTypeMask sourceMask) + public abstract class AnimationInput { - Debug2.Validate(sourceMask.CanMapFromType(sourceType), typeof (ArgumentException), nameof (sourceMask)); - AnimationInputType animationInputType; - switch (sourceMask.ChannelCount) - { - case 0: - animationInputType = sourceType; - break; - case 1: - animationInputType = AnimationInputType.Float; - break; - case 2: - animationInputType = AnimationInputType.Vector2; - break; - case 3: - animationInputType = AnimationInputType.Vector3; - break; - case 4: - animationInputType = AnimationInputType.Vector4; - break; - default: - Debug2.Throw(false, "Masking is limited to four channels"); - animationInputType = sourceType; - break; - } - this.m_sourceType = sourceType; - this.m_sourceMask = sourceMask; - this.m_inputType = animationInputType; + private AnimationInputType m_sourceType; + private AnimationInputType m_inputType; + private AnimationTypeMask m_sourceMask; + + protected void CommonCreate(AnimationInputType sourceType, AnimationTypeMask sourceMask) + { + Debug2.Validate(sourceMask.CanMapFromType(sourceType), typeof(ArgumentException), nameof(sourceMask)); + AnimationInputType animationInputType; + switch (sourceMask.ChannelCount) + { + case 0: + animationInputType = sourceType; + break; + case 1: + animationInputType = AnimationInputType.Float; + break; + case 2: + animationInputType = AnimationInputType.Vector2; + break; + case 3: + animationInputType = AnimationInputType.Vector3; + break; + case 4: + animationInputType = AnimationInputType.Vector4; + break; + default: + Debug2.Throw(false, "Masking is limited to four channels"); + animationInputType = sourceType; + break; + } + this.m_sourceType = sourceType; + this.m_sourceMask = sourceMask; + this.m_inputType = animationInputType; + } + + public AnimationInputType InputType => this.m_inputType; + + internal AnimationInputType SourceType => this.m_sourceType; + + internal AnimationTypeMask SourceMask => this.m_sourceMask; + + internal virtual void RegisterUsage(object user) + { + } + + internal virtual void UnregisterUsage(object user) + { + } + + public static AnimationInput operator +(AnimationInput left, AnimationInput right) + { + Debug2.Validate(left != null, typeof(ArgumentNullException), nameof(left)); + Debug2.Validate(right != null, typeof(ArgumentNullException), nameof(right)); + return (AnimationInput)new BinaryOperation(BinaryOpCode.Add, left, right); + } + + public static AnimationInput operator *(AnimationInput left, AnimationInput right) + { + Debug2.Validate(left != null, typeof(ArgumentNullException), nameof(left)); + Debug2.Validate(right != null, typeof(ArgumentNullException), nameof(right)); + return (AnimationInput)new BinaryOperation(BinaryOpCode.Multiply, left, right); + } } - - public AnimationInputType InputType => this.m_inputType; - - internal AnimationInputType SourceType => this.m_sourceType; - - internal AnimationTypeMask SourceMask => this.m_sourceMask; - - internal virtual void RegisterUsage(object user) - { - } - - internal virtual void UnregisterUsage(object user) - { - } - - public static AnimationInput operator +(AnimationInput left, AnimationInput right) - { - Debug2.Validate(left != null, typeof (ArgumentNullException), nameof (left)); - Debug2.Validate(right != null, typeof (ArgumentNullException), nameof (right)); - return (AnimationInput) new BinaryOperation(BinaryOpCode.Add, left, right); - } - - public static AnimationInput operator *(AnimationInput left, AnimationInput right) - { - Debug2.Validate(left != null, typeof (ArgumentNullException), nameof (left)); - Debug2.Validate(right != null, typeof (ArgumentNullException), nameof (right)); - return (AnimationInput) new BinaryOperation(BinaryOpCode.Multiply, left, right); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInputType.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInputType.cs index c604c51..ca01a62 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInputType.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInputType.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render { - public enum AnimationInputType - { - Float, - Vector2, - Vector3, - Vector4, - Quaternion, - } + public enum AnimationInputType + { + Float, + Vector2, + Vector3, + Vector4, + Quaternion, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInterpolation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInterpolation.cs index 2716cd2..0c3b94c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInterpolation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationInterpolation.cs @@ -6,16 +6,16 @@ namespace Microsoft.Iris.Render { - public abstract class AnimationInterpolation - { - private bool m_isSpherical; - - protected AnimationInterpolation() => this.m_isSpherical = false; - - public bool UseSphericalCombination + public abstract class AnimationInterpolation { - get => this.m_isSpherical; - set => this.m_isSpherical = value; + private bool m_isSpherical; + + protected AnimationInterpolation() => this.m_isSpherical = false; + + public bool UseSphericalCombination + { + get => this.m_isSpherical; + set => this.m_isSpherical = value; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationKeyframe.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationKeyframe.cs index 2dd2436..7ff7232 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationKeyframe.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationKeyframe.cs @@ -9,29 +9,29 @@ using System; namespace Microsoft.Iris.Render { - public sealed class AnimationKeyframe - { - private float m_time; - private AnimationInput m_value; - private AnimationInterpolation m_interpolation; - - public AnimationKeyframe( - float time, - AnimationInput value, - AnimationInterpolation interpolation) + public sealed class AnimationKeyframe { - Debug2.Validate((double) time >= 0.0, typeof (ArgumentException), "'time' must not be negative"); - Debug2.Validate(value != null, typeof (ArgumentNullException), nameof (value)); - Debug2.Validate(interpolation != null, typeof (ArgumentNullException), nameof (interpolation)); - this.m_time = time; - this.m_value = value; - this.m_interpolation = interpolation; + private float m_time; + private AnimationInput m_value; + private AnimationInterpolation m_interpolation; + + public AnimationKeyframe( + float time, + AnimationInput value, + AnimationInterpolation interpolation) + { + Debug2.Validate((double)time >= 0.0, typeof(ArgumentException), "'time' must not be negative"); + Debug2.Validate(value != null, typeof(ArgumentNullException), nameof(value)); + Debug2.Validate(interpolation != null, typeof(ArgumentNullException), nameof(interpolation)); + this.m_time = time; + this.m_value = value; + this.m_interpolation = interpolation; + } + + public float Time => this.m_time; + + public AnimationInput Value => this.m_value; + + public AnimationInterpolation Interpolation => this.m_interpolation; } - - public float Time => this.m_time; - - public AnimationInput Value => this.m_value; - - public AnimationInterpolation Interpolation => this.m_interpolation; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationResetBehavior.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationResetBehavior.cs index 68feff2..204a4bc 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationResetBehavior.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationResetBehavior.cs @@ -6,11 +6,11 @@ namespace Microsoft.Iris.Render { - public enum AnimationResetBehavior : uint - { - LeaveCurrent, - SetInitialValue, - SetFinalValue, - Count, - } + public enum AnimationResetBehavior : uint + { + LeaveCurrent, + SetInitialValue, + SetFinalValue, + Count, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationStage.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationStage.cs index 158a980..10a62ae 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationStage.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationStage.cs @@ -6,13 +6,13 @@ namespace Microsoft.Iris.Render { - public enum AnimationStage : uint - { - Start, - LoopStart, - LoopComplete, - Complete, - Reset, - Count, - } + public enum AnimationStage : uint + { + Start, + LoopStart, + LoopComplete, + Complete, + Reset, + Count, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationTypeChannel.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationTypeChannel.cs index 169dd9c..733205a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationTypeChannel.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationTypeChannel.cs @@ -6,16 +6,16 @@ namespace Microsoft.Iris.Render { - public enum AnimationTypeChannel - { - O = 0, - R = 1, - X = 1, - G = 2, - Y = 2, - B = 3, - Z = 3, - A = 4, - W = 4, - } + public enum AnimationTypeChannel + { + O = 0, + R = 1, + X = 1, + G = 2, + Y = 2, + B = 3, + Z = 3, + A = 4, + W = 4, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationTypeMask.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationTypeMask.cs index 452cc64..caf8512 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationTypeMask.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AnimationTypeMask.cs @@ -10,228 +10,228 @@ using System.Collections; namespace Microsoft.Iris.Render { - public struct AnimationTypeMask - { - public static readonly AnimationTypeMask Default = new AnimationTypeMask(); - public static readonly AnimationTypeMask X = new AnimationTypeMask(AnimationTypeChannel.X); - public static readonly AnimationTypeMask Y = new AnimationTypeMask(AnimationTypeChannel.Y); - public static readonly AnimationTypeMask Z = new AnimationTypeMask(AnimationTypeChannel.Z); - public static readonly AnimationTypeMask W = new AnimationTypeMask(AnimationTypeChannel.W); - public static readonly AnimationTypeMask A = new AnimationTypeMask(AnimationTypeChannel.W); - public static readonly AnimationTypeMask R = new AnimationTypeMask(AnimationTypeChannel.X); - public static readonly AnimationTypeMask G = new AnimationTypeMask(AnimationTypeChannel.Y); - public static readonly AnimationTypeMask B = new AnimationTypeMask(AnimationTypeChannel.Z); - private byte m_channelCount; - private ushort m_maskCode; - - public AnimationTypeMask(AnimationTypeChannel channel0) + public struct AnimationTypeMask { - this.m_maskCode = (ushort) 0; - this.m_channelCount = (byte) 1; - this[0] = channel0; - } + public static readonly AnimationTypeMask Default = new AnimationTypeMask(); + public static readonly AnimationTypeMask X = new AnimationTypeMask(AnimationTypeChannel.X); + public static readonly AnimationTypeMask Y = new AnimationTypeMask(AnimationTypeChannel.Y); + public static readonly AnimationTypeMask Z = new AnimationTypeMask(AnimationTypeChannel.Z); + public static readonly AnimationTypeMask W = new AnimationTypeMask(AnimationTypeChannel.W); + public static readonly AnimationTypeMask A = new AnimationTypeMask(AnimationTypeChannel.W); + public static readonly AnimationTypeMask R = new AnimationTypeMask(AnimationTypeChannel.X); + public static readonly AnimationTypeMask G = new AnimationTypeMask(AnimationTypeChannel.Y); + public static readonly AnimationTypeMask B = new AnimationTypeMask(AnimationTypeChannel.Z); + private byte m_channelCount; + private ushort m_maskCode; - public AnimationTypeMask(AnimationTypeChannel channel0, AnimationTypeChannel channel1) - { - this.m_maskCode = (ushort) 0; - this.m_channelCount = (byte) 2; - this[0] = channel0; - this[1] = channel1; - } - - public AnimationTypeMask( - AnimationTypeChannel channel0, - AnimationTypeChannel channel1, - AnimationTypeChannel channel2) - { - this.m_maskCode = (ushort) 0; - this.m_channelCount = (byte) 3; - this[0] = channel0; - this[1] = channel1; - this[2] = channel2; - } - - public AnimationTypeMask( - AnimationTypeChannel channel0, - AnimationTypeChannel channel1, - AnimationTypeChannel channel2, - AnimationTypeChannel channel3) - { - this.m_maskCode = (ushort) 0; - this.m_channelCount = (byte) 4; - this[0] = channel0; - this[1] = channel1; - this[2] = channel2; - this[3] = channel3; - } - - public AnimationTypeChannel this[int channelIndex] - { - get => this.GetChannel(channelIndex); - set => this.SetChannel(channelIndex, value); - } - - internal ushort MaskCode => this.m_maskCode; - - public uint ChannelCount => (uint) this.m_channelCount & 7U; - - public static AnimationTypeMask FromString(string maskSpec) - { - AnimationTypeMask animationTypeMask; - if (string.IsNullOrEmpty(maskSpec)) - { - animationTypeMask = AnimationTypeMask.Default; - } - else - { - Debug2.Validate(maskSpec.Length > 0 && maskSpec.Length <= 4, typeof (ArgumentException), "Invalid mask spec"); - ArrayList arrayList = new ArrayList(); - for (int index = 0; index < maskSpec.Length; ++index) + public AnimationTypeMask(AnimationTypeChannel channel0) { - switch (maskSpec[index]) - { - case '0': - arrayList.Add((object) AnimationTypeChannel.O); - break; - case 'A': - case 'a': - arrayList.Add((object) AnimationTypeChannel.W); - break; - case 'B': - case 'b': - arrayList.Add((object) AnimationTypeChannel.Z); - break; - case 'G': - case 'g': - arrayList.Add((object) AnimationTypeChannel.Y); - break; - case 'R': - case 'r': - arrayList.Add((object) AnimationTypeChannel.X); - break; - case 'W': - case 'w': - arrayList.Add((object) AnimationTypeChannel.W); - break; - case 'X': - case 'x': - arrayList.Add((object) AnimationTypeChannel.X); - break; - case 'Y': - case 'y': - arrayList.Add((object) AnimationTypeChannel.Y); - break; - case 'Z': - case 'z': - arrayList.Add((object) AnimationTypeChannel.Z); - break; - default: - Debug2.Validate(false, typeof (ArgumentException), (object) "Invalid mask spec: {0}", (object) maskSpec[index]); - break; - } + this.m_maskCode = (ushort)0; + this.m_channelCount = (byte)1; + this[0] = channel0; } - switch (arrayList.Count) + + public AnimationTypeMask(AnimationTypeChannel channel0, AnimationTypeChannel channel1) { - case 1: - animationTypeMask = new AnimationTypeMask((AnimationTypeChannel) arrayList[0]); - break; - case 2: - animationTypeMask = new AnimationTypeMask((AnimationTypeChannel) arrayList[0], (AnimationTypeChannel) arrayList[1]); - break; - case 3: - animationTypeMask = new AnimationTypeMask((AnimationTypeChannel) arrayList[0], (AnimationTypeChannel) arrayList[1], (AnimationTypeChannel) arrayList[2]); - break; - case 4: - animationTypeMask = new AnimationTypeMask((AnimationTypeChannel) arrayList[0], (AnimationTypeChannel) arrayList[1], (AnimationTypeChannel) arrayList[2], (AnimationTypeChannel) arrayList[3]); - break; - default: - Debug2.Throw(false, "Too many channels in mask spec!"); - animationTypeMask = AnimationTypeMask.Default; - break; + this.m_maskCode = (ushort)0; + this.m_channelCount = (byte)2; + this[0] = channel0; + this[1] = channel1; } - } - return animationTypeMask; - } - public override bool Equals(object obj) => obj is AnimationTypeMask animationTypeMask && (int) animationTypeMask.m_channelCount == (int) this.m_channelCount && (int) animationTypeMask.m_maskCode == (int) this.m_maskCode; - - public override int GetHashCode() => this.m_channelCount.GetHashCode() ^ this.m_maskCode.GetHashCode(); - - internal bool CanMapFromType(AnimationInputType animationType) - { - bool flag = true; - AnimationTypeChannel animationTypeChannel; - switch (animationType) - { - case AnimationInputType.Float: - animationTypeChannel = AnimationTypeChannel.X; - break; - case AnimationInputType.Vector2: - animationTypeChannel = AnimationTypeChannel.Y; - break; - case AnimationInputType.Vector3: - animationTypeChannel = AnimationTypeChannel.Z; - break; - case AnimationInputType.Vector4: - case AnimationInputType.Quaternion: - animationTypeChannel = AnimationTypeChannel.W; - break; - default: - animationTypeChannel = AnimationTypeChannel.X; - flag = false; - break; - } - if (this.ChannelCount != 0U) - { - for (int channelIndex = 0; (long) channelIndex < (long) this.ChannelCount; ++channelIndex) + public AnimationTypeMask( + AnimationTypeChannel channel0, + AnimationTypeChannel channel1, + AnimationTypeChannel channel2) { - if (this[channelIndex] > animationTypeChannel) - flag = false; + this.m_maskCode = (ushort)0; + this.m_channelCount = (byte)3; + this[0] = channel0; + this[1] = channel1; + this[2] = channel2; } - } - return flag; - } - internal bool CanMapToType(AnimationInputType animationType) - { - bool flag; - switch (this.ChannelCount) - { - case 0: - flag = true; - break; - case 1: - flag = animationType == AnimationInputType.Float; - break; - case 2: - flag = animationType == AnimationInputType.Vector2; - break; - case 3: - flag = animationType == AnimationInputType.Vector3; - break; - case 4: - flag = animationType == AnimationInputType.Vector4; - break; - default: - flag = false; - break; - } - return flag; - } + public AnimationTypeMask( + AnimationTypeChannel channel0, + AnimationTypeChannel channel1, + AnimationTypeChannel channel2, + AnimationTypeChannel channel3) + { + this.m_maskCode = (ushort)0; + this.m_channelCount = (byte)4; + this[0] = channel0; + this[1] = channel1; + this[2] = channel2; + this[3] = channel3; + } - private AnimationTypeChannel GetChannel(int channelIndex) - { - Debug2.Validate(channelIndex >= 0 && channelIndex <= 3, typeof (ArgumentOutOfRangeException), "Channel index must be between 0 and 3"); - return (AnimationTypeChannel) ((int) this.m_maskCode >> channelIndex * 4 & 15); - } + public AnimationTypeChannel this[int channelIndex] + { + get => this.GetChannel(channelIndex); + set => this.SetChannel(channelIndex, value); + } - private void SetChannel(int channelIndex, AnimationTypeChannel channel) - { - Debug2.Validate(channelIndex >= 0 && channelIndex <= 3, typeof (ArgumentOutOfRangeException), "Channel index must be between 0 and 3"); - Debug2.Validate(channel >= AnimationTypeChannel.O && channel <= AnimationTypeChannel.W, typeof (ArgumentOutOfRangeException), nameof (channel)); - int num1 = (int) channel << channelIndex * 4; - int num2 = 15 << channelIndex * 4; - this.m_maskCode = (ushort) (((int) this.m_maskCode & ~num2 | num1 & num2) & (int) ushort.MaxValue); + internal ushort MaskCode => this.m_maskCode; + + public uint ChannelCount => (uint)this.m_channelCount & 7U; + + public static AnimationTypeMask FromString(string maskSpec) + { + AnimationTypeMask animationTypeMask; + if (string.IsNullOrEmpty(maskSpec)) + { + animationTypeMask = AnimationTypeMask.Default; + } + else + { + Debug2.Validate(maskSpec.Length > 0 && maskSpec.Length <= 4, typeof(ArgumentException), "Invalid mask spec"); + ArrayList arrayList = new ArrayList(); + for (int index = 0; index < maskSpec.Length; ++index) + { + switch (maskSpec[index]) + { + case '0': + arrayList.Add((object)AnimationTypeChannel.O); + break; + case 'A': + case 'a': + arrayList.Add((object)AnimationTypeChannel.W); + break; + case 'B': + case 'b': + arrayList.Add((object)AnimationTypeChannel.Z); + break; + case 'G': + case 'g': + arrayList.Add((object)AnimationTypeChannel.Y); + break; + case 'R': + case 'r': + arrayList.Add((object)AnimationTypeChannel.X); + break; + case 'W': + case 'w': + arrayList.Add((object)AnimationTypeChannel.W); + break; + case 'X': + case 'x': + arrayList.Add((object)AnimationTypeChannel.X); + break; + case 'Y': + case 'y': + arrayList.Add((object)AnimationTypeChannel.Y); + break; + case 'Z': + case 'z': + arrayList.Add((object)AnimationTypeChannel.Z); + break; + default: + Debug2.Validate(false, typeof(ArgumentException), (object)"Invalid mask spec: {0}", (object)maskSpec[index]); + break; + } + } + switch (arrayList.Count) + { + case 1: + animationTypeMask = new AnimationTypeMask((AnimationTypeChannel)arrayList[0]); + break; + case 2: + animationTypeMask = new AnimationTypeMask((AnimationTypeChannel)arrayList[0], (AnimationTypeChannel)arrayList[1]); + break; + case 3: + animationTypeMask = new AnimationTypeMask((AnimationTypeChannel)arrayList[0], (AnimationTypeChannel)arrayList[1], (AnimationTypeChannel)arrayList[2]); + break; + case 4: + animationTypeMask = new AnimationTypeMask((AnimationTypeChannel)arrayList[0], (AnimationTypeChannel)arrayList[1], (AnimationTypeChannel)arrayList[2], (AnimationTypeChannel)arrayList[3]); + break; + default: + Debug2.Throw(false, "Too many channels in mask spec!"); + animationTypeMask = AnimationTypeMask.Default; + break; + } + } + return animationTypeMask; + } + + public override bool Equals(object obj) => obj is AnimationTypeMask animationTypeMask && (int)animationTypeMask.m_channelCount == (int)this.m_channelCount && (int)animationTypeMask.m_maskCode == (int)this.m_maskCode; + + public override int GetHashCode() => this.m_channelCount.GetHashCode() ^ this.m_maskCode.GetHashCode(); + + internal bool CanMapFromType(AnimationInputType animationType) + { + bool flag = true; + AnimationTypeChannel animationTypeChannel; + switch (animationType) + { + case AnimationInputType.Float: + animationTypeChannel = AnimationTypeChannel.X; + break; + case AnimationInputType.Vector2: + animationTypeChannel = AnimationTypeChannel.Y; + break; + case AnimationInputType.Vector3: + animationTypeChannel = AnimationTypeChannel.Z; + break; + case AnimationInputType.Vector4: + case AnimationInputType.Quaternion: + animationTypeChannel = AnimationTypeChannel.W; + break; + default: + animationTypeChannel = AnimationTypeChannel.X; + flag = false; + break; + } + if (this.ChannelCount != 0U) + { + for (int channelIndex = 0; (long)channelIndex < (long)this.ChannelCount; ++channelIndex) + { + if (this[channelIndex] > animationTypeChannel) + flag = false; + } + } + return flag; + } + + internal bool CanMapToType(AnimationInputType animationType) + { + bool flag; + switch (this.ChannelCount) + { + case 0: + flag = true; + break; + case 1: + flag = animationType == AnimationInputType.Float; + break; + case 2: + flag = animationType == AnimationInputType.Vector2; + break; + case 3: + flag = animationType == AnimationInputType.Vector3; + break; + case 4: + flag = animationType == AnimationInputType.Vector4; + break; + default: + flag = false; + break; + } + return flag; + } + + private AnimationTypeChannel GetChannel(int channelIndex) + { + Debug2.Validate(channelIndex >= 0 && channelIndex <= 3, typeof(ArgumentOutOfRangeException), "Channel index must be between 0 and 3"); + return (AnimationTypeChannel)((int)this.m_maskCode >> channelIndex * 4 & 15); + } + + private void SetChannel(int channelIndex, AnimationTypeChannel channel) + { + Debug2.Validate(channelIndex >= 0 && channelIndex <= 3, typeof(ArgumentOutOfRangeException), "Channel index must be between 0 and 3"); + Debug2.Validate(channel >= AnimationTypeChannel.O && channel <= AnimationTypeChannel.W, typeof(ArgumentOutOfRangeException), nameof(channel)); + int num1 = (int)channel << channelIndex * 4; + int num2 = 15 << channelIndex * 4; + this.m_maskCode = (ushort)(((int)this.m_maskCode & ~num2 | num1 & num2) & (int)ushort.MaxValue); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AsyncNotifyHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AsyncNotifyHandler.cs index 2ac5887..d9e82db 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AsyncNotifyHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AsyncNotifyHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void AsyncNotifyHandler(int nCookie); + public delegate void AsyncNotifyHandler(int nCookie); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AxisAngle.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AxisAngle.cs index 64176c7..9b82b71 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/AxisAngle.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/AxisAngle.cs @@ -8,44 +8,44 @@ using System; namespace Microsoft.Iris.Render { - [Serializable] - public struct AxisAngle - { - public static readonly AxisAngle Zero = new AxisAngle(new Vector3(0.0f, 0.0f, 0.0f), 0.0f); - public static readonly AxisAngle Identity = new AxisAngle(new Vector3(0.0f, 0.0f, 1f), 0.0f); - private Vector3 m_axis; - private float m_angle; - - public AxisAngle(Vector3 axis, float angle) + [Serializable] + public struct AxisAngle { - this.m_axis = axis; - this.m_angle = angle; + public static readonly AxisAngle Zero = new AxisAngle(new Vector3(0.0f, 0.0f, 0.0f), 0.0f); + public static readonly AxisAngle Identity = new AxisAngle(new Vector3(0.0f, 0.0f, 1f), 0.0f); + private Vector3 m_axis; + private float m_angle; + + public AxisAngle(Vector3 axis, float angle) + { + this.m_axis = axis; + this.m_angle = angle; + } + + public Vector3 Axis + { + get => this.m_axis; + set => this.m_axis = value; + } + + public float Angle + { + get => this.m_angle; + set => this.m_angle = value; + } + + public Quaternion ToQuaternion() => new Quaternion(this.m_axis, this.m_angle); + + public Vector4 ToVector4() => new Vector4(this.m_axis.X, this.m_axis.Y, this.m_axis.Z, this.m_angle); + + public override bool Equals(object obj) => obj is AxisAngle axisAngle && this == axisAngle; + + public static bool operator ==(AxisAngle left, AxisAngle right) => left.Axis == right.Axis && (double)left.Angle == (double)right.Angle; + + public static bool operator !=(AxisAngle left, AxisAngle right) => !(left == right); + + public override int GetHashCode() => this.Axis.GetHashCode() ^ this.Angle.GetHashCode(); + + public override string ToString() => base.ToString(); } - - public Vector3 Axis - { - get => this.m_axis; - set => this.m_axis = value; - } - - public float Angle - { - get => this.m_angle; - set => this.m_angle = value; - } - - public Quaternion ToQuaternion() => new Quaternion(this.m_axis, this.m_angle); - - public Vector4 ToVector4() => new Vector4(this.m_axis.X, this.m_axis.Y, this.m_axis.Z, this.m_angle); - - public override bool Equals(object obj) => obj is AxisAngle axisAngle && this == axisAngle; - - public static bool operator ==(AxisAngle left, AxisAngle right) => left.Axis == right.Axis && (double) left.Angle == (double) right.Angle; - - public static bool operator !=(AxisAngle left, AxisAngle right) => !(left == right); - - public override int GetHashCode() => this.Axis.GetHashCode() ^ this.Angle.GetHashCode(); - - public override string ToString() => base.ToString(); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BackBufferCapturedHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BackBufferCapturedHandler.cs index 652ac42..af4e939 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BackBufferCapturedHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BackBufferCapturedHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void BackBufferCapturedHandler(); + public delegate void BackBufferCapturedHandler(); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BezierInterpolation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BezierInterpolation.cs index b498ad3..4148e62 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BezierInterpolation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BezierInterpolation.cs @@ -6,19 +6,19 @@ namespace Microsoft.Iris.Render { - public sealed class BezierInterpolation : AnimationInterpolation - { - private float m_controlPoint1; - private float m_controlPoint2; - - public BezierInterpolation(float controlPoint1, float controlPoint2) + public sealed class BezierInterpolation : AnimationInterpolation { - this.m_controlPoint1 = controlPoint1; - this.m_controlPoint2 = controlPoint2; + private float m_controlPoint1; + private float m_controlPoint2; + + public BezierInterpolation(float controlPoint1, float controlPoint2) + { + this.m_controlPoint1 = controlPoint1; + this.m_controlPoint2 = controlPoint2; + } + + internal float ControlPoint1 => this.m_controlPoint1; + + internal float ControlPoint2 => this.m_controlPoint2; } - - internal float ControlPoint1 => this.m_controlPoint1; - - internal float ControlPoint2 => this.m_controlPoint2; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BinaryOpCode.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BinaryOpCode.cs index 45b8cc4..64c89b2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BinaryOpCode.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BinaryOpCode.cs @@ -6,9 +6,9 @@ namespace Microsoft.Iris.Render { - public enum BinaryOpCode - { - Add, - Multiply, - } + public enum BinaryOpCode + { + Add, + Multiply, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BinaryOperation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BinaryOperation.cs index 2441ab9..78b6ee2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BinaryOperation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BinaryOperation.cs @@ -9,29 +9,29 @@ using System; namespace Microsoft.Iris.Render { - public class BinaryOperation : AnimationInput - { - private AnimationInput m_leftInput; - private AnimationInput m_rightInput; - private BinaryOpCode m_opCode; - - public BinaryOperation( - BinaryOpCode opCode, - AnimationInput leftInput, - AnimationInput rightInput) + public class BinaryOperation : AnimationInput { - Debug2.Validate(leftInput != null, typeof (ArgumentNullException), nameof (leftInput)); - Debug2.Validate(rightInput != null, typeof (ArgumentNullException), nameof (rightInput)); - this.m_leftInput = leftInput; - this.m_rightInput = rightInput; - this.m_opCode = opCode; - this.CommonCreate(leftInput.InputType, AnimationTypeMask.Default); + private AnimationInput m_leftInput; + private AnimationInput m_rightInput; + private BinaryOpCode m_opCode; + + public BinaryOperation( + BinaryOpCode opCode, + AnimationInput leftInput, + AnimationInput rightInput) + { + Debug2.Validate(leftInput != null, typeof(ArgumentNullException), nameof(leftInput)); + Debug2.Validate(rightInput != null, typeof(ArgumentNullException), nameof(rightInput)); + this.m_leftInput = leftInput; + this.m_rightInput = rightInput; + this.m_opCode = opCode; + this.CommonCreate(leftInput.InputType, AnimationTypeMask.Default); + } + + public BinaryOpCode Operation => this.m_opCode; + + public AnimationInput LeftOperand => this.m_leftInput; + + public AnimationInput RightOperand => this.m_rightInput; } - - public BinaryOpCode Operation => this.m_opCode; - - public AnimationInput LeftOperand => this.m_leftInput; - - public AnimationInput RightOperand => this.m_rightInput; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BlendElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BlendElement.cs index 1115eba..af881ee 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BlendElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BlendElement.cs @@ -10,88 +10,88 @@ using System; namespace Microsoft.Iris.Render { - public class BlendElement : EffectInput - { - private EffectInput m_effectInput1; - private EffectInput m_effectInput2; - private ColorOperation m_colorOperation; - private AlphaOperation m_alphaOperation; - - public BlendElement( - EffectInput effectInput1, - EffectInput effectInput2, - ColorOperation colorOperation, - AlphaOperation alphaOperation) - : this() + public class BlendElement : EffectInput { - Debug2.Validate(effectInput1 != null, typeof (ArgumentNullException), nameof (effectInput1)); - Debug2.Validate(effectInput2 != null, typeof (ArgumentNullException), nameof (effectInput2)); - this.m_effectInput1 = effectInput1; - this.m_effectInput2 = effectInput2; - this.m_colorOperation = colorOperation; - this.m_alphaOperation = alphaOperation; - } + private EffectInput m_effectInput1; + private EffectInput m_effectInput2; + private ColorOperation m_colorOperation; + private AlphaOperation m_alphaOperation; - public BlendElement( - EffectInput effectInput1, - EffectInput effectInput2, - ColorOperation colorOperation) - : this() - { - Debug2.Validate(effectInput1 != null, typeof (ArgumentNullException), nameof (effectInput1)); - Debug2.Validate(effectInput2 != null, typeof (ArgumentNullException), nameof (effectInput2)); - this.m_effectInput1 = effectInput1; - this.m_effectInput2 = effectInput2; - this.m_colorOperation = colorOperation; - } + public BlendElement( + EffectInput effectInput1, + EffectInput effectInput2, + ColorOperation colorOperation, + AlphaOperation alphaOperation) + : this() + { + Debug2.Validate(effectInput1 != null, typeof(ArgumentNullException), nameof(effectInput1)); + Debug2.Validate(effectInput2 != null, typeof(ArgumentNullException), nameof(effectInput2)); + this.m_effectInput1 = effectInput1; + this.m_effectInput2 = effectInput2; + this.m_colorOperation = colorOperation; + this.m_alphaOperation = alphaOperation; + } - public BlendElement() - { - this.m_stName = "Blend"; - this.m_typeInput = EffectInputType.Blend; - this.m_alphaOperation = AlphaOperation.Source1; - } + public BlendElement( + EffectInput effectInput1, + EffectInput effectInput2, + ColorOperation colorOperation) + : this() + { + Debug2.Validate(effectInput1 != null, typeof(ArgumentNullException), nameof(effectInput1)); + Debug2.Validate(effectInput2 != null, typeof(ArgumentNullException), nameof(effectInput2)); + this.m_effectInput1 = effectInput1; + this.m_effectInput2 = effectInput2; + this.m_colorOperation = colorOperation; + } - public EffectInput Input1 - { - get => this.m_effectInput1; - set => this.m_effectInput1 = value; - } + public BlendElement() + { + this.m_stName = "Blend"; + this.m_typeInput = EffectInputType.Blend; + this.m_alphaOperation = AlphaOperation.Source1; + } - public EffectInput Input2 - { - get => this.m_effectInput2; - set => this.m_effectInput2 = value; - } + public EffectInput Input1 + { + get => this.m_effectInput1; + set => this.m_effectInput1 = value; + } - public ColorOperation ColorOperation - { - get => this.m_colorOperation; - set => this.m_colorOperation = value; - } + public EffectInput Input2 + { + get => this.m_effectInput2; + set => this.m_effectInput2 = value; + } - public AlphaOperation AlphaOperation - { - get => this.m_alphaOperation; - set => this.m_alphaOperation = value; - } + public ColorOperation ColorOperation + { + get => this.m_colorOperation; + set => this.m_colorOperation = value; + } - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GenerateClassCacheKey((byte) 2, (byte) this.m_colorOperation, cacheKey); - this.GenerateClassCacheKey((byte) 2, (byte) this.m_alphaOperation, cacheKey); - this.m_effectInput1.AddCacheKey(cacheKey); - this.m_effectInput2.AddCacheKey(cacheKey); - } + public AlphaOperation AlphaOperation + { + get => this.m_alphaOperation; + set => this.m_alphaOperation = value; + } - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + 3 + 3 + this.m_effectInput1.PreProcessProperties(dictionary, ref nNextUniqueID) + this.m_effectInput2.PreProcessProperties(dictionary, ref nNextUniqueID); - } + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GenerateClassCacheKey((byte)2, (byte)this.m_colorOperation, cacheKey); + this.GenerateClassCacheKey((byte)2, (byte)this.m_alphaOperation, cacheKey); + this.m_effectInput1.AddCacheKey(cacheKey); + this.m_effectInput2.AddCacheKey(cacheKey); + } - internal override bool Process(Map dictProperties) => this.m_effectInput1.Process(dictProperties) && this.m_effectInput2.Process(dictProperties); - } + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + 3 + 3 + this.m_effectInput1.PreProcessProperties(dictionary, ref nNextUniqueID) + this.m_effectInput2.PreProcessProperties(dictionary, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.m_effectInput1.Process(dictProperties) && this.m_effectInput2.Process(dictProperties); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BrightnessElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BrightnessElement.cs index 41bfb6f..9690d72 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/BrightnessElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/BrightnessElement.cs @@ -10,44 +10,44 @@ using System; namespace Microsoft.Iris.Render { - public class BrightnessElement : EffectOperation - { - internal const string BrightnessPropertyName = "Brightness"; - private float m_flBrightness; - private byte m_nBrightnessID; - - public BrightnessElement(string stName, float flBrightness) - : this() + public class BrightnessElement : EffectOperation { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate((double) flBrightness >= -1.0 && (double) flBrightness <= 1.0, typeof (ArgumentOutOfRangeException), "Valid range for Brightness is [-1..1]"); - this.m_flBrightness = flBrightness; - this.m_stName = stName; + internal const string BrightnessPropertyName = "Brightness"; + private float m_flBrightness; + private byte m_nBrightnessID; + + public BrightnessElement(string stName, float flBrightness) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate((double)flBrightness >= -1.0 && (double)flBrightness <= 1.0, typeof(ArgumentOutOfRangeException), "Valid range for Brightness is [-1..1]"); + this.m_flBrightness = flBrightness; + this.m_stName = stName; + } + + public BrightnessElement() => this.m_typeOperation = EffectOperationType.Brightness; + + public float Brightness + { + get => this.m_flBrightness; + set => this.m_flBrightness = value; + } + + internal byte BrightnessID => this.m_nBrightnessID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Brightness", (byte)8, ref this.m_nBrightnessID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("Brightness", EffectPropertyType.Float, (object)this.m_flBrightness, this.m_nBrightnessID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Brightness", this.BrightnessID, this.Brightness, cacheKey); + } } - - public BrightnessElement() => this.m_typeOperation = EffectOperationType.Brightness; - - public float Brightness - { - get => this.m_flBrightness; - set => this.m_flBrightness = value; - } - - internal byte BrightnessID => this.m_nBrightnessID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Brightness", (byte) 8, ref this.m_nBrightnessID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("Brightness", EffectPropertyType.Float, (object) this.m_flBrightness, this.m_nBrightnessID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Brightness", this.BrightnessID, this.Brightness, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/CapturedAnimationInput.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/CapturedAnimationInput.cs index c4ba744..25ec490 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/CapturedAnimationInput.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/CapturedAnimationInput.cs @@ -8,37 +8,37 @@ using Microsoft.Iris.Render.Animation; namespace Microsoft.Iris.Render { - public sealed class CapturedAnimationInput : ObjectAnimationInput - { - private bool m_refreshOnRepeat; - - public CapturedAnimationInput(IAnimatable sourceObject, string sourcePropertyName) - : this(sourceObject, sourcePropertyName, (string) null) + public sealed class CapturedAnimationInput : ObjectAnimationInput { - } + private bool m_refreshOnRepeat; - public CapturedAnimationInput( - IAnimatable sourceObject, - string sourcePropertyName, - string sourceMaskSpec) - : base(sourceObject, sourcePropertyName, sourceMaskSpec) - { - } + public CapturedAnimationInput(IAnimatable sourceObject, string sourcePropertyName) + : this(sourceObject, sourcePropertyName, (string)null) + { + } - public CapturedAnimationInput(IAnimation sourceAnimation) - : this(sourceAnimation, (string) null) - { - } + public CapturedAnimationInput( + IAnimatable sourceObject, + string sourcePropertyName, + string sourceMaskSpec) + : base(sourceObject, sourcePropertyName, sourceMaskSpec) + { + } - public CapturedAnimationInput(IAnimation sourceAnimation, string sourceMaskSpec) - : base(sourceAnimation, sourceMaskSpec) - { - } + public CapturedAnimationInput(IAnimation sourceAnimation) + : this(sourceAnimation, (string)null) + { + } - public bool RefreshOnRepeat - { - get => this.m_refreshOnRepeat; - set => this.m_refreshOnRepeat = value; + public CapturedAnimationInput(IAnimation sourceAnimation, string sourceMaskSpec) + : base(sourceAnimation, sourceMaskSpec) + { + } + + public bool RefreshOnRepeat + { + get => this.m_refreshOnRepeat; + set => this.m_refreshOnRepeat = value; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/CloseHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/CloseHandler.cs index 656aa95..86fb709 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/CloseHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/CloseHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void CloseHandler(); + public delegate void CloseHandler(); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/CloseRequestHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/CloseRequestHandler.cs index 7089b01..edae4d9 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/CloseRequestHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/CloseRequestHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void CloseRequestHandler(); + public delegate void CloseRequestHandler(); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorElement.cs index 9fd0579..9dcd5e7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorElement.cs @@ -9,53 +9,53 @@ using Microsoft.Iris.Render.Graphics; namespace Microsoft.Iris.Render { - public class ColorElement : EffectInput - { - internal const string ColorPropertyName = "Color"; - private ColorF m_clrColor; - private byte m_nColorID; - private static ColorF s_defaultColor = new ColorF(0, 0, 0, 0); - - public ColorElement(string stName, ColorF clrSolid) + public class ColorElement : EffectInput { - this.m_stName = stName; - this.m_typeInput = EffectInputType.Color; - this.m_clrColor = clrSolid; + internal const string ColorPropertyName = "Color"; + private ColorF m_clrColor; + private byte m_nColorID; + private static ColorF s_defaultColor = new ColorF(0, 0, 0, 0); + + public ColorElement(string stName, ColorF clrSolid) + { + this.m_stName = stName; + this.m_typeInput = EffectInputType.Color; + this.m_clrColor = clrSolid; + } + + public ColorElement(string stName) + : this(stName, ColorElement.DefaultColor) + { + } + + public ColorElement() + : this("", ColorElement.DefaultColor) + { + } + + public ColorF Color + { + get => this.m_clrColor; + set => this.m_clrColor = value; + } + + internal byte ColorID => this.m_nColorID; + + internal static ColorF DefaultColor => ColorElement.s_defaultColor; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Color", (byte)20, ref this.m_nColorID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("Color", EffectPropertyType.Color, (object)this.m_clrColor, this.m_nColorID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Color", this.ColorID, this.Color.ToVector4(), cacheKey); + } } - - public ColorElement(string stName) - : this(stName, ColorElement.DefaultColor) - { - } - - public ColorElement() - : this("", ColorElement.DefaultColor) - { - } - - public ColorF Color - { - get => this.m_clrColor; - set => this.m_clrColor = value; - } - - internal byte ColorID => this.m_nColorID; - - internal static ColorF DefaultColor => ColorElement.s_defaultColor; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Color", (byte) 20, ref this.m_nColorID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("Color", EffectPropertyType.Color, (object) this.m_clrColor, this.m_nColorID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Color", this.ColorID, this.Color.ToVector4(), cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorF.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorF.cs index 00fa258..c2ede17 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorF.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorF.cs @@ -10,210 +10,210 @@ using System; namespace Microsoft.Iris.Render { - [Serializable] - public struct ColorF - { - private const int ARGBAlphaShift = 24; - private const int ARGBRedShift = 16; - private const int ARGBGreenShift = 8; - private const int ARGBBlueShift = 0; - private float m_flA; - private float m_flR; - private float m_flG; - private float m_flB; - - public ColorF(int red, int green, int blue) => this = ColorF.FromArgb((int) byte.MaxValue, red, green, blue); - - public ColorF(float red, float green, float blue) + [Serializable] + public struct ColorF { - this.m_flA = 1f; - this.m_flR = red; - this.m_flG = green; - this.m_flB = blue; + private const int ARGBAlphaShift = 24; + private const int ARGBRedShift = 16; + private const int ARGBGreenShift = 8; + private const int ARGBBlueShift = 0; + private float m_flA; + private float m_flR; + private float m_flG; + private float m_flB; + + public ColorF(int red, int green, int blue) => this = ColorF.FromArgb((int)byte.MaxValue, red, green, blue); + + public ColorF(float red, float green, float blue) + { + this.m_flA = 1f; + this.m_flR = red; + this.m_flG = green; + this.m_flB = blue; + } + + public ColorF(int alpha, int red, int green, int blue) => this = ColorF.FromArgb(alpha, red, green, blue); + + public ColorF(float alpha, float red, float green, float blue) + { + this.m_flA = alpha; + this.m_flR = red; + this.m_flG = green; + this.m_flB = blue; + } + + public float R + { + get => this.m_flR; + set => this.m_flR = value; + } + + public float G + { + get => this.m_flG; + set => this.m_flG = value; + } + + public float B + { + get => this.m_flB; + set => this.m_flB = value; + } + + public float A + { + get => this.m_flA; + set => this.m_flA = value; + } + + public uint PackedInt + { + get => (uint)((int)ColorF.ChannelToByte(this.m_flA) << 24 | (int)ColorF.ChannelToByte(this.m_flR) << 16 | (int)ColorF.ChannelToByte(this.m_flG) << 8) | (uint)ColorF.ChannelToByte(this.m_flB); + set => this = ColorF.FromArgb(value); + } + + private static float CheckByte(int value, string name) + { + if (value < 0 || value > (int)byte.MaxValue) + throw new ArgumentException(string.Format("Invalid value ({0}) for {1} color channel. Expecting a value between 0 and 255.", (object)value, (object)name), name); + return (float)value / (float)byte.MaxValue; + } + + private static byte ChannelToByte(float flChannel) => (byte)Math.Round((double)Math.Max(Math.Min(1f, flChannel), 0.0f) * (double)byte.MaxValue); + + private static uint MakeArgb(byte alpha, byte red, byte green, byte blue) => (uint)((int)red << 16 | (int)green << 8 | (int)blue | (int)alpha << 24); + + internal static ColorF FromCOLORREF(Win32Api.COLORREF cr) => ColorF.FromArgb(Win32Api.GetRValue(cr), Win32Api.GetGValue(cr), Win32Api.GetBValue(cr)); + + public static ColorF FromArgb(uint argb) => new ColorF((int)(argb >> 24) & (int)byte.MaxValue, (int)(argb >> 16) & (int)byte.MaxValue, (int)(argb >> 8) & (int)byte.MaxValue, (int)argb & (int)byte.MaxValue); + + public static ColorF FromArgb(int alpha, int red, int green, int blue) => new ColorF(ColorF.CheckByte(alpha, nameof(alpha)), ColorF.CheckByte(red, nameof(red)), ColorF.CheckByte(green, nameof(green)), ColorF.CheckByte(blue, nameof(blue))); + + public static ColorF FromArgb(int red, int green, int blue) => ColorF.FromArgb((int)byte.MaxValue, red, green, blue); + + internal Win32Api.COLORREF ToCOLORREF() => Win32Api.RGB(ColorF.ChannelToByte(this.m_flR), ColorF.ChannelToByte(this.m_flG), ColorF.ChannelToByte(this.m_flB)); + + internal Win32Api.COLORREF ToCOLORREF2() => Win32Api.ARGB(ColorF.ChannelToByte(this.m_flA), ColorF.ChannelToByte(this.m_flR), ColorF.ChannelToByte(this.m_flG), ColorF.ChannelToByte(this.m_flB)); + + internal float GetValue() + { + float num1 = this.m_flR; + float num2 = this.m_flR; + if ((double)this.m_flG > (double)num1) + num1 = this.m_flG; + if ((double)this.m_flB > (double)num1) + num1 = this.m_flB; + if ((double)this.m_flG < (double)num2) + num2 = this.m_flG; + if ((double)this.m_flB < (double)num2) + num2 = this.m_flB; + return (float)(((double)num1 + (double)num2) / 2.0); + } + + internal float GetHue() + { + if (Math2.WithinEpsilon(this.m_flR, this.m_flG) && Math2.WithinEpsilon(this.m_flG, this.m_flB)) + return 0.0f; + float num1 = 0.0f; + float num2 = this.m_flR; + float num3 = this.m_flR; + if ((double)this.m_flG > (double)num2) + num2 = this.m_flG; + if ((double)this.m_flB > (double)num2) + num2 = this.m_flB; + if ((double)this.m_flG < (double)num3) + num3 = this.m_flG; + if ((double)this.m_flB < (double)num3) + num3 = this.m_flB; + float num4 = num2 - num3; + if ((double)this.m_flR == (double)num2) + num1 = (this.m_flG - this.m_flB) / num4; + else if ((double)this.m_flG == (double)num2) + num1 = (float)(2.0 + ((double)this.m_flB - (double)this.m_flR) / (double)num4); + else if ((double)this.m_flB == (double)num2) + num1 = (float)(4.0 + ((double)this.m_flR - (double)this.m_flG) / (double)num4); + float num5 = num1 * 60f; + if ((double)num5 < 0.0) + num5 += 360f; + return num5; + } + + internal float GetSaturation() + { + float num = 0.0f; + float flValue1 = this.m_flR; + float flValue2 = this.m_flR; + if ((double)this.m_flG > (double)flValue1) + flValue1 = this.m_flG; + if ((double)this.m_flB > (double)flValue1) + flValue1 = this.m_flB; + if ((double)this.m_flG < (double)flValue2) + flValue2 = this.m_flG; + if ((double)this.m_flB < (double)flValue2) + flValue2 = this.m_flB; + if (!Math2.WithinEpsilon(flValue1, flValue2)) + num = ((double)flValue1 + (double)flValue2) / 2.0 > 0.5 ? (float)(((double)flValue1 - (double)flValue2) / (2.0 - (double)flValue1 - (double)flValue2)) : (float)(((double)flValue1 - (double)flValue2) / ((double)flValue1 + (double)flValue2)); + return num; + } + + internal static ColorF FromHSV( + float flAlpha, + float flHue, + float flSaturation, + float flValue) + { + Debug2.Validate((double)flHue >= 0.0 && (double)flHue < 360.0, typeof(ArgumentOutOfRangeException), nameof(flHue)); + Debug2.Validate((double)flSaturation >= 0.0 && (double)flSaturation <= 1.0, typeof(ArgumentOutOfRangeException), nameof(flSaturation)); + Debug2.Validate((double)flValue >= 0.0 && (double)flValue <= 1.0, typeof(ArgumentOutOfRangeException), nameof(flValue)); + if (Math2.WithinEpsilon(flSaturation, 0.0f)) + return new ColorF(flAlpha, flValue, flValue, flValue); + float num1 = flHue / 60f; + int num2 = (int)Math.Floor((double)num1) % 6; + float num3 = num1 - (float)num2; + float num4 = flValue * (1f - flSaturation); + float num5 = flValue * (float)(1.0 - (double)num3 * (double)flSaturation); + float num6 = flValue * (float)(1.0 - (1.0 - (double)num3) * (double)flSaturation); + switch (num2) + { + case 0: + return new ColorF(flAlpha, flValue, num6, num4); + case 1: + return new ColorF(flAlpha, num5, flValue, num4); + case 2: + return new ColorF(flAlpha, num4, flValue, num6); + case 3: + return new ColorF(flAlpha, num4, num5, flValue); + case 4: + return new ColorF(flAlpha, num6, num4, flValue); + case 5: + return new ColorF(flAlpha, flValue, num4, num5); + default: + return new ColorF(flAlpha, 0.0f, 0.0f, 0.0f); + } + } + + public static bool operator ==(ColorF left, ColorF right) => Math2.WithinEpsilon(left.A, right.A) && Math2.WithinEpsilon(left.R, right.R) && Math2.WithinEpsilon(left.G, right.G) && Math2.WithinEpsilon(left.B, right.B); + + public static bool operator !=(ColorF left, ColorF right) => !Math2.WithinEpsilon(left.A, right.A) || !Math2.WithinEpsilon(left.R, right.R) || !Math2.WithinEpsilon(left.G, right.G) || !Math2.WithinEpsilon(left.B, right.B); + + public override bool Equals(object obj) => obj is ColorF colorF && this == colorF; + + public Vector4 ToVector4() => new Vector4(this.m_flR, this.m_flG, this.m_flB, this.m_flA); + + public static ColorF operator *(ColorF color, float value) => new ColorF(color.A * value, color.R * value, color.G * value, color.B * value); + + public static ColorF operator +(ColorF left, ColorF right) => new ColorF(left.A + right.A, left.R + right.R, left.G + right.G, left.B + right.B); + + public void Clamp() + { + this.m_flA = Math.Min(Math.Max(0.0f, this.m_flA), 1f); + this.m_flR = Math.Min(Math.Max(0.0f, this.m_flR), 1f); + this.m_flG = Math.Min(Math.Max(0.0f, this.m_flG), 1f); + this.m_flB = Math.Min(Math.Max(0.0f, this.m_flB), 1f); + } + + public override string ToString() => base.ToString(); + + public override int GetHashCode() => this.PackedInt.GetHashCode(); } - - public ColorF(int alpha, int red, int green, int blue) => this = ColorF.FromArgb(alpha, red, green, blue); - - public ColorF(float alpha, float red, float green, float blue) - { - this.m_flA = alpha; - this.m_flR = red; - this.m_flG = green; - this.m_flB = blue; - } - - public float R - { - get => this.m_flR; - set => this.m_flR = value; - } - - public float G - { - get => this.m_flG; - set => this.m_flG = value; - } - - public float B - { - get => this.m_flB; - set => this.m_flB = value; - } - - public float A - { - get => this.m_flA; - set => this.m_flA = value; - } - - public uint PackedInt - { - get => (uint) ((int) ColorF.ChannelToByte(this.m_flA) << 24 | (int) ColorF.ChannelToByte(this.m_flR) << 16 | (int) ColorF.ChannelToByte(this.m_flG) << 8) | (uint) ColorF.ChannelToByte(this.m_flB); - set => this = ColorF.FromArgb(value); - } - - private static float CheckByte(int value, string name) - { - if (value < 0 || value > (int) byte.MaxValue) - throw new ArgumentException(string.Format("Invalid value ({0}) for {1} color channel. Expecting a value between 0 and 255.", (object) value, (object) name), name); - return (float) value / (float) byte.MaxValue; - } - - private static byte ChannelToByte(float flChannel) => (byte) Math.Round((double) Math.Max(Math.Min(1f, flChannel), 0.0f) * (double) byte.MaxValue); - - private static uint MakeArgb(byte alpha, byte red, byte green, byte blue) => (uint) ((int) red << 16 | (int) green << 8 | (int) blue | (int) alpha << 24); - - internal static ColorF FromCOLORREF(Win32Api.COLORREF cr) => ColorF.FromArgb(Win32Api.GetRValue(cr), Win32Api.GetGValue(cr), Win32Api.GetBValue(cr)); - - public static ColorF FromArgb(uint argb) => new ColorF((int) (argb >> 24) & (int) byte.MaxValue, (int) (argb >> 16) & (int) byte.MaxValue, (int) (argb >> 8) & (int) byte.MaxValue, (int) argb & (int) byte.MaxValue); - - public static ColorF FromArgb(int alpha, int red, int green, int blue) => new ColorF(ColorF.CheckByte(alpha, nameof (alpha)), ColorF.CheckByte(red, nameof (red)), ColorF.CheckByte(green, nameof (green)), ColorF.CheckByte(blue, nameof (blue))); - - public static ColorF FromArgb(int red, int green, int blue) => ColorF.FromArgb((int) byte.MaxValue, red, green, blue); - - internal Win32Api.COLORREF ToCOLORREF() => Win32Api.RGB(ColorF.ChannelToByte(this.m_flR), ColorF.ChannelToByte(this.m_flG), ColorF.ChannelToByte(this.m_flB)); - - internal Win32Api.COLORREF ToCOLORREF2() => Win32Api.ARGB(ColorF.ChannelToByte(this.m_flA), ColorF.ChannelToByte(this.m_flR), ColorF.ChannelToByte(this.m_flG), ColorF.ChannelToByte(this.m_flB)); - - internal float GetValue() - { - float num1 = this.m_flR; - float num2 = this.m_flR; - if ((double) this.m_flG > (double) num1) - num1 = this.m_flG; - if ((double) this.m_flB > (double) num1) - num1 = this.m_flB; - if ((double) this.m_flG < (double) num2) - num2 = this.m_flG; - if ((double) this.m_flB < (double) num2) - num2 = this.m_flB; - return (float) (((double) num1 + (double) num2) / 2.0); - } - - internal float GetHue() - { - if (Math2.WithinEpsilon(this.m_flR, this.m_flG) && Math2.WithinEpsilon(this.m_flG, this.m_flB)) - return 0.0f; - float num1 = 0.0f; - float num2 = this.m_flR; - float num3 = this.m_flR; - if ((double) this.m_flG > (double) num2) - num2 = this.m_flG; - if ((double) this.m_flB > (double) num2) - num2 = this.m_flB; - if ((double) this.m_flG < (double) num3) - num3 = this.m_flG; - if ((double) this.m_flB < (double) num3) - num3 = this.m_flB; - float num4 = num2 - num3; - if ((double) this.m_flR == (double) num2) - num1 = (this.m_flG - this.m_flB) / num4; - else if ((double) this.m_flG == (double) num2) - num1 = (float) (2.0 + ((double) this.m_flB - (double) this.m_flR) / (double) num4); - else if ((double) this.m_flB == (double) num2) - num1 = (float) (4.0 + ((double) this.m_flR - (double) this.m_flG) / (double) num4); - float num5 = num1 * 60f; - if ((double) num5 < 0.0) - num5 += 360f; - return num5; - } - - internal float GetSaturation() - { - float num = 0.0f; - float flValue1 = this.m_flR; - float flValue2 = this.m_flR; - if ((double) this.m_flG > (double) flValue1) - flValue1 = this.m_flG; - if ((double) this.m_flB > (double) flValue1) - flValue1 = this.m_flB; - if ((double) this.m_flG < (double) flValue2) - flValue2 = this.m_flG; - if ((double) this.m_flB < (double) flValue2) - flValue2 = this.m_flB; - if (!Math2.WithinEpsilon(flValue1, flValue2)) - num = ((double) flValue1 + (double) flValue2) / 2.0 > 0.5 ? (float) (((double) flValue1 - (double) flValue2) / (2.0 - (double) flValue1 - (double) flValue2)) : (float) (((double) flValue1 - (double) flValue2) / ((double) flValue1 + (double) flValue2)); - return num; - } - - internal static ColorF FromHSV( - float flAlpha, - float flHue, - float flSaturation, - float flValue) - { - Debug2.Validate((double) flHue >= 0.0 && (double) flHue < 360.0, typeof (ArgumentOutOfRangeException), nameof (flHue)); - Debug2.Validate((double) flSaturation >= 0.0 && (double) flSaturation <= 1.0, typeof (ArgumentOutOfRangeException), nameof (flSaturation)); - Debug2.Validate((double) flValue >= 0.0 && (double) flValue <= 1.0, typeof (ArgumentOutOfRangeException), nameof (flValue)); - if (Math2.WithinEpsilon(flSaturation, 0.0f)) - return new ColorF(flAlpha, flValue, flValue, flValue); - float num1 = flHue / 60f; - int num2 = (int) Math.Floor((double) num1) % 6; - float num3 = num1 - (float) num2; - float num4 = flValue * (1f - flSaturation); - float num5 = flValue * (float) (1.0 - (double) num3 * (double) flSaturation); - float num6 = flValue * (float) (1.0 - (1.0 - (double) num3) * (double) flSaturation); - switch (num2) - { - case 0: - return new ColorF(flAlpha, flValue, num6, num4); - case 1: - return new ColorF(flAlpha, num5, flValue, num4); - case 2: - return new ColorF(flAlpha, num4, flValue, num6); - case 3: - return new ColorF(flAlpha, num4, num5, flValue); - case 4: - return new ColorF(flAlpha, num6, num4, flValue); - case 5: - return new ColorF(flAlpha, flValue, num4, num5); - default: - return new ColorF(flAlpha, 0.0f, 0.0f, 0.0f); - } - } - - public static bool operator ==(ColorF left, ColorF right) => Math2.WithinEpsilon(left.A, right.A) && Math2.WithinEpsilon(left.R, right.R) && Math2.WithinEpsilon(left.G, right.G) && Math2.WithinEpsilon(left.B, right.B); - - public static bool operator !=(ColorF left, ColorF right) => !Math2.WithinEpsilon(left.A, right.A) || !Math2.WithinEpsilon(left.R, right.R) || !Math2.WithinEpsilon(left.G, right.G) || !Math2.WithinEpsilon(left.B, right.B); - - public override bool Equals(object obj) => obj is ColorF colorF && this == colorF; - - public Vector4 ToVector4() => new Vector4(this.m_flR, this.m_flG, this.m_flB, this.m_flA); - - public static ColorF operator *(ColorF color, float value) => new ColorF(color.A * value, color.R * value, color.G * value, color.B * value); - - public static ColorF operator +(ColorF left, ColorF right) => new ColorF(left.A + right.A, left.R + right.R, left.G + right.G, left.B + right.B); - - public void Clamp() - { - this.m_flA = Math.Min(Math.Max(0.0f, this.m_flA), 1f); - this.m_flR = Math.Min(Math.Max(0.0f, this.m_flR), 1f); - this.m_flG = Math.Min(Math.Max(0.0f, this.m_flG), 1f); - this.m_flB = Math.Min(Math.Max(0.0f, this.m_flB), 1f); - } - - public override string ToString() => base.ToString(); - - public override int GetHashCode() => this.PackedInt.GetHashCode(); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorOperation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorOperation.cs index 66b2bf3..54b41ea 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorOperation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ColorOperation.cs @@ -6,20 +6,20 @@ namespace Microsoft.Iris.Render { - public enum ColorOperation - { - Add = 0, - LinearDodge = 0, - Subtract = 1, - Multiply = 2, - Lighten = 3, - Darken = 4, - ColorDodge = 5, - ColorBurn = 6, - Screen = 7, - Overlay = 8, - SoftLight = 9, - HardLight = 10, // 0x0000000A - LinearBurn = 11, // 0x0000000B - } + public enum ColorOperation + { + Add = 0, + LinearDodge = 0, + Subtract = 1, + Multiply = 2, + Lighten = 3, + Darken = 4, + ColorDodge = 5, + ColorBurn = 6, + Screen = 7, + Overlay = 8, + SoftLight = 9, + HardLight = 10, // 0x0000000A + LinearBurn = 11, // 0x0000000B + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ByteBuilder.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ByteBuilder.cs index c8b33a6..a534495 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ByteBuilder.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ByteBuilder.cs @@ -9,83 +9,83 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Common { - internal class ByteBuilder - { - private byte[] m_data; - private int m_nCurrentIndex; - private byte m_nHashCode; - - internal ByteBuilder(int nMaxSize) + internal class ByteBuilder { - this.m_data = new byte[nMaxSize]; - this.m_nCurrentIndex = 0; - this.m_nHashCode = (byte) 0; + private byte[] m_data; + private int m_nCurrentIndex; + private byte m_nHashCode; + + internal ByteBuilder(int nMaxSize) + { + this.m_data = new byte[nMaxSize]; + this.m_nCurrentIndex = 0; + this.m_nHashCode = (byte)0; + } + + internal int Capacity => this.m_data.Length; + + internal int Size => this.m_nCurrentIndex; + + internal void AppendByte(byte data) + { + this.m_data[this.m_nCurrentIndex] = data; + ++this.m_nCurrentIndex; + } + + internal unsafe void AppendInt(int nData) + { + Marshal.Copy(new IntPtr((void*)&nData), this.m_data, this.m_nCurrentIndex, 4); + this.m_nCurrentIndex += 4; + } + + internal unsafe void AppendFloat(float fData) + { + Marshal.Copy(new IntPtr((void*)&fData), this.m_data, this.m_nCurrentIndex, 4); + this.m_nCurrentIndex += 4; + } + + internal unsafe void AppendVector(Vector2 vData) + { + Marshal.Copy(new IntPtr((void*)&vData), this.m_data, this.m_nCurrentIndex, sizeof(Vector2)); + this.m_nCurrentIndex += 8; + } + + internal unsafe void AppendVector(Vector3 vData) + { + Marshal.Copy(new IntPtr((void*)&vData), this.m_data, this.m_nCurrentIndex, sizeof(Vector3)); + this.m_nCurrentIndex += 12; + } + + internal unsafe void AppendVector(Vector4 vData) + { + Marshal.Copy(new IntPtr((void*)&vData), this.m_data, this.m_nCurrentIndex, sizeof(Vector4)); + this.m_nCurrentIndex += 16; + } + + internal void Reset() => this.m_nCurrentIndex = 0; + + public override int GetHashCode() + { + if (this.m_nHashCode != (byte)0) + return (int)this.m_nHashCode; + int num = 0; + for (int index = 0; index < this.m_nCurrentIndex; ++index) + num += (int)this.m_data[index]; + this.m_nHashCode = (byte)num; + return (int)this.m_nHashCode; + } + + public override bool Equals(object obj) + { + ByteBuilder byteBuilder = obj as ByteBuilder; + if (byteBuilder.Size != this.Size) + return false; + for (int index = 0; index < this.Size; ++index) + { + if ((int)this.m_data[index] != (int)byteBuilder.m_data[index]) + return false; + } + return true; + } } - - internal int Capacity => this.m_data.Length; - - internal int Size => this.m_nCurrentIndex; - - internal void AppendByte(byte data) - { - this.m_data[this.m_nCurrentIndex] = data; - ++this.m_nCurrentIndex; - } - - internal unsafe void AppendInt(int nData) - { - Marshal.Copy(new IntPtr((void*) &nData), this.m_data, this.m_nCurrentIndex, 4); - this.m_nCurrentIndex += 4; - } - - internal unsafe void AppendFloat(float fData) - { - Marshal.Copy(new IntPtr((void*) &fData), this.m_data, this.m_nCurrentIndex, 4); - this.m_nCurrentIndex += 4; - } - - internal unsafe void AppendVector(Vector2 vData) - { - Marshal.Copy(new IntPtr((void*) &vData), this.m_data, this.m_nCurrentIndex, sizeof (Vector2)); - this.m_nCurrentIndex += 8; - } - - internal unsafe void AppendVector(Vector3 vData) - { - Marshal.Copy(new IntPtr((void*) &vData), this.m_data, this.m_nCurrentIndex, sizeof (Vector3)); - this.m_nCurrentIndex += 12; - } - - internal unsafe void AppendVector(Vector4 vData) - { - Marshal.Copy(new IntPtr((void*) &vData), this.m_data, this.m_nCurrentIndex, sizeof (Vector4)); - this.m_nCurrentIndex += 16; - } - - internal void Reset() => this.m_nCurrentIndex = 0; - - public override int GetHashCode() - { - if (this.m_nHashCode != (byte) 0) - return (int) this.m_nHashCode; - int num = 0; - for (int index = 0; index < this.m_nCurrentIndex; ++index) - num += (int) this.m_data[index]; - this.m_nHashCode = (byte) num; - return (int) this.m_nHashCode; - } - - public override bool Equals(object obj) - { - ByteBuilder byteBuilder = obj as ByteBuilder; - if (byteBuilder.Size != this.Size) - return false; - for (int index = 0; index < this.Size; ++index) - { - if ((int) this.m_data[index] != (int) byteBuilder.m_data[index]) - return false; - } - return true; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/CachedRenderObject.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/CachedRenderObject.cs index f920207..63032a2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/CachedRenderObject.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/CachedRenderObject.cs @@ -6,23 +6,23 @@ namespace Microsoft.Iris.Render.Common { - internal abstract class CachedRenderObject : SharedRenderObject - { - private ObjectCache m_cache; - - internal ObjectCache Cache + internal abstract class CachedRenderObject : SharedRenderObject { - get => this.m_cache; - set => this.m_cache = value; - } + private ObjectCache m_cache; - internal override void UnregisterUsage(object user) - { - if (this.UsageCount == 1 && this.m_cache != null && this.m_cache.Add(this)) - this.Reset(); - base.UnregisterUsage(user); - } + internal ObjectCache Cache + { + get => this.m_cache; + set => this.m_cache = value; + } - internal abstract void Reset(); - } + internal override void UnregisterUsage(object user) + { + if (this.UsageCount == 1 && this.m_cache != null && this.m_cache.Add(this)) + this.Reset(); + base.UnregisterUsage(user); + } + + internal abstract void Reset(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/Debug2.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/Debug2.cs index 2141602..b677828 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/Debug2.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/Debug2.cs @@ -10,288 +10,288 @@ using System.Globalization; namespace Microsoft.Iris.Render.Common { - internal static class Debug2 - { - private static IDebug s_debug; - - internal static IDebug Module + internal static class Debug2 { - get => Debug2.s_debug; - set => Debug2.s_debug = value; - } + private static IDebug s_debug; - [Conditional("DEBUG")] - internal static void Enter(string stBlock) - { - if (Debug2.s_debug == null) - return; - Debug2.s_debug.Enter(stBlock); - } + internal static IDebug Module + { + get => Debug2.s_debug; + set => Debug2.s_debug = value; + } - [Conditional("DEBUG")] - internal static void Leave(string stBlock) - { - if (Debug2.s_debug == null) - return; - Debug2.s_debug.Leave(stBlock); - } + [Conditional("DEBUG")] + internal static void Enter(string stBlock) + { + if (Debug2.s_debug == null) + return; + Debug2.s_debug.Enter(stBlock); + } - [Conditional("DEBUG")] - internal static void Assert(bool condition, string stMessage) - { - if (condition || Debug2.s_debug == null) - return; - Debug2.s_debug.Assert(condition, stMessage); - } + [Conditional("DEBUG")] + internal static void Leave(string stBlock) + { + if (Debug2.s_debug == null) + return; + Debug2.s_debug.Leave(stBlock); + } - [Conditional("DEBUG")] - internal static void Assert(bool condition, string format, object arg1) - { - if (condition || Debug2.s_debug == null) - return; - Debug2.s_debug.Assert(condition, string.Format(format, arg1)); - } + [Conditional("DEBUG")] + internal static void Assert(bool condition, string stMessage) + { + if (condition || Debug2.s_debug == null) + return; + Debug2.s_debug.Assert(condition, stMessage); + } - [Conditional("DEBUG")] - internal static void Assert(bool condition, string format, object arg1, object arg2) - { - if (condition || Debug2.s_debug == null) - return; - Debug2.s_debug.Assert(condition, string.Format(format, arg1, arg2)); - } + [Conditional("DEBUG")] + internal static void Assert(bool condition, string format, object arg1) + { + if (condition || Debug2.s_debug == null) + return; + Debug2.s_debug.Assert(condition, string.Format(format, arg1)); + } - internal static void Throw(bool condition, string format) - { - if (!condition) - { - if (Debug2.s_debug != null) - Debug2.s_debug.Throw(condition, format); - throw new InvalidOperationException(format); - } - } + [Conditional("DEBUG")] + internal static void Assert(bool condition, string format, object arg1, object arg2) + { + if (condition || Debug2.s_debug == null) + return; + Debug2.s_debug.Assert(condition, string.Format(format, arg1, arg2)); + } - internal static void Throw(bool condition, string format, object arg1) - { - if (!condition) - { - if (Debug2.s_debug != null) - Debug2.s_debug.Throw(condition, string.Format(format, arg1)); - throw new InvalidOperationException(string.Format((IFormatProvider) CultureInfo.InvariantCulture, format, arg1)); - } - } + internal static void Throw(bool condition, string format) + { + if (!condition) + { + if (Debug2.s_debug != null) + Debug2.s_debug.Throw(condition, format); + throw new InvalidOperationException(format); + } + } - internal static void Validate(bool condition, Type exceptionType, string arg1) - { - if (!condition) - { - if (exceptionType == null) - exceptionType = typeof (ArgumentException); - throw (Exception) Activator.CreateInstance(exceptionType, (object) arg1); - } - } + internal static void Throw(bool condition, string format, object arg1) + { + if (!condition) + { + if (Debug2.s_debug != null) + Debug2.s_debug.Throw(condition, string.Format(format, arg1)); + throw new InvalidOperationException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, arg1)); + } + } - internal static void Validate(bool condition, Type exceptionType, object arg1, object arg2) - { - if (!condition) - { - if (exceptionType == null) - exceptionType = typeof (ArgumentException); - throw (Exception) Activator.CreateInstance(exceptionType, arg1, arg2); - } - } + internal static void Validate(bool condition, Type exceptionType, string arg1) + { + if (!condition) + { + if (exceptionType == null) + exceptionType = typeof(ArgumentException); + throw (Exception)Activator.CreateInstance(exceptionType, (object)arg1); + } + } - [Conditional("DEBUG")] - internal static void Write(DebugCategory category, int verbosityLevel, string message) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.Write(category, verbosityLevel, message); - } + internal static void Validate(bool condition, Type exceptionType, object arg1, object arg2) + { + if (!condition) + { + if (exceptionType == null) + exceptionType = typeof(ArgumentException); + throw (Exception)Activator.CreateInstance(exceptionType, arg1, arg2); + } + } - [Conditional("DEBUG")] - internal static void WriteLine(DebugCategory category, int verbosityLevel, string format) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.WriteLine(category, verbosityLevel, format); - } + [Conditional("DEBUG")] + internal static void Write(DebugCategory category, int verbosityLevel, string message) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.Write(category, verbosityLevel, message); + } - [Conditional("DEBUG")] - internal static void WriteLine( - DebugCategory category, - int verbosityLevel, - string format, - object arg1) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1)); - } + [Conditional("DEBUG")] + internal static void WriteLine(DebugCategory category, int verbosityLevel, string format) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.WriteLine(category, verbosityLevel, format); + } - [Conditional("DEBUG")] - internal static void WriteLine( - DebugCategory category, - int verbosityLevel, - string format, - object arg1, - object arg2) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2)); - } + [Conditional("DEBUG")] + internal static void WriteLine( + DebugCategory category, + int verbosityLevel, + string format, + object arg1) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1)); + } - [Conditional("DEBUG")] - internal static void WriteLine( - DebugCategory category, - int verbosityLevel, - string format, - object arg1, - object arg2, - object arg3) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2, arg3)); - } + [Conditional("DEBUG")] + internal static void WriteLine( + DebugCategory category, + int verbosityLevel, + string format, + object arg1, + object arg2) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2)); + } - [Conditional("DEBUG")] - internal static void WriteLine( - DebugCategory category, - int verbosityLevel, - string format, - object arg1, - object arg2, - object arg3, - object arg4) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2, arg3, arg4)); - } + [Conditional("DEBUG")] + internal static void WriteLine( + DebugCategory category, + int verbosityLevel, + string format, + object arg1, + object arg2, + object arg3) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2, arg3)); + } - [Conditional("DEBUG")] - internal static void WriteLine( - DebugCategory category, - int verbosityLevel, - string format, - object arg1, - object arg2, - object arg3, - object arg4, - object arg5) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2, arg3, arg4, arg5)); - } + [Conditional("DEBUG")] + internal static void WriteLine( + DebugCategory category, + int verbosityLevel, + string format, + object arg1, + object arg2, + object arg3, + object arg4) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2, arg3, arg4)); + } - [Conditional("DEBUG")] - internal static void WriteLine( - DebugCategory category, - int verbosityLevel, - string format, - object arg1, - object arg2, - object arg3, - object arg4, - object arg5, - object arg6) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2, arg3, arg4, arg5, arg6)); - } + [Conditional("DEBUG")] + internal static void WriteLine( + DebugCategory category, + int verbosityLevel, + string format, + object arg1, + object arg2, + object arg3, + object arg4, + object arg5) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2, arg3, arg4, arg5)); + } - [Conditional("DEBUG")] - internal static void WriteLine( - DebugCategory category, - int verbosityLevel, - string format, - object arg1, - object arg2, - object arg3, - object arg4, - object arg5, - object arg6, - object arg7) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7)); - } + [Conditional("DEBUG")] + internal static void WriteLine( + DebugCategory category, + int verbosityLevel, + string format, + object arg1, + object arg2, + object arg3, + object arg4, + object arg5, + object arg6) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2, arg3, arg4, arg5, arg6)); + } - [Conditional("DEBUG")] - internal static void Indent(DebugCategory category, int verbosityLevel) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.Indent(category, verbosityLevel); - } + [Conditional("DEBUG")] + internal static void WriteLine( + DebugCategory category, + int verbosityLevel, + string format, + object arg1, + object arg2, + object arg3, + object arg4, + object arg5, + object arg6, + object arg7) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.WriteLine(category, verbosityLevel, string.Format(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7)); + } - [Conditional("DEBUG")] - internal static void Unindent(DebugCategory category, int verbosityLevel) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - return; - Debug2.s_debug.Unindent(category, verbosityLevel); - } + [Conditional("DEBUG")] + internal static void Indent(DebugCategory category, int verbosityLevel) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.Indent(category, verbosityLevel); + } - [Conditional("DEBUG")] - internal static void OpenBrace(DebugCategory category, int verbosityLevel) - { - } + [Conditional("DEBUG")] + internal static void Unindent(DebugCategory category, int verbosityLevel) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + return; + Debug2.s_debug.Unindent(category, verbosityLevel); + } - [Conditional("DEBUG")] - internal static void OpenBrace(DebugCategory category, int verbosityLevel, string format) - { - } + [Conditional("DEBUG")] + internal static void OpenBrace(DebugCategory category, int verbosityLevel) + { + } - [Conditional("DEBUG")] - internal static void OpenBrace( - DebugCategory category, - int verbosityLevel, - string format, - object arg1) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - ; - } + [Conditional("DEBUG")] + internal static void OpenBrace(DebugCategory category, int verbosityLevel, string format) + { + } - [Conditional("DEBUG")] - internal static void OpenBrace( - DebugCategory category, - int verbosityLevel, - string format, - object arg1, - object arg2) - { - if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) - ; - } + [Conditional("DEBUG")] + internal static void OpenBrace( + DebugCategory category, + int verbosityLevel, + string format, + object arg1) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + ; + } - [Conditional("DEBUG")] - internal static void CloseBrace(DebugCategory category, int verbosityLevel) - { - } + [Conditional("DEBUG")] + internal static void OpenBrace( + DebugCategory category, + int verbosityLevel, + string format, + object arg1, + object arg2) + { + if (!Debug2.IsCategoryEnabled(category, verbosityLevel)) + ; + } - internal static bool IsCategoryEnabled(DebugCategory category, int verbosityLevel) => Debug2.s_debug != null && Debug2.s_debug.IsCategoryEnabled(category, verbosityLevel); + [Conditional("DEBUG")] + internal static void CloseBrace(DebugCategory category, int verbosityLevel) + { + } - internal static void DumpException(Debug2.ExceptionType exceptionType, Exception e) - { - switch (exceptionType) - { - default: - Exception innerException = e.InnerException; - break; - } - } + internal static bool IsCategoryEnabled(DebugCategory category, int verbosityLevel) => Debug2.s_debug != null && Debug2.s_debug.IsCategoryEnabled(category, verbosityLevel); - public enum ExceptionType - { - NotHandled, - Recovered, - Ignored, + internal static void DumpException(Debug2.ExceptionType exceptionType, Exception e) + { + switch (exceptionType) + { + default: + Exception innerException = e.InnerException; + break; + } + } + + public enum ExceptionType + { + NotHandled, + Recovered, + Ignored, + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/DeferredHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/DeferredHandler.cs index 9a5d8f1..3358510 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/DeferredHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/DeferredHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render.Common { - internal delegate void DeferredHandler(object args); + internal delegate void DeferredHandler(object args); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/DeferredInvokeItem.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/DeferredInvokeItem.cs index a9acd5b..2bce161 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/DeferredInvokeItem.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/DeferredInvokeItem.cs @@ -8,28 +8,28 @@ using System; namespace Microsoft.Iris.Render.Common { - internal class DeferredInvokeItem : IDeferredInvokeItem - { - private Delegate m_method; - private object m_args; - private SharedRenderObject m_owner; - - internal DeferredInvokeItem(SharedRenderObject owner, Delegate method, object args) + internal class DeferredInvokeItem : IDeferredInvokeItem { - this.m_method = method; - this.m_args = args; - this.m_owner = owner; - if (this.m_owner == null) - return; - this.m_owner.RegisterUsage((object) this); - } + private Delegate m_method; + private object m_args; + private SharedRenderObject m_owner; - public void Dispatch() - { - ((DeferredHandler) this.m_method)(this.m_args); - if (this.m_owner == null) - return; - this.m_owner.UnregisterUsage((object) this); + internal DeferredInvokeItem(SharedRenderObject owner, Delegate method, object args) + { + this.m_method = method; + this.m_args = args; + this.m_owner = owner; + if (this.m_owner == null) + return; + this.m_owner.RegisterUsage((object)this); + } + + public void Dispatch() + { + ((DeferredHandler)this.m_method)(this.m_args); + if (this.m_owner == null) + return; + this.m_owner.UnregisterUsage((object)this); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ObjectCache.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ObjectCache.cs index 8aa8a8c..7ff3f37 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ObjectCache.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ObjectCache.cs @@ -8,120 +8,120 @@ using System; namespace Microsoft.Iris.Render.Common { - internal class ObjectCache : RenderObject - { - private const int k_nReductionThreshold = 3; - private Vector m_listObjects; - private int m_nMaxCacheSize; - private int m_nMinCacheSize; - private int m_nStepSize; - private int m_cCacheMisses; - private int m_cCacheHits; - private bool m_fWasCacheFull; - private int m_cReductionRequests; - - internal ObjectCache(int nMinSize, int nMaxSize, int nStepSize) + internal class ObjectCache : RenderObject { - this.m_listObjects = new Vector(nMinSize); - this.m_nMinCacheSize = nMinSize; - this.m_nMaxCacheSize = nMaxSize; - this.m_nStepSize = nStepSize; - } + private const int k_nReductionThreshold = 3; + private Vector m_listObjects; + private int m_nMaxCacheSize; + private int m_nMinCacheSize; + private int m_nStepSize; + private int m_cCacheMisses; + private int m_cCacheHits; + private bool m_fWasCacheFull; + private int m_cReductionRequests; - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + internal ObjectCache(int nMinSize, int nMaxSize, int nStepSize) { - foreach (CachedRenderObject listObject in this.m_listObjects) - { - listObject.Cache = (ObjectCache) null; - listObject.UnregisterUsage((object) this); - } + this.m_listObjects = new Vector(nMinSize); + this.m_nMinCacheSize = nMinSize; + this.m_nMaxCacheSize = nMaxSize; + this.m_nStepSize = nStepSize; } - this.m_listObjects = (Vector) null; - } - finally - { - base.Dispose(fInDispose); - } - } - internal int Size => this.m_listObjects.Count; - - internal bool Add(CachedRenderObject obj) - { - if (this.m_listObjects.Count < this.m_listObjects.Capacity) - { - obj.RegisterUsage((object) this); - this.m_listObjects.Add(obj); - return true; - } - this.m_fWasCacheFull = true; - return false; - } - - internal CachedRenderObject Remove(object objUser) - { - if (this.m_listObjects.Count > 0) - { - ++this.m_cCacheHits; - int index = this.m_listObjects.Count - 1; - CachedRenderObject listObject = this.m_listObjects[index]; - this.m_listObjects.RemoveAt(index); - listObject.RegisterUsage(objUser); - listObject.UnregisterUsage((object) this); - return listObject; - } - ++this.m_cCacheMisses; - return (CachedRenderObject) null; - } - - internal void RemoveAll() - { - foreach (CachedRenderObject listObject in this.m_listObjects) - { - listObject.Cache = (ObjectCache) null; - listObject.UnregisterUsage((object) this); - } - this.m_listObjects.Clear(); - } - - internal void Update() - { - if (this.ShouldGrowCache()) - this.m_listObjects.Capacity = Math.Min(this.m_listObjects.Capacity + this.m_nStepSize, this.m_nMaxCacheSize); - else if (this.ShouldShrinkCache()) - { - if (this.m_cReductionRequests > 3) + protected override void Dispose(bool fInDispose) { - int num = Math.Max(this.m_listObjects.Capacity - this.m_nStepSize, this.m_nMinCacheSize); - if (this.m_listObjects.Count - num > 0) - { - for (int index = this.m_listObjects.Count - 1; index >= num; --index) + try { - CachedRenderObject listObject = this.m_listObjects[index]; - listObject.Cache = (ObjectCache) null; - listObject.UnregisterUsage((object) this); - this.m_listObjects.RemoveAt(index); + if (fInDispose) + { + foreach (CachedRenderObject listObject in this.m_listObjects) + { + listObject.Cache = (ObjectCache)null; + listObject.UnregisterUsage((object)this); + } + } + this.m_listObjects = (Vector)null; + } + finally + { + base.Dispose(fInDispose); } - } - this.m_listObjects.Capacity = num; - this.m_cReductionRequests = 0; } - else - ++this.m_cReductionRequests; - } - else - this.m_cReductionRequests = 0; - this.m_cCacheMisses = 0; - this.m_cCacheHits = 0; - this.m_fWasCacheFull = false; + + internal int Size => this.m_listObjects.Count; + + internal bool Add(CachedRenderObject obj) + { + if (this.m_listObjects.Count < this.m_listObjects.Capacity) + { + obj.RegisterUsage((object)this); + this.m_listObjects.Add(obj); + return true; + } + this.m_fWasCacheFull = true; + return false; + } + + internal CachedRenderObject Remove(object objUser) + { + if (this.m_listObjects.Count > 0) + { + ++this.m_cCacheHits; + int index = this.m_listObjects.Count - 1; + CachedRenderObject listObject = this.m_listObjects[index]; + this.m_listObjects.RemoveAt(index); + listObject.RegisterUsage(objUser); + listObject.UnregisterUsage((object)this); + return listObject; + } + ++this.m_cCacheMisses; + return (CachedRenderObject)null; + } + + internal void RemoveAll() + { + foreach (CachedRenderObject listObject in this.m_listObjects) + { + listObject.Cache = (ObjectCache)null; + listObject.UnregisterUsage((object)this); + } + this.m_listObjects.Clear(); + } + + internal void Update() + { + if (this.ShouldGrowCache()) + this.m_listObjects.Capacity = Math.Min(this.m_listObjects.Capacity + this.m_nStepSize, this.m_nMaxCacheSize); + else if (this.ShouldShrinkCache()) + { + if (this.m_cReductionRequests > 3) + { + int num = Math.Max(this.m_listObjects.Capacity - this.m_nStepSize, this.m_nMinCacheSize); + if (this.m_listObjects.Count - num > 0) + { + for (int index = this.m_listObjects.Count - 1; index >= num; --index) + { + CachedRenderObject listObject = this.m_listObjects[index]; + listObject.Cache = (ObjectCache)null; + listObject.UnregisterUsage((object)this); + this.m_listObjects.RemoveAt(index); + } + } + this.m_listObjects.Capacity = num; + this.m_cReductionRequests = 0; + } + else + ++this.m_cReductionRequests; + } + else + this.m_cReductionRequests = 0; + this.m_cCacheMisses = 0; + this.m_cCacheHits = 0; + this.m_fWasCacheFull = false; + } + + private bool ShouldGrowCache() => this.m_cCacheMisses > 0 && this.m_fWasCacheFull && this.m_listObjects.Capacity < this.m_nMaxCacheSize; + + private bool ShouldShrinkCache() => this.m_cCacheMisses + this.m_cCacheHits == 0 && this.m_listObjects.Capacity > this.m_nMinCacheSize; } - - private bool ShouldGrowCache() => this.m_cCacheMisses > 0 && this.m_fWasCacheFull && this.m_listObjects.Capacity < this.m_nMaxCacheSize; - - private bool ShouldShrinkCache() => this.m_cCacheMisses + this.m_cCacheHits == 0 && this.m_listObjects.Capacity > this.m_nMinCacheSize; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ObjectCacheManager.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ObjectCacheManager.cs index 655e123..bf9cc1b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ObjectCacheManager.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ObjectCacheManager.cs @@ -9,42 +9,42 @@ using System; namespace Microsoft.Iris.Render.Common { - internal class ObjectCacheManager - { - private RenderSession m_sesion; - private Vector m_listCaches; - private bool m_fPendingUpdateCache; - private readonly DeferredHandler m_cbUpdateCache; - - internal ObjectCacheManager(RenderSession session, int nInitialSize) + internal class ObjectCacheManager { - this.m_sesion = session; - this.m_listCaches = new Vector(nInitialSize); - this.m_cbUpdateCache = new DeferredHandler(this.UpdateCache); - } + private RenderSession m_sesion; + private Vector m_listCaches; + private bool m_fPendingUpdateCache; + private readonly DeferredHandler m_cbUpdateCache; - internal void RegisterCache(ObjectCache cache) - { - this.m_listCaches.Add(cache); - this.ScheduleUpdateCache(); - } + internal ObjectCacheManager(RenderSession session, int nInitialSize) + { + this.m_sesion = session; + this.m_listCaches = new Vector(nInitialSize); + this.m_cbUpdateCache = new DeferredHandler(this.UpdateCache); + } - internal void UnregisterCache(ObjectCache cache) => this.m_listCaches.Remove(cache); + internal void RegisterCache(ObjectCache cache) + { + this.m_listCaches.Add(cache); + this.ScheduleUpdateCache(); + } - private void UpdateCache(object arg) - { - this.m_fPendingUpdateCache = false; - for (int index = this.m_listCaches.Count - 1; index >= 0; --index) - this.m_listCaches[index].Update(); - this.ScheduleUpdateCache(); - } + internal void UnregisterCache(ObjectCache cache) => this.m_listCaches.Remove(cache); - private void ScheduleUpdateCache() - { - if (this.m_fPendingUpdateCache || this.m_listCaches.Count <= 0) - return; - this.m_sesion.DeferredInvoke((Delegate) this.m_cbUpdateCache, (object) null, DeferredInvokePriority.Idle, new TimeSpan(0, 0, 5)); - this.m_fPendingUpdateCache = true; + private void UpdateCache(object arg) + { + this.m_fPendingUpdateCache = false; + for (int index = this.m_listCaches.Count - 1; index >= 0; --index) + this.m_listCaches[index].Update(); + this.ScheduleUpdateCache(); + } + + private void ScheduleUpdateCache() + { + if (this.m_fPendingUpdateCache || this.m_listCaches.Count <= 0) + return; + this.m_sesion.DeferredInvoke((Delegate)this.m_cbUpdateCache, (object)null, DeferredInvokePriority.Idle, new TimeSpan(0, 0, 5)); + this.m_fPendingUpdateCache = true; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/RenderObject.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/RenderObject.cs index f63f660..625b651 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/RenderObject.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/RenderObject.cs @@ -9,38 +9,38 @@ using System.Diagnostics; namespace Microsoft.Iris.Render.Common { - internal abstract class RenderObject : IRenderObject, IDisposable - { - private bool m_fObjectDisposed; - - internal RenderObject() => this.m_fObjectDisposed = false; - - ~RenderObject() + internal abstract class RenderObject : IRenderObject, IDisposable { - if (this.m_fObjectDisposed) - return; - this.Dispose(false); + private bool m_fObjectDisposed; + + internal RenderObject() => this.m_fObjectDisposed = false; + + ~RenderObject() + { + if (this.m_fObjectDisposed) + return; + this.Dispose(false); + } + + public void Dispose() + { + if (this.m_fObjectDisposed) + return; + this.Dispose(true); + GC.SuppressFinalize((object)this); + } + + protected virtual void Dispose(bool fInDispose) => this.m_fObjectDisposed = true; + + internal string DebugDescription + { + get => ""; + set + { + } + } + + [Conditional("DEBUG")] + protected virtual void Invariant() => Debug2.Validate(!this.m_fObjectDisposed, typeof(ObjectDisposedException), this.GetType().ToString()); } - - public void Dispose() - { - if (this.m_fObjectDisposed) - return; - this.Dispose(true); - GC.SuppressFinalize((object) this); - } - - protected virtual void Dispose(bool fInDispose) => this.m_fObjectDisposed = true; - - internal string DebugDescription - { - get => ""; - set - { - } - } - - [Conditional("DEBUG")] - protected virtual void Invariant() => Debug2.Validate(!this.m_fObjectDisposed, typeof (ObjectDisposedException), this.GetType().ToString()); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ResourceTracker.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ResourceTracker.cs index a2fdadf..3a58d2b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ResourceTracker.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/ResourceTracker.cs @@ -6,44 +6,44 @@ namespace Microsoft.Iris.Render.Common { - internal class ResourceTracker - { - private int m_cUsers; - private static uint s_uNextUsage; - private uint m_uLastUsage; - private ResourceTracker.UsageChangeHandler m_handler; - - internal ResourceTracker(ResourceTracker.UsageChangeHandler handler) => this.m_handler = handler; - - internal bool InUse => this.m_cUsers > 0; - - internal uint LastUsage => this.m_uLastUsage; - - internal void AddActiveUser(object oUser) + internal class ResourceTracker { - ++this.m_cUsers; - this.m_uLastUsage = uint.MaxValue; - if (this.m_cUsers != 1) - return; - this.NotifyUsageChange(true); - } + private int m_cUsers; + private static uint s_uNextUsage; + private uint m_uLastUsage; + private ResourceTracker.UsageChangeHandler m_handler; - internal void RemoveActiveUser(object oUser) - { - --this.m_cUsers; - if (this.m_cUsers != 0) - return; - this.m_uLastUsage = ResourceTracker.s_uNextUsage++; - this.NotifyUsageChange(false); - } + internal ResourceTracker(ResourceTracker.UsageChangeHandler handler) => this.m_handler = handler; - protected virtual void NotifyUsageChange(bool fInUse) - { - if (this.m_handler == null) - return; - this.m_handler(fInUse); - } + internal bool InUse => this.m_cUsers > 0; - internal delegate void UsageChangeHandler(bool fInUse); - } + internal uint LastUsage => this.m_uLastUsage; + + internal void AddActiveUser(object oUser) + { + ++this.m_cUsers; + this.m_uLastUsage = uint.MaxValue; + if (this.m_cUsers != 1) + return; + this.NotifyUsageChange(true); + } + + internal void RemoveActiveUser(object oUser) + { + --this.m_cUsers; + if (this.m_cUsers != 0) + return; + this.m_uLastUsage = ResourceTracker.s_uNextUsage++; + this.NotifyUsageChange(false); + } + + protected virtual void NotifyUsageChange(bool fInUse) + { + if (this.m_handler == null) + return; + this.m_handler(fInUse); + } + + internal delegate void UsageChangeHandler(bool fInUse); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedRenderObject.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedRenderObject.cs index 5ecf54a..85ca69b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedRenderObject.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedRenderObject.cs @@ -9,73 +9,73 @@ using System.Diagnostics; namespace Microsoft.Iris.Render.Common { - internal class SharedRenderObject : ISharedRenderObject - { - private int m_cUsers; - - internal SharedRenderObject() + internal class SharedRenderObject : ISharedRenderObject { + private int m_cUsers; + + internal SharedRenderObject() + { + } + + ~SharedRenderObject() => this.Dispose(false); + + private void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize((object)this); + } + + protected virtual void Dispose(bool fInDispose) + { + } + + int ISharedRenderObject.UsageCount => this.m_cUsers; + + void ISharedRenderObject.RegisterUsage(object user) => this.RegisterUsage(user); + + void ISharedRenderObject.UnregisterUsage(object user) => this.UnregisterUsage(user); + + internal virtual void RegisterUsage(object user) => ++this.m_cUsers; + + internal virtual void UnregisterUsage(object user) + { + --this.m_cUsers; + if (this.m_cUsers != 0) + return; + this.Dispose(); + } + + internal int UsageCount => this.m_cUsers; + + [Conditional("DEBUG")] + public static void DEBUG_BeginTrackingObjects() + { + } + + [Conditional("DEBUG")] + public static void DEBUG_StopTrackingObjects() + { + } + + internal string DebugDescription + { + get => ""; + set + { + } + } + + [Conditional("DEBUG")] + protected virtual void Invariant() + { + } + + [Conditional("DEBUG")] + private void Invariant(bool fValidateUsers) + { + if (!fValidateUsers) + return; + Debug2.Validate(this.m_cUsers > 0, typeof(ObjectDisposedException), "No registered user"); + } } - - ~SharedRenderObject() => this.Dispose(false); - - private void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize((object) this); - } - - protected virtual void Dispose(bool fInDispose) - { - } - - int ISharedRenderObject.UsageCount => this.m_cUsers; - - void ISharedRenderObject.RegisterUsage(object user) => this.RegisterUsage(user); - - void ISharedRenderObject.UnregisterUsage(object user) => this.UnregisterUsage(user); - - internal virtual void RegisterUsage(object user) => ++this.m_cUsers; - - internal virtual void UnregisterUsage(object user) - { - --this.m_cUsers; - if (this.m_cUsers != 0) - return; - this.Dispose(); - } - - internal int UsageCount => this.m_cUsers; - - [Conditional("DEBUG")] - public static void DEBUG_BeginTrackingObjects() - { - } - - [Conditional("DEBUG")] - public static void DEBUG_StopTrackingObjects() - { - } - - internal string DebugDescription - { - get => ""; - set - { - } - } - - [Conditional("DEBUG")] - protected virtual void Invariant() - { - } - - [Conditional("DEBUG")] - private void Invariant(bool fValidateUsers) - { - if (!fValidateUsers) - return; - Debug2.Validate(this.m_cUsers > 0, typeof (ObjectDisposedException), "No registered user"); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedResource.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedResource.cs index 966f429..aa67645 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedResource.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedResource.cs @@ -8,49 +8,49 @@ using Microsoft.Iris.Render.Internal; namespace Microsoft.Iris.Render.Common { - internal abstract class SharedResource : SharedRenderObject - { - protected RenderSession m_session; - private ResourceTracker m_resourceTracker; - - internal SharedResource(RenderSession session) => this.m_session = session; - - protected override void Dispose(bool fInDispose) + internal abstract class SharedResource : SharedRenderObject { - try - { - if (!fInDispose) - return; - ResourceTracker resourceTracker1 = this.m_resourceTracker; - if (this.m_session == null || !this.m_session.IsValid) - return; - ResourceTracker resourceTracker2 = this.m_resourceTracker; - } - finally - { - base.Dispose(fInDispose); - } + protected RenderSession m_session; + private ResourceTracker m_resourceTracker; + + internal SharedResource(RenderSession session) => this.m_session = session; + + protected override void Dispose(bool fInDispose) + { + try + { + if (!fInDispose) + return; + ResourceTracker resourceTracker1 = this.m_resourceTracker; + if (this.m_session == null || !this.m_session.IsValid) + return; + ResourceTracker resourceTracker2 = this.m_resourceTracker; + } + finally + { + base.Dispose(fInDispose); + } + } + + public bool InUse => this.m_resourceTracker != null && this.m_resourceTracker.InUse; + + public uint LastUsage => this.m_resourceTracker == null ? 0U : this.m_resourceTracker.LastUsage; + + public void AddActiveUser(object oUser) + { + if (this.m_resourceTracker == null) + this.m_resourceTracker = new ResourceTracker(new ResourceTracker.UsageChangeHandler(this.OnUsageChange)); + this.m_resourceTracker.AddActiveUser(oUser); + } + + public void RemoveActiveUser(object oUser) + { + this.m_resourceTracker.RemoveActiveUser(oUser); + if (this.m_resourceTracker.InUse) + return; + this.m_resourceTracker = (ResourceTracker)null; + } + + protected abstract void OnUsageChange(bool fUsed); } - - public bool InUse => this.m_resourceTracker != null && this.m_resourceTracker.InUse; - - public uint LastUsage => this.m_resourceTracker == null ? 0U : this.m_resourceTracker.LastUsage; - - public void AddActiveUser(object oUser) - { - if (this.m_resourceTracker == null) - this.m_resourceTracker = new ResourceTracker(new ResourceTracker.UsageChangeHandler(this.OnUsageChange)); - this.m_resourceTracker.AddActiveUser(oUser); - } - - public void RemoveActiveUser(object oUser) - { - this.m_resourceTracker.RemoveActiveUser(oUser); - if (this.m_resourceTracker.InUse) - return; - this.m_resourceTracker = (ResourceTracker) null; - } - - protected abstract void OnUsageChange(bool fUsed); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedResourceArray.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedResourceArray.cs index b471c34..8230446 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedResourceArray.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SharedResourceArray.cs @@ -8,49 +8,49 @@ using Microsoft.Iris.Render.Internal; namespace Microsoft.Iris.Render.Common { - internal class SharedResourceArray : SharedResource - { - private SharedResource[] m_rgResources; - - internal SharedResourceArray(SharedResource resource) - : base((RenderSession) null) + internal class SharedResourceArray : SharedResource { - this.m_rgResources = new SharedResource[1]; - this.m_rgResources[0] = resource; - } + private SharedResource[] m_rgResources; - internal SharedResourceArray(SharedResource[] rgResources) - : base((RenderSession) null) - => this.m_rgResources = rgResources; - - protected override void OnUsageChange(bool fUsed) - { - for (int index = 0; index < this.m_rgResources.Length; ++index) - { - if (this.m_rgResources[index] != null) + internal SharedResourceArray(SharedResource resource) + : base((RenderSession)null) { - if (fUsed) - this.m_rgResources[index].AddActiveUser((object) this); - else - this.m_rgResources[index].RemoveActiveUser((object) this); + this.m_rgResources = new SharedResource[1]; + this.m_rgResources[0] = resource; } - } - } - internal override void RegisterUsage(object user) - { - base.RegisterUsage(user); - foreach (SharedRenderObject rgResource in this.m_rgResources) - rgResource.RegisterUsage(user); - } + internal SharedResourceArray(SharedResource[] rgResources) + : base((RenderSession)null) + => this.m_rgResources = rgResources; - internal override void UnregisterUsage(object user) - { - foreach (SharedRenderObject rgResource in this.m_rgResources) - rgResource.UnregisterUsage(user); - base.UnregisterUsage(user); - } + protected override void OnUsageChange(bool fUsed) + { + for (int index = 0; index < this.m_rgResources.Length; ++index) + { + if (this.m_rgResources[index] != null) + { + if (fUsed) + this.m_rgResources[index].AddActiveUser((object)this); + else + this.m_rgResources[index].RemoveActiveUser((object)this); + } + } + } - internal SharedResource[] Resources => this.m_rgResources; - } + internal override void RegisterUsage(object user) + { + base.RegisterUsage(user); + foreach (SharedRenderObject rgResource in this.m_rgResources) + rgResource.RegisterUsage(user); + } + + internal override void UnregisterUsage(object user) + { + foreach (SharedRenderObject rgResource in this.m_rgResources) + rgResource.UnregisterUsage(user); + base.UnregisterUsage(user); + } + + internal SharedResource[] Resources => this.m_rgResources; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SmartMap`1.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SmartMap`1.cs index 25e479e..78659e2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SmartMap`1.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Common/SmartMap`1.cs @@ -8,145 +8,145 @@ using System; namespace Microsoft.Iris.Render.Common { - internal struct SmartMap - { - private SmartMap.Entry[] m_entryList; - - public int Count + internal struct SmartMap { - get - { - int num = 0; - if (this.m_entryList != null) - num = this.m_entryList.Length; - return num; - } - } + private SmartMap.Entry[] m_entryList; - public bool IsEmpty => this.Count == 0; - - public bool Lookup(T desired, out uint key) - { - if (this.m_entryList != null) - { - foreach (SmartMap.Entry entry in this.m_entryList) + public int Count { - if (entry.oData.Equals((object) desired)) - { - key = entry.key; - return true; - } + get + { + int num = 0; + if (this.m_entryList != null) + num = this.m_entryList.Length; + return num; + } } - } - key = 0U; - return false; - } - public bool TryGetValue(uint key, out T value) - { - int index = this.IndexOf(key); - if (index >= 0) - { - value = this.m_entryList[index].oData; - return true; - } - value = default (T); - return false; - } + public bool IsEmpty => this.Count == 0; - public void Remove(uint key) - { - int slotIndex = this.IndexOf(key); - if (slotIndex < 0) - return; - this.Remove(slotIndex); - } - - public void SetValue(uint key, T value) - { - int index = this.IndexOf(key); - if (index >= 0) - this.m_entryList[index].oData = value; - else - this.Add(key, value, ~index); - } - - private int IndexOf(uint key) - { - if (this.m_entryList == null) - return -1; - uint num1 = uint.MaxValue; - int index1 = 0; - if (this.m_entryList.Length > 4) - { - int num2 = 0; - int num3 = this.m_entryList.Length - 1; - while (num2 <= num3) + public bool Lookup(T desired, out uint key) { - index1 = (num3 + num2) / 2; - num1 = this.m_entryList[index1].key; - if ((int) key == (int) num1) - return index1; - if (key < num1) - num3 = index1 - 1; - else - num2 = index1 + 1; + if (this.m_entryList != null) + { + foreach (SmartMap.Entry entry in this.m_entryList) + { + if (entry.oData.Equals((object)desired)) + { + key = entry.key; + return true; + } + } + } + key = 0U; + return false; } - } - else - { - for (int index2 = 0; index2 < this.m_entryList.Length; ++index2) + + public bool TryGetValue(uint key, out T value) { - index1 = index2; - num1 = this.m_entryList[index1].key; - if ((int) key == (int) num1) - return index1; - if (key < num1) - break; + int index = this.IndexOf(key); + if (index >= 0) + { + value = this.m_entryList[index].oData; + return true; + } + value = default(T); + return false; } - } - if (key > num1) - ++index1; - return ~index1; - } - private void Add(uint key, T data, int slotIndex) - { - SmartMap.Entry[] entryArray; - if (this.m_entryList == null) - { - entryArray = new SmartMap.Entry[1]; - } - else - { - int length = this.m_entryList.Length; - entryArray = new SmartMap.Entry[length + 1]; - Array.Copy((Array) this.m_entryList, (Array) entryArray, slotIndex); - Array.Copy((Array) this.m_entryList, slotIndex, (Array) entryArray, slotIndex + 1, length - slotIndex); - } - this.m_entryList = entryArray; - this.m_entryList[slotIndex].key = key; - this.m_entryList[slotIndex].oData = data; - } + public void Remove(uint key) + { + int slotIndex = this.IndexOf(key); + if (slotIndex < 0) + return; + this.Remove(slotIndex); + } - private void Remove(int slotIndex) - { - int length = this.m_entryList.Length; - if (length > 0) - { - SmartMap.Entry[] entryArray = new SmartMap.Entry[length - 1]; - Array.Copy((Array) this.m_entryList, (Array) entryArray, slotIndex); - Array.Copy((Array) this.m_entryList, slotIndex + 1, (Array) entryArray, slotIndex, length - (slotIndex + 1)); - this.m_entryList = entryArray; - } - else - this.m_entryList = (SmartMap.Entry[]) null; - } + public void SetValue(uint key, T value) + { + int index = this.IndexOf(key); + if (index >= 0) + this.m_entryList[index].oData = value; + else + this.Add(key, value, ~index); + } - private struct Entry - { - internal uint key; - internal T oData; + private int IndexOf(uint key) + { + if (this.m_entryList == null) + return -1; + uint num1 = uint.MaxValue; + int index1 = 0; + if (this.m_entryList.Length > 4) + { + int num2 = 0; + int num3 = this.m_entryList.Length - 1; + while (num2 <= num3) + { + index1 = (num3 + num2) / 2; + num1 = this.m_entryList[index1].key; + if ((int)key == (int)num1) + return index1; + if (key < num1) + num3 = index1 - 1; + else + num2 = index1 + 1; + } + } + else + { + for (int index2 = 0; index2 < this.m_entryList.Length; ++index2) + { + index1 = index2; + num1 = this.m_entryList[index1].key; + if ((int)key == (int)num1) + return index1; + if (key < num1) + break; + } + } + if (key > num1) + ++index1; + return ~index1; + } + + private void Add(uint key, T data, int slotIndex) + { + SmartMap.Entry[] entryArray; + if (this.m_entryList == null) + { + entryArray = new SmartMap.Entry[1]; + } + else + { + int length = this.m_entryList.Length; + entryArray = new SmartMap.Entry[length + 1]; + Array.Copy((Array)this.m_entryList, (Array)entryArray, slotIndex); + Array.Copy((Array)this.m_entryList, slotIndex, (Array)entryArray, slotIndex + 1, length - slotIndex); + } + this.m_entryList = entryArray; + this.m_entryList[slotIndex].key = key; + this.m_entryList[slotIndex].oData = data; + } + + private void Remove(int slotIndex) + { + int length = this.m_entryList.Length; + if (length > 0) + { + SmartMap.Entry[] entryArray = new SmartMap.Entry[length - 1]; + Array.Copy((Array)this.m_entryList, (Array)entryArray, slotIndex); + Array.Copy((Array)this.m_entryList, slotIndex + 1, (Array)entryArray, slotIndex, length - (slotIndex + 1)); + this.m_entryList = entryArray; + } + else + this.m_entryList = (SmartMap.Entry[])null; + } + + private struct Entry + { + internal uint key; + internal T oData; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ComplexImageElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ComplexImageElement.cs index 3c1c1f7..1ae42df 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ComplexImageElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ComplexImageElement.cs @@ -10,146 +10,146 @@ using System; namespace Microsoft.Iris.Render { - public class ComplexImageElement : EffectInput - { - internal const string ImagePropertyName = "Image"; - internal const string MinFilterPropertyName = "MinFilter"; - internal const string MagFilterPropertyName = "MagFilter"; - internal const string CoordinateMapIndexPropertyName = "CoordinateMapIndex"; - internal const string ImageIndexPropertyName = "ImageIndex"; - private IImage[] m_rgImages; - private byte m_nImageID; - private FilterMode m_modeMinFilter; - private byte m_nMinFilterID; - private FilterMode m_modeMagFilter; - private byte m_nMagFilterID; - private byte m_idxCoordinateMap; - private byte m_nCoordinateMapID; - private byte m_idxImageIndex; - private byte m_nImageIndexID; - - public ComplexImageElement( - string stName, - IImage imgSource, - FilterMode ftrMinification, - FilterMode ftrMagnification, - byte idxCoordinateMap) + public class ComplexImageElement : EffectInput { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate(imgSource != null, typeof (ArgumentNullException), nameof (imgSource)); - this.m_typeInput = EffectInputType.ComplexImage; - this.m_stName = stName; - this.m_modeMinFilter = ftrMinification; - this.m_modeMagFilter = ftrMagnification; - this.m_idxCoordinateMap = idxCoordinateMap; - this.m_idxImageIndex = (byte) 0; - this.Image = imgSource; + internal const string ImagePropertyName = "Image"; + internal const string MinFilterPropertyName = "MinFilter"; + internal const string MagFilterPropertyName = "MagFilter"; + internal const string CoordinateMapIndexPropertyName = "CoordinateMapIndex"; + internal const string ImageIndexPropertyName = "ImageIndex"; + private IImage[] m_rgImages; + private byte m_nImageID; + private FilterMode m_modeMinFilter; + private byte m_nMinFilterID; + private FilterMode m_modeMagFilter; + private byte m_nMagFilterID; + private byte m_idxCoordinateMap; + private byte m_nCoordinateMapID; + private byte m_idxImageIndex; + private byte m_nImageIndexID; + + public ComplexImageElement( + string stName, + IImage imgSource, + FilterMode ftrMinification, + FilterMode ftrMagnification, + byte idxCoordinateMap) + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate(imgSource != null, typeof(ArgumentNullException), nameof(imgSource)); + this.m_typeInput = EffectInputType.ComplexImage; + this.m_stName = stName; + this.m_modeMinFilter = ftrMinification; + this.m_modeMagFilter = ftrMagnification; + this.m_idxCoordinateMap = idxCoordinateMap; + this.m_idxImageIndex = (byte)0; + this.Image = imgSource; + } + + public ComplexImageElement( + string stName, + IImage[] imgSource, + FilterMode ftrMinification, + FilterMode ftrMagnification, + byte idxCoordinateMap, + byte idxImageIndex) + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentNullException), nameof(stName)); + Debug2.Validate(imgSource != null, typeof(ArgumentNullException), nameof(imgSource)); + Debug2.Validate(imgSource.Length > 0, typeof(ArgumentException), "ImgSource"); + Debug2.Validate(imgSource.Length > (int)idxImageIndex, typeof(ArgumentOutOfRangeException), nameof(idxImageIndex)); + this.m_typeInput = EffectInputType.ComplexImage; + this.m_stName = stName; + this.m_modeMinFilter = ftrMinification; + this.m_modeMagFilter = ftrMagnification; + this.m_idxCoordinateMap = idxCoordinateMap; + this.m_idxImageIndex = idxImageIndex; + this.m_rgImages = imgSource; + } + + public IImage Image + { + get => this.m_rgImages == null || this.m_rgImages.Length < 1 ? (IImage)null : this.m_rgImages[0]; + set + { + this.m_rgImages = new IImage[1]; + this.m_rgImages[0] = value; + } + } + + public IImage[] Images + { + get => this.m_rgImages; + set + { + Debug2.Validate(value.Length > 0, typeof(ArgumentException), nameof(Images)); + this.m_rgImages = value; + } + } + + internal byte ImageID => this.m_nImageID; + + public FilterMode MinFilter + { + get => this.m_modeMinFilter; + set => this.m_modeMinFilter = value; + } + + internal byte MinFilterID => this.m_nMinFilterID; + + public FilterMode MagFilter + { + get => this.m_modeMagFilter; + set => this.m_modeMagFilter = value; + } + + internal byte MagFilterID => this.m_nMagFilterID; + + public byte CoordinateMapIndex + { + get => this.m_idxCoordinateMap; + set => this.m_idxCoordinateMap = value; + } + + public byte CoordinateMapIndexID => this.m_nCoordinateMapID; + + public byte ImageIndex + { + get => this.m_idxImageIndex; + set => this.m_idxImageIndex = value; + } + + public byte ImageIndexID => this.m_nImageIndexID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + int num = base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "MinFilter", (byte)5, ref this.m_nMinFilterID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "MagFilter", (byte)5, ref this.m_nMagFilterID, ref nNextUniqueID); + this.AddEffectProperty(dictionary, "CoordinateMapIndex"); + this.m_nCoordinateMapID = nNextUniqueID++; + this.AddEffectProperty(dictionary, "Image"); + this.m_nImageID = nNextUniqueID++; + this.AddEffectProperty(dictionary, "ImageIndex"); + this.m_nImageIndexID = nNextUniqueID++; + return num; + } + + internal override bool Process(Map dictProperties) + { + if (!this.GenerateProperty("MinFilter", EffectPropertyType.Integer, (object)(int)this.MinFilter, this.m_nMinFilterID, dictProperties) || !this.GenerateProperty("MagFilter", EffectPropertyType.Integer, (object)(int)this.MagFilter, this.m_nMagFilterID, dictProperties) || (!this.GenerateProperty("CoordinateMapIndex", EffectPropertyType.Integer, (object)(int)this.CoordinateMapIndex, this.m_nCoordinateMapID, dictProperties) || !this.GenerateProperty("ImageIndex", EffectPropertyType.Integer, (object)(int)this.ImageIndex, this.m_nImageIndexID, dictProperties))) + return false; + SharedResource[] rgResources = new SharedResource[this.m_rgImages.Length]; + for (int index = 0; index < this.m_rgImages.Length; ++index) + rgResources[index] = (SharedResource)this.m_rgImages[index]; + return this.GenerateProperty("Image", EffectPropertyType.ImageArray, (object)new SharedResourceArray(rgResources), this.m_nImageID, dictProperties); + } + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("MinFilter", this.MinFilterID, (byte)this.MinFilter, cacheKey); + this.GeneratePropertyCacheKey("MagFilter", this.MagFilterID, (byte)this.MagFilter, cacheKey); + } } - - public ComplexImageElement( - string stName, - IImage[] imgSource, - FilterMode ftrMinification, - FilterMode ftrMagnification, - byte idxCoordinateMap, - byte idxImageIndex) - { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentNullException), nameof (stName)); - Debug2.Validate(imgSource != null, typeof (ArgumentNullException), nameof (imgSource)); - Debug2.Validate(imgSource.Length > 0, typeof (ArgumentException), "ImgSource"); - Debug2.Validate(imgSource.Length > (int) idxImageIndex, typeof (ArgumentOutOfRangeException), nameof (idxImageIndex)); - this.m_typeInput = EffectInputType.ComplexImage; - this.m_stName = stName; - this.m_modeMinFilter = ftrMinification; - this.m_modeMagFilter = ftrMagnification; - this.m_idxCoordinateMap = idxCoordinateMap; - this.m_idxImageIndex = idxImageIndex; - this.m_rgImages = imgSource; - } - - public IImage Image - { - get => this.m_rgImages == null || this.m_rgImages.Length < 1 ? (IImage) null : this.m_rgImages[0]; - set - { - this.m_rgImages = new IImage[1]; - this.m_rgImages[0] = value; - } - } - - public IImage[] Images - { - get => this.m_rgImages; - set - { - Debug2.Validate(value.Length > 0, typeof (ArgumentException), nameof (Images)); - this.m_rgImages = value; - } - } - - internal byte ImageID => this.m_nImageID; - - public FilterMode MinFilter - { - get => this.m_modeMinFilter; - set => this.m_modeMinFilter = value; - } - - internal byte MinFilterID => this.m_nMinFilterID; - - public FilterMode MagFilter - { - get => this.m_modeMagFilter; - set => this.m_modeMagFilter = value; - } - - internal byte MagFilterID => this.m_nMagFilterID; - - public byte CoordinateMapIndex - { - get => this.m_idxCoordinateMap; - set => this.m_idxCoordinateMap = value; - } - - public byte CoordinateMapIndexID => this.m_nCoordinateMapID; - - public byte ImageIndex - { - get => this.m_idxImageIndex; - set => this.m_idxImageIndex = value; - } - - public byte ImageIndexID => this.m_nImageIndexID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - int num = base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "MinFilter", (byte) 5, ref this.m_nMinFilterID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "MagFilter", (byte) 5, ref this.m_nMagFilterID, ref nNextUniqueID); - this.AddEffectProperty(dictionary, "CoordinateMapIndex"); - this.m_nCoordinateMapID = nNextUniqueID++; - this.AddEffectProperty(dictionary, "Image"); - this.m_nImageID = nNextUniqueID++; - this.AddEffectProperty(dictionary, "ImageIndex"); - this.m_nImageIndexID = nNextUniqueID++; - return num; - } - - internal override bool Process(Map dictProperties) - { - if (!this.GenerateProperty("MinFilter", EffectPropertyType.Integer, (object) (int) this.MinFilter, this.m_nMinFilterID, dictProperties) || !this.GenerateProperty("MagFilter", EffectPropertyType.Integer, (object) (int) this.MagFilter, this.m_nMagFilterID, dictProperties) || (!this.GenerateProperty("CoordinateMapIndex", EffectPropertyType.Integer, (object) (int) this.CoordinateMapIndex, this.m_nCoordinateMapID, dictProperties) || !this.GenerateProperty("ImageIndex", EffectPropertyType.Integer, (object) (int) this.ImageIndex, this.m_nImageIndexID, dictProperties))) - return false; - SharedResource[] rgResources = new SharedResource[this.m_rgImages.Length]; - for (int index = 0; index < this.m_rgImages.Length; ++index) - rgResources[index] = (SharedResource) this.m_rgImages[index]; - return this.GenerateProperty("Image", EffectPropertyType.ImageArray, (object) new SharedResourceArray(rgResources), this.m_nImageID, dictProperties); - } - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("MinFilter", this.MinFilterID, (byte) this.MinFilter, cacheKey); - this.GeneratePropertyCacheKey("MagFilter", this.MagFilterID, (byte) this.MagFilter, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ConstantAnimationInput.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ConstantAnimationInput.cs index 5dfc480..3c0715a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ConstantAnimationInput.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ConstantAnimationInput.cs @@ -8,153 +8,153 @@ using Microsoft.Iris.Render.Common; namespace Microsoft.Iris.Render { - public sealed class ConstantAnimationInput : AnimationInput - { - private object m_inputValue; - - public ConstantAnimationInput(float sourceValue) - : this(sourceValue, (string) null) + public sealed class ConstantAnimationInput : AnimationInput { - } + private object m_inputValue; - public ConstantAnimationInput(float sourceValue, string sourceMaskSpec) - { - AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec); - this.CommonCreate(AnimationInputType.Float, animationTypeMask); - this.m_inputValue = this.ApplyMask(animationTypeMask, (object) sourceValue); - } - - public ConstantAnimationInput(Vector2 sourceValue) - : this(sourceValue, (string) null) - { - } - - public ConstantAnimationInput(Vector2 sourceValue, string sourceMaskSpec) - { - AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec); - this.CommonCreate(AnimationInputType.Vector2, animationTypeMask); - this.m_inputValue = this.ApplyMask(animationTypeMask, (object) sourceValue); - } - - public ConstantAnimationInput(Vector3 sourceValue) - : this(sourceValue, (string) null) - { - } - - public ConstantAnimationInput(Vector3 sourceValue, string sourceMaskSpec) - { - AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec); - this.CommonCreate(AnimationInputType.Vector3, animationTypeMask); - this.m_inputValue = this.ApplyMask(animationTypeMask, (object) sourceValue); - } - - public ConstantAnimationInput(Vector4 sourceValue) - : this(sourceValue, (string) null) - { - } - - public ConstantAnimationInput(Vector4 sourceValue, string sourceMaskSpec) - { - AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec); - this.CommonCreate(AnimationInputType.Vector4, animationTypeMask); - this.m_inputValue = this.ApplyMask(animationTypeMask, (object) sourceValue); - } - - public ConstantAnimationInput(Quaternion sourceValue) - : this(sourceValue, (string) null) - { - } - - public ConstantAnimationInput(Quaternion sourceValue, string sourceMaskSpec) - { - AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec); - this.CommonCreate(AnimationInputType.Quaternion, animationTypeMask); - this.m_inputValue = this.ApplyMask(animationTypeMask, (object) sourceValue); - } - - internal object RawValue => this.m_inputValue; - - private object ApplyMask(AnimationTypeMask mask, object value) - { - object obj = (object) null; - if (mask.ChannelCount == 0U) - { - obj = value; - } - else - { - float[] numArray = new float[4]; - switch (value) + public ConstantAnimationInput(float sourceValue) + : this(sourceValue, (string)null) { - case float num: - numArray[0] = num; - numArray[1] = 0.0f; - numArray[2] = 0.0f; - numArray[3] = 0.0f; - break; - case Vector2 vector2: - numArray[0] = vector2.X; - numArray[1] = vector2.Y; - numArray[2] = 0.0f; - numArray[3] = 0.0f; - break; - case Vector3 vector3: - numArray[0] = vector3.X; - numArray[1] = vector3.Y; - numArray[2] = vector3.Z; - numArray[3] = 0.0f; - break; - case Vector4 vector4: - numArray[0] = vector4.X; - numArray[1] = vector4.Y; - numArray[2] = vector4.Z; - numArray[3] = vector4.W; - break; - case Quaternion quaternion: - numArray[0] = quaternion.X; - numArray[1] = quaternion.Y; - numArray[2] = quaternion.Z; - numArray[3] = quaternion.W; - break; - default: - Debug2.Throw(false, "Unsupported type: {0}", (object) value.GetType()); - break; } - switch (mask.ChannelCount) + + public ConstantAnimationInput(float sourceValue, string sourceMaskSpec) { - case 1: - obj = (object) (float) (mask[0] == AnimationTypeChannel.O ? 0.0 : (double) numArray[(int) (mask[0] - 1)]); - break; - case 2: - obj = (object) new Vector2() + AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec); + this.CommonCreate(AnimationInputType.Float, animationTypeMask); + this.m_inputValue = this.ApplyMask(animationTypeMask, (object)sourceValue); + } + + public ConstantAnimationInput(Vector2 sourceValue) + : this(sourceValue, (string)null) + { + } + + public ConstantAnimationInput(Vector2 sourceValue, string sourceMaskSpec) + { + AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec); + this.CommonCreate(AnimationInputType.Vector2, animationTypeMask); + this.m_inputValue = this.ApplyMask(animationTypeMask, (object)sourceValue); + } + + public ConstantAnimationInput(Vector3 sourceValue) + : this(sourceValue, (string)null) + { + } + + public ConstantAnimationInput(Vector3 sourceValue, string sourceMaskSpec) + { + AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec); + this.CommonCreate(AnimationInputType.Vector3, animationTypeMask); + this.m_inputValue = this.ApplyMask(animationTypeMask, (object)sourceValue); + } + + public ConstantAnimationInput(Vector4 sourceValue) + : this(sourceValue, (string)null) + { + } + + public ConstantAnimationInput(Vector4 sourceValue, string sourceMaskSpec) + { + AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec); + this.CommonCreate(AnimationInputType.Vector4, animationTypeMask); + this.m_inputValue = this.ApplyMask(animationTypeMask, (object)sourceValue); + } + + public ConstantAnimationInput(Quaternion sourceValue) + : this(sourceValue, (string)null) + { + } + + public ConstantAnimationInput(Quaternion sourceValue, string sourceMaskSpec) + { + AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec); + this.CommonCreate(AnimationInputType.Quaternion, animationTypeMask); + this.m_inputValue = this.ApplyMask(animationTypeMask, (object)sourceValue); + } + + internal object RawValue => this.m_inputValue; + + private object ApplyMask(AnimationTypeMask mask, object value) + { + object obj = (object)null; + if (mask.ChannelCount == 0U) { - X = (mask[0] == AnimationTypeChannel.O ? 0.0f : numArray[(int) (mask[0] - 1)]), - Y = (mask[1] == AnimationTypeChannel.O ? 0.0f : numArray[(int) (mask[1] - 1)]) - }; - break; - case 3: - obj = (object) new Vector3() + obj = value; + } + else { - X = (mask[0] == AnimationTypeChannel.O ? 0.0f : numArray[(int) (mask[0] - 1)]), - Y = (mask[1] == AnimationTypeChannel.O ? 0.0f : numArray[(int) (mask[1] - 1)]), - Z = (mask[2] == AnimationTypeChannel.O ? 0.0f : numArray[(int) (mask[2] - 1)]) - }; - break; - case 4: - obj = (object) new Vector4() - { - X = (mask[0] == AnimationTypeChannel.O ? 0.0f : numArray[(int) (mask[0] - 1)]), - Y = (mask[1] == AnimationTypeChannel.O ? 0.0f : numArray[(int) (mask[1] - 1)]), - Z = (mask[2] == AnimationTypeChannel.O ? 0.0f : numArray[(int) (mask[2] - 1)]), - W = (mask[3] == AnimationTypeChannel.O ? 0.0f : numArray[(int) (mask[3] - 1)]) - }; - break; - default: - Debug2.Throw(false, "Only 4 channels are supported"); - break; + float[] numArray = new float[4]; + switch (value) + { + case float num: + numArray[0] = num; + numArray[1] = 0.0f; + numArray[2] = 0.0f; + numArray[3] = 0.0f; + break; + case Vector2 vector2: + numArray[0] = vector2.X; + numArray[1] = vector2.Y; + numArray[2] = 0.0f; + numArray[3] = 0.0f; + break; + case Vector3 vector3: + numArray[0] = vector3.X; + numArray[1] = vector3.Y; + numArray[2] = vector3.Z; + numArray[3] = 0.0f; + break; + case Vector4 vector4: + numArray[0] = vector4.X; + numArray[1] = vector4.Y; + numArray[2] = vector4.Z; + numArray[3] = vector4.W; + break; + case Quaternion quaternion: + numArray[0] = quaternion.X; + numArray[1] = quaternion.Y; + numArray[2] = quaternion.Z; + numArray[3] = quaternion.W; + break; + default: + Debug2.Throw(false, "Unsupported type: {0}", (object)value.GetType()); + break; + } + switch (mask.ChannelCount) + { + case 1: + obj = (object)(float)(mask[0] == AnimationTypeChannel.O ? 0.0 : (double)numArray[(int)(mask[0] - 1)]); + break; + case 2: + obj = (object)new Vector2() + { + X = (mask[0] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[0] - 1)]), + Y = (mask[1] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[1] - 1)]) + }; + break; + case 3: + obj = (object)new Vector3() + { + X = (mask[0] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[0] - 1)]), + Y = (mask[1] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[1] - 1)]), + Z = (mask[2] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[2] - 1)]) + }; + break; + case 4: + obj = (object)new Vector4() + { + X = (mask[0] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[0] - 1)]), + Y = (mask[1] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[1] - 1)]), + Z = (mask[2] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[2] - 1)]), + W = (mask[3] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[3] - 1)]) + }; + break; + default: + Debug2.Throw(false, "Only 4 channels are supported"); + break; + } + } + return obj; } - } - return obj; } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotification.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotification.cs index 016e412..cb2f64d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotification.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotification.cs @@ -6,9 +6,9 @@ namespace Microsoft.Iris.Render { - public enum ContentNotification - { - Acquire, - Release, - } + public enum ContentNotification + { + Acquire, + Release, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotifyHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotifyHandler.cs index 98963e8..2b54b8d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotifyHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContentNotifyHandler.cs @@ -8,8 +8,8 @@ using System; namespace Microsoft.Iris.Render { - public delegate void ContentNotifyHandler( - ContentNotification Notification, - IImage image, - IntPtr data); + public delegate void ContentNotifyHandler( + ContentNotification Notification, + IImage image, + IntPtr data); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContinuousAnimationInput.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContinuousAnimationInput.cs index baf7d82..ce98981 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContinuousAnimationInput.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContinuousAnimationInput.cs @@ -8,29 +8,29 @@ using Microsoft.Iris.Render.Animation; namespace Microsoft.Iris.Render { - public sealed class ContinuousAnimationInput : ObjectAnimationInput - { - public ContinuousAnimationInput(IAnimatable sourceObject, string sourcePropertyName) - : this(sourceObject, sourcePropertyName, (string) null) + public sealed class ContinuousAnimationInput : ObjectAnimationInput { - } + public ContinuousAnimationInput(IAnimatable sourceObject, string sourcePropertyName) + : this(sourceObject, sourcePropertyName, (string)null) + { + } - public ContinuousAnimationInput( - IAnimatable sourceObject, - string sourcePropertyName, - string sourceMaskSpec) - : base(sourceObject, sourcePropertyName, sourceMaskSpec) - { - } + public ContinuousAnimationInput( + IAnimatable sourceObject, + string sourcePropertyName, + string sourceMaskSpec) + : base(sourceObject, sourcePropertyName, sourceMaskSpec) + { + } - public ContinuousAnimationInput(IAnimation sourceAnimation) - : this(sourceAnimation, (string) null) - { - } + public ContinuousAnimationInput(IAnimation sourceAnimation) + : this(sourceAnimation, (string)null) + { + } - public ContinuousAnimationInput(IAnimation sourceAnimation, string sourceMaskSpec) - : base(sourceAnimation, sourceMaskSpec) - { + public ContinuousAnimationInput(IAnimation sourceAnimation, string sourceMaskSpec) + : base(sourceAnimation, sourceMaskSpec) + { + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContrastElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContrastElement.cs index fec2859..05a835d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContrastElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ContrastElement.cs @@ -10,44 +10,44 @@ using System; namespace Microsoft.Iris.Render { - public class ContrastElement : EffectOperation - { - internal const string ContrastPropertyName = "Contrast"; - private float m_flContrast; - private byte m_nContrastID; - - public ContrastElement(string stName, float flConstrastAdjust) - : this() + public class ContrastElement : EffectOperation { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate((double) flConstrastAdjust >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Contrast [0..)"); - this.m_flContrast = flConstrastAdjust; - this.m_stName = stName; + internal const string ContrastPropertyName = "Contrast"; + private float m_flContrast; + private byte m_nContrastID; + + public ContrastElement(string stName, float flConstrastAdjust) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate((double)flConstrastAdjust >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Contrast [0..)"); + this.m_flContrast = flConstrastAdjust; + this.m_stName = stName; + } + + public ContrastElement() => this.m_typeOperation = EffectOperationType.Contrast; + + public float Contrast + { + get => this.m_flContrast; + set => this.m_flContrast = value; + } + + internal byte ContrastID => this.m_nContrastID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Contrast", (byte)8, ref this.m_nContrastID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("Contrast", EffectPropertyType.Float, (object)this.m_flContrast, this.m_nContrastID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Contrast", this.ContrastID, this.Contrast, cacheKey); + } } - - public ContrastElement() => this.m_typeOperation = EffectOperationType.Contrast; - - public float Contrast - { - get => this.m_flContrast; - set => this.m_flContrast = value; - } - - internal byte ContrastID => this.m_nContrastID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Contrast", (byte) 8, ref this.m_nContrastID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("Contrast", EffectPropertyType.Float, (object) this.m_flContrast, this.m_nContrastID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Contrast", this.ContrastID, this.Contrast, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/CoordMap.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/CoordMap.cs index 527f5a1..8460ae9 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/CoordMap.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/CoordMap.cs @@ -10,42 +10,42 @@ using System.Collections; namespace Microsoft.Iris.Render { - public class CoordMap - { - private ArrayList m_alMaps; - - public CoordMap() => this.m_alMaps = new ArrayList(); - - public void AddValue(float flPosition, float flValue, Orientation or) + public class CoordMap { - Debug2.Validate((double) flPosition >= 0.0, typeof (ArgumentOutOfRangeException), "flPosition cannot be less than 0.0f"); - Debug2.Validate((double) flValue >= 0.0, typeof (ArgumentOutOfRangeException), "flValue cannot be less than 0.0f"); - Debug2.Validate((double) flPosition <= 1.0, typeof (ArgumentOutOfRangeException), "flPosition cannot exceed 1.0f"); - Debug2.Validate((double) flValue <= 1.0, typeof (ArgumentOutOfRangeException), "flValue cannot exceed 1.0f"); - foreach (CoordMap.CoordMapSample alMap in this.m_alMaps) - { - if (or == alMap.Orientation) - Debug2.Validate((double) flPosition != (double) alMap.flPosition, typeof (ArgumentException), "CoordMap cannot have two entries with the same flPosition and the same Orientation"); - } - this.m_alMaps.Add((object) new CoordMap.CoordMapSample(flPosition, flValue, or)); + private ArrayList m_alMaps; + + public CoordMap() => this.m_alMaps = new ArrayList(); + + public void AddValue(float flPosition, float flValue, Orientation or) + { + Debug2.Validate((double)flPosition >= 0.0, typeof(ArgumentOutOfRangeException), "flPosition cannot be less than 0.0f"); + Debug2.Validate((double)flValue >= 0.0, typeof(ArgumentOutOfRangeException), "flValue cannot be less than 0.0f"); + Debug2.Validate((double)flPosition <= 1.0, typeof(ArgumentOutOfRangeException), "flPosition cannot exceed 1.0f"); + Debug2.Validate((double)flValue <= 1.0, typeof(ArgumentOutOfRangeException), "flValue cannot exceed 1.0f"); + foreach (CoordMap.CoordMapSample alMap in this.m_alMaps) + { + if (or == alMap.Orientation) + Debug2.Validate((double)flPosition != (double)alMap.flPosition, typeof(ArgumentException), "CoordMap cannot have two entries with the same flPosition and the same Orientation"); + } + this.m_alMaps.Add((object)new CoordMap.CoordMapSample(flPosition, flValue, or)); + } + + public void Clear() => this.m_alMaps.Clear(); + + internal ArrayList RampSamples => this.m_alMaps; + + internal struct CoordMapSample + { + internal float flPosition; + internal float flValue; + internal Orientation Orientation; + + internal CoordMapSample(float pos, float val, Orientation or) + { + this.flPosition = pos; + this.flValue = val; + this.Orientation = or; + } + } } - - public void Clear() => this.m_alMaps.Clear(); - - internal ArrayList RampSamples => this.m_alMaps; - - internal struct CoordMapSample - { - internal float flPosition; - internal float flValue; - internal Orientation Orientation; - - internal CoordMapSample(float pos, float val, Orientation or) - { - this.flPosition = pos; - this.flValue = val; - this.Orientation = or; - } - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/CosineInterpolation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/CosineInterpolation.cs index 198a09f..d0faf71 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/CosineInterpolation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/CosineInterpolation.cs @@ -6,7 +6,7 @@ namespace Microsoft.Iris.Render { - public sealed class CosineInterpolation : AnimationInterpolation - { - } + public sealed class CosineInterpolation : AnimationInterpolation + { + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DebugCategory.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DebugCategory.cs index 96b3245..326acba 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DebugCategory.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DebugCategory.cs @@ -6,46 +6,46 @@ namespace Microsoft.Iris.Render { - public enum DebugCategory - { - Animation, - Critical, - Deprecated, - Dispatcher, - Dump, - Dx9Wrapper, - DynamicSurface, - Failure, - FormWindow, - GraphicsCache, - IFC, - ObjectCache, - Performance, - Profile, - Queues, - Render, - Sounds, - Surface, - SurfacePool, - SurfaceRestoration, - Timeouts, - Transport, - WindowState, - Effect, - HTTP, - ExternalCount, - Protocol, - RenderHost, - DumpException, - Focus, - Input, - TreeDisposal, - VisualSizePos, - Visual, - Painting, - RenderWindow, - ImageLoad, - ImageCache, - TotalCount, - } + public enum DebugCategory + { + Animation, + Critical, + Deprecated, + Dispatcher, + Dump, + Dx9Wrapper, + DynamicSurface, + Failure, + FormWindow, + GraphicsCache, + IFC, + ObjectCache, + Performance, + Profile, + Queues, + Render, + Sounds, + Surface, + SurfacePool, + SurfaceRestoration, + Timeouts, + Transport, + WindowState, + Effect, + HTTP, + ExternalCount, + Protocol, + RenderHost, + DumpException, + Focus, + Input, + TreeDisposal, + VisualSizePos, + Visual, + Painting, + RenderWindow, + ImageLoad, + ImageCache, + TotalCount, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DeferredInvokePriority.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DeferredInvokePriority.cs index 2bc55c6..193fc63 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DeferredInvokePriority.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DeferredInvokePriority.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render { - public enum DeferredInvokePriority - { - High, - Normal, - VisualUpdate, - Low, - Idle, - } + public enum DeferredInvokePriority + { + High, + Normal, + VisualUpdate, + Low, + Idle, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DesaturateElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DesaturateElement.cs index 654121e..dd28a64 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DesaturateElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DesaturateElement.cs @@ -10,44 +10,44 @@ using System; namespace Microsoft.Iris.Render { - public class DesaturateElement : EffectOperation - { - internal const string DesaturatePropertyName = "Desaturate"; - private float m_flDesaturate; - private byte m_nDesaturateID; - - public DesaturateElement(string stName, float flDesaturate) - : this() + public class DesaturateElement : EffectOperation { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate((double) flDesaturate >= 0.0 && (double) flDesaturate <= 1.0, typeof (ArgumentOutOfRangeException), "Valid range for desaturate is [0,1]"); - this.m_flDesaturate = flDesaturate; - this.m_stName = stName; + internal const string DesaturatePropertyName = "Desaturate"; + private float m_flDesaturate; + private byte m_nDesaturateID; + + public DesaturateElement(string stName, float flDesaturate) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate((double)flDesaturate >= 0.0 && (double)flDesaturate <= 1.0, typeof(ArgumentOutOfRangeException), "Valid range for desaturate is [0,1]"); + this.m_flDesaturate = flDesaturate; + this.m_stName = stName; + } + + public DesaturateElement() => this.m_typeOperation = EffectOperationType.Desaturate; + + public float Desaturate + { + get => this.m_flDesaturate; + set => this.m_flDesaturate = value; + } + + internal byte DesaturateID => this.m_nDesaturateID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Desaturate", (byte)8, ref this.m_nDesaturateID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("Desaturate", EffectPropertyType.Float, (object)this.m_flDesaturate, this.m_nDesaturateID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Desaturate", this.DesaturateID, this.Desaturate, cacheKey); + } } - - public DesaturateElement() => this.m_typeOperation = EffectOperationType.Desaturate; - - public float Desaturate - { - get => this.m_flDesaturate; - set => this.m_flDesaturate = value; - } - - internal byte DesaturateID => this.m_nDesaturateID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Desaturate", (byte) 8, ref this.m_nDesaturateID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("Desaturate", EffectPropertyType.Float, (object) this.m_flDesaturate, this.m_nDesaturateID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Desaturate", this.DesaturateID, this.Desaturate, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DestinationElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DestinationElement.cs index 3d7cc9c..a1987e3 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DestinationElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DestinationElement.cs @@ -10,73 +10,73 @@ using System; namespace Microsoft.Iris.Render { - public class DestinationElement : EffectInput - { - internal const string DownsamplePropertyName = "Downsample"; - private const string DestinationPropertyName = "Destination"; - internal const string UVOffsetPropertyName = "UVOffset"; - private float m_flDownsample; - private byte m_nDownsampleID; - private byte m_nDestinationID; - private Vector2 m_UVOffset; - private byte m_nUVOffsetID; - - public DestinationElement() - : this(1f) + public class DestinationElement : EffectInput { + internal const string DownsamplePropertyName = "Downsample"; + private const string DestinationPropertyName = "Destination"; + internal const string UVOffsetPropertyName = "UVOffset"; + private float m_flDownsample; + private byte m_nDownsampleID; + private byte m_nDestinationID; + private Vector2 m_UVOffset; + private byte m_nUVOffsetID; + + public DestinationElement() + : this(1f) + { + } + + public DestinationElement(float flDownsample) + { + Debug2.Validate((double)flDownsample >= 0.0 && (double)flDownsample <= 1.0, typeof(ArgumentOutOfRangeException), "Valid range for downsample is [0,1]"); + this.m_stName = "Destination"; + this.m_typeInput = EffectInputType.Destination; + this.m_flDownsample = flDownsample; + } + + public float Downsample + { + get => this.m_flDownsample; + set => this.m_flDownsample = value; + } + + internal byte DownsampleID => this.m_nDownsampleID; + + internal byte DestinationID => this.m_nDestinationID; + + public Vector2 UVOffset + { + get => this.m_UVOffset; + set => this.m_UVOffset = value; + } + + internal byte UVOffsetID => this.m_nUVOffsetID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + int num = base.PreProcessProperties(dictionary, ref nNextUniqueID); + this.AddEffectProperty(dictionary, "Destination"); + this.m_nDestinationID = nNextUniqueID++; + this.AddEffectProperty(dictionary, "Downsample"); + this.m_nDownsampleID = nNextUniqueID++; + return num + this.PreProcessProperty(dictionary, "UVOffset", (byte)12, ref this.m_nUVOffsetID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) + { + if (!this.GenerateProperty("Destination", EffectPropertyType.Image, (object)null, this.m_nDestinationID, dictProperties)) + return false; + dictProperties[this.GeneratePropertyPath("Destination")].IsDynamic = true; + return this.GenerateProperty("Downsample", EffectPropertyType.Float, (object)this.m_flDownsample, this.m_nDownsampleID, dictProperties) && this.GenerateProperty("UVOffset", EffectPropertyType.Vector2, (object)this.m_UVOffset, this.m_nUVOffsetID, dictProperties); + } + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Downsample", this.DownsampleID, this.Downsample, cacheKey); + this.GeneratePropertyCacheKey("UVOffset", this.UVOffsetID, this.UVOffset, cacheKey); + } } - - public DestinationElement(float flDownsample) - { - Debug2.Validate((double) flDownsample >= 0.0 && (double) flDownsample <= 1.0, typeof (ArgumentOutOfRangeException), "Valid range for downsample is [0,1]"); - this.m_stName = "Destination"; - this.m_typeInput = EffectInputType.Destination; - this.m_flDownsample = flDownsample; - } - - public float Downsample - { - get => this.m_flDownsample; - set => this.m_flDownsample = value; - } - - internal byte DownsampleID => this.m_nDownsampleID; - - internal byte DestinationID => this.m_nDestinationID; - - public Vector2 UVOffset - { - get => this.m_UVOffset; - set => this.m_UVOffset = value; - } - - internal byte UVOffsetID => this.m_nUVOffsetID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - int num = base.PreProcessProperties(dictionary, ref nNextUniqueID); - this.AddEffectProperty(dictionary, "Destination"); - this.m_nDestinationID = nNextUniqueID++; - this.AddEffectProperty(dictionary, "Downsample"); - this.m_nDownsampleID = nNextUniqueID++; - return num + this.PreProcessProperty(dictionary, "UVOffset", (byte) 12, ref this.m_nUVOffsetID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) - { - if (!this.GenerateProperty("Destination", EffectPropertyType.Image, (object) null, this.m_nDestinationID, dictProperties)) - return false; - dictProperties[this.GeneratePropertyPath("Destination")].IsDynamic = true; - return this.GenerateProperty("Downsample", EffectPropertyType.Float, (object) this.m_flDownsample, this.m_nDownsampleID, dictProperties) && this.GenerateProperty("UVOffset", EffectPropertyType.Vector2, (object) this.m_UVOffset, this.m_nUVOffsetID, dictProperties); - } - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Downsample", this.DownsampleID, this.Downsample, cacheKey); - this.GeneratePropertyCacheKey("UVOffset", this.UVOffsetID, this.UVOffset, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DisplayMode.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DisplayMode.cs index 039cd85..a56c58e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DisplayMode.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DisplayMode.cs @@ -9,125 +9,125 @@ using System.Collections.Generic; namespace Microsoft.Iris.Render { - public struct DisplayMode - { - public static readonly DisplayMode[] EmptyModes = new DisplayMode[0]; - public Size sizePhysicalPxl; - public Size sizeLogicalPxl; - public SurfaceFormat nFormat; - public int nRefreshRate; - public bool fInterlaced; - public bool fTvMode; - - public void ChangeFrom(DisplayMode modeChanges, DisplayModeFlags nChanges) + public struct DisplayMode { - if (Bits.TestFlag((int) nChanges, 1)) - { - this.sizePhysicalPxl = modeChanges.sizePhysicalPxl; - this.sizeLogicalPxl = modeChanges.sizeLogicalPxl; - } - if (Bits.TestFlag((int) nChanges, 2)) - this.nFormat = modeChanges.nFormat; - if (Bits.TestFlag((int) nChanges, 4)) - { - this.nRefreshRate = modeChanges.nRefreshRate; - this.fInterlaced = modeChanges.fInterlaced; - } - if (!Bits.TestFlag((int) nChanges, 8)) - return; - this.fTvMode = modeChanges.fTvMode; - } + public static readonly DisplayMode[] EmptyModes = new DisplayMode[0]; + public Size sizePhysicalPxl; + public Size sizeLogicalPxl; + public SurfaceFormat nFormat; + public int nRefreshRate; + public bool fInterlaced; + public bool fTvMode; - public static bool operator ==(DisplayMode left, DisplayMode right) => left.sizePhysicalPxl == right.sizePhysicalPxl && left.sizeLogicalPxl == right.sizeLogicalPxl && (left.nFormat == right.nFormat && left.nRefreshRate == right.nRefreshRate) && left.fInterlaced == right.fInterlaced && left.fTvMode == right.fTvMode; - - public static bool operator !=(DisplayMode left, DisplayMode right) => left.sizePhysicalPxl != right.sizePhysicalPxl || left.sizeLogicalPxl != right.sizeLogicalPxl || (left.nFormat != right.nFormat || left.nRefreshRate != right.nRefreshRate) || left.fInterlaced != right.fInterlaced || left.fTvMode != right.fTvMode; - - public override bool Equals(object obj) => obj is DisplayMode displayMode && this == displayMode; - - public override int GetHashCode() => this.sizePhysicalPxl.GetHashCode() ^ this.sizeLogicalPxl.GetHashCode() ^ this.nFormat.GetHashCode() ^ this.nRefreshRate ^ this.fInterlaced.GetHashCode() ^ this.fTvMode.GetHashCode(); - - public static int CompareRenderModes(DisplayMode dmA, DisplayMode dmB) - { - if (SurfaceFormatInfo.GetBitsPerPixel(dmA.nFormat) >= SurfaceFormatInfo.GetBitsPerPixel(dmB.nFormat)) - { - if (SurfaceFormatInfo.GetBitsPerPixel(dmA.nFormat) <= SurfaceFormatInfo.GetBitsPerPixel(dmB.nFormat)) + public void ChangeFrom(DisplayMode modeChanges, DisplayModeFlags nChanges) { - if (dmA.sizePhysicalPxl.Width >= dmB.sizePhysicalPxl.Width) - { - if (dmA.sizePhysicalPxl.Width <= dmB.sizePhysicalPxl.Width) + if (Bits.TestFlag((int)nChanges, 1)) { - if (dmA.sizePhysicalPxl.Height >= dmB.sizePhysicalPxl.Height) - { - if (dmA.sizePhysicalPxl.Height <= dmB.sizePhysicalPxl.Height) + this.sizePhysicalPxl = modeChanges.sizePhysicalPxl; + this.sizeLogicalPxl = modeChanges.sizeLogicalPxl; + } + if (Bits.TestFlag((int)nChanges, 2)) + this.nFormat = modeChanges.nFormat; + if (Bits.TestFlag((int)nChanges, 4)) + { + this.nRefreshRate = modeChanges.nRefreshRate; + this.fInterlaced = modeChanges.fInterlaced; + } + if (!Bits.TestFlag((int)nChanges, 8)) + return; + this.fTvMode = modeChanges.fTvMode; + } + + public static bool operator ==(DisplayMode left, DisplayMode right) => left.sizePhysicalPxl == right.sizePhysicalPxl && left.sizeLogicalPxl == right.sizeLogicalPxl && (left.nFormat == right.nFormat && left.nRefreshRate == right.nRefreshRate) && left.fInterlaced == right.fInterlaced && left.fTvMode == right.fTvMode; + + public static bool operator !=(DisplayMode left, DisplayMode right) => left.sizePhysicalPxl != right.sizePhysicalPxl || left.sizeLogicalPxl != right.sizeLogicalPxl || (left.nFormat != right.nFormat || left.nRefreshRate != right.nRefreshRate) || left.fInterlaced != right.fInterlaced || left.fTvMode != right.fTvMode; + + public override bool Equals(object obj) => obj is DisplayMode displayMode && this == displayMode; + + public override int GetHashCode() => this.sizePhysicalPxl.GetHashCode() ^ this.sizeLogicalPxl.GetHashCode() ^ this.nFormat.GetHashCode() ^ this.nRefreshRate ^ this.fInterlaced.GetHashCode() ^ this.fTvMode.GetHashCode(); + + public static int CompareRenderModes(DisplayMode dmA, DisplayMode dmB) + { + if (SurfaceFormatInfo.GetBitsPerPixel(dmA.nFormat) >= SurfaceFormatInfo.GetBitsPerPixel(dmB.nFormat)) + { + if (SurfaceFormatInfo.GetBitsPerPixel(dmA.nFormat) <= SurfaceFormatInfo.GetBitsPerPixel(dmB.nFormat)) { - if (dmA.nRefreshRate >= dmB.nRefreshRate) - { - if (dmA.nRefreshRate <= dmB.nRefreshRate) + if (dmA.sizePhysicalPxl.Width >= dmB.sizePhysicalPxl.Width) { - if (dmA.fInterlaced || !dmB.fInterlaced) - { - if (!dmA.fInterlaced || dmB.fInterlaced) - return 0; - } - else - goto label_11; + if (dmA.sizePhysicalPxl.Width <= dmB.sizePhysicalPxl.Width) + { + if (dmA.sizePhysicalPxl.Height >= dmB.sizePhysicalPxl.Height) + { + if (dmA.sizePhysicalPxl.Height <= dmB.sizePhysicalPxl.Height) + { + if (dmA.nRefreshRate >= dmB.nRefreshRate) + { + if (dmA.nRefreshRate <= dmB.nRefreshRate) + { + if (dmA.fInterlaced || !dmB.fInterlaced) + { + if (!dmA.fInterlaced || dmB.fInterlaced) + return 0; + } + else + goto label_11; + } + } + else + goto label_11; + } + } + else + goto label_11; + } } - } - else - goto label_11; + else + goto label_11; } - } - else - goto label_11; + return 1; } - } - else - goto label_11; + label_11: + return -1; } - return 1; - } -label_11: - return -1; - } - public static int CompareSimilarModes(DisplayMode dmA, DisplayMode dmB) - { - if (SurfaceFormatInfo.GetBitsPerPixel(dmA.nFormat) >= SurfaceFormatInfo.GetBitsPerPixel(dmB.nFormat)) - { - if (SurfaceFormatInfo.GetBitsPerPixel(dmA.nFormat) <= SurfaceFormatInfo.GetBitsPerPixel(dmB.nFormat)) + public static int CompareSimilarModes(DisplayMode dmA, DisplayMode dmB) { - if (dmA.sizePhysicalPxl.Width >= dmB.sizePhysicalPxl.Width) - { - if (dmA.sizePhysicalPxl.Width <= dmB.sizePhysicalPxl.Width) + if (SurfaceFormatInfo.GetBitsPerPixel(dmA.nFormat) >= SurfaceFormatInfo.GetBitsPerPixel(dmB.nFormat)) { - if (dmA.sizePhysicalPxl.Height >= dmB.sizePhysicalPxl.Height) - { - if (dmA.sizePhysicalPxl.Height <= dmB.sizePhysicalPxl.Height) - return 0; - } - else - goto label_7; + if (SurfaceFormatInfo.GetBitsPerPixel(dmA.nFormat) <= SurfaceFormatInfo.GetBitsPerPixel(dmB.nFormat)) + { + if (dmA.sizePhysicalPxl.Width >= dmB.sizePhysicalPxl.Width) + { + if (dmA.sizePhysicalPxl.Width <= dmB.sizePhysicalPxl.Width) + { + if (dmA.sizePhysicalPxl.Height >= dmB.sizePhysicalPxl.Height) + { + if (dmA.sizePhysicalPxl.Height <= dmB.sizePhysicalPxl.Height) + return 0; + } + else + goto label_7; + } + } + else + goto label_7; + } + return 1; } - } - else - goto label_7; + label_7: + return -1; } - return 1; - } -label_7: - return -1; - } - public override string ToString() => base.ToString(); + public override string ToString() => base.ToString(); - public class RenderModeComparer : IComparer - { - public int Compare(DisplayMode dmA, DisplayMode dmB) => DisplayMode.CompareRenderModes(dmA, dmB); - } + public class RenderModeComparer : IComparer + { + public int Compare(DisplayMode dmA, DisplayMode dmB) => DisplayMode.CompareRenderModes(dmA, dmB); + } - public class SimilarModeComparer : IComparer - { - public int Compare(DisplayMode dmA, DisplayMode dmB) => DisplayMode.CompareSimilarModes(dmA, dmB); + public class SimilarModeComparer : IComparer + { + public int Compare(DisplayMode dmA, DisplayMode dmB) => DisplayMode.CompareSimilarModes(dmA, dmB); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DisplayModeFlags.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DisplayModeFlags.cs index f9fffb3..49eb909 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/DisplayModeFlags.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/DisplayModeFlags.cs @@ -8,12 +8,12 @@ using System; namespace Microsoft.Iris.Render { - [Flags] - public enum DisplayModeFlags - { - Size = 1, - Format = 2, - RefreshRate = 4, - TvMode = 8, - } + [Flags] + public enum DisplayModeFlags + { + Size = 1, + Format = 2, + RefreshRate = 4, + TvMode = 8, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EaseInInterpolation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EaseInInterpolation.cs index 146bca2..f05f0a5 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EaseInInterpolation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EaseInInterpolation.cs @@ -9,21 +9,21 @@ using System; namespace Microsoft.Iris.Render { - public sealed class EaseInInterpolation : AnimationInterpolation - { - private float m_weight; - private float m_handle; - - public EaseInInterpolation(float weight, float handle) + public sealed class EaseInInterpolation : AnimationInterpolation { - Debug2.Validate((double) weight > 0.0, typeof (ArgumentOutOfRangeException), nameof (weight)); - Debug2.Validate((double) handle > 0.0 && (double) handle < 1.0, typeof (ArgumentOutOfRangeException), nameof (handle)); - this.m_weight = weight; - this.m_handle = handle; + private float m_weight; + private float m_handle; + + public EaseInInterpolation(float weight, float handle) + { + Debug2.Validate((double)weight > 0.0, typeof(ArgumentOutOfRangeException), nameof(weight)); + Debug2.Validate((double)handle > 0.0 && (double)handle < 1.0, typeof(ArgumentOutOfRangeException), nameof(handle)); + this.m_weight = weight; + this.m_handle = handle; + } + + internal float Weight => this.m_weight; + + internal float Handle => this.m_handle; } - - internal float Weight => this.m_weight; - - internal float Handle => this.m_handle; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EaseOutInterpolation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EaseOutInterpolation.cs index dd4d939..c4e43f7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EaseOutInterpolation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EaseOutInterpolation.cs @@ -9,21 +9,21 @@ using System; namespace Microsoft.Iris.Render { - public sealed class EaseOutInterpolation : AnimationInterpolation - { - private float m_weight; - private float m_handle; - - public EaseOutInterpolation(float weight, float handle) + public sealed class EaseOutInterpolation : AnimationInterpolation { - Debug2.Validate((double) weight > 0.0, typeof (ArgumentOutOfRangeException), nameof (weight)); - Debug2.Validate((double) handle > 0.0 && (double) handle < 1.0, typeof (ArgumentOutOfRangeException), nameof (handle)); - this.m_weight = weight; - this.m_handle = handle; + private float m_weight; + private float m_handle; + + public EaseOutInterpolation(float weight, float handle) + { + Debug2.Validate((double)weight > 0.0, typeof(ArgumentOutOfRangeException), nameof(weight)); + Debug2.Validate((double)handle > 0.0 && (double)handle < 1.0, typeof(ArgumentOutOfRangeException), nameof(handle)); + this.m_weight = weight; + this.m_handle = handle; + } + + internal float Weight => this.m_weight; + + internal float Handle => this.m_handle; } - - internal float Weight => this.m_weight; - - internal float Handle => this.m_handle; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EdgeDetectionElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EdgeDetectionElement.cs index ee769b7..8d5e784 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EdgeDetectionElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EdgeDetectionElement.cs @@ -10,43 +10,43 @@ using System; namespace Microsoft.Iris.Render { - public class EdgeDetectionElement : EffectOperation - { - internal const string EdgeLimitPropertyName = "EdgeLimit"; - private float m_flEdgeLimit; - private byte m_nEdgeLimitID; - - public EdgeDetectionElement(string stName, float flEdgeLimit) - : this() + public class EdgeDetectionElement : EffectOperation { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - this.m_stName = stName; - this.m_flEdgeLimit = flEdgeLimit; + internal const string EdgeLimitPropertyName = "EdgeLimit"; + private float m_flEdgeLimit; + private byte m_nEdgeLimitID; + + public EdgeDetectionElement(string stName, float flEdgeLimit) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + this.m_stName = stName; + this.m_flEdgeLimit = flEdgeLimit; + } + + public EdgeDetectionElement() => this.m_typeOperation = EffectOperationType.EdgeDetection; + + public float EdgeLimit + { + get => this.m_flEdgeLimit; + set => this.m_flEdgeLimit = value; + } + + internal byte EdgeLimitID => this.m_nEdgeLimitID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "EdgeLimit", (byte)8, ref this.m_nEdgeLimitID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("EdgeLimit", EffectPropertyType.Float, (object)this.m_flEdgeLimit, this.m_nEdgeLimitID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("EdgeLimit", this.EdgeLimitID, this.EdgeLimit, cacheKey); + } } - - public EdgeDetectionElement() => this.m_typeOperation = EffectOperationType.EdgeDetection; - - public float EdgeLimit - { - get => this.m_flEdgeLimit; - set => this.m_flEdgeLimit = value; - } - - internal byte EdgeLimitID => this.m_nEdgeLimitID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "EdgeLimit", (byte) 8, ref this.m_nEdgeLimitID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("EdgeLimit", EffectPropertyType.Float, (object) this.m_flEdgeLimit, this.m_nEdgeLimitID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("EdgeLimit", this.EdgeLimitID, this.EdgeLimit, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectElement.cs index 1f48012..a0fea21 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectElement.cs @@ -11,207 +11,207 @@ using System.Globalization; namespace Microsoft.Iris.Render { - public abstract class EffectElement - { - protected const byte ClassKeySize = 3; - protected const byte FloatKeySize = 8; - protected const byte Vector2KeySize = 12; - protected const byte Vector3KeySize = 16; - protected const byte Vector4KeySize = 20; - protected const byte IntKeySize = 8; - protected const byte ByteKeySize = 5; - private const byte k_classCacheKeySize = 3; - private const byte k_propHeaderCacheKeySize = 4; - private const byte k_floatCacheKeySize = 8; - private const byte k_vec2CacheKeySize = 12; - private const byte k_vec3CacheKeySize = 16; - private const byte k_vec4CacheKeySize = 20; - private const byte k_byteCacheKeySize = 5; - private const byte k_intCacheKeySize = 8; - protected string m_stName; - protected Vector m_dynamicProps; - - public string Name + public abstract class EffectElement { - get => this.m_stName; - set => this.m_stName = value; + protected const byte ClassKeySize = 3; + protected const byte FloatKeySize = 8; + protected const byte Vector2KeySize = 12; + protected const byte Vector3KeySize = 16; + protected const byte Vector4KeySize = 20; + protected const byte IntKeySize = 8; + protected const byte ByteKeySize = 5; + private const byte k_classCacheKeySize = 3; + private const byte k_propHeaderCacheKeySize = 4; + private const byte k_floatCacheKeySize = 8; + private const byte k_vec2CacheKeySize = 12; + private const byte k_vec3CacheKeySize = 16; + private const byte k_vec4CacheKeySize = 20; + private const byte k_byteCacheKeySize = 5; + private const byte k_intCacheKeySize = 8; + protected string m_stName; + protected Vector m_dynamicProps; + + public string Name + { + get => this.m_stName; + set => this.m_stName = value; + } + + internal abstract void AddCacheKey(ByteBuilder cacheKey); + + internal void GenerateClassCacheKey(byte nClass, byte nOperation, ByteBuilder cacheKey) + { + cacheKey.AppendByte((byte)3); + cacheKey.AppendByte(nClass); + cacheKey.AppendByte(nOperation); + } + + internal void GeneratePropertyCacheKey( + string stProp, + byte nPropertyId, + byte nValue, + ByteBuilder cacheKey) + { + if (this.IsDynamicProperty(stProp)) + return; + cacheKey.AppendByte((byte)5); + cacheKey.AppendByte((byte)3); + cacheKey.AppendByte((byte)9); + cacheKey.AppendByte(nPropertyId); + cacheKey.AppendByte(nValue); + } + + internal void GeneratePropertyCacheKey( + string stPropName, + byte nPropertyId, + int nValue, + ByteBuilder cacheKey) + { + if (this.IsDynamicProperty(stPropName)) + return; + cacheKey.AppendByte((byte)8); + cacheKey.AppendByte((byte)3); + cacheKey.AppendByte((byte)0); + cacheKey.AppendByte(nPropertyId); + cacheKey.AppendInt(nValue); + } + + internal void GeneratePropertyCacheKey( + string stPropName, + byte nPropertyId, + float fValue, + ByteBuilder cacheKey) + { + if (this.IsDynamicProperty(stPropName)) + return; + cacheKey.AppendByte((byte)8); + cacheKey.AppendByte((byte)3); + cacheKey.AppendByte((byte)1); + cacheKey.AppendByte(nPropertyId); + cacheKey.AppendFloat(fValue); + } + + internal void GeneratePropertyCacheKey( + string stPropName, + byte nPropertyId, + Vector2 vValue, + ByteBuilder cacheKey) + { + if (this.IsDynamicProperty(stPropName)) + return; + cacheKey.AppendByte((byte)12); + cacheKey.AppendByte((byte)3); + cacheKey.AppendByte((byte)2); + cacheKey.AppendByte(nPropertyId); + cacheKey.AppendVector(vValue); + } + + internal void GeneratePropertyCacheKey( + string stPropName, + byte nPropertyId, + Vector3 vValue, + ByteBuilder cacheKey) + { + if (this.IsDynamicProperty(stPropName)) + return; + cacheKey.AppendByte((byte)16); + cacheKey.AppendByte((byte)3); + cacheKey.AppendByte((byte)3); + cacheKey.AppendByte(nPropertyId); + cacheKey.AppendVector(vValue); + } + + internal void GeneratePropertyCacheKey( + string stPropName, + byte nPropertyId, + Vector4 vValue, + ByteBuilder cacheKey) + { + if (this.IsDynamicProperty(stPropName)) + return; + cacheKey.AppendByte((byte)16); + cacheKey.AppendByte((byte)3); + cacheKey.AppendByte((byte)4); + cacheKey.AppendByte(nPropertyId); + cacheKey.AppendVector(vValue); + } + + protected string GeneratePropertyPath(string stPropertyName) => string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}.{1}", (object)this.m_stName, (object)stPropertyName); + + internal bool GenerateProperty( + string stName, + EffectPropertyType eptType, + object oValue, + byte nID, + Map dictProperties) + { + string propertyPath = this.GeneratePropertyPath(stName); + if (dictProperties.ContainsKey(propertyPath)) + { + if (dictProperties[propertyPath] != null) + return false; + EffectProperty effectProperty = new EffectProperty(stName, eptType, true, oValue, nID); + dictProperties[propertyPath] = effectProperty; + effectProperty.IsDynamic = true; + } + else + { + EffectProperty effectProperty = new EffectProperty(stName, eptType, false, oValue, nID); + dictProperties.Add(propertyPath, effectProperty); + } + return true; + } + + protected void MarkDynamicProperty(string stProp) + { + if (this.m_dynamicProps == null) + this.m_dynamicProps = new Vector(5); + if (this.m_dynamicProps.Contains(stProp)) + return; + this.m_dynamicProps.Add(stProp); + } + + internal void AddEffectProperty(Map dictionary, string stProp) + { + string propertyPath = this.GeneratePropertyPath(stProp); + if (!dictionary.ContainsKey(propertyPath)) + dictionary.Add(propertyPath, (EffectProperty)null); + this.MarkDynamicProperty(stProp); + } + + internal bool IsDynamicProperty(string stProp) => this.m_dynamicProps != null && this.m_dynamicProps.Contains(stProp); + + internal bool VerifyDynamicProperty(Map dictionary, string stProperty) + { + string propertyPath = this.GeneratePropertyPath(stProperty); + if (!dictionary.ContainsKey(propertyPath)) + return false; + this.MarkDynamicProperty(stProperty); + return true; + } + + internal int PreProcessProperty( + Map dictionary, + string stProperty, + byte nPropSize, + ref byte nPropertyId, + ref byte nNextUniqueID) + { + int num = 0; + if (this.VerifyDynamicProperty(dictionary, stProperty)) + nPropertyId = nNextUniqueID++; + else + num = (int)nPropSize; + return num; + } + + internal virtual bool Process(Map dictProperties) => true; + + internal virtual int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return 3; + } } - - internal abstract void AddCacheKey(ByteBuilder cacheKey); - - internal void GenerateClassCacheKey(byte nClass, byte nOperation, ByteBuilder cacheKey) - { - cacheKey.AppendByte((byte) 3); - cacheKey.AppendByte(nClass); - cacheKey.AppendByte(nOperation); - } - - internal void GeneratePropertyCacheKey( - string stProp, - byte nPropertyId, - byte nValue, - ByteBuilder cacheKey) - { - if (this.IsDynamicProperty(stProp)) - return; - cacheKey.AppendByte((byte) 5); - cacheKey.AppendByte((byte) 3); - cacheKey.AppendByte((byte) 9); - cacheKey.AppendByte(nPropertyId); - cacheKey.AppendByte(nValue); - } - - internal void GeneratePropertyCacheKey( - string stPropName, - byte nPropertyId, - int nValue, - ByteBuilder cacheKey) - { - if (this.IsDynamicProperty(stPropName)) - return; - cacheKey.AppendByte((byte) 8); - cacheKey.AppendByte((byte) 3); - cacheKey.AppendByte((byte) 0); - cacheKey.AppendByte(nPropertyId); - cacheKey.AppendInt(nValue); - } - - internal void GeneratePropertyCacheKey( - string stPropName, - byte nPropertyId, - float fValue, - ByteBuilder cacheKey) - { - if (this.IsDynamicProperty(stPropName)) - return; - cacheKey.AppendByte((byte) 8); - cacheKey.AppendByte((byte) 3); - cacheKey.AppendByte((byte) 1); - cacheKey.AppendByte(nPropertyId); - cacheKey.AppendFloat(fValue); - } - - internal void GeneratePropertyCacheKey( - string stPropName, - byte nPropertyId, - Vector2 vValue, - ByteBuilder cacheKey) - { - if (this.IsDynamicProperty(stPropName)) - return; - cacheKey.AppendByte((byte) 12); - cacheKey.AppendByte((byte) 3); - cacheKey.AppendByte((byte) 2); - cacheKey.AppendByte(nPropertyId); - cacheKey.AppendVector(vValue); - } - - internal void GeneratePropertyCacheKey( - string stPropName, - byte nPropertyId, - Vector3 vValue, - ByteBuilder cacheKey) - { - if (this.IsDynamicProperty(stPropName)) - return; - cacheKey.AppendByte((byte) 16); - cacheKey.AppendByte((byte) 3); - cacheKey.AppendByte((byte) 3); - cacheKey.AppendByte(nPropertyId); - cacheKey.AppendVector(vValue); - } - - internal void GeneratePropertyCacheKey( - string stPropName, - byte nPropertyId, - Vector4 vValue, - ByteBuilder cacheKey) - { - if (this.IsDynamicProperty(stPropName)) - return; - cacheKey.AppendByte((byte) 16); - cacheKey.AppendByte((byte) 3); - cacheKey.AppendByte((byte) 4); - cacheKey.AppendByte(nPropertyId); - cacheKey.AppendVector(vValue); - } - - protected string GeneratePropertyPath(string stPropertyName) => string.Format((IFormatProvider) CultureInfo.InvariantCulture, "{0}.{1}", (object) this.m_stName, (object) stPropertyName); - - internal bool GenerateProperty( - string stName, - EffectPropertyType eptType, - object oValue, - byte nID, - Map dictProperties) - { - string propertyPath = this.GeneratePropertyPath(stName); - if (dictProperties.ContainsKey(propertyPath)) - { - if (dictProperties[propertyPath] != null) - return false; - EffectProperty effectProperty = new EffectProperty(stName, eptType, true, oValue, nID); - dictProperties[propertyPath] = effectProperty; - effectProperty.IsDynamic = true; - } - else - { - EffectProperty effectProperty = new EffectProperty(stName, eptType, false, oValue, nID); - dictProperties.Add(propertyPath, effectProperty); - } - return true; - } - - protected void MarkDynamicProperty(string stProp) - { - if (this.m_dynamicProps == null) - this.m_dynamicProps = new Vector(5); - if (this.m_dynamicProps.Contains(stProp)) - return; - this.m_dynamicProps.Add(stProp); - } - - internal void AddEffectProperty(Map dictionary, string stProp) - { - string propertyPath = this.GeneratePropertyPath(stProp); - if (!dictionary.ContainsKey(propertyPath)) - dictionary.Add(propertyPath, (EffectProperty) null); - this.MarkDynamicProperty(stProp); - } - - internal bool IsDynamicProperty(string stProp) => this.m_dynamicProps != null && this.m_dynamicProps.Contains(stProp); - - internal bool VerifyDynamicProperty(Map dictionary, string stProperty) - { - string propertyPath = this.GeneratePropertyPath(stProperty); - if (!dictionary.ContainsKey(propertyPath)) - return false; - this.MarkDynamicProperty(stProperty); - return true; - } - - internal int PreProcessProperty( - Map dictionary, - string stProperty, - byte nPropSize, - ref byte nPropertyId, - ref byte nNextUniqueID) - { - int num = 0; - if (this.VerifyDynamicProperty(dictionary, stProperty)) - nPropertyId = nNextUniqueID++; - else - num = (int) nPropSize; - return num; - } - - internal virtual bool Process(Map dictProperties) => true; - - internal virtual int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return 3; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectElementCacheKeys.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectElementCacheKeys.cs index de44438..fa45fff 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectElementCacheKeys.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectElementCacheKeys.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render { - internal enum EffectElementCacheKeys : byte - { - Input, - Operation, - BlendOperation, - Property, - MaxValue, - } + internal enum EffectElementCacheKeys : byte + { + Input, + Operation, + BlendOperation, + Property, + MaxValue, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectInput.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectInput.cs index de8125a..36ce541 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectInput.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectInput.cs @@ -8,12 +8,12 @@ using Microsoft.Iris.Render.Common; namespace Microsoft.Iris.Render { - public abstract class EffectInput : EffectElement - { - internal EffectInputType m_typeInput; + public abstract class EffectInput : EffectElement + { + internal EffectInputType m_typeInput; - internal EffectInputType Type => this.m_typeInput; + internal EffectInputType Type => this.m_typeInput; - internal override void AddCacheKey(ByteBuilder cacheKey) => this.GenerateClassCacheKey((byte) 0, (byte) this.m_typeInput, cacheKey); - } + internal override void AddCacheKey(ByteBuilder cacheKey) => this.GenerateClassCacheKey((byte)0, (byte)this.m_typeInput, cacheKey); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectInputType.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectInputType.cs index 4e2a796..0862b29 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectInputType.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectInputType.cs @@ -6,18 +6,18 @@ namespace Microsoft.Iris.Render { - internal enum EffectInputType : byte - { - Color = 1, - Image = 2, - Blend = 3, - Interpolate = 4, - Layer = 5, - ComplexImage = 6, - Video = 7, - Spotlight2D = 8, - PointLight2D = 9, - Destination = 10, // 0x0A - MaxValue = 11, // 0x0B - } + internal enum EffectInputType : byte + { + Color = 1, + Image = 2, + Blend = 3, + Interpolate = 4, + Layer = 5, + ComplexImage = 6, + Video = 7, + Spotlight2D = 8, + PointLight2D = 9, + Destination = 10, // 0x0A + MaxValue = 11, // 0x0B + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectLayer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectLayer.cs index 53ce727..33f5e2a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectLayer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectLayer.cs @@ -12,72 +12,72 @@ using System.Collections.Generic; namespace Microsoft.Iris.Render { - public class EffectLayer : EffectInput - { - internal EffectInput m_input; - internal IList m_listOperations; - - public EffectLayer(EffectInput inputElement, List listOperations) - : this() + public class EffectLayer : EffectInput { - Debug2.Validate(inputElement != null, typeof (ArgumentNullException), nameof (inputElement)); - Debug2.Validate(listOperations != null, typeof (ArgumentNullException), nameof (listOperations)); - this.m_input = inputElement; - this.m_listOperations = (IList) listOperations; - } + internal EffectInput m_input; + internal IList m_listOperations; - public EffectLayer(EffectInput inputElement, EffectOperation efoOperation) - : this() - { - Debug2.Validate(inputElement != null, typeof (ArgumentNullException), nameof (inputElement)); - Debug2.Validate(efoOperation != null, typeof (ArgumentNullException), nameof (efoOperation)); - this.m_input = inputElement; - this.m_listOperations = (IList) new List(1); - this.m_listOperations.Add((object) efoOperation); - } + public EffectLayer(EffectInput inputElement, List listOperations) + : this() + { + Debug2.Validate(inputElement != null, typeof(ArgumentNullException), nameof(inputElement)); + Debug2.Validate(listOperations != null, typeof(ArgumentNullException), nameof(listOperations)); + this.m_input = inputElement; + this.m_listOperations = (IList)listOperations; + } - public EffectLayer() => this.m_typeInput = EffectInputType.Layer; + public EffectLayer(EffectInput inputElement, EffectOperation efoOperation) + : this() + { + Debug2.Validate(inputElement != null, typeof(ArgumentNullException), nameof(inputElement)); + Debug2.Validate(efoOperation != null, typeof(ArgumentNullException), nameof(efoOperation)); + this.m_input = inputElement; + this.m_listOperations = (IList)new List(1); + this.m_listOperations.Add((object)efoOperation); + } - public EffectInput Input - { - get => this.m_input; - set => this.m_input = value; - } + public EffectLayer() => this.m_typeInput = EffectInputType.Layer; - public IList Operations - { - get => this.m_listOperations; - set => this.m_listOperations = value; - } + public EffectInput Input + { + get => this.m_input; + set => this.m_input = value; + } - internal override bool Process(Map dictProperties) - { - if (!this.m_input.Process(dictProperties)) - return false; - foreach (EffectElement listOperation in (IEnumerable) this.m_listOperations) - { - if (!listOperation.Process(dictProperties)) - return false; - } - return true; - } + public IList Operations + { + get => this.m_listOperations; + set => this.m_listOperations = value; + } - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - int num = base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.m_input.PreProcessProperties(dictionary, ref nNextUniqueID); - foreach (EffectOperation listOperation in (IEnumerable) this.m_listOperations) - num += listOperation.PreProcessProperties(dictionary, ref nNextUniqueID); - return num; - } + internal override bool Process(Map dictProperties) + { + if (!this.m_input.Process(dictProperties)) + return false; + foreach (EffectElement listOperation in (IEnumerable)this.m_listOperations) + { + if (!listOperation.Process(dictProperties)) + return false; + } + return true; + } - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.m_input.AddCacheKey(cacheKey); - foreach (EffectElement listOperation in (IEnumerable) this.m_listOperations) - listOperation.AddCacheKey(cacheKey); + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + int num = base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.m_input.PreProcessProperties(dictionary, ref nNextUniqueID); + foreach (EffectOperation listOperation in (IEnumerable)this.m_listOperations) + num += listOperation.PreProcessProperties(dictionary, ref nNextUniqueID); + return num; + } + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.m_input.AddCacheKey(cacheKey); + foreach (EffectElement listOperation in (IEnumerable)this.m_listOperations) + listOperation.AddCacheKey(cacheKey); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectOperation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectOperation.cs index 3382f52..074de83 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectOperation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectOperation.cs @@ -9,19 +9,19 @@ using Microsoft.Iris.Render.Graphics; namespace Microsoft.Iris.Render { - public abstract class EffectOperation : EffectElement - { - protected EffectOperationType m_typeOperation; - - internal EffectOperationType Type => this.m_typeOperation; - - internal override void AddCacheKey(ByteBuilder cacheKey) => this.GenerateClassCacheKey((byte) 1, (byte) this.Type, cacheKey); - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) + public abstract class EffectOperation : EffectElement { - return 3 + base.PreProcessProperties(dictionary, ref nNextUniqueID); + protected EffectOperationType m_typeOperation; + + internal EffectOperationType Type => this.m_typeOperation; + + internal override void AddCacheKey(ByteBuilder cacheKey) => this.GenerateClassCacheKey((byte)1, (byte)this.Type, cacheKey); + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return 3 + base.PreProcessProperties(dictionary, ref nNextUniqueID); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectOperationType.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectOperationType.cs index ccbef98..5340d6f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectOperationType.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EffectOperationType.cs @@ -6,21 +6,21 @@ namespace Microsoft.Iris.Render { - public enum EffectOperationType : byte - { - Brightness = 1, - Contrast = 2, - Desaturate = 3, - EdgeDetection = 4, - Emboss = 5, - GaussianBlur = 6, - HSL = 7, - HSV = 8, - InvAlpha = 9, - InvColor = 10, // 0x0A - Invert = 11, // 0x0B - LightShaft = 12, // 0x0C - Sepia = 13, // 0x0D - MaxValue = 14, // 0x0E - } + public enum EffectOperationType : byte + { + Brightness = 1, + Contrast = 2, + Desaturate = 3, + EdgeDetection = 4, + Emboss = 5, + GaussianBlur = 6, + HSL = 7, + HSV = 8, + InvAlpha = 9, + InvColor = 10, // 0x0A + Invert = 11, // 0x0B + LightShaft = 12, // 0x0C + Sepia = 13, // 0x0D + MaxValue = 14, // 0x0E + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EmbossDirection.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EmbossDirection.cs index e8070f5..d653908 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EmbossDirection.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EmbossDirection.cs @@ -6,9 +6,9 @@ namespace Microsoft.Iris.Render { - public enum EmbossDirection - { - LeftToRight, - RightToLeft, - } + public enum EmbossDirection + { + LeftToRight, + RightToLeft, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EmbossElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EmbossElement.cs index 88dadea..5ecec5b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EmbossElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EmbossElement.cs @@ -10,57 +10,57 @@ using System; namespace Microsoft.Iris.Render { - public class EmbossElement : EffectOperation - { - internal const string DirectionPropertyName = "Direction"; - internal const string GrayLevelPropertyName = "GrayLevel"; - private EmbossDirection m_direction; - private byte m_nDirectionID; - private float m_flGrayLevel; - private byte m_nGrayLevelID; - - public EmbossElement(string stName, EmbossDirection direction, float flGrayLevel) - : this() + public class EmbossElement : EffectOperation { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate((double) flGrayLevel >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for GrayLevel is >= 0"); - this.m_stName = stName; - this.m_direction = direction; - this.m_flGrayLevel = flGrayLevel; + internal const string DirectionPropertyName = "Direction"; + internal const string GrayLevelPropertyName = "GrayLevel"; + private EmbossDirection m_direction; + private byte m_nDirectionID; + private float m_flGrayLevel; + private byte m_nGrayLevelID; + + public EmbossElement(string stName, EmbossDirection direction, float flGrayLevel) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate((double)flGrayLevel >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for GrayLevel is >= 0"); + this.m_stName = stName; + this.m_direction = direction; + this.m_flGrayLevel = flGrayLevel; + } + + public EmbossElement() => this.m_typeOperation = EffectOperationType.Emboss; + + public EmbossDirection Direction + { + get => this.m_direction; + set => this.m_direction = value; + } + + internal byte DirectionID => this.m_nDirectionID; + + public float GrayLevel + { + get => this.m_flGrayLevel; + set => this.m_flGrayLevel = value; + } + + internal byte GrayLevelID => this.m_nGrayLevelID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Direction", (byte)5, ref this.m_nDirectionID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "GrayLevel", (byte)8, ref this.m_nGrayLevelID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("Direction", EffectPropertyType.Integer, (object)this.m_direction, this.m_nDirectionID, dictProperties) && this.GenerateProperty("GrayLevel", EffectPropertyType.Float, (object)this.m_flGrayLevel, this.m_nGrayLevelID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Direction", this.DirectionID, (byte)this.Direction, cacheKey); + this.GeneratePropertyCacheKey("GrayLevel", this.GrayLevelID, this.GrayLevel, cacheKey); + } } - - public EmbossElement() => this.m_typeOperation = EffectOperationType.Emboss; - - public EmbossDirection Direction - { - get => this.m_direction; - set => this.m_direction = value; - } - - internal byte DirectionID => this.m_nDirectionID; - - public float GrayLevel - { - get => this.m_flGrayLevel; - set => this.m_flGrayLevel = value; - } - - internal byte GrayLevelID => this.m_nGrayLevelID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Direction", (byte) 5, ref this.m_nDirectionID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "GrayLevel", (byte) 8, ref this.m_nGrayLevelID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("Direction", EffectPropertyType.Integer, (object) this.m_direction, this.m_nDirectionID, dictProperties) && this.GenerateProperty("GrayLevel", EffectPropertyType.Float, (object) this.m_flGrayLevel, this.m_nGrayLevelID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Direction", this.DirectionID, (byte) this.Direction, cacheKey); - this.GeneratePropertyCacheKey("GrayLevel", this.GrayLevelID, this.GrayLevel, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EngineInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EngineInfo.cs index b7f402c..2d66030 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EngineInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EngineInfo.cs @@ -8,13 +8,13 @@ using System; namespace Microsoft.Iris.Render { - [Serializable] - public abstract class EngineInfo - { - private EngineType m_engineType; + [Serializable] + public abstract class EngineInfo + { + private EngineType m_engineType; - protected EngineInfo(EngineType engineType) => this.m_engineType = engineType; + protected EngineInfo(EngineType engineType) => this.m_engineType = engineType; - internal EngineType Type => this.m_engineType; - } + internal EngineType Type => this.m_engineType; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EngineType.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EngineType.cs index fc73f3a..507ea3e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/EngineType.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/EngineType.cs @@ -6,8 +6,8 @@ namespace Microsoft.Iris.Render { - public enum EngineType - { - Iris, - } + public enum EngineType + { + Iris, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ExponentialInterpolation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ExponentialInterpolation.cs index ef158b4..ebee993 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ExponentialInterpolation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ExponentialInterpolation.cs @@ -9,16 +9,16 @@ using System; namespace Microsoft.Iris.Render { - public sealed class ExponentialInterpolation : AnimationInterpolation - { - private float m_weight; - - public ExponentialInterpolation(float weight) + public sealed class ExponentialInterpolation : AnimationInterpolation { - Debug2.Validate((double) weight > 0.0, typeof (ArgumentOutOfRangeException), "'weight' must be > 0"); - this.m_weight = weight; - } + private float m_weight; - internal float Weight => this.m_weight; - } + public ExponentialInterpolation(float weight) + { + Debug2.Validate((double)weight > 0.0, typeof(ArgumentOutOfRangeException), "'weight' must be > 0"); + this.m_weight = weight; + } + + internal float Weight => this.m_weight; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/BitmapInformation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/BitmapInformation.cs index 3471d86..a1521e7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/BitmapInformation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/BitmapInformation.cs @@ -9,21 +9,21 @@ using System; namespace Microsoft.Iris.Render.Extensions { - public class BitmapInformation : IDisposable - { - public ImageInformation imageInfo; - internal HSpBitmap hBitmap; - - public void Dispose() => this.ReleaseData(); - - private void ReleaseData() + public class BitmapInformation : IDisposable { - if (!(this.hBitmap != HSpBitmap.NULL)) - return; - EngineApi.IFC(ExtensionsApi.SpBitmapDelete(this.hBitmap)); - this.hBitmap = HSpBitmap.NULL; - } + public ImageInformation imageInfo; + internal HSpBitmap hBitmap; - public override string ToString() => base.ToString(); - } + public void Dispose() => this.ReleaseData(); + + private void ReleaseData() + { + if (!(this.hBitmap != HSpBitmap.NULL)) + return; + EngineApi.IFC(ExtensionsApi.SpBitmapDelete(this.hBitmap)); + this.hBitmap = HSpBitmap.NULL; + } + + public override string ToString() => base.ToString(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/CoordMapGenerator.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/CoordMapGenerator.cs index acf5a92..54a7514 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/CoordMapGenerator.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/CoordMapGenerator.cs @@ -9,22 +9,22 @@ using System; namespace Microsoft.Iris.Render.Extensions { - public static class CoordMapGenerator - { - public static CoordMap CreateSubrect(Size sizeImage, Rectangle rect) + public static class CoordMapGenerator { - Debug2.Validate(rect.Right <= sizeImage.Width, typeof (ArgumentOutOfRangeException), "Desired rect cannot extend beyond the image width"); - Debug2.Validate(rect.Bottom <= sizeImage.Height, typeof (ArgumentOutOfRangeException), "Desired rect cannot extend beyond the image height"); - CoordMap coordMap = new CoordMap(); - float flValue1 = (float) rect.Left / (float) sizeImage.Width; - float flValue2 = (float) rect.Right / (float) sizeImage.Width; - float flValue3 = (float) rect.Top / (float) sizeImage.Height; - float flValue4 = (float) rect.Bottom / (float) sizeImage.Height; - coordMap.AddValue(0.0f, flValue1, Orientation.Horizontal); - coordMap.AddValue(1f, flValue2, Orientation.Horizontal); - coordMap.AddValue(0.0f, flValue3, Orientation.Vertical); - coordMap.AddValue(1f, flValue4, Orientation.Vertical); - return coordMap; + public static CoordMap CreateSubrect(Size sizeImage, Rectangle rect) + { + Debug2.Validate(rect.Right <= sizeImage.Width, typeof(ArgumentOutOfRangeException), "Desired rect cannot extend beyond the image width"); + Debug2.Validate(rect.Bottom <= sizeImage.Height, typeof(ArgumentOutOfRangeException), "Desired rect cannot extend beyond the image height"); + CoordMap coordMap = new CoordMap(); + float flValue1 = (float)rect.Left / (float)sizeImage.Width; + float flValue2 = (float)rect.Right / (float)sizeImage.Width; + float flValue3 = (float)rect.Top / (float)sizeImage.Height; + float flValue4 = (float)rect.Bottom / (float)sizeImage.Height; + coordMap.AddValue(0.0f, flValue1, Orientation.Horizontal); + coordMap.AddValue(1f, flValue2, Orientation.Horizontal); + coordMap.AddValue(0.0f, flValue3, Orientation.Vertical); + coordMap.AddValue(1f, flValue4, Orientation.Vertical); + return coordMap; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DataTracker.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DataTracker.cs index 2e96957..bc5f7b7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DataTracker.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DataTracker.cs @@ -9,35 +9,35 @@ using System; namespace Microsoft.Iris.Render.Extensions { - public class DataTracker : IDisposable - { - private Map m_dictData; - - public DataTracker() => this.m_dictData = new Map(); - - public void AddData(object o, IDisposable data) + public class DataTracker : IDisposable { - Debug2.Validate(o != null, typeof (ArgumentNullException), "IRenderObject is invalid"); - Debug2.Validate(data != null, typeof (ArgumentNullException), "Data is invalid"); - Debug2.Validate(!this.m_dictData.ContainsKey(o), typeof (InvalidOperationException), "DataTracker only supports one resource per IRenderObject"); - this.m_dictData[o] = data; - } + private Map m_dictData; - public void DisposeAndRemoveData(object o) - { - IDisposable disposable; - if (!this.m_dictData.TryGetValue(o, out disposable)) - return; - disposable.Dispose(); - this.m_dictData.Remove(o); - } + public DataTracker() => this.m_dictData = new Map(); - public void Dispose() - { - foreach (IDisposable disposable in this.m_dictData.Values) - disposable.Dispose(); - this.m_dictData = (Map) null; - GC.SuppressFinalize((object) this); + public void AddData(object o, IDisposable data) + { + Debug2.Validate(o != null, typeof(ArgumentNullException), "IRenderObject is invalid"); + Debug2.Validate(data != null, typeof(ArgumentNullException), "Data is invalid"); + Debug2.Validate(!this.m_dictData.ContainsKey(o), typeof(InvalidOperationException), "DataTracker only supports one resource per IRenderObject"); + this.m_dictData[o] = data; + } + + public void DisposeAndRemoveData(object o) + { + IDisposable disposable; + if (!this.m_dictData.TryGetValue(o, out disposable)) + return; + disposable.Dispose(); + this.m_dictData.Remove(o); + } + + public void Dispose() + { + foreach (IDisposable disposable in this.m_dictData.Values) + disposable.Dispose(); + this.m_dictData = (Map)null; + GC.SuppressFinalize((object)this); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugCategoryEnabledSet.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugCategoryEnabledSet.cs index b36f196..8641b67 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugCategoryEnabledSet.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugCategoryEnabledSet.cs @@ -8,95 +8,95 @@ using System.Security; namespace Microsoft.Iris.Render.Extensions { - [SuppressUnmanagedCodeSecurity] - internal class DebugCategoryEnabledSet - { - private byte[] m_arbCache; - private TraceRegistryHelper m_registryHelper; - private bool m_invalidCache; - - internal DebugCategoryEnabledSet(TraceRegistryHelper registryHelper) + [SuppressUnmanagedCodeSecurity] + internal class DebugCategoryEnabledSet { - this.m_arbCache = new byte[38]; - for (int index = 0; index < this.m_arbCache.Length; ++index) - this.m_arbCache[index] = (byte) 0; - this.m_registryHelper = registryHelper; - this.m_invalidCache = true; - } + private byte[] m_arbCache; + private TraceRegistryHelper m_registryHelper; + private bool m_invalidCache; - public byte this[DebugCategory cat] - { - get => this.GetLevel(cat); - set => this.SetLevel(cat, value); - } - - public byte GetLevel(DebugCategory cat) - { - if (this.m_invalidCache) - this.Refresh(); - return this.m_arbCache[(int) cat]; - } - - public void SetLevel(DebugCategory cat, byte bValue) - { - if ((int) this.m_arbCache[(int) cat] == (int) bValue) - return; - DebugCategoryEnabledSet.SetExternalDebugLevel(cat, bValue); - this.m_arbCache[(int) cat] = bValue; - } - - public void SetLevel(DebugCategory cat, bool fValue) - { - byte bValue = fValue ? (byte) 1 : (byte) 0; - if (bValue != (byte) 0 && (int) bValue <= (int) this.GetLevel(cat)) - return; - this.SetLevel(cat, bValue); - } - - private void Refresh() - { - lock (this) - { - for (int index = 0; index < this.m_arbCache.Length; ++index) + internal DebugCategoryEnabledSet(TraceRegistryHelper registryHelper) { - DebugCategory cat = (DebugCategory) index; - byte externalDebugLevel = DebugCategoryEnabledSet.GetExternalDebugLevel(cat); - byte level = externalDebugLevel; - byte bValue; - if (this.m_registryHelper.ReadValuesFromRegistry && this.ReadDebugCategoryValueFromRegistry(cat, out bValue)) - level = bValue; - if ((int) externalDebugLevel != (int) level) - DebugCategoryEnabledSet.SetExternalDebugLevel(cat, level); - if ((int) this.m_arbCache[index] != (int) level) - this.m_arbCache[index] = level; + this.m_arbCache = new byte[38]; + for (int index = 0; index < this.m_arbCache.Length; ++index) + this.m_arbCache[index] = (byte)0; + this.m_registryHelper = registryHelper; + this.m_invalidCache = true; } - this.m_invalidCache = false; - } + + public byte this[DebugCategory cat] + { + get => this.GetLevel(cat); + set => this.SetLevel(cat, value); + } + + public byte GetLevel(DebugCategory cat) + { + if (this.m_invalidCache) + this.Refresh(); + return this.m_arbCache[(int)cat]; + } + + public void SetLevel(DebugCategory cat, byte bValue) + { + if ((int)this.m_arbCache[(int)cat] == (int)bValue) + return; + DebugCategoryEnabledSet.SetExternalDebugLevel(cat, bValue); + this.m_arbCache[(int)cat] = bValue; + } + + public void SetLevel(DebugCategory cat, bool fValue) + { + byte bValue = fValue ? (byte)1 : (byte)0; + if (bValue != (byte)0 && (int)bValue <= (int)this.GetLevel(cat)) + return; + this.SetLevel(cat, bValue); + } + + private void Refresh() + { + lock (this) + { + for (int index = 0; index < this.m_arbCache.Length; ++index) + { + DebugCategory cat = (DebugCategory)index; + byte externalDebugLevel = DebugCategoryEnabledSet.GetExternalDebugLevel(cat); + byte level = externalDebugLevel; + byte bValue; + if (this.m_registryHelper.ReadValuesFromRegistry && this.ReadDebugCategoryValueFromRegistry(cat, out bValue)) + level = bValue; + if ((int)externalDebugLevel != (int)level) + DebugCategoryEnabledSet.SetExternalDebugLevel(cat, level); + if ((int)this.m_arbCache[index] != (int)level) + this.m_arbCache[index] = level; + } + this.m_invalidCache = false; + } + } + + internal void Invalidate() + { + if (this.m_invalidCache) + return; + lock (this) + { + if (this.m_invalidCache) + return; + this.m_invalidCache = true; + } + } + + private bool ReadDebugCategoryValueFromRegistry(DebugCategory cat, out byte bValue) => this.m_registryHelper.ReadValueFromRegistry(cat.ToString(), out bValue); + + private static byte GetExternalDebugLevel(DebugCategory cat) => DebugCategoryEnabledSet.IsExternalCategory(cat) ? eDebugApi.DebugGetCategoryLevel(cat) : (byte)0; + + private static void SetExternalDebugLevel(DebugCategory cat, byte level) + { + if (!DebugCategoryEnabledSet.IsExternalCategory(cat)) + return; + eDebugApi.DebugSetCategoryLevel(cat, level); + } + + private static bool IsExternalCategory(DebugCategory cat) => (uint)cat < 25U; } - - internal void Invalidate() - { - if (this.m_invalidCache) - return; - lock (this) - { - if (this.m_invalidCache) - return; - this.m_invalidCache = true; - } - } - - private bool ReadDebugCategoryValueFromRegistry(DebugCategory cat, out byte bValue) => this.m_registryHelper.ReadValueFromRegistry(cat.ToString(), out bValue); - - private static byte GetExternalDebugLevel(DebugCategory cat) => DebugCategoryEnabledSet.IsExternalCategory(cat) ? eDebugApi.DebugGetCategoryLevel(cat) : (byte) 0; - - private static void SetExternalDebugLevel(DebugCategory cat, byte level) - { - if (!DebugCategoryEnabledSet.IsExternalCategory(cat)) - return; - eDebugApi.DebugSetCategoryLevel(cat, level); - } - - private static bool IsExternalCategory(DebugCategory cat) => (uint) cat < 25U; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugDefault.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugDefault.cs index 0554d19..9cda37a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugDefault.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugDefault.cs @@ -11,88 +11,88 @@ using System.Threading; namespace Microsoft.Iris.Render.Extensions { - public class DebugDefault : IDebug, IDisposable - { - private eDebug m_eDebug; - private static ReaderWriterLock s_contextLock = new ReaderWriterLock(); - private static Map s_contextDict = new Map(); - - public DebugDefault() => this.m_eDebug = new eDebug(); - - void IDisposable.Dispose() + public class DebugDefault : IDebug, IDisposable { - if (this.m_eDebug == null) - return; - this.m_eDebug.Dispose(); - this.m_eDebug = (eDebug) null; - } + private eDebug m_eDebug; + private static ReaderWriterLock s_contextLock = new ReaderWriterLock(); + private static Map s_contextDict = new Map(); - public static Stack CurrentContextStack - { - get - { - Stack stack = (Stack) null; - DebugDefault.s_contextLock.AcquireReaderLock(-1); - try + public DebugDefault() => this.m_eDebug = new eDebug(); + + void IDisposable.Dispose() { - stack = DebugDefault.s_contextDict[Thread.CurrentThread]; + if (this.m_eDebug == null) + return; + this.m_eDebug.Dispose(); + this.m_eDebug = (eDebug)null; } - finally + + public static Stack CurrentContextStack { - DebugDefault.s_contextLock.ReleaseReaderLock(); - } - if (stack == null) - { - DebugDefault.s_contextLock.AcquireWriterLock(-1); - try - { - stack = DebugDefault.s_contextDict[Thread.CurrentThread]; - if (stack == null) + get { - stack = new Stack(); - stack.Push((object) ""); - DebugDefault.s_contextDict[Thread.CurrentThread] = stack; + Stack stack = (Stack)null; + DebugDefault.s_contextLock.AcquireReaderLock(-1); + try + { + stack = DebugDefault.s_contextDict[Thread.CurrentThread]; + } + finally + { + DebugDefault.s_contextLock.ReleaseReaderLock(); + } + if (stack == null) + { + DebugDefault.s_contextLock.AcquireWriterLock(-1); + try + { + stack = DebugDefault.s_contextDict[Thread.CurrentThread]; + if (stack == null) + { + stack = new Stack(); + stack.Push((object)""); + DebugDefault.s_contextDict[Thread.CurrentThread] = stack; + } + } + finally + { + DebugDefault.s_contextLock.ReleaseWriterLock(); + } + } + return stack; } - } - finally - { - DebugDefault.s_contextLock.ReleaseWriterLock(); - } } - return stack; - } + + void IDebug.Enter(string context) + { + if (context == null) + context = ""; + DebugDefault.CurrentContextStack.Push((object)context); + this.m_eDebug.WriteLinePrefix = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "[{0}]", (object)context); + } + + void IDebug.Leave(string context) + { + Stack currentContextStack = DebugDefault.CurrentContextStack; + this.m_eDebug.Assert(currentContextStack.Count > 0, "Context stack is empty"); + if (currentContextStack.Count > 0) + this.m_eDebug.WriteLinePrefix = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "[{0}]", (object)(string)currentContextStack.Peek()); + else + this.m_eDebug.WriteLinePrefix = (string)null; + } + + void IDebug.Assert(bool condition, string message) => this.m_eDebug.Assert(condition, message); + + void IDebug.Throw(bool condition, string message) => this.m_eDebug.Prompt(condition, message, typeof(InvalidOperationException)); + + void IDebug.Write(DebugCategory category, int level, string message) => this.m_eDebug.Write(category, (byte)level, (object)message); + + void IDebug.WriteLine(DebugCategory category, int level, string message) => this.m_eDebug.WriteLine(category, (byte)level, (object)message); + + void IDebug.Indent(DebugCategory category, int level) => this.m_eDebug.Indent(category, (byte)level); + + void IDebug.Unindent(DebugCategory category, int level) => this.m_eDebug.Unindent(category, (byte)level); + + bool IDebug.IsCategoryEnabled(DebugCategory category, int level) => this.m_eDebug.IsCategoryEnabled(category, (byte)level); } - - void IDebug.Enter(string context) - { - if (context == null) - context = ""; - DebugDefault.CurrentContextStack.Push((object) context); - this.m_eDebug.WriteLinePrefix = string.Format((IFormatProvider) CultureInfo.InvariantCulture, "[{0}]", (object) context); - } - - void IDebug.Leave(string context) - { - Stack currentContextStack = DebugDefault.CurrentContextStack; - this.m_eDebug.Assert(currentContextStack.Count > 0, "Context stack is empty"); - if (currentContextStack.Count > 0) - this.m_eDebug.WriteLinePrefix = string.Format((IFormatProvider) CultureInfo.InvariantCulture, "[{0}]", (object) (string) currentContextStack.Peek()); - else - this.m_eDebug.WriteLinePrefix = (string) null; - } - - void IDebug.Assert(bool condition, string message) => this.m_eDebug.Assert(condition, message); - - void IDebug.Throw(bool condition, string message) => this.m_eDebug.Prompt(condition, message, typeof (InvalidOperationException)); - - void IDebug.Write(DebugCategory category, int level, string message) => this.m_eDebug.Write(category, (byte) level, (object) message); - - void IDebug.WriteLine(DebugCategory category, int level, string message) => this.m_eDebug.WriteLine(category, (byte) level, (object) message); - - void IDebug.Indent(DebugCategory category, int level) => this.m_eDebug.Indent(category, (byte) level); - - void IDebug.Unindent(DebugCategory category, int level) => this.m_eDebug.Unindent(category, (byte) level); - - bool IDebug.IsCategoryEnabled(DebugCategory category, int level) => this.m_eDebug.IsCategoryEnabled(category, (byte) level); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugNone.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugNone.cs index be16b5f..f4b0996 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugNone.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/DebugNone.cs @@ -8,44 +8,44 @@ using System; namespace Microsoft.Iris.Render.Extensions { - public class DebugNone : IDebug, IDisposable - { - void IDisposable.Dispose() + public class DebugNone : IDebug, IDisposable { - } + void IDisposable.Dispose() + { + } - void IDebug.Enter(string stContext) - { - } + void IDebug.Enter(string stContext) + { + } - void IDebug.Leave(string stContext) - { - } + void IDebug.Leave(string stContext) + { + } - void IDebug.Assert(bool fCondition, string stMessage) - { - } + void IDebug.Assert(bool fCondition, string stMessage) + { + } - void IDebug.Throw(bool fCondition, string stMessage) - { - } + void IDebug.Throw(bool fCondition, string stMessage) + { + } - void IDebug.Write(DebugCategory nCategory, int nLevel, string stMessage) - { - } + void IDebug.Write(DebugCategory nCategory, int nLevel, string stMessage) + { + } - void IDebug.WriteLine(DebugCategory nCategory, int nLevel, string stMessage) - { - } + void IDebug.WriteLine(DebugCategory nCategory, int nLevel, string stMessage) + { + } - void IDebug.Indent(DebugCategory nCategory, int nLevel) - { - } + void IDebug.Indent(DebugCategory nCategory, int nLevel) + { + } - void IDebug.Unindent(DebugCategory nCategory, int nLevel) - { - } + void IDebug.Unindent(DebugCategory nCategory, int nLevel) + { + } - bool IDebug.IsCategoryEnabled(DebugCategory category, int nLevel) => false; - } + bool IDebug.IsCategoryEnabled(DebugCategory category, int nLevel) => false; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ExtensionsApi.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ExtensionsApi.cs index b081321..d5c99c8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ExtensionsApi.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ExtensionsApi.cs @@ -11,124 +11,124 @@ using System.Security; 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( - string stFileName, - [MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req, - ExtensionsApi.BitmapOptions nOptions, - out HSpBitmap hBmp, - out ImageInformation info); - - [DllImport("UIXRender.dll", CharSet = CharSet.Auto)] - internal static extern HRESULT SpBitmapLoadRaw( - Size sizeActualPxl, - int nStride, - SurfaceFormat nFormat, - IntPtr pvData, - [MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req, - ExtensionsApi.BitmapOptions nOptions, - out HSpBitmap hBmp, - out ImageInformation info); - - [DllImport("UIXRender.dll", CharSet = CharSet.Auto)] - internal static extern HRESULT SpBitmapLoadResource( - Win32Api.HINSTANCE hinst, - string stName, - int nType, - [MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req, - ExtensionsApi.BitmapOptions nOptions, - out HSpBitmap hBmp, - out ImageInformation info); - - [DllImport("UIXRender.dll", CharSet = CharSet.Auto)] - internal static extern HRESULT SpBitmapLoadBuffer( - IntPtr pvSrc, - uint cbSize, - [MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req, - ExtensionsApi.BitmapOptions nOptions, - out HSpBitmap hBmp, - out ImageInformation info); - - [DllImport("UIXRender.dll")] - internal static extern HRESULT SpBitmapDelete(HSpBitmap hBmp); - - [DllImport("UIXRender.dll", CharSet = CharSet.Auto)] - internal static extern HRESULT SpSoundLoadBuffer( - IntPtr pBuffer, - int dwSize, - ExtensionsApi.SoundOptions options, - out ExtensionsApi.HSpSound hSound, - out ExtensionsApi.SoundInformation info); - - [DllImport("UIXRender.dll")] - internal static extern HRESULT SpSoundDispose( - ExtensionsApi.HSpSound hSound, - ExtensionsApi.SoundInformation info); - - [System.Flags] - internal enum BitmapOptions + [SuppressUnmanagedCodeSecurity] + public static class ExtensionsApi { - None = 0, - Decode = 1, - Flip = 2, - Valid = Flip | Decode, // 0x00000003 + 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( + string stFileName, + [MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req, + ExtensionsApi.BitmapOptions nOptions, + out HSpBitmap hBmp, + out ImageInformation info); + + [DllImport("UIXRender.dll", CharSet = CharSet.Auto)] + internal static extern HRESULT SpBitmapLoadRaw( + Size sizeActualPxl, + int nStride, + SurfaceFormat nFormat, + IntPtr pvData, + [MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req, + ExtensionsApi.BitmapOptions nOptions, + out HSpBitmap hBmp, + out ImageInformation info); + + [DllImport("UIXRender.dll", CharSet = CharSet.Auto)] + internal static extern HRESULT SpBitmapLoadResource( + Win32Api.HINSTANCE hinst, + string stName, + int nType, + [MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req, + ExtensionsApi.BitmapOptions nOptions, + out HSpBitmap hBmp, + out ImageInformation info); + + [DllImport("UIXRender.dll", CharSet = CharSet.Auto)] + internal static extern HRESULT SpBitmapLoadBuffer( + IntPtr pvSrc, + uint cbSize, + [MarshalAs(UnmanagedType.LPStruct), In] ImageRequirements req, + ExtensionsApi.BitmapOptions nOptions, + out HSpBitmap hBmp, + out ImageInformation info); + + [DllImport("UIXRender.dll")] + internal static extern HRESULT SpBitmapDelete(HSpBitmap hBmp); + + [DllImport("UIXRender.dll", CharSet = CharSet.Auto)] + internal static extern HRESULT SpSoundLoadBuffer( + IntPtr pBuffer, + int dwSize, + ExtensionsApi.SoundOptions options, + out ExtensionsApi.HSpSound hSound, + out ExtensionsApi.SoundInformation info); + + [DllImport("UIXRender.dll")] + internal static extern HRESULT SpSoundDispose( + ExtensionsApi.HSpSound hSound, + ExtensionsApi.SoundInformation info); + + [System.Flags] + internal enum BitmapOptions + { + None = 0, + Decode = 1, + Flip = 2, + Valid = Flip | Decode, // 0x00000003 + } + + [System.Flags] + internal enum SoundOptions + { + None = 0, + Decode = 1, + BigEndian = 2, + Valid = BigEndian | Decode, // 0x00000003 + } + + [ComVisible(false)] + public struct SoundHeader + { + public ushort wFormatTag; + public ushort nChannels; + public uint nSamplesPerSec; + public uint nAvgBytesPerSec; + public ushort nBlockAlign; + public ushort wBitsPerSample; + public ushort cbExtraData; + public uint cbDataSize; + } + + [ComVisible(false)] + public struct SoundData + { + public IntPtr rgData; + } + + [ComVisible(false)] + public struct SoundInformation + { + public ExtensionsApi.SoundHeader Header; + public ExtensionsApi.SoundData Data; + public static ExtensionsApi.SoundInformation NULL = new ExtensionsApi.SoundInformation(); + } + + [ComVisible(false)] + public struct HSpSound + { + public IntPtr h; + public static readonly ExtensionsApi.HSpSound NULL = new ExtensionsApi.HSpSound(); + + public static bool operator ==(ExtensionsApi.HSpSound hA, ExtensionsApi.HSpSound hB) => hA.h == hB.h; + + public static bool operator !=(ExtensionsApi.HSpSound hA, ExtensionsApi.HSpSound hB) => hA.h != hB.h; + + public override bool Equals(object oCompare) => oCompare is ExtensionsApi.HSpSound hspSound && this.h == hspSound.h; + + public override int GetHashCode() => (int)this.h.ToInt64(); + } } - - [System.Flags] - internal enum SoundOptions - { - None = 0, - Decode = 1, - BigEndian = 2, - Valid = BigEndian | Decode, // 0x00000003 - } - - [ComVisible(false)] - public struct SoundHeader - { - public ushort wFormatTag; - public ushort nChannels; - public uint nSamplesPerSec; - public uint nAvgBytesPerSec; - public ushort nBlockAlign; - public ushort wBitsPerSample; - public ushort cbExtraData; - public uint cbDataSize; - } - - [ComVisible(false)] - public struct SoundData - { - public IntPtr rgData; - } - - [ComVisible(false)] - public struct SoundInformation - { - public ExtensionsApi.SoundHeader Header; - public ExtensionsApi.SoundData Data; - public static ExtensionsApi.SoundInformation NULL = new ExtensionsApi.SoundInformation(); - } - - [ComVisible(false)] - public struct HSpSound - { - public IntPtr h; - public static readonly ExtensionsApi.HSpSound NULL = new ExtensionsApi.HSpSound(); - - public static bool operator ==(ExtensionsApi.HSpSound hA, ExtensionsApi.HSpSound hB) => hA.h == hB.h; - - public static bool operator !=(ExtensionsApi.HSpSound hA, ExtensionsApi.HSpSound hB) => hA.h != hB.h; - - public override bool Equals(object oCompare) => oCompare is ExtensionsApi.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 a853ea6..386d602 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/GradientInformation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/GradientInformation.cs @@ -9,16 +9,16 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Extensions { - public class GradientInformation : IDisposable - { - public ImageInformation imageInfo; - internal GCHandle gcData; - - void IDisposable.Dispose() + public class GradientInformation : IDisposable { - if (!this.gcData.IsAllocated) - return; - this.gcData.Free(); + public ImageInformation imageInfo; + internal GCHandle gcData; + + void IDisposable.Dispose() + { + if (!this.gcData.IsAllocated) + return; + this.gcData.Free(); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/HSpBitmap.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/HSpBitmap.cs index a360159..faf957d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/HSpBitmap.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/HSpBitmap.cs @@ -9,18 +9,18 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Extensions { - [ComVisible(false)] - internal struct HSpBitmap - { - internal IntPtr h; - internal static readonly HSpBitmap NULL = new HSpBitmap(); + [ComVisible(false)] + internal struct HSpBitmap + { + internal IntPtr h; + internal static readonly HSpBitmap NULL = new HSpBitmap(); - public static bool operator ==(HSpBitmap hA, HSpBitmap hB) => hA.h == hB.h; + public static bool operator ==(HSpBitmap hA, HSpBitmap hB) => hA.h == hB.h; - public static bool operator !=(HSpBitmap hA, HSpBitmap hB) => hA.h != hB.h; + public static bool operator !=(HSpBitmap hA, HSpBitmap hB) => hA.h != hB.h; - public override bool Equals(object oCompare) => oCompare is HSpBitmap hspBitmap && this.h == hspBitmap.h; + public override bool Equals(object oCompare) => oCompare is HSpBitmap hspBitmap && this.h == hspBitmap.h; - public override int GetHashCode() => (int) this.h.ToInt64(); - } + public override int GetHashCode() => (int)this.h.ToInt64(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCache.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCache.cs index dc79e07..7150329 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCache.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCache.cs @@ -11,275 +11,275 @@ using System.Diagnostics; namespace Microsoft.Iris.Render.Extensions { - public class ImageCache : IDisposable - { - private static readonly ImageCache.ObjectTest s_testCulling = new ImageCache.ObjectTest(ImageCache.CullingTest); - private static readonly ImageCache.ObjectTest s_testDisposeAll = new ImageCache.ObjectTest(ImageCache.DisposeAllTest); - private static readonly ImageCache.ObjectTest s_testObject = new ImageCache.ObjectTest(ImageCache.SpecificObjectTest); - private static readonly ImageCache.ObjectTest s_testDropImages = new ImageCache.ObjectTest(ImageCache.DropImageTest); - private Map m_objectsTable; - private Vector m_lruList; - private bool m_fObjectDisposed; - private string m_stName; - private bool m_fCleanupPending; - private bool m_fShuttingDown; - private int m_numItemsToKeep; - private TimeSpan m_tsCullingKeepTime; - private bool m_fUseCutoffTime; - private DateTime m_dtCullingCutoff; - private int m_numItemsInUse; - private int m_numItemsInCache; - - public ImageCache(IRenderSession session, string name) + public class ImageCache : IDisposable { - this.m_stName = name; - this.m_numItemsToKeep = 100; - this.m_tsCullingKeepTime = new TimeSpan(0, 1, 0); - } + private static readonly ImageCache.ObjectTest s_testCulling = new ImageCache.ObjectTest(ImageCache.CullingTest); + private static readonly ImageCache.ObjectTest s_testDisposeAll = new ImageCache.ObjectTest(ImageCache.DisposeAllTest); + private static readonly ImageCache.ObjectTest s_testObject = new ImageCache.ObjectTest(ImageCache.SpecificObjectTest); + private static readonly ImageCache.ObjectTest s_testDropImages = new ImageCache.ObjectTest(ImageCache.DropImageTest); + private Map m_objectsTable; + private Vector m_lruList; + private bool m_fObjectDisposed; + private string m_stName; + private bool m_fCleanupPending; + private bool m_fShuttingDown; + private int m_numItemsToKeep; + private TimeSpan m_tsCullingKeepTime; + private bool m_fUseCutoffTime; + private DateTime m_dtCullingCutoff; + private int m_numItemsInUse; + private int m_numItemsInCache; - ~ImageCache() - { - if (this.m_fObjectDisposed) - return; - this.Dispose(false); - } - - public void Dispose() - { - if (this.m_fObjectDisposed) - return; - this.Dispose(true); - GC.SuppressFinalize((object) this); - } - - private void Dispose(bool fInDispose) - { - if (!fInDispose) - return; - this.OnDispose(); - } - - protected virtual void OnDispose() - { - this.DisposeAllObjects(); - this.m_fObjectDisposed = true; - } - - public void DisposeAllObjects() - { - this.m_numItemsInCache = 0; - this.RemoveObjects(ImageCache.s_testDisposeAll, (object) this); - } - - public void PrepareToShutdown() - { - this.m_numItemsInCache = 0; - this.RemoveObjects(ImageCache.s_testDropImages, (object) this); - this.m_fCleanupPending = false; - this.m_fShuttingDown = true; - } - - public bool IsEmpty => this.m_objectsTable.Count == 0; - - public bool CleanupPending => this.m_fCleanupPending; - - protected void ClearCleanupPending() => this.m_fCleanupPending = false; - - public int NumItemsToKeep - { - get => this.m_numItemsToKeep; - set => this.m_numItemsToKeep = value; - } - - public TimeSpan ItemRetainTime - { - get => this.m_tsCullingKeepTime; - set => this.m_tsCullingKeepTime = value; - } - - public void Add(ImageCacheKey key, ImageCacheItem item) - { - Debug2.Validate(!this.m_fShuttingDown, typeof (InvalidOperationException), "Should not Add items to cache after starting shutdown sequence"); - Debug2.Validate(item.ImageCacheOwner == null, typeof (InvalidOperationException), "The given item is already part of a cache! double-add detected."); - if (this.m_objectsTable == null) - this.SetupObjectTable(); - this.m_objectsTable[(object) key] = (object) item; - this.m_lruList.Insert(0, new ImageCache.ImageCacheEntry(key, item)); - item.ImageCacheOwner = this; - this.ScheduleScavenge(); - } - - public void RemoveData(ImageCacheKey key) => ((ImageCacheItem) this.Find((object) key))?.RemoveData(); - - public void RemoveItem(ImageCacheItem item) => this.RemoveObjects(ImageCache.s_testObject, (object) item); - - public void RemoveObjects(ImageCache.ObjectTest test, object paramObject) - { - if (this.m_objectsTable == null) - return; - ArrayList arrayList = (ArrayList) null; - foreach (ImageCache.ImageCacheEntry lru in this.m_lruList) - { - ImageCacheItem imageCacheItem = lru.item; - if (test((object) imageCacheItem, paramObject)) + public ImageCache(IRenderSession session, string name) { - if (arrayList == null) - arrayList = new ArrayList(); - arrayList.Add((object) lru); + this.m_stName = name; + this.m_numItemsToKeep = 100; + this.m_tsCullingKeepTime = new TimeSpan(0, 1, 0); } - } - if (arrayList == null) - return; - foreach (ImageCache.ImageCacheEntry imageCacheEntry in arrayList) - { - this.m_lruList.Remove(imageCacheEntry); - this.m_objectsTable.Remove((object) imageCacheEntry.key); - imageCacheEntry.item.ImageCacheOwner = (ImageCache) null; - imageCacheEntry.item.Dispose(); - } - } - public ImageCacheItem Lookup(ImageCacheKey key) - { - ImageCacheItem imageCacheItem = (ImageCacheItem) this.Find((object) key); - if (imageCacheItem == null) - this.ScheduleScavenge(); - return imageCacheItem; - } - - public void CullObjects() - { - this.m_numItemsInUse = 0; - this.m_numItemsInCache = 0; - this.m_fUseCutoffTime = !this.m_tsCullingKeepTime.Equals(TimeSpan.Zero); - this.m_dtCullingCutoff = DateTime.UtcNow - this.m_tsCullingKeepTime; - this.RemoveObjects(ImageCache.s_testCulling, (object) this); - this.m_fCleanupPending = false; - } - - [Conditional("DEBUG")] - protected void AssertOwningThread() - { - } - - protected virtual void SetupObjectTable() - { - if (this.m_objectsTable != null) - return; - this.m_objectsTable = new Map(); - this.m_lruList = new Vector(this.m_numItemsToKeep); - } - - private object Find(object key) - { - object obj = (object) null; - if (this.m_objectsTable != null) - this.m_objectsTable.TryGetValue(key, out obj); - return obj; - } - - private bool ContainsKey(object key) - { - bool flag = false; - if (this.m_objectsTable != null) - flag = this.m_objectsTable.ContainsKey(key); - return flag; - } - - protected virtual void ScheduleScavenge() - { - if (this.m_fCleanupPending || this.m_fShuttingDown) - return; - this.m_fCleanupPending = true; - } - - private static bool DisposeAllTest(object subjectObject, object paramObject) - { - ImageCache imageCache = paramObject as ImageCache; - if (!(subjectObject is ImageCacheItem)) - return false; - ++imageCache.m_numItemsInCache; - return true; - } - - private static bool DropImageTest(object subjectObject, object paramObject) - { - ImageCache imageCache = paramObject as ImageCache; - if (subjectObject is ImageCacheItem imageCacheItem) - { - imageCacheItem.ReleaseImage(); - ++imageCache.m_numItemsInCache; - } - return false; - } - - private static bool CullingTest(object subjectObject, object paramObject) - { - ImageCache imageCache = paramObject as ImageCache; - if (subjectObject is ImageCacheItem imageCacheItem) - { - ++imageCache.m_numItemsInCache; - if (imageCacheItem.HasLoadsInProgress || imageCacheItem.InUse) + ~ImageCache() { - ++imageCache.m_numItemsInUse; - return false; + if (this.m_fObjectDisposed) + return; + this.Dispose(false); + } + + public void Dispose() + { + if (this.m_fObjectDisposed) + return; + this.Dispose(true); + GC.SuppressFinalize((object)this); + } + + private void Dispose(bool fInDispose) + { + if (!fInDispose) + return; + this.OnDispose(); + } + + protected virtual void OnDispose() + { + this.DisposeAllObjects(); + this.m_fObjectDisposed = true; + } + + public void DisposeAllObjects() + { + this.m_numItemsInCache = 0; + this.RemoveObjects(ImageCache.s_testDisposeAll, (object)this); + } + + public void PrepareToShutdown() + { + this.m_numItemsInCache = 0; + this.RemoveObjects(ImageCache.s_testDropImages, (object)this); + this.m_fCleanupPending = false; + this.m_fShuttingDown = true; + } + + public bool IsEmpty => this.m_objectsTable.Count == 0; + + public bool CleanupPending => this.m_fCleanupPending; + + protected void ClearCleanupPending() => this.m_fCleanupPending = false; + + public int NumItemsToKeep + { + get => this.m_numItemsToKeep; + set => this.m_numItemsToKeep = value; + } + + public TimeSpan ItemRetainTime + { + get => this.m_tsCullingKeepTime; + set => this.m_tsCullingKeepTime = value; + } + + public void Add(ImageCacheKey key, ImageCacheItem item) + { + Debug2.Validate(!this.m_fShuttingDown, typeof(InvalidOperationException), "Should not Add items to cache after starting shutdown sequence"); + Debug2.Validate(item.ImageCacheOwner == null, typeof(InvalidOperationException), "The given item is already part of a cache! double-add detected."); + if (this.m_objectsTable == null) + this.SetupObjectTable(); + this.m_objectsTable[(object)key] = (object)item; + this.m_lruList.Insert(0, new ImageCache.ImageCacheEntry(key, item)); + item.ImageCacheOwner = this; + this.ScheduleScavenge(); + } + + public void RemoveData(ImageCacheKey key) => ((ImageCacheItem)this.Find((object)key))?.RemoveData(); + + public void RemoveItem(ImageCacheItem item) => this.RemoveObjects(ImageCache.s_testObject, (object)item); + + public void RemoveObjects(ImageCache.ObjectTest test, object paramObject) + { + if (this.m_objectsTable == null) + return; + ArrayList arrayList = (ArrayList)null; + foreach (ImageCache.ImageCacheEntry lru in this.m_lruList) + { + ImageCacheItem imageCacheItem = lru.item; + if (test((object)imageCacheItem, paramObject)) + { + if (arrayList == null) + arrayList = new ArrayList(); + arrayList.Add((object)lru); + } + } + if (arrayList == null) + return; + foreach (ImageCache.ImageCacheEntry imageCacheEntry in arrayList) + { + this.m_lruList.Remove(imageCacheEntry); + this.m_objectsTable.Remove((object)imageCacheEntry.key); + imageCacheEntry.item.ImageCacheOwner = (ImageCache)null; + imageCacheEntry.item.Dispose(); + } + } + + public ImageCacheItem Lookup(ImageCacheKey key) + { + ImageCacheItem imageCacheItem = (ImageCacheItem)this.Find((object)key); + if (imageCacheItem == null) + this.ScheduleScavenge(); + return imageCacheItem; + } + + public void CullObjects() + { + this.m_numItemsInUse = 0; + this.m_numItemsInCache = 0; + this.m_fUseCutoffTime = !this.m_tsCullingKeepTime.Equals(TimeSpan.Zero); + this.m_dtCullingCutoff = DateTime.UtcNow - this.m_tsCullingKeepTime; + this.RemoveObjects(ImageCache.s_testCulling, (object)this); + this.m_fCleanupPending = false; + } + + [Conditional("DEBUG")] + protected void AssertOwningThread() + { + } + + protected virtual void SetupObjectTable() + { + if (this.m_objectsTable != null) + return; + this.m_objectsTable = new Map(); + this.m_lruList = new Vector(this.m_numItemsToKeep); + } + + private object Find(object key) + { + object obj = (object)null; + if (this.m_objectsTable != null) + this.m_objectsTable.TryGetValue(key, out obj); + return obj; + } + + private bool ContainsKey(object key) + { + bool flag = false; + if (this.m_objectsTable != null) + flag = this.m_objectsTable.ContainsKey(key); + return flag; + } + + protected virtual void ScheduleScavenge() + { + if (this.m_fCleanupPending || this.m_fShuttingDown) + return; + this.m_fCleanupPending = true; + } + + private static bool DisposeAllTest(object subjectObject, object paramObject) + { + ImageCache imageCache = paramObject as ImageCache; + if (!(subjectObject is ImageCacheItem)) + return false; + ++imageCache.m_numItemsInCache; + return true; + } + + private static bool DropImageTest(object subjectObject, object paramObject) + { + ImageCache imageCache = paramObject as ImageCache; + if (subjectObject is ImageCacheItem imageCacheItem) + { + imageCacheItem.ReleaseImage(); + ++imageCache.m_numItemsInCache; + } + return false; + } + + private static bool CullingTest(object subjectObject, object paramObject) + { + ImageCache imageCache = paramObject as ImageCache; + if (subjectObject is ImageCacheItem imageCacheItem) + { + ++imageCache.m_numItemsInCache; + if (imageCacheItem.HasLoadsInProgress || imageCacheItem.InUse) + { + ++imageCache.m_numItemsInUse; + return false; + } + if (imageCache.m_numItemsInCache - imageCache.m_numItemsInUse > imageCache.m_numItemsToKeep || imageCache.m_fUseCutoffTime && imageCacheItem.IsOlder(imageCache.m_dtCullingCutoff)) + return true; + } + return false; + } + + private static bool SpecificObjectTest(object subjectObject, object paramObject) => subjectObject == paramObject; + + [Conditional("DEBUG")] + private void IncKeptItems() + { + } + + [Conditional("DEBUG")] + private void IncCulledItems() + { + } + + [Conditional("DEBUG")] + private void ClearActivityCounts() + { + } + + internal void UpdateLastUsedItem(ImageCacheItem item) + { + ImageCache.ImageCacheEntry inLruList = this.FindInLruList(item); + if (inLruList == null) + return; + this.m_lruList.Remove(inLruList); + this.m_lruList.Insert(0, inLruList); + } + + internal ImageCache.ImageCacheEntry FindInLruList(ImageCacheItem item) + { + foreach (ImageCache.ImageCacheEntry lru in this.m_lruList) + { + if (lru.MatchItem(item)) + return lru; + } + return (ImageCache.ImageCacheEntry)null; + } + + public delegate bool ObjectTest(object subjectObject, object paramObject); + + internal class ImageCacheEntry + { + public ImageCacheKey key; + public ImageCacheItem item; + + public ImageCacheEntry(ImageCacheKey keyIn, ImageCacheItem itemIn) + { + this.key = keyIn; + this.item = itemIn; + } + + public bool MatchItem(ImageCacheItem itemToMatch) => itemToMatch == this.item; } - if (imageCache.m_numItemsInCache - imageCache.m_numItemsInUse > imageCache.m_numItemsToKeep || imageCache.m_fUseCutoffTime && imageCacheItem.IsOlder(imageCache.m_dtCullingCutoff)) - return true; - } - return false; } - - private static bool SpecificObjectTest(object subjectObject, object paramObject) => subjectObject == paramObject; - - [Conditional("DEBUG")] - private void IncKeptItems() - { - } - - [Conditional("DEBUG")] - private void IncCulledItems() - { - } - - [Conditional("DEBUG")] - private void ClearActivityCounts() - { - } - - internal void UpdateLastUsedItem(ImageCacheItem item) - { - ImageCache.ImageCacheEntry inLruList = this.FindInLruList(item); - if (inLruList == null) - return; - this.m_lruList.Remove(inLruList); - this.m_lruList.Insert(0, inLruList); - } - - internal ImageCache.ImageCacheEntry FindInLruList(ImageCacheItem item) - { - foreach (ImageCache.ImageCacheEntry lru in this.m_lruList) - { - if (lru.MatchItem(item)) - return lru; - } - return (ImageCache.ImageCacheEntry) null; - } - - public delegate bool ObjectTest(object subjectObject, object paramObject); - - internal class ImageCacheEntry - { - public ImageCacheKey key; - public ImageCacheItem item; - - public ImageCacheEntry(ImageCacheKey keyIn, ImageCacheItem itemIn) - { - this.key = keyIn; - this.item = itemIn; - } - - public bool MatchItem(ImageCacheItem itemToMatch) => itemToMatch == this.item; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheItem.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheItem.cs index 8e1eee7..a9de9b5 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheItem.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheItem.cs @@ -9,277 +9,277 @@ using System.Collections; namespace Microsoft.Iris.Render.Extensions { - public class ImageCacheItem : IDisposable - { - private static TimeSpan s_tsUpdateThreshhold = new TimeSpan(0, 0, 2); - private bool m_fObjectDisposed; - private string m_stIdentifier; - private IImage m_image; - protected ImageRequirements m_req; - protected Size m_size; - protected BitmapInformation m_info; - protected IntPtr m_buffer; - protected uint m_length; - private int m_countUsers; - private int m_countLoadsInProgress; - private bool m_fFullLoadRequested; - private ArrayList m_prevLoadInfos; - private DateTime m_dtLastUsed; - private ImageCache m_owner; - - public ImageCacheItem( - IRenderSession renderSession, - string identifier, - IntPtr buffer, - uint length, - Size maxSize, - bool flippable, - bool antialiasEdges) - : this(renderSession, identifier, maxSize, flippable, antialiasEdges) + public class ImageCacheItem : IDisposable { - this.m_buffer = buffer; - this.m_length = length; - } + private static TimeSpan s_tsUpdateThreshhold = new TimeSpan(0, 0, 2); + private bool m_fObjectDisposed; + private string m_stIdentifier; + private IImage m_image; + protected ImageRequirements m_req; + protected Size m_size; + protected BitmapInformation m_info; + protected IntPtr m_buffer; + protected uint m_length; + private int m_countUsers; + private int m_countLoadsInProgress; + private bool m_fFullLoadRequested; + private ArrayList m_prevLoadInfos; + private DateTime m_dtLastUsed; + private ImageCache m_owner; - public ImageCacheItem( - IRenderSession renderSession, - string identifier, - Size maxSize, - bool flippable, - bool antialiasEdges) - : this(renderSession, identifier) - { - this.m_req = new ImageRequirements(); - this.m_req.MaximumSize = maxSize; - this.m_req.Flippable = flippable; - this.m_req.AntialiasEdges = antialiasEdges; - } - - protected ImageCacheItem(IRenderSession renderSession, string identifier) - { - this.m_stIdentifier = identifier; - this.m_image = renderSession.CreateImage((object) this, this.m_stIdentifier, new ContentNotifyHandler(this.ReloadImage)); - this.UpdateLastUsedTime(); - } - - ~ImageCacheItem() => this.Dispose(false); - - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize((object) this); - } - - private void Dispose(bool fInDispose) - { - if (!fInDispose) - return; - this.OnDispose(); - } - - protected virtual void OnDispose() - { - if (this.m_image != null) - { - this.m_image.UnregisterUsage((object) this); - this.m_image = (IImage) null; - } - if (this.m_info != null) - { - this.m_info.Dispose(); - this.m_info = (BitmapInformation) null; - } - this.m_fObjectDisposed = true; - } - - public virtual void ReleaseImage() - { - if (this.m_image == null) - return; - this.m_image.UnregisterUsage((object) this); - this.m_image = (IImage) null; - } - - public int UsageCount => this.m_countUsers; - - public void RegisterUsage(object user) - { - this.AssertValidState(); - ++this.m_countUsers; - this.UpdateLastUsedTime(); - } - - public void UnregisterUsage(object user) - { - this.AssertValidState(); - --this.m_countUsers; - this.UpdateLastUsedTime(); - } - - public string Identifier => this.m_stIdentifier; - - public IImage RenderImage => this.m_image; - - public Size ImageSize - { - get - { - if (this.m_size.IsZero) - this.LoadBuffer(); - return this.m_size; - } - } - - public bool HasLoadsInProgress => this.m_countLoadsInProgress > 0; - - public bool InUse => this.m_image != null && this.m_image.UsageCount > 1 || this.m_countUsers > 0; - - public virtual void RemoveData() - { - if (this.HasLoadsInProgress) - { - if (this.m_prevLoadInfos == null) - this.m_prevLoadInfos = new ArrayList(); - this.m_prevLoadInfos.Add((object) this.m_info); - this.m_size = Size.Zero; - this.m_info = (BitmapInformation) null; - } - else - { - this.m_size = Size.Zero; - if (this.m_info == null) - return; - this.m_info.Dispose(); - this.m_info = (BitmapInformation) null; - } - } - - public virtual void StartLoad() => this.LoadBuffer(); - - protected void SetBuffer(IntPtr buffer, uint length) - { - this.m_buffer = buffer; - this.m_length = length; - } - - protected void SetSize(Size size) => this.m_size = size; - - internal void ReloadImage(ContentNotification notification, IImage image, IntPtr data) - { - switch (notification) - { - case ContentNotification.Acquire: - if (this.m_image == null) - break; - this.m_fFullLoadRequested = true; - this.LoadBuffer(); - break; - case ContentNotification.Release: - this.EndLoadImageData(); - break; - } - } - - private void LoadBuffer() - { - if (!this.EnsureBuffer()) - return; - this.ProcessBuffer(); - } - - protected bool ProcessBuffer() - { - this.UpdateLastUsedTime(); - return !this.m_fFullLoadRequested ? this.DoHeaderLoad() : this.BeginLoadImageData(); - } - - private bool BeginLoadImageData() - { - if (!this.DoImageLoad()) - return false; - ++this.m_countLoadsInProgress; - return true; - } - - private void EndLoadImageData() - { - this.AssertValidState(); - --this.m_countLoadsInProgress; - this.OnImageLoadComplete(); - if (!this.HasLoadsInProgress) - { - if (this.m_info != null) + public ImageCacheItem( + IRenderSession renderSession, + string identifier, + IntPtr buffer, + uint length, + Size maxSize, + bool flippable, + bool antialiasEdges) + : this(renderSession, identifier, maxSize, flippable, antialiasEdges) { - this.m_info.Dispose(); - this.m_info = (BitmapInformation) null; + this.m_buffer = buffer; + this.m_length = length; } - if (this.m_prevLoadInfos != null) + + public ImageCacheItem( + IRenderSession renderSession, + string identifier, + Size maxSize, + bool flippable, + bool antialiasEdges) + : this(renderSession, identifier) { - foreach (BitmapInformation prevLoadInfo in this.m_prevLoadInfos) - prevLoadInfo?.Dispose(); - this.m_prevLoadInfos.Clear(); - this.m_prevLoadInfos = (ArrayList) null; + this.m_req = new ImageRequirements(); + this.m_req.MaximumSize = maxSize; + this.m_req.Flippable = flippable; + this.m_req.AntialiasEdges = antialiasEdges; } - } - this.UpdateLastUsedTime(); + + protected ImageCacheItem(IRenderSession renderSession, string identifier) + { + this.m_stIdentifier = identifier; + this.m_image = renderSession.CreateImage((object)this, this.m_stIdentifier, new ContentNotifyHandler(this.ReloadImage)); + this.UpdateLastUsedTime(); + } + + ~ImageCacheItem() => this.Dispose(false); + + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize((object)this); + } + + private void Dispose(bool fInDispose) + { + if (!fInDispose) + return; + this.OnDispose(); + } + + protected virtual void OnDispose() + { + if (this.m_image != null) + { + this.m_image.UnregisterUsage((object)this); + this.m_image = (IImage)null; + } + if (this.m_info != null) + { + this.m_info.Dispose(); + this.m_info = (BitmapInformation)null; + } + this.m_fObjectDisposed = true; + } + + public virtual void ReleaseImage() + { + if (this.m_image == null) + return; + this.m_image.UnregisterUsage((object)this); + this.m_image = (IImage)null; + } + + public int UsageCount => this.m_countUsers; + + public void RegisterUsage(object user) + { + this.AssertValidState(); + ++this.m_countUsers; + this.UpdateLastUsedTime(); + } + + public void UnregisterUsage(object user) + { + this.AssertValidState(); + --this.m_countUsers; + this.UpdateLastUsedTime(); + } + + public string Identifier => this.m_stIdentifier; + + public IImage RenderImage => this.m_image; + + public Size ImageSize + { + get + { + if (this.m_size.IsZero) + this.LoadBuffer(); + return this.m_size; + } + } + + public bool HasLoadsInProgress => this.m_countLoadsInProgress > 0; + + public bool InUse => this.m_image != null && this.m_image.UsageCount > 1 || this.m_countUsers > 0; + + public virtual void RemoveData() + { + if (this.HasLoadsInProgress) + { + if (this.m_prevLoadInfos == null) + this.m_prevLoadInfos = new ArrayList(); + this.m_prevLoadInfos.Add((object)this.m_info); + this.m_size = Size.Zero; + this.m_info = (BitmapInformation)null; + } + else + { + this.m_size = Size.Zero; + if (this.m_info == null) + return; + this.m_info.Dispose(); + this.m_info = (BitmapInformation)null; + } + } + + public virtual void StartLoad() => this.LoadBuffer(); + + protected void SetBuffer(IntPtr buffer, uint length) + { + this.m_buffer = buffer; + this.m_length = length; + } + + protected void SetSize(Size size) => this.m_size = size; + + internal void ReloadImage(ContentNotification notification, IImage image, IntPtr data) + { + switch (notification) + { + case ContentNotification.Acquire: + if (this.m_image == null) + break; + this.m_fFullLoadRequested = true; + this.LoadBuffer(); + break; + case ContentNotification.Release: + this.EndLoadImageData(); + break; + } + } + + private void LoadBuffer() + { + if (!this.EnsureBuffer()) + return; + this.ProcessBuffer(); + } + + protected bool ProcessBuffer() + { + this.UpdateLastUsedTime(); + return !this.m_fFullLoadRequested ? this.DoHeaderLoad() : this.BeginLoadImageData(); + } + + private bool BeginLoadImageData() + { + if (!this.DoImageLoad()) + return false; + ++this.m_countLoadsInProgress; + return true; + } + + private void EndLoadImageData() + { + this.AssertValidState(); + --this.m_countLoadsInProgress; + this.OnImageLoadComplete(); + if (!this.HasLoadsInProgress) + { + if (this.m_info != null) + { + this.m_info.Dispose(); + this.m_info = (BitmapInformation)null; + } + if (this.m_prevLoadInfos != null) + { + foreach (BitmapInformation prevLoadInfo in this.m_prevLoadInfos) + prevLoadInfo?.Dispose(); + this.m_prevLoadInfos.Clear(); + this.m_prevLoadInfos = (ArrayList)null; + } + } + this.UpdateLastUsedTime(); + } + + protected virtual bool EnsureBuffer() => true; + + protected virtual bool DoHeaderLoad() + { + ImageHeader header; + if (!(this.m_buffer != IntPtr.Zero) || this.m_length <= 0U || !ImageLoader.LoadHeader(this.m_buffer, (int)this.m_length, this.m_req, out header)) + return false; + this.SetSize(header.sizeActualPxl); + return true; + } + + protected virtual bool DoImageLoad() + { + BitmapInformation bitmapInfo = (BitmapInformation)null; + bool flag = false; + if (this.m_image != null) + flag = !(this.m_buffer == IntPtr.Zero) ? ImageLoader.FromBuffer(this.m_image, this.m_buffer, (int)this.m_length, this.m_req.MaximumSize, this.m_req.Flippable, this.m_req.AntialiasEdges, this.m_req.BorderWidth, this.m_req.BorderColor, out bitmapInfo) : ImageLoader.FromFile(this.m_image, this.m_image.Identifier, this.m_req.MaximumSize, this.m_req.Flippable, this.m_req.AntialiasEdges, this.m_req.BorderWidth, this.m_req.BorderColor, out bitmapInfo); + if (flag) + { + this.m_info = bitmapInfo; + this.SetSize(this.m_info.imageInfo.Header.sizeActualPxl); + } + return flag; + } + + protected virtual void OnImageLoadComplete() + { + } + + internal ImageCache ImageCacheOwner + { + get => this.m_owner; + set => this.m_owner = value; + } + + protected void UpdateLastUsedTime() + { + this.AssertValidState(); + if (!(DateTime.UtcNow - this.m_dtLastUsed > ImageCacheItem.s_tsUpdateThreshhold)) + return; + this.m_dtLastUsed = DateTime.UtcNow; + if (this.m_owner == null) + return; + this.m_owner.UpdateLastUsedItem(this); + } + + public bool IsOlder(DateTime dtCompare) + { + this.AssertValidState(); + return this.m_dtLastUsed < dtCompare; + } + + protected void AssertValidState() + { + } + + public override string ToString() => this.m_stIdentifier; } - - protected virtual bool EnsureBuffer() => true; - - protected virtual bool DoHeaderLoad() - { - ImageHeader header; - if (!(this.m_buffer != IntPtr.Zero) || this.m_length <= 0U || !ImageLoader.LoadHeader(this.m_buffer, (int) this.m_length, this.m_req, out header)) - return false; - this.SetSize(header.sizeActualPxl); - return true; - } - - protected virtual bool DoImageLoad() - { - BitmapInformation bitmapInfo = (BitmapInformation) null; - bool flag = false; - if (this.m_image != null) - flag = !(this.m_buffer == IntPtr.Zero) ? ImageLoader.FromBuffer(this.m_image, this.m_buffer, (int) this.m_length, this.m_req.MaximumSize, this.m_req.Flippable, this.m_req.AntialiasEdges, this.m_req.BorderWidth, this.m_req.BorderColor, out bitmapInfo) : ImageLoader.FromFile(this.m_image, this.m_image.Identifier, this.m_req.MaximumSize, this.m_req.Flippable, this.m_req.AntialiasEdges, this.m_req.BorderWidth, this.m_req.BorderColor, out bitmapInfo); - if (flag) - { - this.m_info = bitmapInfo; - this.SetSize(this.m_info.imageInfo.Header.sizeActualPxl); - } - return flag; - } - - protected virtual void OnImageLoadComplete() - { - } - - internal ImageCache ImageCacheOwner - { - get => this.m_owner; - set => this.m_owner = value; - } - - protected void UpdateLastUsedTime() - { - this.AssertValidState(); - if (!(DateTime.UtcNow - this.m_dtLastUsed > ImageCacheItem.s_tsUpdateThreshhold)) - return; - this.m_dtLastUsed = DateTime.UtcNow; - if (this.m_owner == null) - return; - this.m_owner.UpdateLastUsedItem(this); - } - - public bool IsOlder(DateTime dtCompare) - { - this.AssertValidState(); - return this.m_dtLastUsed < dtCompare; - } - - protected void AssertValidState() - { - } - - public override string ToString() => this.m_stIdentifier; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheKey.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheKey.cs index f2a97b6..da630bd 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheKey.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageCacheKey.cs @@ -6,32 +6,32 @@ namespace Microsoft.Iris.Render.Extensions { - public class ImageCacheKey - { - private string m_stIdentifier; - private Size m_sizeMaxPxl; - private bool m_fFlippable; - private bool m_fAntialiasEdges; - protected int m_nHashCode; - - protected ImageCacheKey(string identifier) => this.m_stIdentifier = identifier; - - public ImageCacheKey(string identifier, Size maxSize, bool flippable, bool antialiasEdges) + public class ImageCacheKey { - this.m_stIdentifier = identifier; - this.m_sizeMaxPxl = maxSize; - this.m_fFlippable = flippable; - this.m_fAntialiasEdges = antialiasEdges; - this.m_nHashCode = this.m_stIdentifier.GetHashCode() + this.m_sizeMaxPxl.Width + this.m_sizeMaxPxl.Height + (this.m_fFlippable ? 1 : 0) + (this.m_fAntialiasEdges ? 1 : 0); - } + private string m_stIdentifier; + private Size m_sizeMaxPxl; + private bool m_fFlippable; + private bool m_fAntialiasEdges; + protected int m_nHashCode; - public override bool Equals(object obj) - { - if (object.ReferenceEquals((object) this, obj)) - return true; - return obj is ImageCacheKey imageCacheKey && this.m_stIdentifier.Equals(imageCacheKey.m_stIdentifier) && (this.m_sizeMaxPxl == imageCacheKey.m_sizeMaxPxl && this.m_fFlippable == imageCacheKey.m_fFlippable) && this.m_fAntialiasEdges == imageCacheKey.m_fAntialiasEdges; - } + protected ImageCacheKey(string identifier) => this.m_stIdentifier = identifier; - public override int GetHashCode() => this.m_nHashCode; - } + public ImageCacheKey(string identifier, Size maxSize, bool flippable, bool antialiasEdges) + { + this.m_stIdentifier = identifier; + this.m_sizeMaxPxl = maxSize; + this.m_fFlippable = flippable; + this.m_fAntialiasEdges = antialiasEdges; + this.m_nHashCode = this.m_stIdentifier.GetHashCode() + this.m_sizeMaxPxl.Width + this.m_sizeMaxPxl.Height + (this.m_fFlippable ? 1 : 0) + (this.m_fAntialiasEdges ? 1 : 0); + } + + public override bool Equals(object obj) + { + if (object.ReferenceEquals((object)this, obj)) + return true; + return obj is ImageCacheKey imageCacheKey && this.m_stIdentifier.Equals(imageCacheKey.m_stIdentifier) && (this.m_sizeMaxPxl == imageCacheKey.m_sizeMaxPxl && this.m_fFlippable == imageCacheKey.m_fFlippable) && this.m_fAntialiasEdges == imageCacheKey.m_fAntialiasEdges; + } + + public override int GetHashCode() => this.m_nHashCode; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageData.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageData.cs index bdb177b..2e2c406 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageData.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageData.cs @@ -9,9 +9,9 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Extensions { - [ComVisible(false)] - public struct ImageData - { - public IntPtr rgData; - } + [ComVisible(false)] + public struct ImageData + { + public IntPtr rgData; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageHeader.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageHeader.cs index ef7a00d..6747c8f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageHeader.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageHeader.cs @@ -8,12 +8,12 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Extensions { - [ComVisible(false)] - public struct ImageHeader - { - public Size sizeActualPxl; - public Size sizeOriginalPxl; - public int nStride; - public SurfaceFormat nFormat; - } + [ComVisible(false)] + public struct ImageHeader + { + public Size sizeActualPxl; + public Size sizeOriginalPxl; + public int nStride; + public SurfaceFormat nFormat; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageInformation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageInformation.cs index 243eb1b..97ae63c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageInformation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageInformation.cs @@ -8,10 +8,10 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Extensions { - [ComVisible(false)] - public struct ImageInformation - { - public ImageHeader Header; - public ImageData Data; - } + [ComVisible(false)] + public struct ImageInformation + { + public ImageHeader Header; + public ImageData Data; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageLoader.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageLoader.cs index 2d62c12..a3e9515 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageLoader.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageLoader.cs @@ -11,280 +11,280 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Extensions { - public static class ImageLoader - { - public static bool LoadHeader(IntPtr rgData, int length, out ImageHeader header) + public static class ImageLoader { - ImageRequirements req = new ImageRequirements(); - return ImageLoader.LoadHeader(rgData, length, req, out header); - } - - public static bool LoadHeader( - IntPtr rgData, - int length, - ImageRequirements req, - out ImageHeader header) - { - Debug2.Validate(rgData != IntPtr.Zero, typeof (ArgumentNullException), "Must provide valid data to load"); - Debug2.Validate(length > 0, typeof (ArgumentOutOfRangeException), "Must provide non-zero length data to load"); - Debug2.Validate(req != null, typeof (ArgumentNullException), "Must provide valid ImageRequirements"); - ExtensionsApi.BitmapOptions nOptions = ExtensionsApi.BitmapOptions.None; - BitmapInformation bitmapInformation = new BitmapInformation(); - HRESULT hresult = new HRESULT(-1); - try - { - hresult = ExtensionsApi.SpBitmapLoadBuffer(rgData, (uint) length, req, nOptions, out bitmapInformation.hBitmap, out bitmapInformation.imageInfo); - if (!hresult.IsSuccess()) - header = new ImageHeader(); - else - header = bitmapInformation.imageInfo.Header; - } - finally - { - bitmapInformation.Dispose(); - } - return hresult.IsSuccess(); - } - - public static bool FromFile( - IImage image, - string filename, - Size maxSize, - bool flipRTL, - bool antialiasEdges, - int borderWidth, - ColorF borderColor, - out BitmapInformation bitmapInfo) - { - Debug2.Validate(image != null, typeof (ArgumentNullException), "Image must be valid"); - ImageRequirements req = new ImageRequirements(); - req.BorderWidth = borderWidth; - req.BorderColor = borderColor; - req.Flippable = flipRTL; - req.AntialiasEdges = antialiasEdges; - req.MaximumSize = maxSize; - ExtensionsApi.BitmapOptions nOptions = ExtensionsApi.BitmapOptions.Decode; - if (flipRTL) - nOptions |= ExtensionsApi.BitmapOptions.Flip; - BitmapInformation bitmapInformation = new BitmapInformation(); - if (!ExtensionsApi.SpBitmapLoadFile(filename, req, nOptions, out bitmapInformation.hBitmap, out bitmapInformation.imageInfo).IsSuccess()) - { - bitmapInfo = (BitmapInformation) null; - return false; - } - bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(bitmapInformation.imageInfo.Header.nFormat), bitmapInformation.imageInfo.Header.sizeActualPxl, bitmapInformation.imageInfo.Header.nStride, bitmapInformation.imageInfo.Data.rgData); - if (flag) - { - bitmapInfo = bitmapInformation; - } - else - { - bitmapInfo = (BitmapInformation) null; - bitmapInformation.Dispose(); - } - return flag; - } - - public static bool FromResource( - IImage image, - string moduleName, - string resourceID, - Size maxSize, - bool flipRTL, - bool antialiasEdges, - int borderWidth, - ColorF borderColor, - out BitmapInformation bitmapInfo) - { - Debug2.Validate(image != null, typeof (ArgumentNullException), "Image must be valid"); - ImageRequirements req = new ImageRequirements(); - req.BorderWidth = borderWidth; - req.BorderColor = borderColor; - req.Flippable = flipRTL; - req.AntialiasEdges = antialiasEdges; - req.MaximumSize = maxSize; - Win32Api.HINSTANCE hinst = ModuleManager.Instance.LoadModule(moduleName); - if (hinst == Win32Api.HINSTANCE.NULL) - { - bitmapInfo = (BitmapInformation) null; - return false; - } - ExtensionsApi.BitmapOptions nOptions = ExtensionsApi.BitmapOptions.Decode; - if (flipRTL) - nOptions |= ExtensionsApi.BitmapOptions.Flip; - BitmapInformation bitmapInformation = new BitmapInformation(); - if (!ExtensionsApi.SpBitmapLoadResource(hinst, resourceID, 10, req, nOptions, out bitmapInformation.hBitmap, out bitmapInformation.imageInfo).IsSuccess()) - { - bitmapInfo = (BitmapInformation) null; - return false; - } - bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(bitmapInformation.imageInfo.Header.nFormat), bitmapInformation.imageInfo.Header.sizeActualPxl, bitmapInformation.imageInfo.Header.nStride, bitmapInformation.imageInfo.Data.rgData); - if (flag) - { - bitmapInfo = bitmapInformation; - } - else - { - bitmapInfo = (BitmapInformation) null; - bitmapInformation.Dispose(); - } - return flag; - } - - public static bool FromBuffer( - IImage image, - IntPtr buffer, - int length, - Size maxSize, - bool flipRTL, - bool antialiasEdges, - int borderWidth, - ColorF borderColor, - out BitmapInformation bitmapInfo) - { - Debug2.Validate(image != null, typeof (ArgumentNullException), "Image must be valid"); - Debug2.Validate(length > 0, typeof (ArgumentException), "Do not call for zero-length buffer"); - ImageRequirements req = new ImageRequirements(); - req.BorderWidth = borderWidth; - req.BorderColor = borderColor; - req.Flippable = flipRTL; - req.AntialiasEdges = antialiasEdges; - req.MaximumSize = maxSize; - ExtensionsApi.BitmapOptions nOptions = ExtensionsApi.BitmapOptions.Decode; - if (flipRTL) - nOptions |= ExtensionsApi.BitmapOptions.Flip; - BitmapInformation bitmapInformation = new BitmapInformation(); - if (!ExtensionsApi.SpBitmapLoadBuffer(buffer, (uint) length, req, nOptions, out bitmapInformation.hBitmap, out bitmapInformation.imageInfo).IsSuccess()) - { - bitmapInfo = (BitmapInformation) null; - return false; - } - bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(bitmapInformation.imageInfo.Header.nFormat), bitmapInformation.imageInfo.Header.sizeActualPxl, bitmapInformation.imageInfo.Header.nStride, bitmapInformation.imageInfo.Data.rgData); - if (flag) - { - bitmapInfo = bitmapInformation; - } - else - { - bitmapInfo = (BitmapInformation) null; - bitmapInformation.Dispose(); - } - return flag; - } - - public static bool FromRaw( - IImage image, - IntPtr buffer, - int length, - Size imageSize, - int stride, - SurfaceFormat format, - Size maxSize, - bool flipRTL, - bool antialiasEdges, - int borderWidth, - ColorF borderColor, - out BitmapInformation bitmapInfo) - { - Debug2.Validate(image != null, typeof (ArgumentNullException), "Image must be valid"); - Debug2.Validate(length > 0, typeof (ArgumentException), "Do not call for zero-length buffer"); - ImageRequirements req = new ImageRequirements(); - req.BorderWidth = borderWidth; - req.BorderColor = borderColor; - req.Flippable = flipRTL; - req.AntialiasEdges = antialiasEdges; - req.MaximumSize = maxSize; - ExtensionsApi.BitmapOptions nOptions = ExtensionsApi.BitmapOptions.Decode; - if (flipRTL) - nOptions |= ExtensionsApi.BitmapOptions.Flip; - BitmapInformation bitmapInformation = new BitmapInformation(); - if (!ExtensionsApi.SpBitmapLoadRaw(imageSize, stride, format, buffer, req, nOptions, out bitmapInformation.hBitmap, out bitmapInformation.imageInfo).IsSuccess()) - { - bitmapInfo = (BitmapInformation) null; - return false; - } - bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(bitmapInformation.imageInfo.Header.nFormat), bitmapInformation.imageInfo.Header.sizeActualPxl, bitmapInformation.imageInfo.Header.nStride, bitmapInformation.imageInfo.Data.rgData); - if (flag) - { - bitmapInfo = bitmapInformation; - } - else - { - bitmapInfo = (BitmapInformation) null; - bitmapInformation.Dispose(); - } - return flag; - } - - public static bool FromGradient( - IImage image, - Size sizeImage, - ImageFormat format, - ImageLoader.GradientValue[] horizontalRamp, - ImageLoader.GradientValue[] verticalRamp, - out GradientInformation gradientInfo) - { - Debug2.Validate(image != null, typeof (ArgumentException), "Image must be valid"); - Debug2.Validate(sizeImage.Width > 0 && sizeImage.Height > 0, typeof (ArgumentException), "Image size must be valid"); - Debug2.Validate(horizontalRamp != null || verticalRamp != null, typeof (ArgumentException), "Must provide at least one ramp"); - Debug2.Validate(format == ImageFormat.X8R8G8B8 || format == ImageFormat.A8R8G8B8 || format == ImageFormat.A8, typeof (ArgumentException), "Image format not supported"); - ImageLoader.ValidateRamp(verticalRamp); - ImageLoader.ValidateRamp(horizontalRamp); - SurfaceFormat nFormat = SurfaceFormatInfo.FromImageFormat(format); - int num1 = SurfaceFormatInfo.GetBitsPerPixel(nFormat) / 8; - int num2 = sizeImage.Width * num1; - int length = num2 * num1 * sizeImage.Height; - int num3 = 0; - byte[] numArray = new byte[length]; - for (int index = 0; index < sizeImage.Height; ++index) - { - ColorF colorF1 = new ColorF(0, 0, 0, 0); - if (verticalRamp != null) + public static bool LoadHeader(IntPtr rgData, int length, out ImageHeader header) { - float flValue = sizeImage.Height > 1 ? (float) index / (float) (sizeImage.Height - 1) : 0.0f; - colorF1 = ImageLoader.SampleGradient(verticalRamp, flValue); - colorF1.Clamp(); + ImageRequirements req = new ImageRequirements(); + return ImageLoader.LoadHeader(rgData, length, req, out header); } - int num4 = 0; - int num5 = 0; - while (num4 < sizeImage.Width) + + public static bool LoadHeader( + IntPtr rgData, + int length, + ImageRequirements req, + out ImageHeader header) { - ColorF colorF2 = colorF1; - if (horizontalRamp != null) - { - float flValue = sizeImage.Width > 1 ? (float) num4 / (float) (sizeImage.Width - 1) : 0.0f; - colorF2 += ImageLoader.SampleGradient(horizontalRamp, flValue); - colorF2.Clamp(); - } - switch (nFormat) - { - case SurfaceFormat.A8: - numArray[num3 + num5] = (byte) ((double) colorF2.A * (double) byte.MaxValue); - break; - case SurfaceFormat.RGB32: - numArray[num3 + num5] = (byte) ((double) colorF2.B * (double) byte.MaxValue); - numArray[num3 + num5 + 1] = (byte) ((double) colorF2.G * (double) byte.MaxValue); - numArray[num3 + num5 + 2] = (byte) ((double) colorF2.R * (double) byte.MaxValue); - numArray[num3 + num5 + 3] = byte.MaxValue; - break; - case SurfaceFormat.ARGB32: - numArray[num3 + num5] = (byte) ((double) colorF2.B * (double) byte.MaxValue); - numArray[num3 + num5 + 1] = (byte) ((double) colorF2.G * (double) byte.MaxValue); - numArray[num3 + num5 + 2] = (byte) ((double) colorF2.R * (double) byte.MaxValue); - numArray[num3 + num5 + 3] = (byte) ((double) colorF2.A * (double) byte.MaxValue); - break; - default: - Debug2.Throw(false, "Unsupported format type"); - break; - } - ++num4; - num5 += num1; + Debug2.Validate(rgData != IntPtr.Zero, typeof(ArgumentNullException), "Must provide valid data to load"); + Debug2.Validate(length > 0, typeof(ArgumentOutOfRangeException), "Must provide non-zero length data to load"); + Debug2.Validate(req != null, typeof(ArgumentNullException), "Must provide valid ImageRequirements"); + ExtensionsApi.BitmapOptions nOptions = ExtensionsApi.BitmapOptions.None; + BitmapInformation bitmapInformation = new BitmapInformation(); + HRESULT hresult = new HRESULT(-1); + try + { + hresult = ExtensionsApi.SpBitmapLoadBuffer(rgData, (uint)length, req, nOptions, out bitmapInformation.hBitmap, out bitmapInformation.imageInfo); + if (!hresult.IsSuccess()) + header = new ImageHeader(); + else + header = bitmapInformation.imageInfo.Header; + } + finally + { + bitmapInformation.Dispose(); + } + return hresult.IsSuccess(); } - num3 += num2; - } - GradientInformation gradientInformation = new GradientInformation() - { - imageInfo = { + + public static bool FromFile( + IImage image, + string filename, + Size maxSize, + bool flipRTL, + bool antialiasEdges, + int borderWidth, + ColorF borderColor, + out BitmapInformation bitmapInfo) + { + Debug2.Validate(image != null, typeof(ArgumentNullException), "Image must be valid"); + ImageRequirements req = new ImageRequirements(); + req.BorderWidth = borderWidth; + req.BorderColor = borderColor; + req.Flippable = flipRTL; + req.AntialiasEdges = antialiasEdges; + req.MaximumSize = maxSize; + ExtensionsApi.BitmapOptions nOptions = ExtensionsApi.BitmapOptions.Decode; + if (flipRTL) + nOptions |= ExtensionsApi.BitmapOptions.Flip; + BitmapInformation bitmapInformation = new BitmapInformation(); + if (!ExtensionsApi.SpBitmapLoadFile(filename, req, nOptions, out bitmapInformation.hBitmap, out bitmapInformation.imageInfo).IsSuccess()) + { + bitmapInfo = (BitmapInformation)null; + return false; + } + bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(bitmapInformation.imageInfo.Header.nFormat), bitmapInformation.imageInfo.Header.sizeActualPxl, bitmapInformation.imageInfo.Header.nStride, bitmapInformation.imageInfo.Data.rgData); + if (flag) + { + bitmapInfo = bitmapInformation; + } + else + { + bitmapInfo = (BitmapInformation)null; + bitmapInformation.Dispose(); + } + return flag; + } + + public static bool FromResource( + IImage image, + string moduleName, + string resourceID, + Size maxSize, + bool flipRTL, + bool antialiasEdges, + int borderWidth, + ColorF borderColor, + out BitmapInformation bitmapInfo) + { + Debug2.Validate(image != null, typeof(ArgumentNullException), "Image must be valid"); + ImageRequirements req = new ImageRequirements(); + req.BorderWidth = borderWidth; + req.BorderColor = borderColor; + req.Flippable = flipRTL; + req.AntialiasEdges = antialiasEdges; + req.MaximumSize = maxSize; + Win32Api.HINSTANCE hinst = ModuleManager.Instance.LoadModule(moduleName); + if (hinst == Win32Api.HINSTANCE.NULL) + { + bitmapInfo = (BitmapInformation)null; + return false; + } + ExtensionsApi.BitmapOptions nOptions = ExtensionsApi.BitmapOptions.Decode; + if (flipRTL) + nOptions |= ExtensionsApi.BitmapOptions.Flip; + BitmapInformation bitmapInformation = new BitmapInformation(); + if (!ExtensionsApi.SpBitmapLoadResource(hinst, resourceID, 10, req, nOptions, out bitmapInformation.hBitmap, out bitmapInformation.imageInfo).IsSuccess()) + { + bitmapInfo = (BitmapInformation)null; + return false; + } + bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(bitmapInformation.imageInfo.Header.nFormat), bitmapInformation.imageInfo.Header.sizeActualPxl, bitmapInformation.imageInfo.Header.nStride, bitmapInformation.imageInfo.Data.rgData); + if (flag) + { + bitmapInfo = bitmapInformation; + } + else + { + bitmapInfo = (BitmapInformation)null; + bitmapInformation.Dispose(); + } + return flag; + } + + public static bool FromBuffer( + IImage image, + IntPtr buffer, + int length, + Size maxSize, + bool flipRTL, + bool antialiasEdges, + int borderWidth, + ColorF borderColor, + out BitmapInformation bitmapInfo) + { + Debug2.Validate(image != null, typeof(ArgumentNullException), "Image must be valid"); + Debug2.Validate(length > 0, typeof(ArgumentException), "Do not call for zero-length buffer"); + ImageRequirements req = new ImageRequirements(); + req.BorderWidth = borderWidth; + req.BorderColor = borderColor; + req.Flippable = flipRTL; + req.AntialiasEdges = antialiasEdges; + req.MaximumSize = maxSize; + ExtensionsApi.BitmapOptions nOptions = ExtensionsApi.BitmapOptions.Decode; + if (flipRTL) + nOptions |= ExtensionsApi.BitmapOptions.Flip; + BitmapInformation bitmapInformation = new BitmapInformation(); + if (!ExtensionsApi.SpBitmapLoadBuffer(buffer, (uint)length, req, nOptions, out bitmapInformation.hBitmap, out bitmapInformation.imageInfo).IsSuccess()) + { + bitmapInfo = (BitmapInformation)null; + return false; + } + bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(bitmapInformation.imageInfo.Header.nFormat), bitmapInformation.imageInfo.Header.sizeActualPxl, bitmapInformation.imageInfo.Header.nStride, bitmapInformation.imageInfo.Data.rgData); + if (flag) + { + bitmapInfo = bitmapInformation; + } + else + { + bitmapInfo = (BitmapInformation)null; + bitmapInformation.Dispose(); + } + return flag; + } + + public static bool FromRaw( + IImage image, + IntPtr buffer, + int length, + Size imageSize, + int stride, + SurfaceFormat format, + Size maxSize, + bool flipRTL, + bool antialiasEdges, + int borderWidth, + ColorF borderColor, + out BitmapInformation bitmapInfo) + { + Debug2.Validate(image != null, typeof(ArgumentNullException), "Image must be valid"); + Debug2.Validate(length > 0, typeof(ArgumentException), "Do not call for zero-length buffer"); + ImageRequirements req = new ImageRequirements(); + req.BorderWidth = borderWidth; + req.BorderColor = borderColor; + req.Flippable = flipRTL; + req.AntialiasEdges = antialiasEdges; + req.MaximumSize = maxSize; + ExtensionsApi.BitmapOptions nOptions = ExtensionsApi.BitmapOptions.Decode; + if (flipRTL) + nOptions |= ExtensionsApi.BitmapOptions.Flip; + BitmapInformation bitmapInformation = new BitmapInformation(); + if (!ExtensionsApi.SpBitmapLoadRaw(imageSize, stride, format, buffer, req, nOptions, out bitmapInformation.hBitmap, out bitmapInformation.imageInfo).IsSuccess()) + { + bitmapInfo = (BitmapInformation)null; + return false; + } + bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(bitmapInformation.imageInfo.Header.nFormat), bitmapInformation.imageInfo.Header.sizeActualPxl, bitmapInformation.imageInfo.Header.nStride, bitmapInformation.imageInfo.Data.rgData); + if (flag) + { + bitmapInfo = bitmapInformation; + } + else + { + bitmapInfo = (BitmapInformation)null; + bitmapInformation.Dispose(); + } + return flag; + } + + public static bool FromGradient( + IImage image, + Size sizeImage, + ImageFormat format, + ImageLoader.GradientValue[] horizontalRamp, + ImageLoader.GradientValue[] verticalRamp, + out GradientInformation gradientInfo) + { + Debug2.Validate(image != null, typeof(ArgumentException), "Image must be valid"); + Debug2.Validate(sizeImage.Width > 0 && sizeImage.Height > 0, typeof(ArgumentException), "Image size must be valid"); + Debug2.Validate(horizontalRamp != null || verticalRamp != null, typeof(ArgumentException), "Must provide at least one ramp"); + Debug2.Validate(format == ImageFormat.X8R8G8B8 || format == ImageFormat.A8R8G8B8 || format == ImageFormat.A8, typeof(ArgumentException), "Image format not supported"); + ImageLoader.ValidateRamp(verticalRamp); + ImageLoader.ValidateRamp(horizontalRamp); + SurfaceFormat nFormat = SurfaceFormatInfo.FromImageFormat(format); + int num1 = SurfaceFormatInfo.GetBitsPerPixel(nFormat) / 8; + int num2 = sizeImage.Width * num1; + int length = num2 * num1 * sizeImage.Height; + int num3 = 0; + byte[] numArray = new byte[length]; + for (int index = 0; index < sizeImage.Height; ++index) + { + ColorF colorF1 = new ColorF(0, 0, 0, 0); + if (verticalRamp != null) + { + float flValue = sizeImage.Height > 1 ? (float)index / (float)(sizeImage.Height - 1) : 0.0f; + colorF1 = ImageLoader.SampleGradient(verticalRamp, flValue); + colorF1.Clamp(); + } + int num4 = 0; + int num5 = 0; + while (num4 < sizeImage.Width) + { + ColorF colorF2 = colorF1; + if (horizontalRamp != null) + { + float flValue = sizeImage.Width > 1 ? (float)num4 / (float)(sizeImage.Width - 1) : 0.0f; + colorF2 += ImageLoader.SampleGradient(horizontalRamp, flValue); + colorF2.Clamp(); + } + switch (nFormat) + { + case SurfaceFormat.A8: + numArray[num3 + num5] = (byte)((double)colorF2.A * (double)byte.MaxValue); + break; + case SurfaceFormat.RGB32: + numArray[num3 + num5] = (byte)((double)colorF2.B * (double)byte.MaxValue); + numArray[num3 + num5 + 1] = (byte)((double)colorF2.G * (double)byte.MaxValue); + numArray[num3 + num5 + 2] = (byte)((double)colorF2.R * (double)byte.MaxValue); + numArray[num3 + num5 + 3] = byte.MaxValue; + break; + case SurfaceFormat.ARGB32: + numArray[num3 + num5] = (byte)((double)colorF2.B * (double)byte.MaxValue); + numArray[num3 + num5 + 1] = (byte)((double)colorF2.G * (double)byte.MaxValue); + numArray[num3 + num5 + 2] = (byte)((double)colorF2.R * (double)byte.MaxValue); + numArray[num3 + num5 + 3] = (byte)((double)colorF2.A * (double)byte.MaxValue); + break; + default: + Debug2.Throw(false, "Unsupported format type"); + break; + } + ++num4; + num5 += num1; + } + num3 += num2; + } + GradientInformation gradientInformation = new GradientInformation() + { + imageInfo = { Header = { sizeActualPxl = sizeImage, sizeOriginalPxl = sizeImage, @@ -292,66 +292,66 @@ namespace Microsoft.Iris.Render.Extensions nFormat = nFormat } }, - gcData = GCHandle.Alloc((object) numArray, GCHandleType.Pinned) - }; - gradientInformation.imageInfo.Data.rgData = gradientInformation.gcData.AddrOfPinnedObject(); - bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(gradientInformation.imageInfo.Header.nFormat), gradientInformation.imageInfo.Header.sizeActualPxl, gradientInformation.imageInfo.Header.nStride, gradientInformation.imageInfo.Data.rgData); - if (flag) - { - gradientInfo = gradientInformation; - } - else - { - gradientInfo = (GradientInformation) null; - ((IDisposable) gradientInformation).Dispose(); - } - return flag; - } + gcData = GCHandle.Alloc((object)numArray, GCHandleType.Pinned) + }; + gradientInformation.imageInfo.Data.rgData = gradientInformation.gcData.AddrOfPinnedObject(); + bool flag = image.LoadContent(SurfaceFormatInfo.ToImageFormat(gradientInformation.imageInfo.Header.nFormat), gradientInformation.imageInfo.Header.sizeActualPxl, gradientInformation.imageInfo.Header.nStride, gradientInformation.imageInfo.Data.rgData); + if (flag) + { + gradientInfo = gradientInformation; + } + else + { + gradientInfo = (GradientInformation)null; + ((IDisposable)gradientInformation).Dispose(); + } + return flag; + } - private static ColorF SampleGradient( - ImageLoader.GradientValue[] rampValues, - float flValue) - { - if (rampValues.Length == 1) - return rampValues[0].value; - int index = 0; - ImageLoader.GradientValue rampValue1; - do - { - rampValue1 = rampValues[index++]; - } - while (index < rampValues.Length && (double) flValue > (double) rampValues[index].position); - if (rampValues.Length <= index) - return rampValue1.value; - ImageLoader.GradientValue rampValue2 = rampValues[index]; - float num = (float) (((double) flValue - (double) rampValue1.position) / ((double) rampValue2.position - (double) rampValue1.position)); - return rampValue1.value * (1f - num) + rampValue2.value * num; - } + private static ColorF SampleGradient( + ImageLoader.GradientValue[] rampValues, + float flValue) + { + if (rampValues.Length == 1) + return rampValues[0].value; + int index = 0; + ImageLoader.GradientValue rampValue1; + do + { + rampValue1 = rampValues[index++]; + } + while (index < rampValues.Length && (double)flValue > (double)rampValues[index].position); + if (rampValues.Length <= index) + return rampValue1.value; + ImageLoader.GradientValue rampValue2 = rampValues[index]; + float num = (float)(((double)flValue - (double)rampValue1.position) / ((double)rampValue2.position - (double)rampValue1.position)); + return rampValue1.value * (1f - num) + rampValue2.value * num; + } - private static void ValidateRamp(ImageLoader.GradientValue[] rampValues) - { - Debug2.Validate(rampValues == null || rampValues.Length > 0, typeof (ArgumentException), "Gradient must contain at least one sample point"); - if (rampValues == null) - return; - float num = 0.0f; - for (int index = 0; index < rampValues.Length; ++index) - { - Debug2.Validate((double) rampValues[index].position >= (double) num, typeof (ArgumentException), "Gradient ramp values must be monotomically increasing"); - Debug2.Validate((double) rampValues[index].position >= 0.0 && (double) rampValues[index].position <= 1.0, typeof (ArgumentException), "Gradient ramp values must be [0, 1]"); - num = rampValues[index].position; - } - } + private static void ValidateRamp(ImageLoader.GradientValue[] rampValues) + { + Debug2.Validate(rampValues == null || rampValues.Length > 0, typeof(ArgumentException), "Gradient must contain at least one sample point"); + if (rampValues == null) + return; + float num = 0.0f; + for (int index = 0; index < rampValues.Length; ++index) + { + Debug2.Validate((double)rampValues[index].position >= (double)num, typeof(ArgumentException), "Gradient ramp values must be monotomically increasing"); + Debug2.Validate((double)rampValues[index].position >= 0.0 && (double)rampValues[index].position <= 1.0, typeof(ArgumentException), "Gradient ramp values must be [0, 1]"); + num = rampValues[index].position; + } + } - public struct GradientValue - { - public float position; - public ColorF value; + public struct GradientValue + { + public float position; + public ColorF value; - public GradientValue(float pos, ColorF val) - { - this.position = pos; - this.value = val; - } + public GradientValue(float pos, ColorF val) + { + this.position = pos; + this.value = val; + } + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageRequirements.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageRequirements.cs index 53380b4..626784d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageRequirements.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ImageRequirements.cs @@ -9,79 +9,79 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Extensions { - [ComVisible(false)] - [StructLayout(LayoutKind.Sequential)] - public class ImageRequirements - { - private ImageRequirements.Fields m_nMask; - private Size m_sizeMaximumPxl; - private int m_nBorderPxl; - private ColorF m_clrBorder; - - public Size MaximumSize + [ComVisible(false)] + [StructLayout(LayoutKind.Sequential)] + public class ImageRequirements { - get => this.m_sizeMaximumPxl; - set - { - this.m_sizeMaximumPxl = value; - if (this.m_sizeMaximumPxl.IsZero) - this.m_nMask &= ~ImageRequirements.Fields.MaximumSize; - else - this.m_nMask |= ImageRequirements.Fields.MaximumSize; - } - } + private ImageRequirements.Fields m_nMask; + private Size m_sizeMaximumPxl; + private int m_nBorderPxl; + private ColorF m_clrBorder; - public bool Flippable - { - get => (this.m_nMask & ImageRequirements.Fields.Flippable) != ImageRequirements.Fields.None; - set - { - if (value) - this.m_nMask |= ImageRequirements.Fields.Flippable; - else - this.m_nMask &= ~ImageRequirements.Fields.Flippable; - } - } + public Size MaximumSize + { + get => this.m_sizeMaximumPxl; + set + { + this.m_sizeMaximumPxl = value; + if (this.m_sizeMaximumPxl.IsZero) + this.m_nMask &= ~ImageRequirements.Fields.MaximumSize; + else + this.m_nMask |= ImageRequirements.Fields.MaximumSize; + } + } - public int BorderWidth - { - get => this.m_nBorderPxl; - set - { - this.m_nBorderPxl = value; - if (this.m_nBorderPxl > 0) - this.m_nMask |= ImageRequirements.Fields.Border; - else - this.m_nMask &= ~ImageRequirements.Fields.Border; - } - } + public bool Flippable + { + get => (this.m_nMask & ImageRequirements.Fields.Flippable) != ImageRequirements.Fields.None; + set + { + if (value) + this.m_nMask |= ImageRequirements.Fields.Flippable; + else + this.m_nMask &= ~ImageRequirements.Fields.Flippable; + } + } - public ColorF BorderColor - { - get => this.m_clrBorder; - set => this.m_clrBorder = value; - } + public int BorderWidth + { + get => this.m_nBorderPxl; + set + { + this.m_nBorderPxl = value; + if (this.m_nBorderPxl > 0) + this.m_nMask |= ImageRequirements.Fields.Border; + else + this.m_nMask &= ~ImageRequirements.Fields.Border; + } + } - public bool AntialiasEdges - { - get => (this.m_nMask & ImageRequirements.Fields.AntialiasEdges) != ImageRequirements.Fields.None; - set - { - if (value) - this.m_nMask |= ImageRequirements.Fields.AntialiasEdges; - else - this.m_nMask &= ~ImageRequirements.Fields.AntialiasEdges; - } - } + public ColorF BorderColor + { + get => this.m_clrBorder; + set => this.m_clrBorder = value; + } - [Flags] - internal enum Fields - { - None = 0, - MaximumSize = 1, - Border = 2, - Flippable = 4, - AntialiasEdges = 16, // 0x00000010 + public bool AntialiasEdges + { + get => (this.m_nMask & ImageRequirements.Fields.AntialiasEdges) != ImageRequirements.Fields.None; + set + { + if (value) + this.m_nMask |= ImageRequirements.Fields.AntialiasEdges; + else + this.m_nMask &= ~ImageRequirements.Fields.AntialiasEdges; + } + } + + [Flags] + internal enum Fields + { + None = 0, + MaximumSize = 1, + Border = 2, + Flippable = 4, + AntialiasEdges = 16, // 0x00000010 + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ModuleManager.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ModuleManager.cs index 3f31632..bcd4326 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ModuleManager.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/ModuleManager.cs @@ -10,64 +10,64 @@ using System; namespace Microsoft.Iris.Render.Extensions { - internal class ModuleManager - { - private static ModuleManager s_singleton; - private Map m_dictModules; - - ~ModuleManager() + internal class ModuleManager { - if (this.m_dictModules == null) - return; - Map.ValueCollection.Enumerator enumerator = this.m_dictModules.Values.GetEnumerator(); - while (enumerator.MoveNext()) - Win32Api.FreeLibrary(enumerator.Current); - this.m_dictModules = (Map) null; - } + private static ModuleManager s_singleton; + private Map m_dictModules; - public static ModuleManager Instance - { - get - { - if (ModuleManager.s_singleton == null) - ModuleManager.s_singleton = new ModuleManager(); - return ModuleManager.s_singleton; - } - } + ~ModuleManager() + { + if (this.m_dictModules == null) + return; + Map.ValueCollection.Enumerator enumerator = this.m_dictModules.Values.GetEnumerator(); + while (enumerator.MoveNext()) + Win32Api.FreeLibrary(enumerator.Current); + this.m_dictModules = (Map)null; + } - public Win32Api.HINSTANCE LoadModule(string stModuleName) - { - if (this.m_dictModules == null) - this.m_dictModules = new Map(); - Win32Api.HINSTANCE hinstance; - if (this.m_dictModules.ContainsKey(stModuleName)) - { - hinstance = this.m_dictModules[stModuleName]; - } - else - { - hinstance = Win32Api.LoadLibraryEx(stModuleName, Win32Api.HANDLE.NULL, 2U); - Debug2.Validate(hinstance != Win32Api.HINSTANCE.NULL, typeof (ArgumentException), (object) "Failed to load module {0}", (object) stModuleName); - this.m_dictModules[stModuleName] = hinstance; - } - return hinstance; - } + public static ModuleManager Instance + { + get + { + if (ModuleManager.s_singleton == null) + ModuleManager.s_singleton = new ModuleManager(); + return ModuleManager.s_singleton; + } + } - public void LoadResource( - Win32Api.HINSTANCE hInstance, - string resourceId, - out IntPtr resourceData, - out int resourceSize) - { - IntPtr resource = Win32Api.FindResource(hInstance.h, resourceId, new IntPtr(10)); - Debug2.Validate(resource != IntPtr.Zero, typeof (ArgumentException), string.Format("Unable to find resource {0} in the module", (object) resourceId)); - IntPtr i = Win32Api.LoadResource(hInstance.h, resource); - Debug2.Validate(i != IntPtr.Zero, typeof (ArgumentException), string.Format("Unable to load resource {0} from the module", (object) resourceId)); - IntPtr num1 = Win32Api.LockResource(i); - Debug2.Validate(num1 != IntPtr.Zero, typeof (InvalidOperationException), "Failed to aquire pointer to resource data"); - int num2 = Win32Api.SizeofResource(hInstance.h, resource); - resourceData = num1; - resourceSize = num2; + public Win32Api.HINSTANCE LoadModule(string stModuleName) + { + if (this.m_dictModules == null) + this.m_dictModules = new Map(); + Win32Api.HINSTANCE hinstance; + if (this.m_dictModules.ContainsKey(stModuleName)) + { + hinstance = this.m_dictModules[stModuleName]; + } + else + { + hinstance = Win32Api.LoadLibraryEx(stModuleName, Win32Api.HANDLE.NULL, 2U); + Debug2.Validate(hinstance != Win32Api.HINSTANCE.NULL, typeof(ArgumentException), (object)"Failed to load module {0}", (object)stModuleName); + this.m_dictModules[stModuleName] = hinstance; + } + return hinstance; + } + + public void LoadResource( + Win32Api.HINSTANCE hInstance, + string resourceId, + out IntPtr resourceData, + out int resourceSize) + { + IntPtr resource = Win32Api.FindResource(hInstance.h, resourceId, new IntPtr(10)); + Debug2.Validate(resource != IntPtr.Zero, typeof(ArgumentException), string.Format("Unable to find resource {0} in the module", (object)resourceId)); + IntPtr i = Win32Api.LoadResource(hInstance.h, resource); + Debug2.Validate(i != IntPtr.Zero, typeof(ArgumentException), string.Format("Unable to load resource {0} from the module", (object)resourceId)); + IntPtr num1 = Win32Api.LockResource(i); + Debug2.Validate(num1 != IntPtr.Zero, typeof(InvalidOperationException), "Failed to aquire pointer to resource data"); + int num2 = Win32Api.SizeofResource(hInstance.h, resource); + resourceData = num1; + resourceSize = num2; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/RegistryListener.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/RegistryListener.cs index 0fa7e14..6a2c225 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/RegistryListener.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/RegistryListener.cs @@ -12,105 +12,105 @@ using System.Security; namespace Microsoft.Iris.Render.Extensions { - [SuppressUnmanagedCodeSecurity] - internal class RegistryListener : IDisposable - { - private Win32Api.WaitOrTimerCallBack m_RegistryChangeCallback; - private IntPtr m_hWaitHandle = IntPtr.Zero; - private Win32Api.HANDLE m_hRegEvent = Win32Api.HANDLE.NULL; - private IntPtr m_hkey = IntPtr.Zero; - private string m_stRegKey; - - public RegistryListener(string stKey) + [SuppressUnmanagedCodeSecurity] + internal class RegistryListener : IDisposable { - this.m_stRegKey = stKey; - this.m_RegistryChangeCallback = new Win32Api.WaitOrTimerCallBack(this.OnRegistryChanged); - } + private Win32Api.WaitOrTimerCallBack m_RegistryChangeCallback; + private IntPtr m_hWaitHandle = IntPtr.Zero; + private Win32Api.HANDLE m_hRegEvent = Win32Api.HANDLE.NULL; + private IntPtr m_hkey = IntPtr.Zero; + private string m_stRegKey; - ~RegistryListener() - { - } - - void IDisposable.Dispose() => this.StopListeningForRegistryChangeNotifications(); - - public bool ReadValueFromRegistry(string st, out int nValue) - { - nValue = 0; - RegistryKey registryKey = RegistryKey.Open(RegistryKey.HKEY_CURRENT_USER, this.m_stRegKey); - if (registryKey == null) - return false; - bool flag = registryKey.ReadInt(st, out nValue); - registryKey.Close(); - return flag; - } - - public bool ReadValueFromRegistry(string st, out byte bValue) - { - int nValue; - bool flag = this.ReadValueFromRegistry(st, out nValue); - bValue = (byte) nValue; - return flag; - } - - public bool ReadValueFromRegistry(string st, out bool fValue) - { - int nValue; - bool flag = this.ReadValueFromRegistry(st, out nValue); - fValue = nValue != 0; - return flag; - } - - internal void StartListeningForRegistryChanges() - { - lock (this) - { - this.StopListeningForRegistryChangeNotifications(); - this.m_hkey = IntPtr.Zero; - if (Win32Api.RegOpenKeyExW(Win32Api.HKEY_CURRENT_USER, this.m_stRegKey, 0, 16, out this.m_hkey) != 0) - return; - this.m_hRegEvent = Win32Api.CreateEvent(IntPtr.Zero, false, false, (string) null); - int num = Win32Api.RegNotifyChangeKeyValue(this.m_hkey, true, 15, this.m_hRegEvent, true); - if (num != 0) - throw new Exception(string.Format((IFormatProvider) CultureInfo.InvariantCulture, "Unable to register key change handler: {0} (due to error {1})", (object) this.m_stRegKey, (object) num)); - IntPtr phNewWaitObject; - if (Win32Api.RegisterWaitForSingleObject(out phNewWaitObject, this.m_hRegEvent.h, this.m_RegistryChangeCallback, IntPtr.Zero, uint.MaxValue, 4U) == 0) + public RegistryListener(string stKey) { - this.StopListeningForRegistryChangeNotifications(); - throw new Exception("Unable to register wait for object."); + this.m_stRegKey = stKey; + this.m_RegistryChangeCallback = new Win32Api.WaitOrTimerCallBack(this.OnRegistryChanged); } - this.m_hWaitHandle = phNewWaitObject; - } - } - private void StopListeningForRegistryChangeNotifications() - { - lock (this) - { - if (this.m_hWaitHandle != IntPtr.Zero) + ~RegistryListener() { - Win32Api.UnregisterWait(this.m_hWaitHandle); - this.m_hWaitHandle = IntPtr.Zero; } - if (this.m_hRegEvent != Win32Api.HANDLE.NULL) + + void IDisposable.Dispose() => this.StopListeningForRegistryChangeNotifications(); + + public bool ReadValueFromRegistry(string st, out int nValue) { - Win32Api.CloseHandle(this.m_hRegEvent); - this.m_hRegEvent = Win32Api.HANDLE.NULL; + nValue = 0; + RegistryKey registryKey = RegistryKey.Open(RegistryKey.HKEY_CURRENT_USER, this.m_stRegKey); + if (registryKey == null) + return false; + bool flag = registryKey.ReadInt(st, out nValue); + registryKey.Close(); + return flag; } - if (!(this.m_hkey != IntPtr.Zero)) - return; - Win32Api.RegCloseKey(this.m_hkey); - this.m_hkey = IntPtr.Zero; - } - } - public event EventHandler RegistryChanged; + public bool ReadValueFromRegistry(string st, out byte bValue) + { + int nValue; + bool flag = this.ReadValueFromRegistry(st, out nValue); + bValue = (byte)nValue; + return flag; + } - private void OnRegistryChanged(IntPtr ptrParameter, byte b) - { - this.StopListeningForRegistryChangeNotifications(); - if (this.RegistryChanged == null) - return; - this.RegistryChanged((object) this, EventArgs.Empty); + public bool ReadValueFromRegistry(string st, out bool fValue) + { + int nValue; + bool flag = this.ReadValueFromRegistry(st, out nValue); + fValue = nValue != 0; + return flag; + } + + internal void StartListeningForRegistryChanges() + { + lock (this) + { + this.StopListeningForRegistryChangeNotifications(); + this.m_hkey = IntPtr.Zero; + if (Win32Api.RegOpenKeyExW(Win32Api.HKEY_CURRENT_USER, this.m_stRegKey, 0, 16, out this.m_hkey) != 0) + return; + this.m_hRegEvent = Win32Api.CreateEvent(IntPtr.Zero, false, false, (string)null); + int num = Win32Api.RegNotifyChangeKeyValue(this.m_hkey, true, 15, this.m_hRegEvent, true); + if (num != 0) + throw new Exception(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Unable to register key change handler: {0} (due to error {1})", (object)this.m_stRegKey, (object)num)); + IntPtr phNewWaitObject; + if (Win32Api.RegisterWaitForSingleObject(out phNewWaitObject, this.m_hRegEvent.h, this.m_RegistryChangeCallback, IntPtr.Zero, uint.MaxValue, 4U) == 0) + { + this.StopListeningForRegistryChangeNotifications(); + throw new Exception("Unable to register wait for object."); + } + this.m_hWaitHandle = phNewWaitObject; + } + } + + private void StopListeningForRegistryChangeNotifications() + { + lock (this) + { + if (this.m_hWaitHandle != IntPtr.Zero) + { + Win32Api.UnregisterWait(this.m_hWaitHandle); + this.m_hWaitHandle = IntPtr.Zero; + } + if (this.m_hRegEvent != Win32Api.HANDLE.NULL) + { + Win32Api.CloseHandle(this.m_hRegEvent); + this.m_hRegEvent = Win32Api.HANDLE.NULL; + } + if (!(this.m_hkey != IntPtr.Zero)) + return; + Win32Api.RegCloseKey(this.m_hkey); + this.m_hkey = IntPtr.Zero; + } + } + + public event EventHandler RegistryChanged; + + private void OnRegistryChanged(IntPtr ptrParameter, byte b) + { + this.StopListeningForRegistryChangeNotifications(); + if (this.RegistryChanged == null) + return; + this.RegistryChanged((object)this, EventArgs.Empty); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundData.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundData.cs index 91862de..32ab758 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundData.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundData.cs @@ -9,82 +9,82 @@ using System; namespace Microsoft.Iris.Render.Extensions { - public class SoundData : ISoundData, IDisposable - { - private string m_moduleName; - private string m_resourceId; - private int m_usageCount; - private bool m_hasContent; - private ExtensionsApi.HSpSound m_soundHandle; - private ExtensionsApi.SoundInformation m_soundInfo; - - public SoundData(string moduleName, string resourceId) + public class SoundData : ISoundData, IDisposable { - Debug2.Validate(moduleName != null, typeof (ArgumentNullException), nameof (moduleName)); - Debug2.Validate(resourceId != null, typeof (ArgumentNullException), nameof (resourceId)); - this.m_moduleName = moduleName; - this.m_resourceId = resourceId; - this.m_usageCount = 0; - this.m_hasContent = false; - this.LoadSoundData(); + private string m_moduleName; + private string m_resourceId; + private int m_usageCount; + private bool m_hasContent; + private ExtensionsApi.HSpSound m_soundHandle; + private ExtensionsApi.SoundInformation m_soundInfo; + + public SoundData(string moduleName, string resourceId) + { + Debug2.Validate(moduleName != null, typeof(ArgumentNullException), nameof(moduleName)); + Debug2.Validate(resourceId != null, typeof(ArgumentNullException), nameof(resourceId)); + this.m_moduleName = moduleName; + this.m_resourceId = resourceId; + this.m_usageCount = 0; + this.m_hasContent = false; + this.LoadSoundData(); + } + + ~SoundData() => this.Dispose(false); + + public void Dispose() + { + GC.SuppressFinalize((object)this); + this.Dispose(true); + } + + protected virtual void Dispose(bool fInDispose) + { + if (!this.m_hasContent) + return; + this.UnloadSoundData(); + } + + SoundDataFormat ISoundData.Format => SoundDataFormat.PCM; + + uint ISoundData.ChannelCount => (uint)this.m_soundInfo.Header.nChannels; + + uint ISoundData.SampleRate => this.m_soundInfo.Header.nSamplesPerSec; + + uint ISoundData.SampleSize => (uint)this.m_soundInfo.Header.wBitsPerSample; + + uint ISoundData.SampleCount => (uint)((ulong)this.m_soundInfo.Header.cbDataSize / (ulong)((int)this.m_soundInfo.Header.wBitsPerSample / 8)); + + IntPtr ISoundData.AcquireContent() + { + ++this.m_usageCount; + return this.m_soundInfo.Data.rgData; + } + + void ISoundData.ReleaseContent() => --this.m_usageCount; + + private void LoadSoundData() + { + if (this.m_hasContent) + return; + 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.Header.wFormatTag == (ushort)1, typeof(ArgumentException), "Only PCM sound data is currently supported"); + Debug2.Validate(soundDataInfo.Header.nChannels >= (ushort)1 && soundDataInfo.Header.nChannels <= (ushort)2, typeof(ArgumentException), "Only mono/stereo sound data is currently supported"); + Debug2.Validate(soundDataInfo.Header.wBitsPerSample == (ushort)8 || soundDataInfo.Header.wBitsPerSample == (ushort)16, typeof(ArgumentException), "Only 8bps/16bps sound data is currently supported"); + Debug2.Validate((uint)((ulong)soundDataInfo.Header.cbDataSize / (ulong)((int)soundDataInfo.Header.wBitsPerSample / 8)) % (uint)soundDataInfo.Header.nChannels == 0U, typeof(ArgumentException), "Insufficient sample data"); + this.m_soundHandle = soundDataHandle; + this.m_soundInfo = soundDataInfo; + this.m_hasContent = true; + } + + private void UnloadSoundData() + { + if (!this.m_hasContent) + return; + this.m_hasContent = false; + SoundLoader.DisposeData(this.m_soundHandle, this.m_soundInfo); + } } - - ~SoundData() => this.Dispose(false); - - public void Dispose() - { - GC.SuppressFinalize((object) this); - this.Dispose(true); - } - - protected virtual void Dispose(bool fInDispose) - { - if (!this.m_hasContent) - return; - this.UnloadSoundData(); - } - - SoundDataFormat ISoundData.Format => SoundDataFormat.PCM; - - uint ISoundData.ChannelCount => (uint) this.m_soundInfo.Header.nChannels; - - uint ISoundData.SampleRate => this.m_soundInfo.Header.nSamplesPerSec; - - uint ISoundData.SampleSize => (uint) this.m_soundInfo.Header.wBitsPerSample; - - uint ISoundData.SampleCount => (uint) ((ulong) this.m_soundInfo.Header.cbDataSize / (ulong) ((int) this.m_soundInfo.Header.wBitsPerSample / 8)); - - IntPtr ISoundData.AcquireContent() - { - ++this.m_usageCount; - return this.m_soundInfo.Data.rgData; - } - - void ISoundData.ReleaseContent() => --this.m_usageCount; - - private void LoadSoundData() - { - if (this.m_hasContent) - return; - 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.Header.wFormatTag == (ushort) 1, typeof (ArgumentException), "Only PCM sound data is currently supported"); - Debug2.Validate(soundDataInfo.Header.nChannels >= (ushort) 1 && soundDataInfo.Header.nChannels <= (ushort) 2, typeof (ArgumentException), "Only mono/stereo sound data is currently supported"); - Debug2.Validate(soundDataInfo.Header.wBitsPerSample == (ushort) 8 || soundDataInfo.Header.wBitsPerSample == (ushort) 16, typeof (ArgumentException), "Only 8bps/16bps sound data is currently supported"); - Debug2.Validate((uint) ((ulong) soundDataInfo.Header.cbDataSize / (ulong) ((int) soundDataInfo.Header.wBitsPerSample / 8)) % (uint) soundDataInfo.Header.nChannels == 0U, typeof (ArgumentException), "Insufficient sample data"); - this.m_soundHandle = soundDataHandle; - this.m_soundInfo = soundDataInfo; - this.m_hasContent = true; - } - - private void UnloadSoundData() - { - if (!this.m_hasContent) - return; - this.m_hasContent = false; - SoundLoader.DisposeData(this.m_soundHandle, this.m_soundInfo); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundLoader.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundLoader.cs index 87c252b..241d1f6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundLoader.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/SoundLoader.cs @@ -11,43 +11,43 @@ using System; namespace Microsoft.Iris.Render.Extensions { - public static class SoundLoader - { - public static void FromResource( - string moduleName, - string resourceId, - out ExtensionsApi.HSpSound soundDataHandle, - out ExtensionsApi.SoundInformation soundDataInfo) + public static class SoundLoader { - Win32Api.HINSTANCE hInstance = ModuleManager.Instance.LoadModule(moduleName); - Debug2.Validate(hInstance != Win32Api.HINSTANCE.NULL, typeof (ArgumentException), nameof (moduleName)); - IntPtr resourceData; - int resourceSize; - ModuleManager.Instance.LoadResource(hInstance, resourceId, out resourceData, out resourceSize); - SoundLoader.FromMemory(resourceData, resourceSize, out soundDataHandle, out soundDataInfo); - } + public static void FromResource( + string moduleName, + string resourceId, + out ExtensionsApi.HSpSound soundDataHandle, + out ExtensionsApi.SoundInformation soundDataInfo) + { + Win32Api.HINSTANCE hInstance = ModuleManager.Instance.LoadModule(moduleName); + Debug2.Validate(hInstance != Win32Api.HINSTANCE.NULL, typeof(ArgumentException), nameof(moduleName)); + IntPtr resourceData; + int resourceSize; + ModuleManager.Instance.LoadResource(hInstance, resourceId, out resourceData, out resourceSize); + SoundLoader.FromMemory(resourceData, resourceSize, out soundDataHandle, out soundDataInfo); + } - public static void FromMemory( - IntPtr rawSoundData, - int rawSoundDataSize, - out ExtensionsApi.HSpSound soundDataHandle, - out ExtensionsApi.SoundInformation soundDataInfo) - { - Debug2.Validate(rawSoundData != IntPtr.Zero, typeof (ArgumentNullException), nameof (rawSoundData)); - Debug2.Validate(rawSoundDataSize > 0, typeof (ArgumentException), "Invalid sound data size"); - ExtensionsApi.SoundOptions options = ExtensionsApi.SoundOptions.Decode; - ExtensionsApi.SoundInformation info = new ExtensionsApi.SoundInformation(); - ExtensionsApi.HSpSound hSound; - EngineApi.IFC(ExtensionsApi.SpSoundLoadBuffer(rawSoundData, rawSoundDataSize, options, out hSound, out info)); - soundDataHandle = hSound; - soundDataInfo = info; - } + public static void FromMemory( + IntPtr rawSoundData, + int rawSoundDataSize, + out ExtensionsApi.HSpSound soundDataHandle, + out ExtensionsApi.SoundInformation soundDataInfo) + { + Debug2.Validate(rawSoundData != IntPtr.Zero, typeof(ArgumentNullException), nameof(rawSoundData)); + Debug2.Validate(rawSoundDataSize > 0, typeof(ArgumentException), "Invalid sound data size"); + ExtensionsApi.SoundOptions options = ExtensionsApi.SoundOptions.Decode; + ExtensionsApi.SoundInformation info = new ExtensionsApi.SoundInformation(); + ExtensionsApi.HSpSound hSound; + EngineApi.IFC(ExtensionsApi.SpSoundLoadBuffer(rawSoundData, rawSoundDataSize, options, out hSound, out info)); + soundDataHandle = hSound; + soundDataInfo = info; + } - public static void DisposeData( - ExtensionsApi.HSpSound soundDataHandle, - ExtensionsApi.SoundInformation soundDataInfo) - { - EngineApi.IFC(ExtensionsApi.SpSoundDispose(soundDataHandle, soundDataInfo)); + public static void DisposeData( + ExtensionsApi.HSpSound soundDataHandle, + ExtensionsApi.SoundInformation soundDataInfo) + { + EngineApi.IFC(ExtensionsApi.SpSoundDispose(soundDataHandle, soundDataInfo)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/TraceRegistryHelper.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/TraceRegistryHelper.cs index c3b853a..60a584a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/TraceRegistryHelper.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/TraceRegistryHelper.cs @@ -6,74 +6,74 @@ namespace Microsoft.Iris.Render.Extensions { - internal class TraceRegistryHelper : RegistryListener - { - private const string k_stReadValuesKey = "ReadValuesFromRegistry"; - private const string k_stSaveValuesKey = "SaveValuesToRegistry"; - private const string k_stTimedWriteLinesKey = "TimedWriteLines"; - private bool m_invalidCache; - private bool m_fReadValuesFromRegistry; - private bool m_fSaveValuesToRegistry; - - internal TraceRegistryHelper(string stRegKey) - : base(stRegKey) - => this.m_invalidCache = true; - - private void Refresh() + internal class TraceRegistryHelper : RegistryListener { - lock (this) - { - bool fValue; - if (this.ReadValueFromRegistry("ReadValuesFromRegistry", out fValue)) - this.m_fReadValuesFromRegistry = fValue; - if (this.ReadValueFromRegistry("SaveValuesToRegistry", out fValue)) - this.m_fSaveValuesToRegistry = fValue; - this.m_invalidCache = false; - } - } + private const string k_stReadValuesKey = "ReadValuesFromRegistry"; + private const string k_stSaveValuesKey = "SaveValuesToRegistry"; + private const string k_stTimedWriteLinesKey = "TimedWriteLines"; + private bool m_invalidCache; + private bool m_fReadValuesFromRegistry; + private bool m_fSaveValuesToRegistry; - internal void Invalidate() - { - if (this.m_invalidCache) - return; - lock (this) - { - if (this.m_invalidCache) - return; - this.m_invalidCache = true; - } - } + internal TraceRegistryHelper(string stRegKey) + : base(stRegKey) + => this.m_invalidCache = true; - public bool ReadValuesFromRegistry - { - get - { - if (this.m_invalidCache) - this.Refresh(); - return this.m_fReadValuesFromRegistry; - } - set - { - if (this.m_fReadValuesFromRegistry == value) - return; - this.m_fReadValuesFromRegistry = value; - } - } + private void Refresh() + { + lock (this) + { + bool fValue; + if (this.ReadValueFromRegistry("ReadValuesFromRegistry", out fValue)) + this.m_fReadValuesFromRegistry = fValue; + if (this.ReadValueFromRegistry("SaveValuesToRegistry", out fValue)) + this.m_fSaveValuesToRegistry = fValue; + this.m_invalidCache = false; + } + } - public bool SaveValuesToRegistry - { - get - { - if (this.m_invalidCache) - this.Refresh(); - return this.m_fSaveValuesToRegistry; - } - set - { - if (this.m_fSaveValuesToRegistry == value) - return; - this.m_fSaveValuesToRegistry = value; - } + internal void Invalidate() + { + if (this.m_invalidCache) + return; + lock (this) + { + if (this.m_invalidCache) + return; + this.m_invalidCache = true; + } + } + + public bool ReadValuesFromRegistry + { + get + { + if (this.m_invalidCache) + this.Refresh(); + return this.m_fReadValuesFromRegistry; + } + set + { + if (this.m_fReadValuesFromRegistry == value) + return; + this.m_fReadValuesFromRegistry = value; + } + } + + public bool SaveValuesToRegistry + { + get + { + if (this.m_invalidCache) + this.Refresh(); + return this.m_fSaveValuesToRegistry; + } + set + { + if (this.m_fSaveValuesToRegistry == value) + return; + this.m_fSaveValuesToRegistry = value; + } + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/eDebug.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/eDebug.cs index 3a7103a..60f52e6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/eDebug.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/eDebug.cs @@ -14,509 +14,509 @@ using System.Text; namespace Microsoft.Iris.Render.Extensions { - [SuppressUnmanagedCodeSecurity] - internal class eDebug - { - public const byte k_bDefaultTraceLevel = 1; - private bool m_fTimedWriteLines; - private bool m_fShowCategories; - private bool m_fAlwaysShowBraces; - private bool m_fOpenBracePending; - private DateTime m_dtStart; - private string m_stWriteLinePrefix; - private string m_stRendererWriteLinePrefix; - private string m_stIndent; - private Stack m_stackIndentStrings; - private byte m_bTraceLevelAdjustment; - private string m_stPendingWrite; - private int m_nMaxCategoryLength; - private DebugCategory m_pendingBraceCategory; - private string m_pendingBraceComment; - - internal eDebug() + [SuppressUnmanagedCodeSecurity] + internal class eDebug { - this.m_stIndent = " "; - this.m_stackIndentStrings = new Stack(); - this.m_dtStart = DateTime.UtcNow; - this.m_fShowCategories = true; - this.m_bTraceLevelAdjustment = (byte) 0; - } + public const byte k_bDefaultTraceLevel = 1; + private bool m_fTimedWriteLines; + private bool m_fShowCategories; + private bool m_fAlwaysShowBraces; + private bool m_fOpenBracePending; + private DateTime m_dtStart; + private string m_stWriteLinePrefix; + private string m_stRendererWriteLinePrefix; + private string m_stIndent; + private Stack m_stackIndentStrings; + private byte m_bTraceLevelAdjustment; + private string m_stPendingWrite; + private int m_nMaxCategoryLength; + private DebugCategory m_pendingBraceCategory; + private string m_pendingBraceComment; - internal void Dispose() - { - } - - public static void Break() - { - if (Debugger.IsAttached || !Win32Api.IsDebuggerPresent()) - Debugger.Break(); - else - Win32Api.DebugBreak(); - } - - public void Assert(bool fCondition) - { - if (!this.Assert(fCondition, "false", 2, (StackTrace) null)) - return; - eDebug.Break(); - } - - public void Assert(bool fCondition, string stMessage) - { - if (!this.Assert(fCondition, stMessage, 2, (StackTrace) null)) - return; - eDebug.Break(); - } - - public void Assert(bool fCondition, string stMessage, StackTrace stack) - { - if (!this.Assert(fCondition, stMessage, 0, stack)) - return; - eDebug.Break(); - } - - public void Assert(Type type, object obj, string stMessage) - { - this.Prompt(type != null, "must pass a valid type", typeof (ArgumentNullException)); - if (!this.Assert(type.IsInstanceOfType(obj), stMessage, 2, (StackTrace) null)) - return; - eDebug.Break(); - } - - private bool Assert(bool fCondition, string stMessage, int cIgnoreFrames, StackTrace stack) - { - if (fCondition) - return false; - if (stack == null) - stack = new StackTrace(true); - return this.DisplayStackTrace("Iris Assert", stMessage, stack, cIgnoreFrames); - } - - public void Prompt(string stMessage) => this.Prompt(false, stMessage, (Type) null, (object) null, 1); - - public void Prompt(string stMessage, Type type) => this.Prompt(false, stMessage, type, (object) null, 1); - - public void Prompt(bool fCondition, string stMessage) => this.Prompt(fCondition, stMessage, (Type) null, (object) null, 1); - - public void Prompt(bool fCondition, string stMessage, Type type) => this.Prompt(fCondition, stMessage, type, (object) null, 1); - - public void Prompt(bool fCondition, string stMessage, Type type, object objSubject) => this.Prompt(fCondition, stMessage, type, objSubject, 1); - - private void Prompt( - bool fCondition, - string stMessage, - Type type, - object objSubject, - int cIgnoreFrames) - { - if (!fCondition) - { - StackTrace trace = new StackTrace(true); - if (this.DisplayStackTrace("Iris API Validation Error (Application error)", stMessage, trace, cIgnoreFrames + 1)) - eDebug.Break(); - Exception exception; - if (type == null) + internal eDebug() { - exception = (Exception) new ArgumentException(stMessage); + this.m_stIndent = " "; + this.m_stackIndentStrings = new Stack(); + this.m_dtStart = DateTime.UtcNow; + this.m_fShowCategories = true; + this.m_bTraceLevelAdjustment = (byte)0; } - else + + internal void Dispose() { - object[] objArray; - if (objSubject != null) - objArray = new object[2] + } + + public static void Break() + { + if (Debugger.IsAttached || !Win32Api.IsDebuggerPresent()) + Debugger.Break(); + else + Win32Api.DebugBreak(); + } + + public void Assert(bool fCondition) + { + if (!this.Assert(fCondition, "false", 2, (StackTrace)null)) + return; + eDebug.Break(); + } + + public void Assert(bool fCondition, string stMessage) + { + if (!this.Assert(fCondition, stMessage, 2, (StackTrace)null)) + return; + eDebug.Break(); + } + + public void Assert(bool fCondition, string stMessage, StackTrace stack) + { + if (!this.Assert(fCondition, stMessage, 0, stack)) + return; + eDebug.Break(); + } + + public void Assert(Type type, object obj, string stMessage) + { + this.Prompt(type != null, "must pass a valid type", typeof(ArgumentNullException)); + if (!this.Assert(type.IsInstanceOfType(obj), stMessage, 2, (StackTrace)null)) + return; + eDebug.Break(); + } + + private bool Assert(bool fCondition, string stMessage, int cIgnoreFrames, StackTrace stack) + { + if (fCondition) + return false; + if (stack == null) + stack = new StackTrace(true); + return this.DisplayStackTrace("Iris Assert", stMessage, stack, cIgnoreFrames); + } + + public void Prompt(string stMessage) => this.Prompt(false, stMessage, (Type)null, (object)null, 1); + + public void Prompt(string stMessage, Type type) => this.Prompt(false, stMessage, type, (object)null, 1); + + public void Prompt(bool fCondition, string stMessage) => this.Prompt(fCondition, stMessage, (Type)null, (object)null, 1); + + public void Prompt(bool fCondition, string stMessage, Type type) => this.Prompt(fCondition, stMessage, type, (object)null, 1); + + public void Prompt(bool fCondition, string stMessage, Type type, object objSubject) => this.Prompt(fCondition, stMessage, type, objSubject, 1); + + private void Prompt( + bool fCondition, + string stMessage, + Type type, + object objSubject, + int cIgnoreFrames) + { + if (!fCondition) { + StackTrace trace = new StackTrace(true); + if (this.DisplayStackTrace("Iris API Validation Error (Application error)", stMessage, trace, cIgnoreFrames + 1)) + eDebug.Break(); + Exception exception; + if (type == null) + { + exception = (Exception)new ArgumentException(stMessage); + } + else + { + object[] objArray; + if (objSubject != null) + objArray = new object[2] + { (object) stMessage, objSubject - }; - else - objArray = new object[1]{ (object) stMessage }; - exception = (Exception) Activator.CreateInstance(type, objArray); + }; + else + objArray = new object[1] { (object)stMessage }; + exception = (Exception)Activator.CreateInstance(type, objArray); + } + throw exception; + } } - throw exception; - } - } - public void PromptCompatibleArray(Array array, int indexStart, Type typeObject, int numItems) - { - this.Prompt(array != null, "Must have valid array", typeof (ArgumentNullException)); - this.Prompt(typeObject != null, "Must have valid Type", typeof (ArgumentNullException)); - this.Prompt(array.Rank == 1, "Array must have rank=1", typeof (RankException)); - this.Prompt(indexStart < array.Length || numItems == 0, "Must have valid index", typeof (ArgumentException)); - this.Prompt(indexStart >= 0, "Must have valid index", typeof (ArgumentOutOfRangeException)); - this.Prompt(indexStart + numItems <= array.Length, "Must have sufficient room in array", typeof (ArgumentOutOfRangeException)); - Type elementType = array.GetType().GetElementType(); - this.Prompt(typeObject == elementType || typeObject.IsSubclassOf(elementType), "Must be a compatible array type", typeof (ArrayTypeMismatchException)); - } - - public void PromptListContents(IList list, Type typeExpected) - { - this.Prompt(list != null, "Must have valid list", typeof (ArgumentNullException)); - this.Prompt(typeExpected != null, "Must have valid Type", typeof (ArgumentNullException)); - foreach (object obj in (IEnumerable) list) - this.Prompt(obj != null && typeExpected.IsAssignableFrom(obj.GetType()), "List should only contain {0}.", typeExpected); - } - - public void Write(DebugCategory cat, object oValue) - { - if (!this.IsCategoryEnabled(cat)) - return; - this.WriteWorker(cat, oValue); - } - - public void WriteLine(DebugCategory cat, object oValue) - { - if (!this.IsCategoryEnabled(cat)) - return; - this.WriteLineWorker(cat, oValue); - } - - public void Write(DebugCategory cat, byte bLevel, object oValue) - { - if (!this.IsCategoryEnabled(cat, bLevel)) - return; - this.WriteWorker(cat, oValue); - } - - public void WriteLine(DebugCategory cat, byte bLevel, object oValue) - { - if (!this.IsCategoryEnabled(cat, bLevel)) - return; - this.WriteLineWorker(cat, oValue); - } - - public void Write(DebugCategory cat, string stMessage) - { - if (!this.IsCategoryEnabled(cat)) - return; - this.WriteWorker(cat, (object) stMessage); - } - - public void WriteLine(DebugCategory cat, string stMessage) - { - if (!this.IsCategoryEnabled(cat)) - return; - this.WriteLineWorker(cat, (object) stMessage); - } - - public bool TimedWriteLines - { - get => this.m_fTimedWriteLines; - set - { - if (this.m_fTimedWriteLines == value) - return; - this.m_fTimedWriteLines = value; - eDebugApi.DebugSetTimedWriteLines(value); - } - } - - public bool ShowCategories - { - get => this.m_fShowCategories; - set - { - this.m_fShowCategories = value; - if (value) - return; - this.m_nMaxCategoryLength = 0; - } - } - - public bool AlwaysShowBraces - { - get => this.m_fAlwaysShowBraces; - set - { - this.m_fAlwaysShowBraces = value; - if (!value || !this.m_fOpenBracePending) - return; - this.FlushBraces(); - } - } - - public string WriteLinePrefix - { - get => this.m_stWriteLinePrefix; - set => this.m_stWriteLinePrefix = value; - } - - public string RendererWriteLinePrefix - { - get => this.m_stRendererWriteLinePrefix; - set - { - this.m_stRendererWriteLinePrefix = value; - eDebugApi.DebugSetWriteLinePrefix(value); - } - } - - public byte TraceLevelAdjustment - { - get => this.m_bTraceLevelAdjustment; - set => this.m_bTraceLevelAdjustment = value; - } - - public bool IsCategoryEnabled(DebugCategory cat) => false; - - public bool IsCategoryEnabled(DebugCategory cat, byte bLevel) => false; - - internal void EnableCategory(DebugCategory cat, bool fEnable) - { - } - - internal void EnableCategory(DebugCategory cat, byte bLevel) - { - } - - public string IndentString - { - get => this.m_stIndent; - set - { - if (!(this.m_stIndent != value)) - return; - this.m_stIndent = value; - int indentLevel = this.IndentLevel; - this.IndentLevel = 0; - this.IndentLevel = indentLevel; - } - } - - public void Indent(DebugCategory cat) => this.Indent(cat, (byte) 1); - - public void Indent(DebugCategory cat, byte bLevel) - { - if (!this.IsCategoryEnabled(cat, bLevel)) - return; - this.Indent(); - } - - public void Unindent(DebugCategory cat) => this.Unindent(cat, (byte) 1); - - public void Unindent(DebugCategory cat, byte bLevel) - { - if (!this.IsCategoryEnabled(cat, bLevel)) - return; - this.Unindent(); - } - - public int IndentLevel - { - get => this.m_stackIndentStrings.Count; - set - { - while (this.IndentLevel < value) - this.Indent(); - while (this.IndentLevel > value) - this.Unindent(); - } - } - - public void OpenBrace(DebugCategory cat) => this.OpenBrace(cat, (string) null); - - public void OpenBrace(DebugCategory cat, string stComment) => this.OpenBrace(cat, (byte) 1, stComment); - - public void OpenBrace(DebugCategory cat, byte bLevel, string stComment) - { - if (!this.IsCategoryEnabled(cat, bLevel)) - return; - if (this.m_fOpenBracePending) - this.FlushBraces(); - if (stComment != null) - this.WriteLineWorker(cat, (object) stComment); - if (!this.m_fAlwaysShowBraces) - { - this.m_fOpenBracePending = true; - this.m_pendingBraceCategory = cat; - this.m_pendingBraceComment = (string) null; - } - else - { - this.WriteLineWorker(cat, (object) "{"); - this.Indent(); - } - } - - public void DeferOpenBrace(DebugCategory cat) => this.DeferOpenBrace(cat, (string) null); - - public void DeferOpenBrace(DebugCategory cat, string stComment) => this.DeferOpenBrace(cat, (byte) 1, stComment); - - public void DeferOpenBrace(DebugCategory cat, byte bLevel, string stComment) - { - if (!this.IsCategoryEnabled(cat, bLevel)) - return; - if (this.m_fOpenBracePending) - this.FlushBraces(); - this.m_fOpenBracePending = true; - this.m_pendingBraceCategory = cat; - this.m_pendingBraceComment = stComment; - } - - public void FlushBraces() - { - if (!this.m_fOpenBracePending) - return; - this.m_fOpenBracePending = false; - bool alwaysShowBraces = this.m_fAlwaysShowBraces; - this.m_fAlwaysShowBraces = true; - this.OpenBrace(this.m_pendingBraceCategory, this.m_pendingBraceComment); - this.m_fAlwaysShowBraces = alwaysShowBraces; - } - - public void CloseBrace(DebugCategory cat) => this.CloseBrace(cat, (byte) 1); - - public void CloseBrace(DebugCategory cat, byte bLevel) - { - if (!this.IsCategoryEnabled(cat, bLevel)) - return; - if (this.m_fOpenBracePending && cat == this.m_pendingBraceCategory) - { - this.m_fOpenBracePending = false; - this.m_pendingBraceComment = (string) null; - } - else - { - this.Unindent(); - this.WriteLineWorker(cat, (object) "}"); - } - } - - private bool DisplayStackTrace( - string title, - string stMessage, - StackTrace trace, - int cIgnoreFrames) - { - this.Prompt(trace != null, "Must pass a valid StackTrace", typeof (ArgumentNullException)); - StackFrame frame1 = trace.GetFrame(cIgnoreFrames); - string filename = frame1.GetFileName(); - int fileLineNumber = frame1.GetFileLineNumber(); - if (filename == null) - filename = ""; - StringBuilder stringBuilder = new StringBuilder(10240); - for (int index = cIgnoreFrames; index < trace.FrameCount; ++index) - { - StackFrame frame2 = trace.GetFrame(index); - stringBuilder.Append(frame2.GetILOffset()); - stringBuilder.Append("\t"); - string fileName = frame2.GetFileName(); - if (!string.IsNullOrEmpty(fileName)) + public void PromptCompatibleArray(Array array, int indexStart, Type typeObject, int numItems) { - stringBuilder.Append(fileName); - stringBuilder.Append(","); - stringBuilder.Append(frame2.GetFileLineNumber()); + this.Prompt(array != null, "Must have valid array", typeof(ArgumentNullException)); + this.Prompt(typeObject != null, "Must have valid Type", typeof(ArgumentNullException)); + this.Prompt(array.Rank == 1, "Array must have rank=1", typeof(RankException)); + this.Prompt(indexStart < array.Length || numItems == 0, "Must have valid index", typeof(ArgumentException)); + this.Prompt(indexStart >= 0, "Must have valid index", typeof(ArgumentOutOfRangeException)); + this.Prompt(indexStart + numItems <= array.Length, "Must have sufficient room in array", typeof(ArgumentOutOfRangeException)); + Type elementType = array.GetType().GetElementType(); + this.Prompt(typeObject == elementType || typeObject.IsSubclassOf(elementType), "Must be a compatible array type", typeof(ArrayTypeMismatchException)); } - else - stringBuilder.Append(""); - stringBuilder.Append("\t"); - MethodBase method = frame2.GetMethod(); - Type reflectedType = method.ReflectedType; - if (reflectedType != null) + + public void PromptListContents(IList list, Type typeExpected) { - stringBuilder.Append(reflectedType.Name); - stringBuilder.Append("."); + this.Prompt(list != null, "Must have valid list", typeof(ArgumentNullException)); + this.Prompt(typeExpected != null, "Must have valid Type", typeof(ArgumentNullException)); + foreach (object obj in (IEnumerable)list) + this.Prompt(obj != null && typeExpected.IsAssignableFrom(obj.GetType()), "List should only contain {0}.", typeExpected); } - else - stringBuilder.Append("::"); - stringBuilder.Append(method.Name); - stringBuilder.Append("\t"); - if (reflectedType != null) + + public void Write(DebugCategory cat, object oValue) { - AssemblyName assemblyName = new AssemblyName(reflectedType.Assembly.FullName); - stringBuilder.Append(assemblyName.Name); + if (!this.IsCategoryEnabled(cat)) + return; + this.WriteWorker(cat, oValue); } - else + + public void WriteLine(DebugCategory cat, object oValue) { - Assembly entryAssembly = Assembly.GetEntryAssembly(); - if (entryAssembly != null) - { - AssemblyName assemblyName = new AssemblyName(entryAssembly.FullName); - stringBuilder.Append(assemblyName.Name); - } - else - stringBuilder.Append(""); + if (!this.IsCategoryEnabled(cat)) + return; + this.WriteLineWorker(cat, oValue); } - stringBuilder.Append("\n"); - stringBuilder.Append("\t"); - } - string str = stringBuilder.ToString(); - this.OpenBrace(DebugCategory.Failure, string.Format("Assert: {0}", (object) stMessage)); - this.WriteLine(DebugCategory.Failure, string.Format("Filename: {0}", (object) filename)); - this.WriteLine(DebugCategory.Failure, string.Format("Line: {0}", (object) fileLineNumber)); - this.OpenBrace(DebugCategory.Failure, string.Format("Stack trace:")); - this.WriteLine(DebugCategory.Failure, string.Format("Frame\tFile Name\tMethod Name\tAssembly", (object) fileLineNumber)); - this.WriteLine(DebugCategory.Failure, str); - this.CloseBrace(DebugCategory.Failure); - this.CloseBrace(DebugCategory.Failure); - return eDebugApi.DebugDisplayErrorStack(stMessage, filename, fileLineNumber, title, str); + + public void Write(DebugCategory cat, byte bLevel, object oValue) + { + if (!this.IsCategoryEnabled(cat, bLevel)) + return; + this.WriteWorker(cat, oValue); + } + + public void WriteLine(DebugCategory cat, byte bLevel, object oValue) + { + if (!this.IsCategoryEnabled(cat, bLevel)) + return; + this.WriteLineWorker(cat, oValue); + } + + public void Write(DebugCategory cat, string stMessage) + { + if (!this.IsCategoryEnabled(cat)) + return; + this.WriteWorker(cat, (object)stMessage); + } + + public void WriteLine(DebugCategory cat, string stMessage) + { + if (!this.IsCategoryEnabled(cat)) + return; + this.WriteLineWorker(cat, (object)stMessage); + } + + public bool TimedWriteLines + { + get => this.m_fTimedWriteLines; + set + { + if (this.m_fTimedWriteLines == value) + return; + this.m_fTimedWriteLines = value; + eDebugApi.DebugSetTimedWriteLines(value); + } + } + + public bool ShowCategories + { + get => this.m_fShowCategories; + set + { + this.m_fShowCategories = value; + if (value) + return; + this.m_nMaxCategoryLength = 0; + } + } + + public bool AlwaysShowBraces + { + get => this.m_fAlwaysShowBraces; + set + { + this.m_fAlwaysShowBraces = value; + if (!value || !this.m_fOpenBracePending) + return; + this.FlushBraces(); + } + } + + public string WriteLinePrefix + { + get => this.m_stWriteLinePrefix; + set => this.m_stWriteLinePrefix = value; + } + + public string RendererWriteLinePrefix + { + get => this.m_stRendererWriteLinePrefix; + set + { + this.m_stRendererWriteLinePrefix = value; + eDebugApi.DebugSetWriteLinePrefix(value); + } + } + + public byte TraceLevelAdjustment + { + get => this.m_bTraceLevelAdjustment; + set => this.m_bTraceLevelAdjustment = value; + } + + public bool IsCategoryEnabled(DebugCategory cat) => false; + + public bool IsCategoryEnabled(DebugCategory cat, byte bLevel) => false; + + internal void EnableCategory(DebugCategory cat, bool fEnable) + { + } + + internal void EnableCategory(DebugCategory cat, byte bLevel) + { + } + + public string IndentString + { + get => this.m_stIndent; + set + { + if (!(this.m_stIndent != value)) + return; + this.m_stIndent = value; + int indentLevel = this.IndentLevel; + this.IndentLevel = 0; + this.IndentLevel = indentLevel; + } + } + + public void Indent(DebugCategory cat) => this.Indent(cat, (byte)1); + + public void Indent(DebugCategory cat, byte bLevel) + { + if (!this.IsCategoryEnabled(cat, bLevel)) + return; + this.Indent(); + } + + public void Unindent(DebugCategory cat) => this.Unindent(cat, (byte)1); + + public void Unindent(DebugCategory cat, byte bLevel) + { + if (!this.IsCategoryEnabled(cat, bLevel)) + return; + this.Unindent(); + } + + public int IndentLevel + { + get => this.m_stackIndentStrings.Count; + set + { + while (this.IndentLevel < value) + this.Indent(); + while (this.IndentLevel > value) + this.Unindent(); + } + } + + public void OpenBrace(DebugCategory cat) => this.OpenBrace(cat, (string)null); + + public void OpenBrace(DebugCategory cat, string stComment) => this.OpenBrace(cat, (byte)1, stComment); + + public void OpenBrace(DebugCategory cat, byte bLevel, string stComment) + { + if (!this.IsCategoryEnabled(cat, bLevel)) + return; + if (this.m_fOpenBracePending) + this.FlushBraces(); + if (stComment != null) + this.WriteLineWorker(cat, (object)stComment); + if (!this.m_fAlwaysShowBraces) + { + this.m_fOpenBracePending = true; + this.m_pendingBraceCategory = cat; + this.m_pendingBraceComment = (string)null; + } + else + { + this.WriteLineWorker(cat, (object)"{"); + this.Indent(); + } + } + + public void DeferOpenBrace(DebugCategory cat) => this.DeferOpenBrace(cat, (string)null); + + public void DeferOpenBrace(DebugCategory cat, string stComment) => this.DeferOpenBrace(cat, (byte)1, stComment); + + public void DeferOpenBrace(DebugCategory cat, byte bLevel, string stComment) + { + if (!this.IsCategoryEnabled(cat, bLevel)) + return; + if (this.m_fOpenBracePending) + this.FlushBraces(); + this.m_fOpenBracePending = true; + this.m_pendingBraceCategory = cat; + this.m_pendingBraceComment = stComment; + } + + public void FlushBraces() + { + if (!this.m_fOpenBracePending) + return; + this.m_fOpenBracePending = false; + bool alwaysShowBraces = this.m_fAlwaysShowBraces; + this.m_fAlwaysShowBraces = true; + this.OpenBrace(this.m_pendingBraceCategory, this.m_pendingBraceComment); + this.m_fAlwaysShowBraces = alwaysShowBraces; + } + + public void CloseBrace(DebugCategory cat) => this.CloseBrace(cat, (byte)1); + + public void CloseBrace(DebugCategory cat, byte bLevel) + { + if (!this.IsCategoryEnabled(cat, bLevel)) + return; + if (this.m_fOpenBracePending && cat == this.m_pendingBraceCategory) + { + this.m_fOpenBracePending = false; + this.m_pendingBraceComment = (string)null; + } + else + { + this.Unindent(); + this.WriteLineWorker(cat, (object)"}"); + } + } + + private bool DisplayStackTrace( + string title, + string stMessage, + StackTrace trace, + int cIgnoreFrames) + { + this.Prompt(trace != null, "Must pass a valid StackTrace", typeof(ArgumentNullException)); + StackFrame frame1 = trace.GetFrame(cIgnoreFrames); + string filename = frame1.GetFileName(); + int fileLineNumber = frame1.GetFileLineNumber(); + if (filename == null) + filename = ""; + StringBuilder stringBuilder = new StringBuilder(10240); + for (int index = cIgnoreFrames; index < trace.FrameCount; ++index) + { + StackFrame frame2 = trace.GetFrame(index); + stringBuilder.Append(frame2.GetILOffset()); + stringBuilder.Append("\t"); + string fileName = frame2.GetFileName(); + if (!string.IsNullOrEmpty(fileName)) + { + stringBuilder.Append(fileName); + stringBuilder.Append(","); + stringBuilder.Append(frame2.GetFileLineNumber()); + } + else + stringBuilder.Append(""); + stringBuilder.Append("\t"); + MethodBase method = frame2.GetMethod(); + Type reflectedType = method.ReflectedType; + if (reflectedType != null) + { + stringBuilder.Append(reflectedType.Name); + stringBuilder.Append("."); + } + else + stringBuilder.Append("::"); + stringBuilder.Append(method.Name); + stringBuilder.Append("\t"); + if (reflectedType != null) + { + AssemblyName assemblyName = new AssemblyName(reflectedType.Assembly.FullName); + stringBuilder.Append(assemblyName.Name); + } + else + { + Assembly entryAssembly = Assembly.GetEntryAssembly(); + if (entryAssembly != null) + { + AssemblyName assemblyName = new AssemblyName(entryAssembly.FullName); + stringBuilder.Append(assemblyName.Name); + } + else + stringBuilder.Append(""); + } + stringBuilder.Append("\n"); + stringBuilder.Append("\t"); + } + string str = stringBuilder.ToString(); + this.OpenBrace(DebugCategory.Failure, string.Format("Assert: {0}", (object)stMessage)); + this.WriteLine(DebugCategory.Failure, string.Format("Filename: {0}", (object)filename)); + this.WriteLine(DebugCategory.Failure, string.Format("Line: {0}", (object)fileLineNumber)); + this.OpenBrace(DebugCategory.Failure, string.Format("Stack trace:")); + this.WriteLine(DebugCategory.Failure, string.Format("Frame\tFile Name\tMethod Name\tAssembly", (object)fileLineNumber)); + this.WriteLine(DebugCategory.Failure, str); + this.CloseBrace(DebugCategory.Failure); + this.CloseBrace(DebugCategory.Failure); + return eDebugApi.DebugDisplayErrorStack(stMessage, filename, fileLineNumber, title, str); + } + + private string CurrentIndentString => this.m_stackIndentStrings.Count == 0 ? string.Empty : (string)this.m_stackIndentStrings.Peek(); + + private void WriteWorker(DebugCategory cat, object oValue) + { + string str1 = (string)null; + if (oValue != null) + str1 = oValue.ToString(); + this.m_stPendingWrite += str1; + if (this.m_stPendingWrite == null) + return; + int length1 = this.m_stPendingWrite.LastIndexOf('\n'); + if (length1 <= 0) + return; + int length2 = this.m_stPendingWrite.Length - length1 - 1; + if (length2 > 0) + { + string str2 = this.m_stPendingWrite.Substring(0, length1); + string str3 = this.m_stPendingWrite.Substring(length1 + 1, length2); + this.m_stPendingWrite = (string)null; + this.WriteLineWorker(cat, (object)str2); + this.m_stPendingWrite = str3; + } + else + { + string str2 = this.m_stPendingWrite.Substring(0, this.m_stPendingWrite.Length - 1); + this.m_stPendingWrite = (string)null; + this.WriteLineWorker(cat, (object)str2); + } + } + + private void WriteLineWorker(DebugCategory cat, object oValue) + { + if (this.m_fOpenBracePending) + this.FlushBraces(); + string str1 = (string)null; + if (this.ShowCategories) + { + str1 = string.Format("[{0}] ", (object)cat); + int length = str1.Length; + if (this.m_nMaxCategoryLength > length) + str1 = str1.PadLeft(this.m_nMaxCategoryLength); + else if (this.m_nMaxCategoryLength < length) + this.m_nMaxCategoryLength = length; + } + string str2 = this.m_stPendingWrite + oValue; + this.m_stPendingWrite = (string)null; + string str3 = str2; + char[] chArray = new char[1] { '\n' }; + foreach (string str4 in str3.Split(chArray)) + { + string lpOutputString = this.WriteLinePrefix + str1 + this.CurrentIndentString + str4 + "\n"; + if (this.TimedWriteLines) + lpOutputString = this.PrefixCurrentTime((object)lpOutputString); + Win32Api.OutputDebugString(lpOutputString); + } + } + + private void Indent() => this.m_stackIndentStrings.Push((object)(this.CurrentIndentString + this.m_stIndent)); + + private void Unindent() + { + if (this.m_stackIndentStrings.Count <= 0) + return; + this.m_stackIndentStrings.Pop(); + } + + private string PrefixCurrentTime(object oValue) => oValue.ToString(); } - - private string CurrentIndentString => this.m_stackIndentStrings.Count == 0 ? string.Empty : (string) this.m_stackIndentStrings.Peek(); - - private void WriteWorker(DebugCategory cat, object oValue) - { - string str1 = (string) null; - if (oValue != null) - str1 = oValue.ToString(); - this.m_stPendingWrite += str1; - if (this.m_stPendingWrite == null) - return; - int length1 = this.m_stPendingWrite.LastIndexOf('\n'); - if (length1 <= 0) - return; - int length2 = this.m_stPendingWrite.Length - length1 - 1; - if (length2 > 0) - { - string str2 = this.m_stPendingWrite.Substring(0, length1); - string str3 = this.m_stPendingWrite.Substring(length1 + 1, length2); - this.m_stPendingWrite = (string) null; - this.WriteLineWorker(cat, (object) str2); - this.m_stPendingWrite = str3; - } - else - { - string str2 = this.m_stPendingWrite.Substring(0, this.m_stPendingWrite.Length - 1); - this.m_stPendingWrite = (string) null; - this.WriteLineWorker(cat, (object) str2); - } - } - - private void WriteLineWorker(DebugCategory cat, object oValue) - { - if (this.m_fOpenBracePending) - this.FlushBraces(); - string str1 = (string) null; - if (this.ShowCategories) - { - str1 = string.Format("[{0}] ", (object) cat); - int length = str1.Length; - if (this.m_nMaxCategoryLength > length) - str1 = str1.PadLeft(this.m_nMaxCategoryLength); - else if (this.m_nMaxCategoryLength < length) - this.m_nMaxCategoryLength = length; - } - string str2 = this.m_stPendingWrite + oValue; - this.m_stPendingWrite = (string) null; - string str3 = str2; - char[] chArray = new char[1]{ '\n' }; - foreach (string str4 in str3.Split(chArray)) - { - string lpOutputString = this.WriteLinePrefix + str1 + this.CurrentIndentString + str4 + "\n"; - if (this.TimedWriteLines) - lpOutputString = this.PrefixCurrentTime((object) lpOutputString); - Win32Api.OutputDebugString(lpOutputString); - } - } - - private void Indent() => this.m_stackIndentStrings.Push((object) (this.CurrentIndentString + this.m_stIndent)); - - private void Unindent() - { - if (this.m_stackIndentStrings.Count <= 0) - return; - this.m_stackIndentStrings.Pop(); - } - - private string PrefixCurrentTime(object oValue) => oValue.ToString(); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/eDebugApi.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/eDebugApi.cs index 462845e..399ce7d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/eDebugApi.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Extensions/eDebugApi.cs @@ -11,34 +11,34 @@ using System.Security; namespace Microsoft.Iris.Render.Extensions { - [SuppressUnmanagedCodeSecurity] - internal static class eDebugApi - { - private const string k_strEhDebugDllFileName = "UIXsup.dll"; - - static eDebugApi() + [SuppressUnmanagedCodeSecurity] + internal static class eDebugApi { - IntPtr h = Win32Api.LoadLibraryEx("UIXsup.dll", Win32Api.HANDLE.NULL, 0U).h; + private const string k_strEhDebugDllFileName = "UIXsup.dll"; + + static eDebugApi() + { + IntPtr h = Win32Api.LoadLibraryEx("UIXsup.dll", Win32Api.HANDLE.NULL, 0U).h; + } + + [DllImport("UIXsup.dll")] + internal static extern bool DebugDisplayErrorStack( + string stMessage, + string filename, + int line, + string title, + string stackTrace); + + [DllImport("UIXsup.dll")] + internal static extern void DebugSetTimedWriteLines(bool fEnabled); + + [DllImport("UIXsup.dll")] + internal static extern void DebugSetWriteLinePrefix(string stPrefix); + + [DllImport("UIXsup.dll")] + internal static extern byte DebugGetCategoryLevel(DebugCategory cat); + + [DllImport("UIXsup.dll")] + internal static extern void DebugSetCategoryLevel(DebugCategory cat, byte level); } - - [DllImport("UIXsup.dll")] - internal static extern bool DebugDisplayErrorStack( - string stMessage, - string filename, - int line, - string title, - string stackTrace); - - [DllImport("UIXsup.dll")] - internal static extern void DebugSetTimedWriteLines(bool fEnabled); - - [DllImport("UIXsup.dll")] - internal static extern void DebugSetWriteLinePrefix(string stPrefix); - - [DllImport("UIXsup.dll")] - internal static extern byte DebugGetCategoryLevel(DebugCategory cat); - - [DllImport("UIXsup.dll")] - internal static extern void DebugSetCategoryLevel(DebugCategory cat, byte level); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/FilterMode.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/FilterMode.cs index 2472c25..829c2fd 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/FilterMode.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/FilterMode.cs @@ -6,9 +6,9 @@ namespace Microsoft.Iris.Render { - public enum FilterMode : byte - { - Point = 1, - Linear = 2, - } + public enum FilterMode : byte + { + Point = 1, + Linear = 2, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormCloseReason.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormCloseReason.cs index e5240d9..6f4e5a7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormCloseReason.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormCloseReason.cs @@ -6,13 +6,13 @@ namespace Microsoft.Iris.Render { - public enum FormCloseReason - { - Unknown = -1, // 0xFFFFFFFF - ForcedClose = 0, - UserRequest = 1, - AutoRestart = 2, - RendererRequest = 3, - GenericError = 4, - } + public enum FormCloseReason + { + Unknown = -1, // 0xFFFFFFFF + ForcedClose = 0, + UserRequest = 1, + AutoRestart = 2, + RendererRequest = 3, + GenericError = 4, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormPlacement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormPlacement.cs index 7f8a7e0..fa668bb 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormPlacement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormPlacement.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render { - public struct FormPlacement - { - public Rectangle NormalPosition; - public Point MaximizedLocation; - public uint ShowState; - } + public struct FormPlacement + { + public Rectangle NormalPosition; + public Point MaximizedLocation; + public uint ShowState; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormStyleInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormStyleInfo.cs index 1bf0681..81fbf13 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormStyleInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/FormStyleInfo.cs @@ -6,23 +6,23 @@ namespace Microsoft.Iris.Render { - public struct FormStyleInfo - { - public uint uStyleRestored; - public uint uExStyleRestored; - public uint uStyleMinimized; - public uint uExStyleMinimized; - public uint uStyleMaximized; - public uint uExStyleMaximized; - public uint uStyleFullscreen; - public uint uExStyleFullscreen; + public struct FormStyleInfo + { + public uint uStyleRestored; + public uint uExStyleRestored; + public uint uStyleMinimized; + public uint uExStyleMinimized; + public uint uStyleMaximized; + public uint uExStyleMaximized; + public uint uStyleFullscreen; + public uint uExStyleFullscreen; - public override bool Equals(object o) => o is FormStyleInfo formStyleInfo && (int) this.uStyleRestored == (int) formStyleInfo.uStyleRestored && ((int) this.uExStyleRestored == (int) formStyleInfo.uExStyleRestored && (int) this.uStyleMinimized == (int) formStyleInfo.uStyleMinimized) && ((int) this.uExStyleMinimized == (int) formStyleInfo.uExStyleMinimized && (int) this.uStyleMaximized == (int) formStyleInfo.uStyleMaximized && ((int) this.uExStyleMaximized == (int) formStyleInfo.uExStyleMaximized && (int) this.uStyleFullscreen == (int) formStyleInfo.uStyleFullscreen)) && (int) this.uExStyleFullscreen == (int) formStyleInfo.uExStyleFullscreen; + public override bool Equals(object o) => o is FormStyleInfo formStyleInfo && (int)this.uStyleRestored == (int)formStyleInfo.uStyleRestored && ((int)this.uExStyleRestored == (int)formStyleInfo.uExStyleRestored && (int)this.uStyleMinimized == (int)formStyleInfo.uStyleMinimized) && ((int)this.uExStyleMinimized == (int)formStyleInfo.uExStyleMinimized && (int)this.uStyleMaximized == (int)formStyleInfo.uStyleMaximized && ((int)this.uExStyleMaximized == (int)formStyleInfo.uExStyleMaximized && (int)this.uStyleFullscreen == (int)formStyleInfo.uStyleFullscreen)) && (int)this.uExStyleFullscreen == (int)formStyleInfo.uExStyleFullscreen; - public override int GetHashCode() => (int) this.uStyleRestored ^ (int) this.uExStyleRestored; + public override int GetHashCode() => (int)this.uStyleRestored ^ (int)this.uExStyleRestored; - public static bool operator ==(FormStyleInfo fsi1, FormStyleInfo fsi2) => fsi1.Equals((object) fsi2); + public static bool operator ==(FormStyleInfo fsi1, FormStyleInfo fsi2) => fsi1.Equals((object)fsi2); - public static bool operator !=(FormStyleInfo fsi1, FormStyleInfo fsi2) => !(fsi1 == fsi2); - } + public static bool operator !=(FormStyleInfo fsi1, FormStyleInfo fsi2) => !(fsi1 == fsi2); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ForwardMessageHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ForwardMessageHandler.cs index 4773d76..f29f106 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ForwardMessageHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ForwardMessageHandler.cs @@ -8,5 +8,5 @@ using System; namespace Microsoft.Iris.Render { - public delegate void ForwardMessageHandler(uint msg, IntPtr wParam, IntPtr lParam); + public delegate void ForwardMessageHandler(uint msg, IntPtr wParam, IntPtr lParam); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/GaussianBlurElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/GaussianBlurElement.cs index 8be7920..bbfde0b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/GaussianBlurElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/GaussianBlurElement.cs @@ -10,75 +10,75 @@ using System; namespace Microsoft.Iris.Render { - public class GaussianBlurElement : EffectOperation - { - internal const string ModePropertyName = "Mode"; - internal const string KernelRadiusPropertyName = "KernelRadius"; - internal const string BlurinessPropertyName = "Bluriness"; - private GaussianBlurMode m_blurMode; - private byte m_nModeID; - private int m_nKernelRadius; - private byte m_nKernelRadiusID; - private float m_flBluriness; - private byte m_nBlurinessID; - - public GaussianBlurElement(GaussianBlurMode blurMode, int nKernalRadius, float flBluriness) + public class GaussianBlurElement : EffectOperation { - Debug2.Validate((double) flBluriness > 0.0 && (double) flBluriness <= 6.0, typeof (ArgumentOutOfRangeException), "Valid range for Bluriness is (0,6]"); - Debug2.Validate(nKernalRadius >= 1 && nKernalRadius <= 6, typeof (ArgumentOutOfRangeException), "Valid range for KernelRadius is [1,6]"); - this.m_blurMode = blurMode; - this.m_nKernelRadius = nKernalRadius; - this.m_flBluriness = flBluriness; - this.m_typeOperation = EffectOperationType.GaussianBlur; - } + internal const string ModePropertyName = "Mode"; + internal const string KernelRadiusPropertyName = "KernelRadius"; + internal const string BlurinessPropertyName = "Bluriness"; + private GaussianBlurMode m_blurMode; + private byte m_nModeID; + private int m_nKernelRadius; + private byte m_nKernelRadiusID; + private float m_flBluriness; + private byte m_nBlurinessID; - public GaussianBlurElement() - { - this.m_blurMode = GaussianBlurMode.Normal; - this.m_nKernelRadius = 1; - this.m_flBluriness = 1.5f; - this.m_typeOperation = EffectOperationType.GaussianBlur; - } + public GaussianBlurElement(GaussianBlurMode blurMode, int nKernalRadius, float flBluriness) + { + Debug2.Validate((double)flBluriness > 0.0 && (double)flBluriness <= 6.0, typeof(ArgumentOutOfRangeException), "Valid range for Bluriness is (0,6]"); + Debug2.Validate(nKernalRadius >= 1 && nKernalRadius <= 6, typeof(ArgumentOutOfRangeException), "Valid range for KernelRadius is [1,6]"); + this.m_blurMode = blurMode; + this.m_nKernelRadius = nKernalRadius; + this.m_flBluriness = flBluriness; + this.m_typeOperation = EffectOperationType.GaussianBlur; + } - public GaussianBlurMode Mode - { - get => this.m_blurMode; - set => this.m_blurMode = value; - } + public GaussianBlurElement() + { + this.m_blurMode = GaussianBlurMode.Normal; + this.m_nKernelRadius = 1; + this.m_flBluriness = 1.5f; + this.m_typeOperation = EffectOperationType.GaussianBlur; + } - public int KernelRadius - { - get => this.m_nKernelRadius; - set - { - Debug2.Validate(value >= 1 && value <= 6, typeof (ArgumentOutOfRangeException), "Valid range for KernelRadius is [1,6]"); - this.m_nKernelRadius = value; - } - } + public GaussianBlurMode Mode + { + get => this.m_blurMode; + set => this.m_blurMode = value; + } - public float Bluriness - { - get => this.m_flBluriness; - set - { - Debug2.Validate((double) value > 0.0 && (double) value <= 6.0, typeof (ArgumentOutOfRangeException), "Valid range for Bluriness is (0,6]"); - this.m_flBluriness = value; - } - } + public int KernelRadius + { + get => this.m_nKernelRadius; + set + { + Debug2.Validate(value >= 1 && value <= 6, typeof(ArgumentOutOfRangeException), "Valid range for KernelRadius is [1,6]"); + this.m_nKernelRadius = value; + } + } - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Mode", (byte) 5, ref this.m_nModeID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "KernelRadius", (byte) 5, ref this.m_nKernelRadiusID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Bluriness", (byte) 8, ref this.m_nBlurinessID, ref nNextUniqueID); - } + public float Bluriness + { + get => this.m_flBluriness; + set + { + Debug2.Validate((double)value > 0.0 && (double)value <= 6.0, typeof(ArgumentOutOfRangeException), "Valid range for Bluriness is (0,6]"); + this.m_flBluriness = value; + } + } - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Mode", this.m_nModeID, (byte) this.m_blurMode, cacheKey); - this.GeneratePropertyCacheKey("KernelRadius", this.m_nKernelRadiusID, this.m_nKernelRadius, cacheKey); - this.GeneratePropertyCacheKey("Bluriness", this.m_nBlurinessID, this.m_flBluriness, cacheKey); + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Mode", (byte)5, ref this.m_nModeID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "KernelRadius", (byte)5, ref this.m_nKernelRadiusID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Bluriness", (byte)8, ref this.m_nBlurinessID, ref nNextUniqueID); + } + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Mode", this.m_nModeID, (byte)this.m_blurMode, cacheKey); + this.GeneratePropertyCacheKey("KernelRadius", this.m_nKernelRadiusID, this.m_nKernelRadius, cacheKey); + this.GeneratePropertyCacheKey("Bluriness", this.m_nBlurinessID, this.m_flBluriness, cacheKey); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/GaussianBlurMode.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/GaussianBlurMode.cs index c7a77f1..9d11a76 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/GaussianBlurMode.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/GaussianBlurMode.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render { - public enum GaussianBlurMode - { - Normal, - Horizontal, - Vertical, - } + public enum GaussianBlurMode + { + Normal, + Horizontal, + Vertical, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/AncestorEnumerator.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/AncestorEnumerator.cs index 9df6192..78ecb2f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/AncestorEnumerator.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/AncestorEnumerator.cs @@ -8,40 +8,40 @@ using System.Collections; namespace Microsoft.Iris.Render.Graphics { - internal struct AncestorEnumerator : IEnumerator, IEnumerable - { - private TreeNode m_nodeStart; - private TreeNode m_nodeCurrent; - private TreeNode m_nodeNext; - - internal AncestorEnumerator(TreeNode nodeStart) + internal struct AncestorEnumerator : IEnumerator, IEnumerable { - this.m_nodeStart = nodeStart; - this.m_nodeCurrent = (TreeNode) null; - this.m_nodeNext = this.m_nodeStart; + private TreeNode m_nodeStart; + private TreeNode m_nodeCurrent; + private TreeNode m_nodeNext; + + internal AncestorEnumerator(TreeNode nodeStart) + { + this.m_nodeStart = nodeStart; + this.m_nodeCurrent = (TreeNode)null; + this.m_nodeNext = this.m_nodeStart; + } + + object IEnumerator.Current => (object)this.m_nodeCurrent; + + public TreeNode Current => this.m_nodeCurrent; + + IEnumerator IEnumerable.GetEnumerator() => (IEnumerator)this; + + public AncestorEnumerator GetEnumerator() => this; + + public void Reset() + { + this.m_nodeCurrent = (TreeNode)null; + this.m_nodeNext = this.m_nodeStart; + } + + public bool MoveNext() + { + this.m_nodeCurrent = this.m_nodeNext; + if (this.m_nodeNext == null) + return false; + this.m_nodeNext = this.m_nodeNext.Parent; + return true; + } } - - object IEnumerator.Current => (object) this.m_nodeCurrent; - - public TreeNode Current => this.m_nodeCurrent; - - IEnumerator IEnumerable.GetEnumerator() => (IEnumerator) this; - - public AncestorEnumerator GetEnumerator() => this; - - public void Reset() - { - this.m_nodeCurrent = (TreeNode) null; - this.m_nodeNext = this.m_nodeStart; - } - - public bool MoveNext() - { - this.m_nodeCurrent = this.m_nodeNext; - if (this.m_nodeNext == null) - return false; - this.m_nodeNext = this.m_nodeNext.Parent; - return true; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Camera.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Camera.cs index 5bf64d1..d139c4e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Camera.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Camera.cs @@ -13,173 +13,173 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal class Camera : - SharedRenderObject, - ICamera, - IAnimatableObject, - IAnimatable, - ISharedRenderObject, - IRenderHandleOwner - { - public static readonly string EyeProperty = "CameraEye"; - public static readonly string AtProperty = "CameraAt"; - public static readonly string UpProperty = "CameraUp"; - public static readonly string ZnProperty = "CameraZn"; - private RenderSession m_session; - private RemoteCamera m_remoteCamera; - private Vector3 m_vEye; - private Vector3 m_vAt; - private Vector3 m_vUp; - private float m_flZn; - private bool m_fPerspective; - - internal Camera(RenderSession session) + internal class Camera : + SharedRenderObject, + ICamera, + IAnimatableObject, + IAnimatable, + ISharedRenderObject, + IRenderHandleOwner { - this.m_session = session; - Debug2.Validate(this.m_session != null, typeof (ArgumentNullException), "Must have valid RenderSession"); - this.m_session.AssertOwningThread(); - this.m_remoteCamera = this.m_session.BuildRemoteCamera(this); - this.SetEye(new Vector3(0.0, 0.0, -4.0)); - this.SetAt(new Vector3(0.0, 0.0, 0.0)); - this.SetUp(new Vector3(0.0, 1.0, 0.0)); - this.SetZn(2f); - this.SetPerspective(true); + public static readonly string EyeProperty = "CameraEye"; + public static readonly string AtProperty = "CameraAt"; + public static readonly string UpProperty = "CameraUp"; + public static readonly string ZnProperty = "CameraZn"; + private RenderSession m_session; + private RemoteCamera m_remoteCamera; + private Vector3 m_vEye; + private Vector3 m_vAt; + private Vector3 m_vUp; + private float m_flZn; + private bool m_fPerspective; + + internal Camera(RenderSession session) + { + this.m_session = session; + Debug2.Validate(this.m_session != null, typeof(ArgumentNullException), "Must have valid RenderSession"); + this.m_session.AssertOwningThread(); + this.m_remoteCamera = this.m_session.BuildRemoteCamera(this); + this.SetEye(new Vector3(0.0, 0.0, -4.0)); + this.SetAt(new Vector3(0.0, 0.0, 0.0)); + this.SetUp(new Vector3(0.0, 1.0, 0.0)); + this.SetZn(2f); + this.SetPerspective(true); + } + + protected override void Dispose(bool fInDispose) + { + try + { + if (!fInDispose || this.m_remoteCamera == null) + return; + this.m_remoteCamera.Dispose(); + this.m_remoteCamera = (RemoteCamera)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteCamera.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteCamera = (RemoteCamera)null; + + internal RemoteCamera RemoteStub => this.m_remoteCamera; + + Vector3 ICamera.Eye + { + get => this.m_vEye; + set => this.SetEye(value); + } + + Vector3 ICamera.At + { + get => this.m_vAt; + set => this.SetAt(value); + } + + Vector3 ICamera.Up + { + get => this.m_vUp; + set => this.SetUp(value); + } + + float ICamera.Zn + { + get => this.m_flZn; + set => this.SetZn(value); + } + + bool ICamera.Perspective + { + get => this.m_fPerspective; + set => this.SetPerspective(value); + } + + private void SetEye(Vector3 vEye) + { + if (!(this.m_vEye != vEye)) + return; + this.m_vEye = vEye; + if (!this.m_session.IsValid || !this.m_remoteCamera.IsValid) + return; + this.m_remoteCamera.SendSetEye(vEye); + } + + private void SetAt(Vector3 vAt) + { + if (!(this.m_vAt != vAt)) + return; + this.m_vAt = vAt; + if (!this.m_session.IsValid || !this.m_remoteCamera.IsValid) + return; + this.m_remoteCamera.SendSetAt(vAt); + } + + private void SetUp(Vector3 vUp) + { + if (!(this.m_vUp != vUp)) + return; + this.m_vUp = vUp; + if (!this.m_session.IsValid || !this.m_remoteCamera.IsValid) + return; + this.m_remoteCamera.SendSetUp(vUp); + } + + private void SetZn(float flZn) + { + if ((double)this.m_flZn == (double)flZn) + return; + this.m_flZn = flZn; + if (!this.m_session.IsValid || !this.m_remoteCamera.IsValid) + return; + this.m_remoteCamera.SendSetZn(flZn); + } + + private void SetPerspective(bool fPerspective) + { + if (this.m_fPerspective == fPerspective) + return; + this.m_fPerspective = fPerspective; + if (!this.m_session.IsValid || !this.m_remoteCamera.IsValid) + return; + this.m_remoteCamera.SendSetPerspective(fPerspective); + } + + RENDERHANDLE IAnimatableObject.GetObjectId() => ((IRenderHandleOwner)this).RenderHandle; + + uint IAnimatableObject.GetPropertyId(string propertyName) + { + if (propertyName == Camera.EyeProperty) + return 1; + if (propertyName == Camera.AtProperty) + return 2; + if (propertyName == Camera.UpProperty) + return 3; + if (propertyName == Camera.ZnProperty) + return 4; + Debug2.Validate(false, typeof(ArgumentException), "Unsupported property"); + return 0; + } + + AnimationInputType IAnimatableObject.GetPropertyType( + string propertyName) + { + if (propertyName == Camera.EyeProperty || propertyName == Camera.AtProperty || propertyName == Camera.UpProperty) + return AnimationInputType.Vector3; + if (propertyName == Camera.ZnProperty) + return AnimationInputType.Float; + Debug2.Validate(false, typeof(ArgumentException), "Unsupported property"); + return AnimationInputType.Float; + } + + private enum AnimatableProperties : uint + { + Eye = 1, + At = 2, + Up = 3, + Zn = 4, + } } - - protected override void Dispose(bool fInDispose) - { - try - { - if (!fInDispose || this.m_remoteCamera == null) - return; - this.m_remoteCamera.Dispose(); - this.m_remoteCamera = (RemoteCamera) null; - } - finally - { - base.Dispose(fInDispose); - } - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteCamera.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteCamera = (RemoteCamera) null; - - internal RemoteCamera RemoteStub => this.m_remoteCamera; - - Vector3 ICamera.Eye - { - get => this.m_vEye; - set => this.SetEye(value); - } - - Vector3 ICamera.At - { - get => this.m_vAt; - set => this.SetAt(value); - } - - Vector3 ICamera.Up - { - get => this.m_vUp; - set => this.SetUp(value); - } - - float ICamera.Zn - { - get => this.m_flZn; - set => this.SetZn(value); - } - - bool ICamera.Perspective - { - get => this.m_fPerspective; - set => this.SetPerspective(value); - } - - private void SetEye(Vector3 vEye) - { - if (!(this.m_vEye != vEye)) - return; - this.m_vEye = vEye; - if (!this.m_session.IsValid || !this.m_remoteCamera.IsValid) - return; - this.m_remoteCamera.SendSetEye(vEye); - } - - private void SetAt(Vector3 vAt) - { - if (!(this.m_vAt != vAt)) - return; - this.m_vAt = vAt; - if (!this.m_session.IsValid || !this.m_remoteCamera.IsValid) - return; - this.m_remoteCamera.SendSetAt(vAt); - } - - private void SetUp(Vector3 vUp) - { - if (!(this.m_vUp != vUp)) - return; - this.m_vUp = vUp; - if (!this.m_session.IsValid || !this.m_remoteCamera.IsValid) - return; - this.m_remoteCamera.SendSetUp(vUp); - } - - private void SetZn(float flZn) - { - if ((double) this.m_flZn == (double) flZn) - return; - this.m_flZn = flZn; - if (!this.m_session.IsValid || !this.m_remoteCamera.IsValid) - return; - this.m_remoteCamera.SendSetZn(flZn); - } - - private void SetPerspective(bool fPerspective) - { - if (this.m_fPerspective == fPerspective) - return; - this.m_fPerspective = fPerspective; - if (!this.m_session.IsValid || !this.m_remoteCamera.IsValid) - return; - this.m_remoteCamera.SendSetPerspective(fPerspective); - } - - RENDERHANDLE IAnimatableObject.GetObjectId() => ((IRenderHandleOwner) this).RenderHandle; - - uint IAnimatableObject.GetPropertyId(string propertyName) - { - if (propertyName == Camera.EyeProperty) - return 1; - if (propertyName == Camera.AtProperty) - return 2; - if (propertyName == Camera.UpProperty) - return 3; - if (propertyName == Camera.ZnProperty) - return 4; - Debug2.Validate(false, typeof (ArgumentException), "Unsupported property"); - return 0; - } - - AnimationInputType IAnimatableObject.GetPropertyType( - string propertyName) - { - if (propertyName == Camera.EyeProperty || propertyName == Camera.AtProperty || propertyName == Camera.UpProperty) - return AnimationInputType.Vector3; - if (propertyName == Camera.ZnProperty) - return AnimationInputType.Float; - Debug2.Validate(false, typeof (ArgumentException), "Unsupported property"); - return AnimationInputType.Float; - } - - private enum AnimatableProperties : uint - { - Eye = 1, - At = 2, - Up = 3, - Zn = 4, - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DataBufferCleanupInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DataBufferCleanupInfo.cs index 3c532e9..e2166fd 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DataBufferCleanupInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DataBufferCleanupInfo.cs @@ -8,9 +8,9 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal class DataBufferCleanupInfo - { - public IntPtr rgConvertData; - public ImageLoadInfo imageLoadInfo; - } + internal class DataBufferCleanupInfo + { + public IntPtr rgConvertData; + public ImageLoadInfo imageLoadInfo; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9BlendElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9BlendElement.cs index 8e31f9b..983c4da 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9BlendElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9BlendElement.cs @@ -9,84 +9,84 @@ using Microsoft.Iris.Render.Common; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9BlendElement - { - internal static void Generate( - BlendElement efiBlend, - string stBlendOutput1, - string stBlendOutput2, - ref Dx9EffectBuilder effectBuilder) + internal class Dx9BlendElement { - effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiBlend.Name); - string str1 = (string) null; - switch (efiBlend.ColorOperation) - { - case ColorOperation.Add: - str1 = InvariantString.Format(" // Blend the RGB - result\r\n float4 {0};\r\n {0}.rgb = {1}.rgb + {2}.rgb;\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case ColorOperation.Subtract: - str1 = InvariantString.Format(" // Blend the RGB - result\r\n float4 {0};\r\n {0}.rgb = float3(abs({1}.rgb - {2}.rgb));\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case ColorOperation.Multiply: - str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = {1}.rgb * {2}.rgb;\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case ColorOperation.Lighten: - str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = max({1}.rgb, {2}.rgb);\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case ColorOperation.Darken: - str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = min({1}.rgb, {2}.rgb);\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case ColorOperation.ColorDodge: - str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = {1}.rgb / (1 - {2}.rgb);\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case ColorOperation.ColorBurn: - str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = 1 - ((1 - {1}.rgb) / {2}.rgb);\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case ColorOperation.Screen: - str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = 1 - ((1 - {1}.rgb) * (1 - {2}.rgb));\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case ColorOperation.Overlay: - string localVariable1 = effectBuilder.GenerateLocalVariable(Dx9VariableType.Float, "trueClause"); - str1 = InvariantString.Format(" // Blend the RGB result\r\n float3 {3} = ceil({1}.rgb - 0.5);\r\n float4 {0};\r\n {0}.rgb = {3}.rgb * (1 - (1 - 2 * ({1}.rgb - 0.5)) * (1 - {2}.rgb)) \r\n + (1 - {3}.rgb) * (2 * {1}.rgb * {2}.rgb);\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2, (object) localVariable1); - break; - case ColorOperation.SoftLight: - string localVariable2 = effectBuilder.GenerateLocalVariable(Dx9VariableType.Float, "trueClause"); - str1 = InvariantString.Format(" // Blend the RGB result\r\n float3 {3} = ceil({2}.rgb - 0.5);\r\n float4 {0};\r\n {0}.rgb = {3}.rgb * (1 - (2 * (1 - (({1}.rgb / 2) + 0.25)) * (1 - {2}.rgb)))\r\n + (1 - {3}.rgb) * (2 * ({1}.rgb / 2 + 0.25) * {2}.rgb);\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2, (object) localVariable2); - break; - case ColorOperation.HardLight: - string localVariable3 = effectBuilder.GenerateLocalVariable(Dx9VariableType.Float, "trueClause"); - str1 = InvariantString.Format(" // Blend the RGB result\r\n float3 {3} = ceil({2}.rgb - 0.5);\r\n float4 {0};\r\n {0}.rgb = {3}.rgb * (1 - (1 - 2 * ({2}.rgb - 0.5)) * (1 - {1}.rgb)) \r\n + (1 - {3}.rgb) * (2 * {1}.rgb * {2}.rgb);\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2, (object) localVariable3); - break; - case ColorOperation.LinearBurn: - str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = {1}.rgb + {2}.rgb - 1;\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - default: - Debug2.Throw(false, "Unknown color blend operation"); - break; - } - string str2 = (string) null; - switch (efiBlend.AlphaOperation) - { - case AlphaOperation.Add: - str2 = InvariantString.Format(" // Blend the Alpha result\r\n {0}.a = {1}.a + {2}.a;\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case AlphaOperation.Subtract: - str2 = InvariantString.Format(" // Blend the Alpha result\r\n {0}.a = {1}.a - {2}.a;\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case AlphaOperation.Multiply: - str2 = InvariantString.Format(" // Blend the Alpha result\r\n {0}.a = {1}.a * {2}.a;\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1, (object) stBlendOutput2); - break; - case AlphaOperation.Source1: - str2 = InvariantString.Format(" // Blend the Alpha result\r\n {0}.a = {1}.a;\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput1); - break; - case AlphaOperation.Source2: - str2 = InvariantString.Format(" // Blend the Alpha result\r\n {0}.a = {1}.a;\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) stBlendOutput2); - break; - default: - Debug2.Throw(false, "Unknown alpha blend operation"); - break; - } - effectBuilder.EmitPixelFragment(str1 + str2); + internal static void Generate( + BlendElement efiBlend, + string stBlendOutput1, + string stBlendOutput2, + ref Dx9EffectBuilder effectBuilder) + { + effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiBlend.Name); + string str1 = (string)null; + switch (efiBlend.ColorOperation) + { + case ColorOperation.Add: + str1 = InvariantString.Format(" // Blend the RGB - result\r\n float4 {0};\r\n {0}.rgb = {1}.rgb + {2}.rgb;\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case ColorOperation.Subtract: + str1 = InvariantString.Format(" // Blend the RGB - result\r\n float4 {0};\r\n {0}.rgb = float3(abs({1}.rgb - {2}.rgb));\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case ColorOperation.Multiply: + str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = {1}.rgb * {2}.rgb;\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case ColorOperation.Lighten: + str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = max({1}.rgb, {2}.rgb);\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case ColorOperation.Darken: + str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = min({1}.rgb, {2}.rgb);\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case ColorOperation.ColorDodge: + str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = {1}.rgb / (1 - {2}.rgb);\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case ColorOperation.ColorBurn: + str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = 1 - ((1 - {1}.rgb) / {2}.rgb);\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case ColorOperation.Screen: + str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = 1 - ((1 - {1}.rgb) * (1 - {2}.rgb));\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case ColorOperation.Overlay: + string localVariable1 = effectBuilder.GenerateLocalVariable(Dx9VariableType.Float, "trueClause"); + str1 = InvariantString.Format(" // Blend the RGB result\r\n float3 {3} = ceil({1}.rgb - 0.5);\r\n float4 {0};\r\n {0}.rgb = {3}.rgb * (1 - (1 - 2 * ({1}.rgb - 0.5)) * (1 - {2}.rgb)) \r\n + (1 - {3}.rgb) * (2 * {1}.rgb * {2}.rgb);\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2, (object)localVariable1); + break; + case ColorOperation.SoftLight: + string localVariable2 = effectBuilder.GenerateLocalVariable(Dx9VariableType.Float, "trueClause"); + str1 = InvariantString.Format(" // Blend the RGB result\r\n float3 {3} = ceil({2}.rgb - 0.5);\r\n float4 {0};\r\n {0}.rgb = {3}.rgb * (1 - (2 * (1 - (({1}.rgb / 2) + 0.25)) * (1 - {2}.rgb)))\r\n + (1 - {3}.rgb) * (2 * ({1}.rgb / 2 + 0.25) * {2}.rgb);\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2, (object)localVariable2); + break; + case ColorOperation.HardLight: + string localVariable3 = effectBuilder.GenerateLocalVariable(Dx9VariableType.Float, "trueClause"); + str1 = InvariantString.Format(" // Blend the RGB result\r\n float3 {3} = ceil({2}.rgb - 0.5);\r\n float4 {0};\r\n {0}.rgb = {3}.rgb * (1 - (1 - 2 * ({2}.rgb - 0.5)) * (1 - {1}.rgb)) \r\n + (1 - {3}.rgb) * (2 * {1}.rgb * {2}.rgb);\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2, (object)localVariable3); + break; + case ColorOperation.LinearBurn: + str1 = InvariantString.Format(" // Blend the RGB result\r\n float4 {0};\r\n {0}.rgb = {1}.rgb + {2}.rgb - 1;\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + default: + Debug2.Throw(false, "Unknown color blend operation"); + break; + } + string str2 = (string)null; + switch (efiBlend.AlphaOperation) + { + case AlphaOperation.Add: + str2 = InvariantString.Format(" // Blend the Alpha result\r\n {0}.a = {1}.a + {2}.a;\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case AlphaOperation.Subtract: + str2 = InvariantString.Format(" // Blend the Alpha result\r\n {0}.a = {1}.a - {2}.a;\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case AlphaOperation.Multiply: + str2 = InvariantString.Format(" // Blend the Alpha result\r\n {0}.a = {1}.a * {2}.a;\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1, (object)stBlendOutput2); + break; + case AlphaOperation.Source1: + str2 = InvariantString.Format(" // Blend the Alpha result\r\n {0}.a = {1}.a;\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput1); + break; + case AlphaOperation.Source2: + str2 = InvariantString.Format(" // Blend the Alpha result\r\n {0}.a = {1}.a;\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)stBlendOutput2); + break; + default: + Debug2.Throw(false, "Unknown alpha blend operation"); + break; + } + effectBuilder.EmitPixelFragment(str1 + str2); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9BrightnessElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9BrightnessElement.cs index 4a9ad34..7393a1c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9BrightnessElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9BrightnessElement.cs @@ -8,22 +8,22 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9BrightnessElement - { - internal static void Generate( - BrightnessElement efoBrightness, - ref Dx9EffectBuilder effectBuilder) + internal class Dx9BrightnessElement { - VariableInfo variableInfo = new VariableInfo() - { - ID = (int) efoBrightness.BrightnessID, - Type = Dx9VariableType.Float, - IsDynamic = efoBrightness.IsDynamicProperty("Brightness") - }; - variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efoBrightness.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efoBrightness.Name); - variableInfo.DefaultValue = (object) efoBrightness.Brightness; - effectBuilder.AddPropertyVariable(variableInfo); - effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // adjust brightness based on input\r\n {0}.rgb += float3({1}, {1}, {1});\r\n }}\r\n", (object) effectBuilder.PixelShaderOutput, (object) variableInfo.Name)); + internal static void Generate( + BrightnessElement efoBrightness, + ref Dx9EffectBuilder effectBuilder) + { + VariableInfo variableInfo = new VariableInfo() + { + ID = (int)efoBrightness.BrightnessID, + Type = Dx9VariableType.Float, + IsDynamic = efoBrightness.IsDynamicProperty("Brightness") + }; + variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efoBrightness.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efoBrightness.Name); + variableInfo.DefaultValue = (object)efoBrightness.Brightness; + effectBuilder.AddPropertyVariable(variableInfo); + effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // adjust brightness based on input\r\n {0}.rgb += float3({1}, {1}, {1});\r\n }}\r\n", (object)effectBuilder.PixelShaderOutput, (object)variableInfo.Name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ColorElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ColorElement.cs index c39158f..dd4cb14 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ColorElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ColorElement.cs @@ -8,22 +8,22 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9ColorElement - { - internal static void Generate(ColorElement efiColor, ref Dx9EffectBuilder effectBuilder) + internal class Dx9ColorElement { - VariableInfo variableInfo = new VariableInfo() - { - ID = (int) efiColor.ColorID, - Type = Dx9VariableType.Vector4, - IsDynamic = efiColor.IsDynamicProperty("Color") - }; - variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efiColor.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efiColor.Name); - variableInfo.DefaultValue = (object) efiColor.Color.ToVector4(); - effectBuilder.AddPropertyVariable(variableInfo); - string name = variableInfo.Name; - effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiColor.Name); - effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the color\r\n float4 {0} = {1};\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) name)); + internal static void Generate(ColorElement efiColor, ref Dx9EffectBuilder effectBuilder) + { + VariableInfo variableInfo = new VariableInfo() + { + ID = (int)efiColor.ColorID, + Type = Dx9VariableType.Vector4, + IsDynamic = efiColor.IsDynamicProperty("Color") + }; + variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efiColor.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efiColor.Name); + variableInfo.DefaultValue = (object)efiColor.Color.ToVector4(); + effectBuilder.AddPropertyVariable(variableInfo); + string name = variableInfo.Name; + effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiColor.Name); + effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the color\r\n float4 {0} = {1};\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ComplexImageElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ComplexImageElement.cs index dd23eee..a7a40a3 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ComplexImageElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ComplexImageElement.cs @@ -8,60 +8,60 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9ComplexImageElement - { - internal static void Generate(ComplexImageElement efiImage, ref Dx9EffectBuilder effectBuilder) + internal class Dx9ComplexImageElement { - VariableInfo variableInfo1 = new VariableInfo() - { - ID = (int) efiImage.MinFilterID, - Type = Dx9VariableType.Integer, - IsDynamic = efiImage.IsDynamicProperty("MinFilter") - }; - variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efiImage.Name + "MinFilter") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efiImage.Name + "MinFilter"); - variableInfo1.DefaultValue = (object) (int) efiImage.MinFilter; - effectBuilder.AddPropertyVariable(variableInfo1); - string name1 = variableInfo1.Name; - VariableInfo variableInfo2 = new VariableInfo() - { - ID = (int) efiImage.MagFilterID, - Type = Dx9VariableType.Integer, - IsDynamic = efiImage.IsDynamicProperty("MagFilter") - }; - variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efiImage.Name + "MagFilter") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efiImage.Name + "MagFilter"); - variableInfo2.DefaultValue = (object) (int) efiImage.MagFilter; - effectBuilder.AddPropertyVariable(variableInfo2); - string name2 = variableInfo2.Name; - effectBuilder.AddPropertyVariable(new VariableInfo() - { - ID = (int) efiImage.CoordinateMapIndexID, - Type = Dx9VariableType.Integer, - IsDynamic = efiImage.IsDynamicProperty("CoordinateMapIndex"), - Name = (string) null, - DefaultValue = (object) (int) efiImage.CoordinateMapIndex - }); - Dx9TextureInfo dx9TextureInfo = effectBuilder.AllocateTexture(); - TextureVariableInfo textureVariableInfo = new TextureVariableInfo(); - textureVariableInfo.ID = (int) efiImage.ImageID; - textureVariableInfo.Type = Dx9VariableType.Texture; - textureVariableInfo.Name = effectBuilder.GenerateGlobalVariable(textureVariableInfo.Type, efiImage.Name); - textureVariableInfo.DefaultValue = (object) efiImage.Image; - textureVariableInfo.SamplerName = dx9TextureInfo.Sampler; - textureVariableInfo.MinFilter = InvariantString.Format("<{0}>", (object) name1); - textureVariableInfo.MagFilter = InvariantString.Format("<{0}>", (object) name2); - textureVariableInfo.CoordinateMapID = (int) efiImage.CoordinateMapIndexID; - textureVariableInfo.ImageIndexID = (int) efiImage.ImageIndexID; - effectBuilder.AddPropertyVariable((VariableInfo) textureVariableInfo); - effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiImage.Name); - effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2});\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) dx9TextureInfo.Sampler, (object) dx9TextureInfo.TexCoordInput)); - effectBuilder.AddPropertyVariable(new VariableInfo() - { - ID = (int) efiImage.ImageIndexID, - Type = Dx9VariableType.Integer, - IsDynamic = efiImage.IsDynamicProperty("ImageIndex"), - Name = (string) null, - DefaultValue = (object) (int) efiImage.ImageIndex - }); + internal static void Generate(ComplexImageElement efiImage, ref Dx9EffectBuilder effectBuilder) + { + VariableInfo variableInfo1 = new VariableInfo() + { + ID = (int)efiImage.MinFilterID, + Type = Dx9VariableType.Integer, + IsDynamic = efiImage.IsDynamicProperty("MinFilter") + }; + variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efiImage.Name + "MinFilter") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efiImage.Name + "MinFilter"); + variableInfo1.DefaultValue = (object)(int)efiImage.MinFilter; + effectBuilder.AddPropertyVariable(variableInfo1); + string name1 = variableInfo1.Name; + VariableInfo variableInfo2 = new VariableInfo() + { + ID = (int)efiImage.MagFilterID, + Type = Dx9VariableType.Integer, + IsDynamic = efiImage.IsDynamicProperty("MagFilter") + }; + variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efiImage.Name + "MagFilter") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efiImage.Name + "MagFilter"); + variableInfo2.DefaultValue = (object)(int)efiImage.MagFilter; + effectBuilder.AddPropertyVariable(variableInfo2); + string name2 = variableInfo2.Name; + effectBuilder.AddPropertyVariable(new VariableInfo() + { + ID = (int)efiImage.CoordinateMapIndexID, + Type = Dx9VariableType.Integer, + IsDynamic = efiImage.IsDynamicProperty("CoordinateMapIndex"), + Name = (string)null, + DefaultValue = (object)(int)efiImage.CoordinateMapIndex + }); + Dx9TextureInfo dx9TextureInfo = effectBuilder.AllocateTexture(); + TextureVariableInfo textureVariableInfo = new TextureVariableInfo(); + textureVariableInfo.ID = (int)efiImage.ImageID; + textureVariableInfo.Type = Dx9VariableType.Texture; + textureVariableInfo.Name = effectBuilder.GenerateGlobalVariable(textureVariableInfo.Type, efiImage.Name); + textureVariableInfo.DefaultValue = (object)efiImage.Image; + textureVariableInfo.SamplerName = dx9TextureInfo.Sampler; + textureVariableInfo.MinFilter = InvariantString.Format("<{0}>", (object)name1); + textureVariableInfo.MagFilter = InvariantString.Format("<{0}>", (object)name2); + textureVariableInfo.CoordinateMapID = (int)efiImage.CoordinateMapIndexID; + textureVariableInfo.ImageIndexID = (int)efiImage.ImageIndexID; + effectBuilder.AddPropertyVariable((VariableInfo)textureVariableInfo); + effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiImage.Name); + effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2});\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)dx9TextureInfo.Sampler, (object)dx9TextureInfo.TexCoordInput)); + effectBuilder.AddPropertyVariable(new VariableInfo() + { + ID = (int)efiImage.ImageIndexID, + Type = Dx9VariableType.Integer, + IsDynamic = efiImage.IsDynamicProperty("ImageIndex"), + Name = (string)null, + DefaultValue = (object)(int)efiImage.ImageIndex + }); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ContrastElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ContrastElement.cs index e372bfa..1170204 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ContrastElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ContrastElement.cs @@ -8,20 +8,20 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9ContrastElement - { - internal static void Generate(ContrastElement efoContrast, ref Dx9EffectBuilder effectBuilder) + internal class Dx9ContrastElement { - VariableInfo variableInfo = new VariableInfo() - { - ID = (int) efoContrast.ContrastID, - Type = Dx9VariableType.Float, - IsDynamic = efoContrast.IsDynamicProperty("Contrast") - }; - variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efoContrast.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efoContrast.Name); - variableInfo.DefaultValue = (object) efoContrast.Contrast; - effectBuilder.AddPropertyVariable(variableInfo); - effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // apply the gain factor \r\n {0}.rgb -= float3(0.5f, 0.5f, 0.5f)\r\n; {0}.rgb *= float3({1}, {1}, {1});\r\n {0}.rgb += float3(0.5f, 0.5f, 0.5f)\r\n; }}\r\n", (object) effectBuilder.PixelShaderOutput, (object) variableInfo.Name)); + internal static void Generate(ContrastElement efoContrast, ref Dx9EffectBuilder effectBuilder) + { + VariableInfo variableInfo = new VariableInfo() + { + ID = (int)efoContrast.ContrastID, + Type = Dx9VariableType.Float, + IsDynamic = efoContrast.IsDynamicProperty("Contrast") + }; + variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efoContrast.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efoContrast.Name); + variableInfo.DefaultValue = (object)efoContrast.Contrast; + effectBuilder.AddPropertyVariable(variableInfo); + effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // apply the gain factor \r\n {0}.rgb -= float3(0.5f, 0.5f, 0.5f)\r\n; {0}.rgb *= float3({1}, {1}, {1});\r\n {0}.rgb += float3(0.5f, 0.5f, 0.5f)\r\n; }}\r\n", (object)effectBuilder.PixelShaderOutput, (object)variableInfo.Name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9DesaturateElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9DesaturateElement.cs index 0146122..3b2fd95 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9DesaturateElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9DesaturateElement.cs @@ -8,23 +8,23 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9DesaturateElement - { - internal static void Generate( - DesaturateElement efoDesaturate, - ref Dx9EffectBuilder effectBuilder) + internal class Dx9DesaturateElement { - VariableInfo variableInfo = new VariableInfo() - { - ID = (int) efoDesaturate.DesaturateID, - Type = Dx9VariableType.Float, - DefaultValue = (object) efoDesaturate.Desaturate, - IsDynamic = efoDesaturate.IsDynamicProperty("Desaturate") - }; - variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efoDesaturate.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efoDesaturate.Name); - effectBuilder.AddPropertyVariable(variableInfo); - string name = variableInfo.Name; - effectBuilder.EmitPixelFragment(InvariantString.Format(" // Desaturate the value\r\n {{\r\n float3 vGray = {{.15, .55, .30}};\r\n float fLuminance = dot({0}.rgb, vGray);\r\n {0}.rgb = lerp({0}.rgb, fLuminance.rrr, {1});\r\n\r\n }}\r\n", (object) effectBuilder.PixelShaderOutput, (object) name)); + internal static void Generate( + DesaturateElement efoDesaturate, + ref Dx9EffectBuilder effectBuilder) + { + VariableInfo variableInfo = new VariableInfo() + { + ID = (int)efoDesaturate.DesaturateID, + Type = Dx9VariableType.Float, + DefaultValue = (object)efoDesaturate.Desaturate, + IsDynamic = efoDesaturate.IsDynamicProperty("Desaturate") + }; + variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efoDesaturate.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efoDesaturate.Name); + effectBuilder.AddPropertyVariable(variableInfo); + string name = variableInfo.Name; + effectBuilder.EmitPixelFragment(InvariantString.Format(" // Desaturate the value\r\n {{\r\n float3 vGray = {{.15, .55, .30}};\r\n float fLuminance = dot({0}.rgb, vGray);\r\n {0}.rgb = lerp({0}.rgb, fLuminance.rrr, {1});\r\n\r\n }}\r\n", (object)effectBuilder.PixelShaderOutput, (object)name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9DestinationElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9DestinationElement.cs index 5165a96..2eb35b7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9DestinationElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9DestinationElement.cs @@ -8,49 +8,49 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9DestinationElement - { - internal static void Generate( - DestinationElement efiDestination, - ref Dx9EffectBuilder effectBuilder) + internal class Dx9DestinationElement { - Dx9TextureInfo textureInfo = effectBuilder.AllocateTexture(); - effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.SampleBackbuffer, (object) (int) efiDestination.DownsampleID); - effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.DisablePerspectiveCorrection, (object) null); - effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object) null); - TextureVariableInfo textureVariableInfo = new TextureVariableInfo(); - textureVariableInfo.ID = (int) efiDestination.DestinationID; - textureVariableInfo.Type = Dx9VariableType.Texture; - textureVariableInfo.Name = effectBuilder.GenerateGlobalVariable(textureVariableInfo.Type, efiDestination.Name); - textureVariableInfo.DefaultValue = (object) null; - textureVariableInfo.SamplerName = textureInfo.Sampler; - textureVariableInfo.MinFilter = "Linear"; - textureVariableInfo.MagFilter = "Linear"; - textureVariableInfo.CoordinateMapID = -1; - textureVariableInfo.ImageIndexID = -1; - effectBuilder.AddPropertyVariable((VariableInfo) textureVariableInfo); - effectBuilder.AddPropertyVariable(new VariableInfo() - { - ID = (int) efiDestination.DownsampleID, - Type = Dx9VariableType.Float, - IsDynamic = efiDestination.IsDynamicProperty("Downsample"), - Name = (string) null, - DefaultValue = (object) efiDestination.Downsample - }); - VariableInfo variableInfo = new VariableInfo() - { - ID = (int) efiDestination.UVOffsetID, - Type = Dx9VariableType.Vector2, - IsDynamic = efiDestination.IsDynamicProperty("UVOffset") - }; - variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, "UVOffset") : effectBuilder.GenerateGlobalConstant(variableInfo.Type, "UVOffset"); - variableInfo.DefaultValue = (object) efiDestination.UVOffset; - effectBuilder.AddPropertyVariable(variableInfo); - effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Texture, efiDestination.Name); - if (variableInfo.IsDynamic || !efiDestination.UVOffset.IsApproximate(Vector2.Zero)) - effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2} + float2({3}.x * {4}.x, {3}.y * {4}.y));\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput, (object) textureInfo.TexelSize, (object) variableInfo.Name)); - else - effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2});\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput)); + internal static void Generate( + DestinationElement efiDestination, + ref Dx9EffectBuilder effectBuilder) + { + Dx9TextureInfo textureInfo = effectBuilder.AllocateTexture(); + effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.SampleBackbuffer, (object)(int)efiDestination.DownsampleID); + effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.DisablePerspectiveCorrection, (object)null); + effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object)null); + TextureVariableInfo textureVariableInfo = new TextureVariableInfo(); + textureVariableInfo.ID = (int)efiDestination.DestinationID; + textureVariableInfo.Type = Dx9VariableType.Texture; + textureVariableInfo.Name = effectBuilder.GenerateGlobalVariable(textureVariableInfo.Type, efiDestination.Name); + textureVariableInfo.DefaultValue = (object)null; + textureVariableInfo.SamplerName = textureInfo.Sampler; + textureVariableInfo.MinFilter = "Linear"; + textureVariableInfo.MagFilter = "Linear"; + textureVariableInfo.CoordinateMapID = -1; + textureVariableInfo.ImageIndexID = -1; + effectBuilder.AddPropertyVariable((VariableInfo)textureVariableInfo); + effectBuilder.AddPropertyVariable(new VariableInfo() + { + ID = (int)efiDestination.DownsampleID, + Type = Dx9VariableType.Float, + IsDynamic = efiDestination.IsDynamicProperty("Downsample"), + Name = (string)null, + DefaultValue = (object)efiDestination.Downsample + }); + VariableInfo variableInfo = new VariableInfo() + { + ID = (int)efiDestination.UVOffsetID, + Type = Dx9VariableType.Vector2, + IsDynamic = efiDestination.IsDynamicProperty("UVOffset") + }; + variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, "UVOffset") : effectBuilder.GenerateGlobalConstant(variableInfo.Type, "UVOffset"); + variableInfo.DefaultValue = (object)efiDestination.UVOffset; + effectBuilder.AddPropertyVariable(variableInfo); + effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Texture, efiDestination.Name); + if (variableInfo.IsDynamic || !efiDestination.UVOffset.IsApproximate(Vector2.Zero)) + effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2} + float2({3}.x * {4}.x, {3}.y * {4}.y));\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput, (object)textureInfo.TexelSize, (object)variableInfo.Name)); + else + effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2});\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EdgeDetectionElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EdgeDetectionElement.cs index 94b30ea..69211b6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EdgeDetectionElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EdgeDetectionElement.cs @@ -8,24 +8,24 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9EdgeDetectionElement - { - internal static void Generate( - EdgeDetectionElement efoEdgeDetection, - ref Dx9EffectBuilder effectBuilder) + internal class Dx9EdgeDetectionElement { - Dx9TextureInfo textureInfo = effectBuilder.GetTextureInfo(effectBuilder.ImageCount - 1); - effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object) null); - VariableInfo variableInfo = new VariableInfo() - { - ID = (int) efoEdgeDetection.EdgeLimitID, - Type = Dx9VariableType.Float, - IsDynamic = efoEdgeDetection.IsDynamicProperty("EdgeLimit") - }; - variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efoEdgeDetection.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efoEdgeDetection.Name); - variableInfo.DefaultValue = (object) efoEdgeDetection.EdgeLimit; - effectBuilder.AddPropertyVariable(variableInfo); - effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // Sample neightbour pixel\r\n float4 vBottomPixel = tex2D({1}, {2} + float2(0.0f, {3}.y));\r\n float currentAvg = {0}.r + {0}.g + {0}.b;\r\n currentAvg = currentAvg / 3.0f;\r\n float bottomAvg = vBottomPixel.r + vBottomPixel.g + vBottomPixel.b;\r\n bottomAvg = bottomAvg / 3.0f;\r\n float diff = abs(currentAvg - bottomAvg);\r\n // change color into black or white depending on what the delta is\r\n if (diff < {4})\r\n {{\r\n {0}.rgb = 1.0f;\r\n }}\r\n else\r\n {{\r\n {0}.rgb = 0.0f;\r\n }}\r\n }}\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput, (object) textureInfo.TexelSize, (object) variableInfo.Name)); + internal static void Generate( + EdgeDetectionElement efoEdgeDetection, + ref Dx9EffectBuilder effectBuilder) + { + Dx9TextureInfo textureInfo = effectBuilder.GetTextureInfo(effectBuilder.ImageCount - 1); + effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object)null); + VariableInfo variableInfo = new VariableInfo() + { + ID = (int)efoEdgeDetection.EdgeLimitID, + Type = Dx9VariableType.Float, + IsDynamic = efoEdgeDetection.IsDynamicProperty("EdgeLimit") + }; + variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efoEdgeDetection.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efoEdgeDetection.Name); + variableInfo.DefaultValue = (object)efoEdgeDetection.EdgeLimit; + effectBuilder.AddPropertyVariable(variableInfo); + effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // Sample neightbour pixel\r\n float4 vBottomPixel = tex2D({1}, {2} + float2(0.0f, {3}.y));\r\n float currentAvg = {0}.r + {0}.g + {0}.b;\r\n currentAvg = currentAvg / 3.0f;\r\n float bottomAvg = vBottomPixel.r + vBottomPixel.g + vBottomPixel.b;\r\n bottomAvg = bottomAvg / 3.0f;\r\n float diff = abs(currentAvg - bottomAvg);\r\n // change color into black or white depending on what the delta is\r\n if (diff < {4})\r\n {{\r\n {0}.rgb = 1.0f;\r\n }}\r\n else\r\n {{\r\n {0}.rgb = 0.0f;\r\n }}\r\n }}\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput, (object)textureInfo.TexelSize, (object)variableInfo.Name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9Effect.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9Effect.cs index 87a3c88..0bc3fc3 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9Effect.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9Effect.cs @@ -8,39 +8,39 @@ using Microsoft.Iris.Render.Protocols.Splash.Rendering; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9Effect : Effect - { - internal Dx9Effect(Dx9EffectTemplate effectTemplate) - : base((EffectTemplate) effectTemplate) - => this.m_remoteEffect = (Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect) this.m_effectTemplate.Session.BuildRemoteDx9Effect(this); - - internal Dx9EffectManager EffectManager => ((Dx9GraphicsDevice) this.m_effectTemplate.Device).EffectManager; - - internal override void RemoteEffect() + internal class Dx9Effect : Effect { - ((RemoteDx9Effect) this.m_remoteEffect).SendLoadEffectResource(((Dx9EffectTemplate) this.m_effectTemplate).EffectResource.RemoteStub); - this.Initialize(); - } + internal Dx9Effect(Dx9EffectTemplate effectTemplate) + : base((EffectTemplate)effectTemplate) + => this.m_remoteEffect = (Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect)this.m_effectTemplate.Session.BuildRemoteDx9Effect(this); - internal override void SetProperty(string stPropertyName, Image image) - { - if (image != null) - { - Dx9EffectResource effectResource = ((Dx9EffectTemplate) this.m_effectTemplate).EffectResource; - image.GutterSize = effectResource.GutterSize; - } - base.SetProperty(stPropertyName, image); - } + internal Dx9EffectManager EffectManager => ((Dx9GraphicsDevice)this.m_effectTemplate.Device).EffectManager; - internal override void SetProperty(string stPropertyName, IImage[] images) - { - Dx9EffectResource effectResource = ((Dx9EffectTemplate) this.m_effectTemplate).EffectResource; - for (int index = 0; index < images.Length; ++index) - { - if (images[index] is Image image) - image.GutterSize = effectResource.GutterSize; - } - base.SetProperty(stPropertyName, images); + internal override void RemoteEffect() + { + ((RemoteDx9Effect)this.m_remoteEffect).SendLoadEffectResource(((Dx9EffectTemplate)this.m_effectTemplate).EffectResource.RemoteStub); + this.Initialize(); + } + + internal override void SetProperty(string stPropertyName, Image image) + { + if (image != null) + { + Dx9EffectResource effectResource = ((Dx9EffectTemplate)this.m_effectTemplate).EffectResource; + image.GutterSize = effectResource.GutterSize; + } + base.SetProperty(stPropertyName, image); + } + + internal override void SetProperty(string stPropertyName, IImage[] images) + { + Dx9EffectResource effectResource = ((Dx9EffectTemplate)this.m_effectTemplate).EffectResource; + for (int index = 0; index < images.Length; ++index) + { + if (images[index] is Image image) + image.GutterSize = effectResource.GutterSize; + } + base.SetProperty(stPropertyName, images); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectBuilder.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectBuilder.cs index e2500cc..f1bcbb8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectBuilder.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectBuilder.cs @@ -11,366 +11,366 @@ using System.Text; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9EffectBuilder - { - private string m_stPixelOutput; - private StringBuilder m_sbPixelShader; - private StringBuilder m_sbVertexShader; - private StringBuilder m_sbDeclarations; - private StringBuilder m_sbEffect; - private Vector m_alPropertyVariables; - private int m_nUniqueVariableID; - private Vector m_alTextureInfos; - private Vector m_alGlobalVariables; - private Vector m_alIncludes; - private int m_cMaxSimultaneousTextures; - private int m_cMaxRenderTargets; - private int m_nRequirements; - - internal Dx9EffectBuilder(GraphicsCaps caps) + internal class Dx9EffectBuilder { - this.m_cMaxSimultaneousTextures = caps.MaxSimultaneousTextures; - this.m_cMaxRenderTargets = caps.AvailableRenderTargets; - } + private string m_stPixelOutput; + private StringBuilder m_sbPixelShader; + private StringBuilder m_sbVertexShader; + private StringBuilder m_sbDeclarations; + private StringBuilder m_sbEffect; + private Vector m_alPropertyVariables; + private int m_nUniqueVariableID; + private Vector m_alTextureInfos; + private Vector m_alGlobalVariables; + private Vector m_alIncludes; + private int m_cMaxSimultaneousTextures; + private int m_cMaxRenderTargets; + private int m_nRequirements; - internal void EmitPixelFragment(string stData) - { - if (this.m_sbPixelShader == null) - this.m_sbPixelShader = new StringBuilder(128); - this.m_sbPixelShader.Append(stData); - } - - internal void EmitEffectFragment(string stData) - { - if (this.m_sbEffect == null) - this.m_sbEffect = new StringBuilder(512); - this.m_sbEffect.Append(stData); - } - - internal void EmitIncludesFragment(string stData) - { - if (this.m_alIncludes == null) - this.m_alIncludes = new Vector(); - if (this.m_alIncludes.Contains(stData)) - return; - this.m_alIncludes.Add(stData); - } - - internal string GenerateGlobalConstant(Dx9VariableType typeProperty, string stName) => this.GenerateVariableName(VariableScope.Const, typeProperty, stName); - - internal string GenerateLocalVariable(Dx9VariableType typeProperty, string stName) => this.GenerateVariableName(VariableScope.Local, typeProperty, stName); - - internal string GenerateGlobalVariable(Dx9VariableType typeProperty, string stName) => this.GenerateVariableName(VariableScope.Global, typeProperty, stName); - - internal void AddPropertyVariable(VariableInfo variableInfo) - { - if (this.m_alPropertyVariables == null) - this.m_alPropertyVariables = new Vector(); - this.m_alPropertyVariables.Add(variableInfo); - } - - internal void AddGlobalVariable(VariableInfo variableInfo) - { - if (this.m_alGlobalVariables == null) - this.m_alGlobalVariables = new Vector(); - this.m_alGlobalVariables.Add(variableInfo); - } - - private string GenerateVariableName( - VariableScope scope, - Dx9VariableType typeProperty, - string stName) - { - StringBuilder stringBuilder = new StringBuilder(32); - switch (scope) - { - case VariableScope.Global: - stringBuilder.Append("g_"); - break; - case VariableScope.Const: - stringBuilder.Append("k_"); - break; - } - switch (typeProperty) - { - case Dx9VariableType.Integer: - stringBuilder.Append("n"); - break; - case Dx9VariableType.Float: - stringBuilder.Append("fl"); - break; - case Dx9VariableType.Vector2: - case Dx9VariableType.Vector3: - case Dx9VariableType.Vector4: - stringBuilder.Append("v"); - break; - case Dx9VariableType.Texture: - stringBuilder.Append("tex"); - break; - } - if (stName != null) - { - if (stName.Length > 15) - stName = stName.Substring(0, 15); - stringBuilder.Append(stName); - } - else - stringBuilder.Append("Temp"); - return stringBuilder.ToString() + (object) this.m_nUniqueVariableID++; - } - - internal void Clear() - { - this.m_stPixelOutput = (string) null; - this.m_nUniqueVariableID = 0; - this.m_nRequirements = 0; - this.m_sbPixelShader = (StringBuilder) null; - this.m_sbVertexShader = (StringBuilder) null; - this.m_sbDeclarations = (StringBuilder) null; - this.m_sbEffect = (StringBuilder) null; - if (this.m_alPropertyVariables != null) - this.m_alPropertyVariables.Clear(); - if (this.m_alGlobalVariables != null) - this.m_alGlobalVariables.Clear(); - if (this.m_alTextureInfos != null) - this.m_alTextureInfos.Clear(); - if (this.m_alIncludes == null) - return; - this.m_alIncludes.Clear(); - } - - internal string ConvertToString(Dx9VariableType type) - { - switch (type) - { - case Dx9VariableType.Integer: - return "int"; - case Dx9VariableType.Float: - return "float"; - case Dx9VariableType.Vector2: - return "float2"; - case Dx9VariableType.Vector3: - return "float3"; - case Dx9VariableType.Vector4: - return "float4"; - case Dx9VariableType.Texture: - return "texture"; - default: - return ""; - } - } - - internal string ConvertToString(FilterMode mode) - { - switch (mode) - { - case FilterMode.Point: - return "Point"; - case FilterMode.Linear: - return "Linear"; - default: - return ""; - } - } - - internal bool Validate() => this.ImageCount <= this.m_cMaxSimultaneousTextures && this.GetRenderTargetCount() <= this.m_cMaxRenderTargets; - - internal Dx9TextureInfo AllocateTexture() - { - Dx9TextureInfo dx9TextureInfo = new Dx9TextureInfo() - { - ImageIndex = this.ImageCount - }; - dx9TextureInfo.TexCoordInput = InvariantString.Format("{0}{1}", (object) "vTexCoord", (object) dx9TextureInfo.ImageIndex); - dx9TextureInfo.Sampler = InvariantString.Format("{0}{1}", (object) "Sampler", (object) dx9TextureInfo.ImageIndex); - dx9TextureInfo.DownsamplePropertyID = -1; - if (this.m_alTextureInfos == null) - this.m_alTextureInfos = new Vector(); - this.m_alTextureInfos.Add(dx9TextureInfo); - return dx9TextureInfo; - } - - internal void AddRequirement( - Dx9TextureInfo textureInfo, - Dx9TextureRequirements type, - object oValue) - { - textureInfo.Requirements |= (int) type; - switch (type) - { - case Dx9TextureRequirements.TexelSize: - if (textureInfo.TexelSize != null) - break; - string stName1 = InvariantString.Format("{0}{1}", (object) "TexelSize", (object) textureInfo.ImageIndex); - VariableInfo variableInfo1 = new VariableInfo() - { - IsDynamic = true, - ID = -1, - Type = Dx9VariableType.Vector2 - }; - variableInfo1.Name = this.GenerateGlobalVariable(variableInfo1.Type, stName1); - variableInfo1.DefaultValue = (object) new Vector2(0.0f, 0.0f); - this.AddGlobalVariable(variableInfo1); - textureInfo.TexelSize = variableInfo1.Name; - break; - case Dx9TextureRequirements.SampleBackbuffer: - textureInfo.DownsamplePropertyID = (int) oValue; - break; - case Dx9TextureRequirements.TexUVSize: - if (textureInfo.TexUVSize != null) - break; - string stName2 = InvariantString.Format("{0}{1}", (object) "TexUVSize", (object) textureInfo.ImageIndex); - VariableInfo variableInfo2 = new VariableInfo() - { - IsDynamic = true, - ID = -1, - Type = Dx9VariableType.Vector2 - }; - variableInfo2.Name = this.GenerateGlobalVariable(variableInfo2.Type, stName2); - variableInfo2.DefaultValue = (object) new Vector2(0.0f, 0.0f); - this.AddGlobalVariable(variableInfo2); - textureInfo.TexUVSize = variableInfo2.Name; - break; - case Dx9TextureRequirements.TexUVRefPoint: - if (textureInfo.TexUVRefPoint != null) - break; - string stName3 = InvariantString.Format("{0}{1}", (object) "TexUVRefPoint", (object) textureInfo.ImageIndex); - VariableInfo variableInfo3 = new VariableInfo() - { - IsDynamic = true, - ID = -1, - Type = Dx9VariableType.Vector2 - }; - variableInfo3.Name = this.GenerateGlobalVariable(variableInfo3.Type, stName3); - variableInfo3.DefaultValue = (object) new Vector2(0.0f, 0.0f); - this.AddGlobalVariable(variableInfo3); - textureInfo.TexUVRefPoint = variableInfo3.Name; - break; - } - } - - internal void AddRequirement(EffectRequirements requirement) => Bits.SetFlag(ref this.m_nRequirements, (int) requirement); - - internal Dx9TextureInfo GetTextureInfo(int idxTexture) => this.m_alTextureInfos[idxTexture]; - - internal string PixelShaderOutput - { - get => this.m_stPixelOutput; - set => this.m_stPixelOutput = value; - } - - internal string ShaderDeclarations => this.GenerateDeclarations(); - - internal string IncludesFragment - { - get - { - if (this.m_alIncludes == null) - return ""; - StringBuilder stringBuilder = new StringBuilder(); - for (int index = 0; index < this.m_alIncludes.Count; ++index) - stringBuilder.AppendFormat("#include {0}\r\n", (object) this.m_alIncludes[index]); - return stringBuilder.ToString(); - } - } - - internal string PixelShader => this.GeneratePixelShader(); - - internal string VertexShader => this.GenerateVertexShader(); - - internal Vector PropertyVariables => this.m_alPropertyVariables; - - internal Vector GlobalVariables => this.m_alGlobalVariables; - - internal string EffectDefinition => this.m_sbEffect.ToString(); - - internal int ImageCount => this.m_alTextureInfos == null ? 0 : this.m_alTextureInfos.Count; - - internal Vector TextureInfoList => this.m_alTextureInfos; - - internal void SaveEffect(string stFilename) - { - StreamWriter streamWriter = new StreamWriter(stFilename); - streamWriter.WriteLine(this.m_sbEffect.ToString()); - streamWriter.Close(); - } - - private string GenerateDeclarations() - { - if (this.m_sbDeclarations == null) - this.m_sbDeclarations = new StringBuilder(128); - if (this.m_sbDeclarations.Length == 0) - { - this.m_sbDeclarations.Append("struct PS_OUTPUT\r\n{\r\n float4 Color : COLOR; // Object space position\r\n};\r\n\r\n"); - this.m_sbDeclarations.Append("struct VS_INPUT\r\n{\r\n float4 ObjPos : POSITION; // Object space position\r\n float4 Color : COLOR; // Vertex color\r\n"); - for (int index = 0; index < this.ImageCount; ++index) - this.m_sbDeclarations.AppendFormat(" float2 TexCoord{0} : TEXCOORD{0}; // Texture {0} UV coordinates\r\n", (object) index); - this.m_sbDeclarations.Append("};\r\n\r\n"); - this.m_sbDeclarations.Append("struct VS_OUTPUT\r\n{\r\n float4 ProjPos : POSITION; // Projected space position\r\n float4 Color : COLOR; // Vertex color\r\n"); - if (Bits.TestFlag(this.m_nRequirements, 1)) - this.m_sbDeclarations.Append(" float3 ViewPos : TEXCOORD5; // View space position\r\n"); - for (int index = 0; index < this.ImageCount; ++index) + internal Dx9EffectBuilder(GraphicsCaps caps) { - if (Bits.TestFlag(this.m_alTextureInfos[index].Requirements, 16)) - this.m_sbDeclarations.AppendFormat(" float3 TexCoord{0} : TEXCOORD{0}; // Texture {0} UVW coordinates\r\n", (object) index); - else - this.m_sbDeclarations.AppendFormat(" float2 TexCoord{0} : TEXCOORD{0}; // Texture {0} UV coordinates\r\n", (object) index); + this.m_cMaxSimultaneousTextures = caps.MaxSimultaneousTextures; + this.m_cMaxRenderTargets = caps.AvailableRenderTargets; } - this.m_sbDeclarations.Append("};\r\n\r\n"); - } - return this.m_sbDeclarations.ToString(); - } - private string GenerateVertexShader() - { - if (this.m_sbVertexShader == null) - this.m_sbVertexShader = new StringBuilder(128); - if (this.m_sbVertexShader.Length == 0) - { - this.m_sbVertexShader.Append(" //\r\n // Compute the accumulated WVP matrix. If the separate matrices are not referenced\r\n // by effect elements, the D3DX preshader will combine these on the CPU and set the\r\n // result via VS constants.\r\n //\r\n\r\n float4x4 matAccumulated = mul(g_matWorldView, g_matProjection);\r\n\r\n\r\n //\r\n // Setup the resulting device vertex.\r\n //\r\n\r\n Output.ProjPos = mul(Input.ObjPos, matAccumulated);\r\n Output.Color = Input.Color;\r\n"); - if (Bits.TestFlag(this.m_nRequirements, 1)) - this.m_sbVertexShader.Append(" Output.ViewPos = mul(Input.ObjPos, g_matWorldView);\r\n"); - for (int index = 0; index < this.ImageCount; ++index) + internal void EmitPixelFragment(string stData) { - if (Bits.TestFlag(this.m_alTextureInfos[index].Requirements, 16)) - this.m_sbVertexShader.AppendFormat(" Output.TexCoord{0} = float3(Input.TexCoord{0}.x * Output.ProjPos.w, Input.TexCoord{0}.y * Output.ProjPos.w, Output.ProjPos.w);\r\n", (object) index); - else - this.m_sbVertexShader.AppendFormat(" Output.TexCoord{0} = Input.TexCoord{0};\r\n", (object) index); + if (this.m_sbPixelShader == null) + this.m_sbPixelShader = new StringBuilder(128); + this.m_sbPixelShader.Append(stData); } - } - return this.m_sbVertexShader.ToString(); - } - private string GeneratePixelShader() - { - StringBuilder stringBuilder = new StringBuilder(128); - for (int index = 0; index < this.ImageCount; ++index) - { - Dx9TextureInfo alTextureInfo = this.m_alTextureInfos[index]; - if (Bits.TestFlag(alTextureInfo.Requirements, 16)) - stringBuilder.AppendFormat(" float2 {0} = Input.TexCoord{1}.xy / Input.TexCoord{1}.z;\r\n", (object) alTextureInfo.TexCoordInput, (object) index); - else - stringBuilder.AppendFormat(" float2 {0} = Input.TexCoord{1};\r\n", (object) alTextureInfo.TexCoordInput, (object) index); - } - stringBuilder.Append("\r\n"); - stringBuilder.Append(this.m_sbPixelShader.ToString()); - return stringBuilder.ToString(); - } - - private int GetRenderTargetCount() - { - if (this.m_alTextureInfos == null) - return 0; - int num = 0; - foreach (Dx9TextureInfo alTextureInfo in this.m_alTextureInfos) - { - if ((alTextureInfo.Requirements & 2) > 0) + internal void EmitEffectFragment(string stData) { - ++num; - break; + if (this.m_sbEffect == null) + this.m_sbEffect = new StringBuilder(512); + this.m_sbEffect.Append(stData); + } + + internal void EmitIncludesFragment(string stData) + { + if (this.m_alIncludes == null) + this.m_alIncludes = new Vector(); + if (this.m_alIncludes.Contains(stData)) + return; + this.m_alIncludes.Add(stData); + } + + internal string GenerateGlobalConstant(Dx9VariableType typeProperty, string stName) => this.GenerateVariableName(VariableScope.Const, typeProperty, stName); + + internal string GenerateLocalVariable(Dx9VariableType typeProperty, string stName) => this.GenerateVariableName(VariableScope.Local, typeProperty, stName); + + internal string GenerateGlobalVariable(Dx9VariableType typeProperty, string stName) => this.GenerateVariableName(VariableScope.Global, typeProperty, stName); + + internal void AddPropertyVariable(VariableInfo variableInfo) + { + if (this.m_alPropertyVariables == null) + this.m_alPropertyVariables = new Vector(); + this.m_alPropertyVariables.Add(variableInfo); + } + + internal void AddGlobalVariable(VariableInfo variableInfo) + { + if (this.m_alGlobalVariables == null) + this.m_alGlobalVariables = new Vector(); + this.m_alGlobalVariables.Add(variableInfo); + } + + private string GenerateVariableName( + VariableScope scope, + Dx9VariableType typeProperty, + string stName) + { + StringBuilder stringBuilder = new StringBuilder(32); + switch (scope) + { + case VariableScope.Global: + stringBuilder.Append("g_"); + break; + case VariableScope.Const: + stringBuilder.Append("k_"); + break; + } + switch (typeProperty) + { + case Dx9VariableType.Integer: + stringBuilder.Append("n"); + break; + case Dx9VariableType.Float: + stringBuilder.Append("fl"); + break; + case Dx9VariableType.Vector2: + case Dx9VariableType.Vector3: + case Dx9VariableType.Vector4: + stringBuilder.Append("v"); + break; + case Dx9VariableType.Texture: + stringBuilder.Append("tex"); + break; + } + if (stName != null) + { + if (stName.Length > 15) + stName = stName.Substring(0, 15); + stringBuilder.Append(stName); + } + else + stringBuilder.Append("Temp"); + return stringBuilder.ToString() + (object)this.m_nUniqueVariableID++; + } + + internal void Clear() + { + this.m_stPixelOutput = (string)null; + this.m_nUniqueVariableID = 0; + this.m_nRequirements = 0; + this.m_sbPixelShader = (StringBuilder)null; + this.m_sbVertexShader = (StringBuilder)null; + this.m_sbDeclarations = (StringBuilder)null; + this.m_sbEffect = (StringBuilder)null; + if (this.m_alPropertyVariables != null) + this.m_alPropertyVariables.Clear(); + if (this.m_alGlobalVariables != null) + this.m_alGlobalVariables.Clear(); + if (this.m_alTextureInfos != null) + this.m_alTextureInfos.Clear(); + if (this.m_alIncludes == null) + return; + this.m_alIncludes.Clear(); + } + + internal string ConvertToString(Dx9VariableType type) + { + switch (type) + { + case Dx9VariableType.Integer: + return "int"; + case Dx9VariableType.Float: + return "float"; + case Dx9VariableType.Vector2: + return "float2"; + case Dx9VariableType.Vector3: + return "float3"; + case Dx9VariableType.Vector4: + return "float4"; + case Dx9VariableType.Texture: + return "texture"; + default: + return ""; + } + } + + internal string ConvertToString(FilterMode mode) + { + switch (mode) + { + case FilterMode.Point: + return "Point"; + case FilterMode.Linear: + return "Linear"; + default: + return ""; + } + } + + internal bool Validate() => this.ImageCount <= this.m_cMaxSimultaneousTextures && this.GetRenderTargetCount() <= this.m_cMaxRenderTargets; + + internal Dx9TextureInfo AllocateTexture() + { + Dx9TextureInfo dx9TextureInfo = new Dx9TextureInfo() + { + ImageIndex = this.ImageCount + }; + dx9TextureInfo.TexCoordInput = InvariantString.Format("{0}{1}", (object)"vTexCoord", (object)dx9TextureInfo.ImageIndex); + dx9TextureInfo.Sampler = InvariantString.Format("{0}{1}", (object)"Sampler", (object)dx9TextureInfo.ImageIndex); + dx9TextureInfo.DownsamplePropertyID = -1; + if (this.m_alTextureInfos == null) + this.m_alTextureInfos = new Vector(); + this.m_alTextureInfos.Add(dx9TextureInfo); + return dx9TextureInfo; + } + + internal void AddRequirement( + Dx9TextureInfo textureInfo, + Dx9TextureRequirements type, + object oValue) + { + textureInfo.Requirements |= (int)type; + switch (type) + { + case Dx9TextureRequirements.TexelSize: + if (textureInfo.TexelSize != null) + break; + string stName1 = InvariantString.Format("{0}{1}", (object)"TexelSize", (object)textureInfo.ImageIndex); + VariableInfo variableInfo1 = new VariableInfo() + { + IsDynamic = true, + ID = -1, + Type = Dx9VariableType.Vector2 + }; + variableInfo1.Name = this.GenerateGlobalVariable(variableInfo1.Type, stName1); + variableInfo1.DefaultValue = (object)new Vector2(0.0f, 0.0f); + this.AddGlobalVariable(variableInfo1); + textureInfo.TexelSize = variableInfo1.Name; + break; + case Dx9TextureRequirements.SampleBackbuffer: + textureInfo.DownsamplePropertyID = (int)oValue; + break; + case Dx9TextureRequirements.TexUVSize: + if (textureInfo.TexUVSize != null) + break; + string stName2 = InvariantString.Format("{0}{1}", (object)"TexUVSize", (object)textureInfo.ImageIndex); + VariableInfo variableInfo2 = new VariableInfo() + { + IsDynamic = true, + ID = -1, + Type = Dx9VariableType.Vector2 + }; + variableInfo2.Name = this.GenerateGlobalVariable(variableInfo2.Type, stName2); + variableInfo2.DefaultValue = (object)new Vector2(0.0f, 0.0f); + this.AddGlobalVariable(variableInfo2); + textureInfo.TexUVSize = variableInfo2.Name; + break; + case Dx9TextureRequirements.TexUVRefPoint: + if (textureInfo.TexUVRefPoint != null) + break; + string stName3 = InvariantString.Format("{0}{1}", (object)"TexUVRefPoint", (object)textureInfo.ImageIndex); + VariableInfo variableInfo3 = new VariableInfo() + { + IsDynamic = true, + ID = -1, + Type = Dx9VariableType.Vector2 + }; + variableInfo3.Name = this.GenerateGlobalVariable(variableInfo3.Type, stName3); + variableInfo3.DefaultValue = (object)new Vector2(0.0f, 0.0f); + this.AddGlobalVariable(variableInfo3); + textureInfo.TexUVRefPoint = variableInfo3.Name; + break; + } + } + + internal void AddRequirement(EffectRequirements requirement) => Bits.SetFlag(ref this.m_nRequirements, (int)requirement); + + internal Dx9TextureInfo GetTextureInfo(int idxTexture) => this.m_alTextureInfos[idxTexture]; + + internal string PixelShaderOutput + { + get => this.m_stPixelOutput; + set => this.m_stPixelOutput = value; + } + + internal string ShaderDeclarations => this.GenerateDeclarations(); + + internal string IncludesFragment + { + get + { + if (this.m_alIncludes == null) + return ""; + StringBuilder stringBuilder = new StringBuilder(); + for (int index = 0; index < this.m_alIncludes.Count; ++index) + stringBuilder.AppendFormat("#include {0}\r\n", (object)this.m_alIncludes[index]); + return stringBuilder.ToString(); + } + } + + internal string PixelShader => this.GeneratePixelShader(); + + internal string VertexShader => this.GenerateVertexShader(); + + internal Vector PropertyVariables => this.m_alPropertyVariables; + + internal Vector GlobalVariables => this.m_alGlobalVariables; + + internal string EffectDefinition => this.m_sbEffect.ToString(); + + internal int ImageCount => this.m_alTextureInfos == null ? 0 : this.m_alTextureInfos.Count; + + internal Vector TextureInfoList => this.m_alTextureInfos; + + internal void SaveEffect(string stFilename) + { + StreamWriter streamWriter = new StreamWriter(stFilename); + streamWriter.WriteLine(this.m_sbEffect.ToString()); + streamWriter.Close(); + } + + private string GenerateDeclarations() + { + if (this.m_sbDeclarations == null) + this.m_sbDeclarations = new StringBuilder(128); + if (this.m_sbDeclarations.Length == 0) + { + this.m_sbDeclarations.Append("struct PS_OUTPUT\r\n{\r\n float4 Color : COLOR; // Object space position\r\n};\r\n\r\n"); + this.m_sbDeclarations.Append("struct VS_INPUT\r\n{\r\n float4 ObjPos : POSITION; // Object space position\r\n float4 Color : COLOR; // Vertex color\r\n"); + for (int index = 0; index < this.ImageCount; ++index) + this.m_sbDeclarations.AppendFormat(" float2 TexCoord{0} : TEXCOORD{0}; // Texture {0} UV coordinates\r\n", (object)index); + this.m_sbDeclarations.Append("};\r\n\r\n"); + this.m_sbDeclarations.Append("struct VS_OUTPUT\r\n{\r\n float4 ProjPos : POSITION; // Projected space position\r\n float4 Color : COLOR; // Vertex color\r\n"); + if (Bits.TestFlag(this.m_nRequirements, 1)) + this.m_sbDeclarations.Append(" float3 ViewPos : TEXCOORD5; // View space position\r\n"); + for (int index = 0; index < this.ImageCount; ++index) + { + if (Bits.TestFlag(this.m_alTextureInfos[index].Requirements, 16)) + this.m_sbDeclarations.AppendFormat(" float3 TexCoord{0} : TEXCOORD{0}; // Texture {0} UVW coordinates\r\n", (object)index); + else + this.m_sbDeclarations.AppendFormat(" float2 TexCoord{0} : TEXCOORD{0}; // Texture {0} UV coordinates\r\n", (object)index); + } + this.m_sbDeclarations.Append("};\r\n\r\n"); + } + return this.m_sbDeclarations.ToString(); + } + + private string GenerateVertexShader() + { + if (this.m_sbVertexShader == null) + this.m_sbVertexShader = new StringBuilder(128); + if (this.m_sbVertexShader.Length == 0) + { + this.m_sbVertexShader.Append(" //\r\n // Compute the accumulated WVP matrix. If the separate matrices are not referenced\r\n // by effect elements, the D3DX preshader will combine these on the CPU and set the\r\n // result via VS constants.\r\n //\r\n\r\n float4x4 matAccumulated = mul(g_matWorldView, g_matProjection);\r\n\r\n\r\n //\r\n // Setup the resulting device vertex.\r\n //\r\n\r\n Output.ProjPos = mul(Input.ObjPos, matAccumulated);\r\n Output.Color = Input.Color;\r\n"); + if (Bits.TestFlag(this.m_nRequirements, 1)) + this.m_sbVertexShader.Append(" Output.ViewPos = mul(Input.ObjPos, g_matWorldView);\r\n"); + for (int index = 0; index < this.ImageCount; ++index) + { + if (Bits.TestFlag(this.m_alTextureInfos[index].Requirements, 16)) + this.m_sbVertexShader.AppendFormat(" Output.TexCoord{0} = float3(Input.TexCoord{0}.x * Output.ProjPos.w, Input.TexCoord{0}.y * Output.ProjPos.w, Output.ProjPos.w);\r\n", (object)index); + else + this.m_sbVertexShader.AppendFormat(" Output.TexCoord{0} = Input.TexCoord{0};\r\n", (object)index); + } + } + return this.m_sbVertexShader.ToString(); + } + + private string GeneratePixelShader() + { + StringBuilder stringBuilder = new StringBuilder(128); + for (int index = 0; index < this.ImageCount; ++index) + { + Dx9TextureInfo alTextureInfo = this.m_alTextureInfos[index]; + if (Bits.TestFlag(alTextureInfo.Requirements, 16)) + stringBuilder.AppendFormat(" float2 {0} = Input.TexCoord{1}.xy / Input.TexCoord{1}.z;\r\n", (object)alTextureInfo.TexCoordInput, (object)index); + else + stringBuilder.AppendFormat(" float2 {0} = Input.TexCoord{1};\r\n", (object)alTextureInfo.TexCoordInput, (object)index); + } + stringBuilder.Append("\r\n"); + stringBuilder.Append(this.m_sbPixelShader.ToString()); + return stringBuilder.ToString(); + } + + private int GetRenderTargetCount() + { + if (this.m_alTextureInfos == null) + return 0; + int num = 0; + foreach (Dx9TextureInfo alTextureInfo in this.m_alTextureInfos) + { + if ((alTextureInfo.Requirements & 2) > 0) + { + ++num; + break; + } + } + return num; } - } - return num; } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectManager.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectManager.cs index 0c03fea..4c58769 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectManager.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectManager.cs @@ -10,120 +10,120 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9EffectManager : RenderObject - { - private const int k_cMaxTargetItems = 50; - private RenderSession m_session; - private Dx9GraphicsDevice m_device; - private Dx9EffectBuilder m_effectBuilder; - private Map m_mapEffectCache; - private bool m_fPendingCacheUpdate; - private readonly DeferredHandler m_cbUpdateCache; - - internal Dx9EffectManager(RenderSession session, Dx9GraphicsDevice dx9Device) + internal class Dx9EffectManager : RenderObject { - this.m_session = session; - this.m_device = dx9Device; - this.m_cbUpdateCache = new DeferredHandler(this.UpdateCache); - this.m_effectBuilder = new Dx9EffectBuilder(this.m_device.GraphicsCaps); - } + private const int k_cMaxTargetItems = 50; + private RenderSession m_session; + private Dx9GraphicsDevice m_device; + private Dx9EffectBuilder m_effectBuilder; + private Map m_mapEffectCache; + private bool m_fPendingCacheUpdate; + private readonly DeferredHandler m_cbUpdateCache; - protected override void Dispose(bool fInDispose) - { - try - { - if (!fInDispose || this.m_mapEffectCache == null) - return; - Map.ValueCollection.Enumerator enumerator = this.m_mapEffectCache.Values.GetEnumerator(); - while (enumerator.MoveNext()) - enumerator.Current?.UnregisterUsage((object) this); - this.m_mapEffectCache = (Map) null; - } - finally - { - base.Dispose(fInDispose); - } - } - - internal Dx9EffectBuilder EffectBuilder => this.m_effectBuilder; - - internal Dx9GraphicsDevice Device => this.m_device; - - private bool CacheLookup(ByteBuilder cacheKey, out Dx9EffectResource resource) - { - if (this.m_mapEffectCache == null) - { - resource = (Dx9EffectResource) null; - return false; - } - bool flag = this.m_mapEffectCache.ContainsKey(cacheKey); - resource = !flag ? (Dx9EffectResource) null : this.m_mapEffectCache[cacheKey]; - return flag; - } - - private void AddCachedEffect(ByteBuilder cacheWriter, Dx9EffectResource effect) - { - if (this.m_mapEffectCache == null) - this.m_mapEffectCache = new Map(50); - this.m_mapEffectCache.Add(cacheWriter, effect); - if (effect == null) - return; - this.ScheduleCacheUpdate(); - } - - internal bool CreateEffectResource( - string stName, - EffectInput element, - int nPropCacheSize, - out Dx9EffectResource dxEffectResource) - { - Dx9EffectResource resource = (Dx9EffectResource) null; - ByteBuilder byteBuilder = new ByteBuilder(nPropCacheSize); - element.AddCacheKey(byteBuilder); - if (!this.CacheLookup(byteBuilder, out resource)) - { - resource = new Dx9EffectResource(this.m_session, stName, this); - resource.RegisterUsage((object) this); - if (!resource.Create(element)) + internal Dx9EffectManager(RenderSession session, Dx9GraphicsDevice dx9Device) { - resource.UnregisterUsage((object) this); - dxEffectResource = (Dx9EffectResource) null; - this.AddCachedEffect(byteBuilder, (Dx9EffectResource) null); - return false; + this.m_session = session; + this.m_device = dx9Device; + this.m_cbUpdateCache = new DeferredHandler(this.UpdateCache); + this.m_effectBuilder = new Dx9EffectBuilder(this.m_device.GraphicsCaps); } - this.AddCachedEffect(byteBuilder, resource); - } - dxEffectResource = resource; - return dxEffectResource != null; - } - private void UpdateCache(object arg) - { - if (this.m_mapEffectCache != null) - { - Map map = new Map(Math.Max(50, this.m_mapEffectCache.Count)); - foreach (KeyValueEntry keyValueEntry in this.m_mapEffectCache) + protected override void Dispose(bool fInDispose) { - if (keyValueEntry.Value != null) - { - if (keyValueEntry.Value.UsageCount == 1) - keyValueEntry.Value.UnregisterUsage((object) this); - else - map.Add(keyValueEntry.Key, keyValueEntry.Value); - } + try + { + if (!fInDispose || this.m_mapEffectCache == null) + return; + Map.ValueCollection.Enumerator enumerator = this.m_mapEffectCache.Values.GetEnumerator(); + while (enumerator.MoveNext()) + enumerator.Current?.UnregisterUsage((object)this); + this.m_mapEffectCache = (Map)null; + } + finally + { + base.Dispose(fInDispose); + } } - if (map.Count != this.m_mapEffectCache.Count) - this.m_mapEffectCache = map; - } - this.m_fPendingCacheUpdate = false; - } - private void ScheduleCacheUpdate() - { - if (this.m_fPendingCacheUpdate || this.m_mapEffectCache.Count < 50) - return; - this.m_session.DeferredInvoke((Delegate) this.m_cbUpdateCache, (object) null, DeferredInvokePriority.Idle, new TimeSpan(0, 0, 5)); - this.m_fPendingCacheUpdate = true; + internal Dx9EffectBuilder EffectBuilder => this.m_effectBuilder; + + internal Dx9GraphicsDevice Device => this.m_device; + + private bool CacheLookup(ByteBuilder cacheKey, out Dx9EffectResource resource) + { + if (this.m_mapEffectCache == null) + { + resource = (Dx9EffectResource)null; + return false; + } + bool flag = this.m_mapEffectCache.ContainsKey(cacheKey); + resource = !flag ? (Dx9EffectResource)null : this.m_mapEffectCache[cacheKey]; + return flag; + } + + private void AddCachedEffect(ByteBuilder cacheWriter, Dx9EffectResource effect) + { + if (this.m_mapEffectCache == null) + this.m_mapEffectCache = new Map(50); + this.m_mapEffectCache.Add(cacheWriter, effect); + if (effect == null) + return; + this.ScheduleCacheUpdate(); + } + + internal bool CreateEffectResource( + string stName, + EffectInput element, + int nPropCacheSize, + out Dx9EffectResource dxEffectResource) + { + Dx9EffectResource resource = (Dx9EffectResource)null; + ByteBuilder byteBuilder = new ByteBuilder(nPropCacheSize); + element.AddCacheKey(byteBuilder); + if (!this.CacheLookup(byteBuilder, out resource)) + { + resource = new Dx9EffectResource(this.m_session, stName, this); + resource.RegisterUsage((object)this); + if (!resource.Create(element)) + { + resource.UnregisterUsage((object)this); + dxEffectResource = (Dx9EffectResource)null; + this.AddCachedEffect(byteBuilder, (Dx9EffectResource)null); + return false; + } + this.AddCachedEffect(byteBuilder, resource); + } + dxEffectResource = resource; + return dxEffectResource != null; + } + + private void UpdateCache(object arg) + { + if (this.m_mapEffectCache != null) + { + Map map = new Map(Math.Max(50, this.m_mapEffectCache.Count)); + foreach (KeyValueEntry keyValueEntry in this.m_mapEffectCache) + { + if (keyValueEntry.Value != null) + { + if (keyValueEntry.Value.UsageCount == 1) + keyValueEntry.Value.UnregisterUsage((object)this); + else + map.Add(keyValueEntry.Key, keyValueEntry.Value); + } + } + if (map.Count != this.m_mapEffectCache.Count) + this.m_mapEffectCache = map; + } + this.m_fPendingCacheUpdate = false; + } + + private void ScheduleCacheUpdate() + { + if (this.m_fPendingCacheUpdate || this.m_mapEffectCache.Count < 50) + return; + this.m_session.DeferredInvoke((Delegate)this.m_cbUpdateCache, (object)null, DeferredInvokePriority.Idle, new TimeSpan(0, 0, 5)); + this.m_fPendingCacheUpdate = true; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectResource.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectResource.cs index de57914..dac75b3 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectResource.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectResource.cs @@ -15,382 +15,382 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9EffectResource : SharedRenderObject, IRenderHandleOwner - { - private RenderSession m_session; - private RemoteDx9EffectResource m_remoteEffect; - private string m_stName; - private Dx9EffectManager m_effectManager; - private DataBufferTracker m_tracker; - private Size m_sizeGutter; - private static string k_stVertexShaderName = "ExecuteVertexShader"; - private static string k_stPixelShaderName = "ExecutePixelShader"; - - internal Dx9EffectResource( - RenderSession session, - string stName, - Dx9EffectManager effectManager) + internal class Dx9EffectResource : SharedRenderObject, IRenderHandleOwner { - this.m_session = session; - this.m_stName = stName; - this.m_effectManager = effectManager; - this.m_tracker = MessagingSession.Current.CreateDataBufferTracker((object) this); - } + private RenderSession m_session; + private RemoteDx9EffectResource m_remoteEffect; + private string m_stName; + private Dx9EffectManager m_effectManager; + private DataBufferTracker m_tracker; + private Size m_sizeGutter; + private static string k_stVertexShaderName = "ExecuteVertexShader"; + private static string k_stPixelShaderName = "ExecutePixelShader"; - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + internal Dx9EffectResource( + RenderSession session, + string stName, + Dx9EffectManager effectManager) { - if (this.m_tracker != null) - MessagingSession.Current.ReturnDataBufferTracker(this.m_tracker); - if (this.m_remoteEffect != null) - this.m_remoteEffect.Dispose(); + this.m_session = session; + this.m_stName = stName; + this.m_effectManager = effectManager; + this.m_tracker = MessagingSession.Current.CreateDataBufferTracker((object)this); } - this.m_tracker = (DataBufferTracker) null; - this.m_remoteEffect = (RemoteDx9EffectResource) null; - } - finally - { - base.Dispose(fInDispose); - } - } - public RemoteDx9EffectResource RemoteStub => this.m_remoteEffect; - - private string PixelShaderVersion => this.m_effectManager.Device.PixelShaderProfile; - - private string VertexShaderVersion => this.m_effectManager.Device.VertexShaderProfile; - - internal Size GutterSize => this.m_sizeGutter; - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteEffect.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteEffect = (RemoteDx9EffectResource) null; - - internal bool Create(EffectInput element) - { - Dx9EffectBuilder effectBuilder = this.m_effectManager.EffectBuilder; - effectBuilder.Clear(); - if (!this.ProcessEffectInput(element, ref effectBuilder)) - return false; - this.GenerateEffect(effectBuilder); - uint nBlobSize = 0; - IntPtr pEffectBlob = IntPtr.Zero; - IntPtr pBlobBuffer = IntPtr.Zero; - if (!this.CompileEffect(effectBuilder, out pEffectBlob, out pBlobBuffer, out nBlobSize)) - return false; - Vector propertyVariables = effectBuilder.PropertyVariables; - if (propertyVariables != null) - { - int index = 0; - while (index < propertyVariables.Count) + protected override void Dispose(bool fInDispose) { - if (!propertyVariables[index].IsDynamic) - propertyVariables.RemoveAt(index); - else - ++index; + try + { + if (fInDispose) + { + if (this.m_tracker != null) + MessagingSession.Current.ReturnDataBufferTracker(this.m_tracker); + if (this.m_remoteEffect != null) + this.m_remoteEffect.Dispose(); + } + this.m_tracker = (DataBufferTracker)null; + this.m_remoteEffect = (RemoteDx9EffectResource)null; + } + finally + { + base.Dispose(fInDispose); + } } - } - this.RemoteEffect(effectBuilder, pEffectBlob, pBlobBuffer, nBlobSize); - return true; - } - private bool CompileEffect( - Dx9EffectBuilder effectBuilder, - out IntPtr pEffectBlob, - out IntPtr pBlobBuffer, - out uint nBlobSize) - { - bool flag = false; - IntPtr pErrorString = IntPtr.Zero; - IntPtr pErrorBuffer = IntPtr.Zero; - pEffectBlob = IntPtr.Zero; - pBlobBuffer = IntPtr.Zero; - nBlobSize = 0U; - try - { - EngineApi.IFC(EngineApi.SpDx9CompileEffect(effectBuilder.EffectDefinition, (string) null, out pErrorString, out pErrorBuffer, out pEffectBlob, out nBlobSize, out pBlobBuffer)); - flag = true; - } - catch (Exception ex) - { - if (Marshal.PtrToStringAnsi(pErrorString) == null) - throw; - } - finally - { - if (pErrorBuffer != IntPtr.Zero) - Marshal.Release(pErrorBuffer); - } - return flag; - } + public RemoteDx9EffectResource RemoteStub => this.m_remoteEffect; - private void RemoteEffect( - Dx9EffectBuilder effectBuilder, - IntPtr pEffectBlob, - IntPtr pBlobBuffer, - uint nBlobSize) - { - DataBuffer dataBuffer = this.m_session.BuildDataBuffer(pEffectBlob, nBlobSize); - this.m_tracker.Track(dataBuffer, new DataBufferTracker.CleanupEventHandler(Dx9EffectResource.OnReleaseLocalData), (object) pBlobBuffer); - dataBuffer.Commit(); - this.m_remoteEffect = this.m_session.BuildRemoteDx9EffectResource(this, this.m_effectManager.Device, dataBuffer); - Vector propertyVariables = effectBuilder.PropertyVariables; - if (propertyVariables != null) - { - foreach (VariableInfo variableInfo in propertyVariables) + private string PixelShaderVersion => this.m_effectManager.Device.PixelShaderProfile; + + private string VertexShaderVersion => this.m_effectManager.Device.VertexShaderProfile; + + internal Size GutterSize => this.m_sizeGutter; + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteEffect.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteEffect = (RemoteDx9EffectResource)null; + + internal bool Create(EffectInput element) { - switch (variableInfo.Type) - { - case Dx9VariableType.Integer: - this.m_remoteEffect.SendAddProperty(variableInfo.Name, (int) variableInfo.DefaultValue); - continue; - case Dx9VariableType.Float: - this.m_remoteEffect.SendAddProperty(variableInfo.Name, (float) variableInfo.DefaultValue); - continue; - case Dx9VariableType.Vector2: - this.m_remoteEffect.SendAddProperty(variableInfo.Name, (Vector2) variableInfo.DefaultValue); - continue; - case Dx9VariableType.Vector3: - this.m_remoteEffect.SendAddProperty(variableInfo.Name, (Vector3) variableInfo.DefaultValue); - continue; - case Dx9VariableType.Vector4: - this.m_remoteEffect.SendAddProperty(variableInfo.Name, (Vector4) variableInfo.DefaultValue); - continue; - case Dx9VariableType.Texture: - TextureVariableInfo textureVariableInfo = (TextureVariableInfo) variableInfo; - this.m_remoteEffect.SendAddProperty(variableInfo.Name, textureVariableInfo.CoordinateMapID, textureVariableInfo.ImageIndexID); - continue; - default: - continue; - } + Dx9EffectBuilder effectBuilder = this.m_effectManager.EffectBuilder; + effectBuilder.Clear(); + if (!this.ProcessEffectInput(element, ref effectBuilder)) + return false; + this.GenerateEffect(effectBuilder); + uint nBlobSize = 0; + IntPtr pEffectBlob = IntPtr.Zero; + IntPtr pBlobBuffer = IntPtr.Zero; + if (!this.CompileEffect(effectBuilder, out pEffectBlob, out pBlobBuffer, out nBlobSize)) + return false; + Vector propertyVariables = effectBuilder.PropertyVariables; + if (propertyVariables != null) + { + int index = 0; + while (index < propertyVariables.Count) + { + if (!propertyVariables[index].IsDynamic) + propertyVariables.RemoveAt(index); + else + ++index; + } + } + this.RemoteEffect(effectBuilder, pEffectBlob, pBlobBuffer, nBlobSize); + return true; } - } - this.m_remoteEffect.SendPostPropertiesAdded(); - this.m_remoteEffect.SendSetGutterSize(this.m_sizeGutter); - if (effectBuilder.TextureInfoList == null) - return; - foreach (Dx9TextureInfo textureInfo in effectBuilder.TextureInfoList) - { - if (textureInfo.Requirements != 0) - this.m_remoteEffect.SendAddTextureRequirements(textureInfo.ImageIndex, textureInfo.Requirements, textureInfo.TexelSize, textureInfo.TexUVSize, textureInfo.TexUVRefPoint, textureInfo.DownsamplePropertyID); - } - } - private static void OnReleaseLocalData(object sender, DataBufferTracker.CleanupEventArgs args) - { - IntPtr contextData = (IntPtr) args.ContextData; - if (!(contextData != IntPtr.Zero)) - return; - Marshal.Release(contextData); - IntPtr zero = IntPtr.Zero; - } + private bool CompileEffect( + Dx9EffectBuilder effectBuilder, + out IntPtr pEffectBlob, + out IntPtr pBlobBuffer, + out uint nBlobSize) + { + bool flag = false; + IntPtr pErrorString = IntPtr.Zero; + IntPtr pErrorBuffer = IntPtr.Zero; + pEffectBlob = IntPtr.Zero; + pBlobBuffer = IntPtr.Zero; + nBlobSize = 0U; + try + { + EngineApi.IFC(EngineApi.SpDx9CompileEffect(effectBuilder.EffectDefinition, (string)null, out pErrorString, out pErrorBuffer, out pEffectBlob, out nBlobSize, out pBlobBuffer)); + flag = true; + } + catch (Exception ex) + { + if (Marshal.PtrToStringAnsi(pErrorString) == null) + throw; + } + finally + { + if (pErrorBuffer != IntPtr.Zero) + Marshal.Release(pErrorBuffer); + } + return flag; + } - private string GenerateFileName() => this.m_stName + ".fx"; + private void RemoteEffect( + Dx9EffectBuilder effectBuilder, + IntPtr pEffectBlob, + IntPtr pBlobBuffer, + uint nBlobSize) + { + DataBuffer dataBuffer = this.m_session.BuildDataBuffer(pEffectBlob, nBlobSize); + this.m_tracker.Track(dataBuffer, new DataBufferTracker.CleanupEventHandler(Dx9EffectResource.OnReleaseLocalData), (object)pBlobBuffer); + dataBuffer.Commit(); + this.m_remoteEffect = this.m_session.BuildRemoteDx9EffectResource(this, this.m_effectManager.Device, dataBuffer); + Vector propertyVariables = effectBuilder.PropertyVariables; + if (propertyVariables != null) + { + foreach (VariableInfo variableInfo in propertyVariables) + { + switch (variableInfo.Type) + { + case Dx9VariableType.Integer: + this.m_remoteEffect.SendAddProperty(variableInfo.Name, (int)variableInfo.DefaultValue); + continue; + case Dx9VariableType.Float: + this.m_remoteEffect.SendAddProperty(variableInfo.Name, (float)variableInfo.DefaultValue); + continue; + case Dx9VariableType.Vector2: + this.m_remoteEffect.SendAddProperty(variableInfo.Name, (Vector2)variableInfo.DefaultValue); + continue; + case Dx9VariableType.Vector3: + this.m_remoteEffect.SendAddProperty(variableInfo.Name, (Vector3)variableInfo.DefaultValue); + continue; + case Dx9VariableType.Vector4: + this.m_remoteEffect.SendAddProperty(variableInfo.Name, (Vector4)variableInfo.DefaultValue); + continue; + case Dx9VariableType.Texture: + TextureVariableInfo textureVariableInfo = (TextureVariableInfo)variableInfo; + this.m_remoteEffect.SendAddProperty(variableInfo.Name, textureVariableInfo.CoordinateMapID, textureVariableInfo.ImageIndexID); + continue; + default: + continue; + } + } + } + this.m_remoteEffect.SendPostPropertiesAdded(); + this.m_remoteEffect.SendSetGutterSize(this.m_sizeGutter); + if (effectBuilder.TextureInfoList == null) + return; + foreach (Dx9TextureInfo textureInfo in effectBuilder.TextureInfoList) + { + if (textureInfo.Requirements != 0) + this.m_remoteEffect.SendAddTextureRequirements(textureInfo.ImageIndex, textureInfo.Requirements, textureInfo.TexelSize, textureInfo.TexUVSize, textureInfo.TexUVRefPoint, textureInfo.DownsamplePropertyID); + } + } - protected void EmitHeader(Dx9EffectBuilder effectBuilder) - { - effectBuilder.EmitEffectFragment("#include \"Common.fx\"\r\n"); - effectBuilder.EmitEffectFragment(effectBuilder.IncludesFragment + "\r\n\r\n"); - Vector[] vectorArray = new Vector[2] - { + private static void OnReleaseLocalData(object sender, DataBufferTracker.CleanupEventArgs args) + { + IntPtr contextData = (IntPtr)args.ContextData; + if (!(contextData != IntPtr.Zero)) + return; + Marshal.Release(contextData); + IntPtr zero = IntPtr.Zero; + } + + private string GenerateFileName() => this.m_stName + ".fx"; + + protected void EmitHeader(Dx9EffectBuilder effectBuilder) + { + effectBuilder.EmitEffectFragment("#include \"Common.fx\"\r\n"); + effectBuilder.EmitEffectFragment(effectBuilder.IncludesFragment + "\r\n\r\n"); + Vector[] vectorArray = new Vector[2] + { effectBuilder.PropertyVariables, effectBuilder.GlobalVariables - }; - for (int index = 0; index < vectorArray.Length; ++index) - { - if (vectorArray[index] != null) - { - foreach (VariableInfo variableInfo in vectorArray[index]) - { - if (variableInfo.Name != null) + }; + for (int index = 0; index < vectorArray.Length; ++index) { - switch (variableInfo.Type) - { - case Dx9VariableType.Integer: - if (variableInfo.IsDynamic) - { - effectBuilder.EmitEffectFragment(InvariantString.Format("{0} {1};\r\n", (object) effectBuilder.ConvertToString(variableInfo.Type), (object) variableInfo.Name)); - continue; - } - effectBuilder.EmitEffectFragment(InvariantString.Format("static const {0} {1} = {2};\r\n", (object) effectBuilder.ConvertToString(variableInfo.Type), (object) variableInfo.Name, (object) (int) variableInfo.DefaultValue)); - continue; - case Dx9VariableType.Float: - if (variableInfo.IsDynamic) - { - effectBuilder.EmitEffectFragment(InvariantString.Format("{0} {1};\r\n", (object) effectBuilder.ConvertToString(variableInfo.Type), (object) variableInfo.Name)); - continue; - } - effectBuilder.EmitEffectFragment(InvariantString.Format("static const {0} {1} = {2};\r\n", (object) effectBuilder.ConvertToString(variableInfo.Type), (object) variableInfo.Name, (object) (float) variableInfo.DefaultValue)); - continue; - case Dx9VariableType.Vector2: - if (variableInfo.IsDynamic) - { - effectBuilder.EmitEffectFragment(InvariantString.Format("{0} {1};\r\n", (object) effectBuilder.ConvertToString(variableInfo.Type), (object) variableInfo.Name)); - continue; - } - effectBuilder.EmitEffectFragment(InvariantString.Format("static const {0} {1} = {2};\r\n", (object) effectBuilder.ConvertToString(variableInfo.Type), (object) variableInfo.Name, (object) ((Vector2) variableInfo.DefaultValue).ToDxShaderString())); - continue; - case Dx9VariableType.Vector3: - if (variableInfo.IsDynamic) - { - effectBuilder.EmitEffectFragment(InvariantString.Format("{0} {1};\r\n", (object) effectBuilder.ConvertToString(variableInfo.Type), (object) variableInfo.Name)); - continue; - } - effectBuilder.EmitEffectFragment(InvariantString.Format("static const {0} {1} = {2};\r\n", (object) effectBuilder.ConvertToString(variableInfo.Type), (object) variableInfo.Name, (object) ((Vector3) variableInfo.DefaultValue).ToDxShaderString())); - continue; - case Dx9VariableType.Vector4: - if (variableInfo.IsDynamic) - { - effectBuilder.EmitEffectFragment(InvariantString.Format("{0} {1};\r\n", (object) effectBuilder.ConvertToString(variableInfo.Type), (object) variableInfo.Name)); - continue; - } - effectBuilder.EmitEffectFragment(InvariantString.Format("static const {0} {1} = {2};\r\n", (object) effectBuilder.ConvertToString(variableInfo.Type), (object) variableInfo.Name, (object) ((Vector4) variableInfo.DefaultValue).ToDxShaderString())); - continue; - case Dx9VariableType.Texture: - TextureVariableInfo textureVariableInfo = (TextureVariableInfo) variableInfo; - effectBuilder.EmitEffectFragment(InvariantString.Format("\r\n{0} {1};\r\n", (object) effectBuilder.ConvertToString(textureVariableInfo.Type), (object) textureVariableInfo.Name)); - effectBuilder.EmitEffectFragment(InvariantString.Format("sampler {0} = \r\n sampler_state\r\n {{\r\n Texture = <{1}>;\r\n MinFilter = {2};\r\n MagFilter = {3};\r\n AddressU = Clamp;\r\n AddressV = Clamp;\r\n }};\r\n\r\n", (object) textureVariableInfo.SamplerName, (object) textureVariableInfo.Name, (object) textureVariableInfo.MinFilter, (object) textureVariableInfo.MagFilter)); - continue; - default: - continue; - } + if (vectorArray[index] != null) + { + foreach (VariableInfo variableInfo in vectorArray[index]) + { + if (variableInfo.Name != null) + { + switch (variableInfo.Type) + { + case Dx9VariableType.Integer: + if (variableInfo.IsDynamic) + { + effectBuilder.EmitEffectFragment(InvariantString.Format("{0} {1};\r\n", (object)effectBuilder.ConvertToString(variableInfo.Type), (object)variableInfo.Name)); + continue; + } + effectBuilder.EmitEffectFragment(InvariantString.Format("static const {0} {1} = {2};\r\n", (object)effectBuilder.ConvertToString(variableInfo.Type), (object)variableInfo.Name, (object)(int)variableInfo.DefaultValue)); + continue; + case Dx9VariableType.Float: + if (variableInfo.IsDynamic) + { + effectBuilder.EmitEffectFragment(InvariantString.Format("{0} {1};\r\n", (object)effectBuilder.ConvertToString(variableInfo.Type), (object)variableInfo.Name)); + continue; + } + effectBuilder.EmitEffectFragment(InvariantString.Format("static const {0} {1} = {2};\r\n", (object)effectBuilder.ConvertToString(variableInfo.Type), (object)variableInfo.Name, (object)(float)variableInfo.DefaultValue)); + continue; + case Dx9VariableType.Vector2: + if (variableInfo.IsDynamic) + { + effectBuilder.EmitEffectFragment(InvariantString.Format("{0} {1};\r\n", (object)effectBuilder.ConvertToString(variableInfo.Type), (object)variableInfo.Name)); + continue; + } + effectBuilder.EmitEffectFragment(InvariantString.Format("static const {0} {1} = {2};\r\n", (object)effectBuilder.ConvertToString(variableInfo.Type), (object)variableInfo.Name, (object)((Vector2)variableInfo.DefaultValue).ToDxShaderString())); + continue; + case Dx9VariableType.Vector3: + if (variableInfo.IsDynamic) + { + effectBuilder.EmitEffectFragment(InvariantString.Format("{0} {1};\r\n", (object)effectBuilder.ConvertToString(variableInfo.Type), (object)variableInfo.Name)); + continue; + } + effectBuilder.EmitEffectFragment(InvariantString.Format("static const {0} {1} = {2};\r\n", (object)effectBuilder.ConvertToString(variableInfo.Type), (object)variableInfo.Name, (object)((Vector3)variableInfo.DefaultValue).ToDxShaderString())); + continue; + case Dx9VariableType.Vector4: + if (variableInfo.IsDynamic) + { + effectBuilder.EmitEffectFragment(InvariantString.Format("{0} {1};\r\n", (object)effectBuilder.ConvertToString(variableInfo.Type), (object)variableInfo.Name)); + continue; + } + effectBuilder.EmitEffectFragment(InvariantString.Format("static const {0} {1} = {2};\r\n", (object)effectBuilder.ConvertToString(variableInfo.Type), (object)variableInfo.Name, (object)((Vector4)variableInfo.DefaultValue).ToDxShaderString())); + continue; + case Dx9VariableType.Texture: + TextureVariableInfo textureVariableInfo = (TextureVariableInfo)variableInfo; + effectBuilder.EmitEffectFragment(InvariantString.Format("\r\n{0} {1};\r\n", (object)effectBuilder.ConvertToString(textureVariableInfo.Type), (object)textureVariableInfo.Name)); + effectBuilder.EmitEffectFragment(InvariantString.Format("sampler {0} = \r\n sampler_state\r\n {{\r\n Texture = <{1}>;\r\n MinFilter = {2};\r\n MagFilter = {3};\r\n AddressU = Clamp;\r\n AddressV = Clamp;\r\n }};\r\n\r\n", (object)textureVariableInfo.SamplerName, (object)textureVariableInfo.Name, (object)textureVariableInfo.MinFilter, (object)textureVariableInfo.MagFilter)); + continue; + default: + continue; + } + } + } + } } - } + effectBuilder.EmitEffectFragment("\r\n"); } - } - effectBuilder.EmitEffectFragment("\r\n"); - } - protected void EmitShaders(Dx9EffectBuilder effectBuilder) - { - effectBuilder.EmitEffectFragment(effectBuilder.ShaderDeclarations); - effectBuilder.EmitEffectFragment(InvariantString.Format("VS_OUTPUT {0}(VS_INPUT Input)\r\n{{\r\n VS_OUTPUT Output;\r\n\r\n{1}\r\n return Output;\r\n}}\r\n\r\n", (object) Dx9EffectResource.k_stVertexShaderName, (object) effectBuilder.VertexShader)); - effectBuilder.EmitEffectFragment(InvariantString.Format("PS_OUTPUT {0}(VS_OUTPUT Input)\r\n{{\r\n PS_OUTPUT Output;\r\n\r\n{1} // Include Vertex color contribution\r\n Output.Color = {2} * Input.Color;\r\n\r\n // Return the final result\r\n return Output;\r\n}}\r\n\r\n", (object) Dx9EffectResource.k_stPixelShaderName, (object) effectBuilder.PixelShader, (object) effectBuilder.PixelShaderOutput)); - } - - protected void EmitTechnique(Dx9EffectBuilder effectBuilder) => effectBuilder.EmitEffectFragment(InvariantString.Format("technique GeneratedTechnique\r\n{{\r\n pass P0\r\n {{\r\n // Shaders\r\n PixelShader = compile {0} {1}();\r\n VertexShader = compile {2} {3}();\r\n }}\r\n}}\r\n", (object) this.PixelShaderVersion, (object) Dx9EffectResource.k_stPixelShaderName, (object) this.VertexShaderVersion, (object) Dx9EffectResource.k_stVertexShaderName)); - - private void GenerateEffect(Dx9EffectBuilder effectBuilder) - { - this.EmitHeader(effectBuilder); - this.EmitShaders(effectBuilder); - this.EmitTechnique(effectBuilder); - } - - private bool ProcessEffectInput(EffectInput efiCurrent, ref Dx9EffectBuilder effectBuilder) - { - bool flag = true; - switch (efiCurrent.Type) - { - case EffectInputType.Color: - Dx9ColorElement.Generate((ColorElement) efiCurrent, ref effectBuilder); - break; - case EffectInputType.Image: - Dx9ImageElement.Generate((ImageElement) efiCurrent, ref effectBuilder); - break; - case EffectInputType.Blend: - BlendElement efiBlend = (BlendElement) efiCurrent; - this.ProcessEffectInput(efiBlend.Input1, ref effectBuilder); - string pixelShaderOutput1 = effectBuilder.PixelShaderOutput; - this.ProcessEffectInput(efiBlend.Input2, ref effectBuilder); - string pixelShaderOutput2 = effectBuilder.PixelShaderOutput; - Dx9BlendElement.Generate(efiBlend, pixelShaderOutput1, pixelShaderOutput2, ref effectBuilder); - break; - case EffectInputType.Interpolate: - InterpolateElement efiInterpolate = (InterpolateElement) efiCurrent; - this.ProcessEffectInput(efiInterpolate.Input1, ref effectBuilder); - string pixelShaderOutput3 = effectBuilder.PixelShaderOutput; - this.ProcessEffectInput(efiInterpolate.Input2, ref effectBuilder); - string pixelShaderOutput4 = effectBuilder.PixelShaderOutput; - Dx9InterpolateElement.Generate(efiInterpolate, pixelShaderOutput3, pixelShaderOutput4, ref effectBuilder); - break; - case EffectInputType.Layer: - flag = this.ProcessEffectLayer((EffectLayer) efiCurrent, ref effectBuilder); - break; - case EffectInputType.ComplexImage: - Dx9ComplexImageElement.Generate((ComplexImageElement) efiCurrent, ref effectBuilder); - break; - case EffectInputType.Video: - Dx9VideoElement.Generate((VideoElement) efiCurrent, ref effectBuilder); - break; - case EffectInputType.Spotlight2D: - Dx9SpotLight2DElement.Generate((SpotLight2DElement) efiCurrent, ref effectBuilder); - break; - case EffectInputType.PointLight2D: - Dx9PointLight2DElement.Generate((PointLight2DElement) efiCurrent, ref effectBuilder); - break; - case EffectInputType.Destination: - Dx9DestinationElement.Generate((DestinationElement) efiCurrent, ref effectBuilder); - this.m_sizeGutter.Width = Math.Max(this.m_sizeGutter.Width, 1); - this.m_sizeGutter.Height = Math.Max(this.m_sizeGutter.Height, 1); - break; - } - return flag && effectBuilder.Validate(); - } - - private bool ProcessEffectLayer(EffectLayer eflCurrent, ref Dx9EffectBuilder effectBuilder) - { - if (!this.ProcessEffectInput(eflCurrent.Input, ref effectBuilder)) - return false; - if (eflCurrent.Operations != null) - { - foreach (EffectOperation operation in (IEnumerable) eflCurrent.Operations) + protected void EmitShaders(Dx9EffectBuilder effectBuilder) { - switch (operation.Type) - { - case EffectOperationType.Brightness: - Dx9BrightnessElement.Generate((BrightnessElement) operation, ref effectBuilder); - continue; - case EffectOperationType.Contrast: - Dx9ContrastElement.Generate((ContrastElement) operation, ref effectBuilder); - continue; - case EffectOperationType.Desaturate: - Dx9DesaturateElement.Generate((DesaturateElement) operation, ref effectBuilder); - continue; - case EffectOperationType.EdgeDetection: - Dx9EdgeDetectionElement.Generate((EdgeDetectionElement) operation, ref effectBuilder); - continue; - case EffectOperationType.Emboss: - Dx9EmbossElement.Generate((EmbossElement) operation, ref effectBuilder); - continue; - case EffectOperationType.GaussianBlur: - Debug2.Validate(eflCurrent.Input.Type == EffectInputType.Image || eflCurrent.Input.Type == EffectInputType.Video || eflCurrent.Input.Type == EffectInputType.Destination, typeof (InvalidOperationException), "GaussianBlurElement only valid for inputs with ImageElement inputs"); - GaussianBlurElement efoBlur = (GaussianBlurElement) operation; - Dx9GaussianBlurElement.Generate(efoBlur, ref effectBuilder); - this.m_sizeGutter.Width = Math.Max(this.m_sizeGutter.Width, efoBlur.KernelRadius + 1); - this.m_sizeGutter.Height = Math.Max(this.m_sizeGutter.Height, efoBlur.KernelRadius + 1); - continue; - case EffectOperationType.HSL: - Dx9HSLElement.Generate((HSLElement) operation, ref effectBuilder); - continue; - case EffectOperationType.HSV: - Dx9HSVElement.Generate((HSVElement) operation, ref effectBuilder); - continue; - case EffectOperationType.InvAlpha: - Dx9InvAlphaElement.Generate(operation, ref effectBuilder); - continue; - case EffectOperationType.InvColor: - Dx9InvColorElement.Generate(operation, ref effectBuilder); - continue; - case EffectOperationType.Invert: - Dx9InvertElement.Generate((InvertElement) operation, ref effectBuilder); - continue; - case EffectOperationType.LightShaft: - Debug2.Validate(eflCurrent.Input.Type == EffectInputType.Image || eflCurrent.Input.Type == EffectInputType.Video || eflCurrent.Input.Type == EffectInputType.Destination, typeof (InvalidOperationException), "LightShaftElement only valid for inputs with ImageElement inputs"); - Dx9LightShaftElement.Generate((LightShaftElement) operation, ref effectBuilder); - continue; - case EffectOperationType.Sepia: - Dx9SepiaElement.Generate((SepiaElement) operation, ref effectBuilder); - continue; - default: - continue; - } + effectBuilder.EmitEffectFragment(effectBuilder.ShaderDeclarations); + effectBuilder.EmitEffectFragment(InvariantString.Format("VS_OUTPUT {0}(VS_INPUT Input)\r\n{{\r\n VS_OUTPUT Output;\r\n\r\n{1}\r\n return Output;\r\n}}\r\n\r\n", (object)Dx9EffectResource.k_stVertexShaderName, (object)effectBuilder.VertexShader)); + effectBuilder.EmitEffectFragment(InvariantString.Format("PS_OUTPUT {0}(VS_OUTPUT Input)\r\n{{\r\n PS_OUTPUT Output;\r\n\r\n{1} // Include Vertex color contribution\r\n Output.Color = {2} * Input.Color;\r\n\r\n // Return the final result\r\n return Output;\r\n}}\r\n\r\n", (object)Dx9EffectResource.k_stPixelShaderName, (object)effectBuilder.PixelShader, (object)effectBuilder.PixelShaderOutput)); + } + + protected void EmitTechnique(Dx9EffectBuilder effectBuilder) => effectBuilder.EmitEffectFragment(InvariantString.Format("technique GeneratedTechnique\r\n{{\r\n pass P0\r\n {{\r\n // Shaders\r\n PixelShader = compile {0} {1}();\r\n VertexShader = compile {2} {3}();\r\n }}\r\n}}\r\n", (object)this.PixelShaderVersion, (object)Dx9EffectResource.k_stPixelShaderName, (object)this.VertexShaderVersion, (object)Dx9EffectResource.k_stVertexShaderName)); + + private void GenerateEffect(Dx9EffectBuilder effectBuilder) + { + this.EmitHeader(effectBuilder); + this.EmitShaders(effectBuilder); + this.EmitTechnique(effectBuilder); + } + + private bool ProcessEffectInput(EffectInput efiCurrent, ref Dx9EffectBuilder effectBuilder) + { + bool flag = true; + switch (efiCurrent.Type) + { + case EffectInputType.Color: + Dx9ColorElement.Generate((ColorElement)efiCurrent, ref effectBuilder); + break; + case EffectInputType.Image: + Dx9ImageElement.Generate((ImageElement)efiCurrent, ref effectBuilder); + break; + case EffectInputType.Blend: + BlendElement efiBlend = (BlendElement)efiCurrent; + this.ProcessEffectInput(efiBlend.Input1, ref effectBuilder); + string pixelShaderOutput1 = effectBuilder.PixelShaderOutput; + this.ProcessEffectInput(efiBlend.Input2, ref effectBuilder); + string pixelShaderOutput2 = effectBuilder.PixelShaderOutput; + Dx9BlendElement.Generate(efiBlend, pixelShaderOutput1, pixelShaderOutput2, ref effectBuilder); + break; + case EffectInputType.Interpolate: + InterpolateElement efiInterpolate = (InterpolateElement)efiCurrent; + this.ProcessEffectInput(efiInterpolate.Input1, ref effectBuilder); + string pixelShaderOutput3 = effectBuilder.PixelShaderOutput; + this.ProcessEffectInput(efiInterpolate.Input2, ref effectBuilder); + string pixelShaderOutput4 = effectBuilder.PixelShaderOutput; + Dx9InterpolateElement.Generate(efiInterpolate, pixelShaderOutput3, pixelShaderOutput4, ref effectBuilder); + break; + case EffectInputType.Layer: + flag = this.ProcessEffectLayer((EffectLayer)efiCurrent, ref effectBuilder); + break; + case EffectInputType.ComplexImage: + Dx9ComplexImageElement.Generate((ComplexImageElement)efiCurrent, ref effectBuilder); + break; + case EffectInputType.Video: + Dx9VideoElement.Generate((VideoElement)efiCurrent, ref effectBuilder); + break; + case EffectInputType.Spotlight2D: + Dx9SpotLight2DElement.Generate((SpotLight2DElement)efiCurrent, ref effectBuilder); + break; + case EffectInputType.PointLight2D: + Dx9PointLight2DElement.Generate((PointLight2DElement)efiCurrent, ref effectBuilder); + break; + case EffectInputType.Destination: + Dx9DestinationElement.Generate((DestinationElement)efiCurrent, ref effectBuilder); + this.m_sizeGutter.Width = Math.Max(this.m_sizeGutter.Width, 1); + this.m_sizeGutter.Height = Math.Max(this.m_sizeGutter.Height, 1); + break; + } + return flag && effectBuilder.Validate(); + } + + private bool ProcessEffectLayer(EffectLayer eflCurrent, ref Dx9EffectBuilder effectBuilder) + { + if (!this.ProcessEffectInput(eflCurrent.Input, ref effectBuilder)) + return false; + if (eflCurrent.Operations != null) + { + foreach (EffectOperation operation in (IEnumerable)eflCurrent.Operations) + { + switch (operation.Type) + { + case EffectOperationType.Brightness: + Dx9BrightnessElement.Generate((BrightnessElement)operation, ref effectBuilder); + continue; + case EffectOperationType.Contrast: + Dx9ContrastElement.Generate((ContrastElement)operation, ref effectBuilder); + continue; + case EffectOperationType.Desaturate: + Dx9DesaturateElement.Generate((DesaturateElement)operation, ref effectBuilder); + continue; + case EffectOperationType.EdgeDetection: + Dx9EdgeDetectionElement.Generate((EdgeDetectionElement)operation, ref effectBuilder); + continue; + case EffectOperationType.Emboss: + Dx9EmbossElement.Generate((EmbossElement)operation, ref effectBuilder); + continue; + case EffectOperationType.GaussianBlur: + Debug2.Validate(eflCurrent.Input.Type == EffectInputType.Image || eflCurrent.Input.Type == EffectInputType.Video || eflCurrent.Input.Type == EffectInputType.Destination, typeof(InvalidOperationException), "GaussianBlurElement only valid for inputs with ImageElement inputs"); + GaussianBlurElement efoBlur = (GaussianBlurElement)operation; + Dx9GaussianBlurElement.Generate(efoBlur, ref effectBuilder); + this.m_sizeGutter.Width = Math.Max(this.m_sizeGutter.Width, efoBlur.KernelRadius + 1); + this.m_sizeGutter.Height = Math.Max(this.m_sizeGutter.Height, efoBlur.KernelRadius + 1); + continue; + case EffectOperationType.HSL: + Dx9HSLElement.Generate((HSLElement)operation, ref effectBuilder); + continue; + case EffectOperationType.HSV: + Dx9HSVElement.Generate((HSVElement)operation, ref effectBuilder); + continue; + case EffectOperationType.InvAlpha: + Dx9InvAlphaElement.Generate(operation, ref effectBuilder); + continue; + case EffectOperationType.InvColor: + Dx9InvColorElement.Generate(operation, ref effectBuilder); + continue; + case EffectOperationType.Invert: + Dx9InvertElement.Generate((InvertElement)operation, ref effectBuilder); + continue; + case EffectOperationType.LightShaft: + Debug2.Validate(eflCurrent.Input.Type == EffectInputType.Image || eflCurrent.Input.Type == EffectInputType.Video || eflCurrent.Input.Type == EffectInputType.Destination, typeof(InvalidOperationException), "LightShaftElement only valid for inputs with ImageElement inputs"); + Dx9LightShaftElement.Generate((LightShaftElement)operation, ref effectBuilder); + continue; + case EffectOperationType.Sepia: + Dx9SepiaElement.Generate((SepiaElement)operation, ref effectBuilder); + continue; + default: + continue; + } + } + } + return true; } - } - return true; } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectTemplate.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectTemplate.cs index a40b67a..1658e0a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectTemplate.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EffectTemplate.cs @@ -10,83 +10,83 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9EffectTemplate : EffectTemplate - { - private Dx9EffectResource m_effectResource; - - internal Dx9EffectTemplate(RenderSession session, GraphicsDevice device, string stName) - : base(session, device, stName) + internal class Dx9EffectTemplate : EffectTemplate { - } + private Dx9EffectResource m_effectResource; - protected override void Dispose(bool fInDispose) - { - try - { - if (!fInDispose || this.m_effectResource == null) - return; - this.m_effectResource.UnregisterUsage((object) this); - this.m_effectResource = (Dx9EffectResource) null; - } - finally - { - base.Dispose(fInDispose); - } - } - - internal Dx9EffectManager EffectManager => ((Dx9GraphicsDevice) this.m_graphicsDevice).EffectManager; - - internal Dx9EffectResource EffectResource => this.m_effectResource; - - protected override bool Build(EffectInput input) - { - int nPropCacheSize = 0; - if (!this.GenerateProperties(input, this.m_dynamicProperties, out nPropCacheSize) || !this.ProcessEffectElement(input, this.m_dynamicProperties, nPropCacheSize)) - return false; - Map.Enumerator enumerator = this.m_dynamicProperties.GetEnumerator(); - while (enumerator.MoveNext()) - { - EffectProperty effectProperty = enumerator.Current.Value; - if (effectProperty == null || !effectProperty.IsDynamic) + internal Dx9EffectTemplate(RenderSession session, GraphicsDevice device, string stName) + : base(session, device, stName) { - this.m_dynamicProperties.Remove(enumerator.Current.Key); - enumerator = this.m_dynamicProperties.GetEnumerator(); } - } - return true; - } - public override IEffect CreateInstance(object objUser) - { - Debug2.Validate(this.m_fBuilt, typeof (InvalidOperationException), "Cannot create instance if the template is not built"); - Dx9Effect dx9Effect = (Dx9Effect) null; - if (this.m_cache != null) - dx9Effect = (Dx9Effect) this.m_cache.Remove(objUser); - if (dx9Effect == null) - { - dx9Effect = new Dx9Effect(this); - dx9Effect.Cache = this.m_cache; - dx9Effect.RegisterUsage(objUser); - dx9Effect.RemoteEffect(); - } - return (IEffect) dx9Effect; - } + protected override void Dispose(bool fInDispose) + { + try + { + if (!fInDispose || this.m_effectResource == null) + return; + this.m_effectResource.UnregisterUsage((object)this); + this.m_effectResource = (Dx9EffectResource)null; + } + finally + { + base.Dispose(fInDispose); + } + } - private bool ProcessEffectElement( - EffectInput element, - Map allProps, - int nPropCacheSize) - { - if (!(this.m_graphicsDevice as Dx9GraphicsDevice).EffectManager.CreateEffectResource(this.m_stName, element, nPropCacheSize, out this.m_effectResource)) - return false; - this.m_effectResource.RegisterUsage((object) this); - foreach (KeyValueEntry allProp in allProps) - { - EffectProperty effectProperty = allProp.Value; - if (effectProperty.Type == EffectPropertyType.Image && effectProperty.Value != null) - ((Image) effectProperty.Value).GutterSize = this.m_effectResource.GutterSize; - } - return true; + internal Dx9EffectManager EffectManager => ((Dx9GraphicsDevice)this.m_graphicsDevice).EffectManager; + + internal Dx9EffectResource EffectResource => this.m_effectResource; + + protected override bool Build(EffectInput input) + { + int nPropCacheSize = 0; + if (!this.GenerateProperties(input, this.m_dynamicProperties, out nPropCacheSize) || !this.ProcessEffectElement(input, this.m_dynamicProperties, nPropCacheSize)) + return false; + Map.Enumerator enumerator = this.m_dynamicProperties.GetEnumerator(); + while (enumerator.MoveNext()) + { + EffectProperty effectProperty = enumerator.Current.Value; + if (effectProperty == null || !effectProperty.IsDynamic) + { + this.m_dynamicProperties.Remove(enumerator.Current.Key); + enumerator = this.m_dynamicProperties.GetEnumerator(); + } + } + return true; + } + + public override IEffect CreateInstance(object objUser) + { + Debug2.Validate(this.m_fBuilt, typeof(InvalidOperationException), "Cannot create instance if the template is not built"); + Dx9Effect dx9Effect = (Dx9Effect)null; + if (this.m_cache != null) + dx9Effect = (Dx9Effect)this.m_cache.Remove(objUser); + if (dx9Effect == null) + { + dx9Effect = new Dx9Effect(this); + dx9Effect.Cache = this.m_cache; + dx9Effect.RegisterUsage(objUser); + dx9Effect.RemoteEffect(); + } + return (IEffect)dx9Effect; + } + + private bool ProcessEffectElement( + EffectInput element, + Map allProps, + int nPropCacheSize) + { + if (!(this.m_graphicsDevice as Dx9GraphicsDevice).EffectManager.CreateEffectResource(this.m_stName, element, nPropCacheSize, out this.m_effectResource)) + return false; + this.m_effectResource.RegisterUsage((object)this); + foreach (KeyValueEntry allProp in allProps) + { + EffectProperty effectProperty = allProp.Value; + if (effectProperty.Type == EffectPropertyType.Image && effectProperty.Value != null) + ((Image)effectProperty.Value).GutterSize = this.m_effectResource.GutterSize; + } + return true; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EmbossElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EmbossElement.cs index da3fbc0..546437a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EmbossElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9EmbossElement.cs @@ -8,31 +8,31 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9EmbossElement - { - internal static void Generate(EmbossElement efoEmboss, ref Dx9EffectBuilder effectBuilder) + internal class Dx9EmbossElement { - Dx9TextureInfo textureInfo = effectBuilder.GetTextureInfo(effectBuilder.ImageCount - 1); - effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object) null); - VariableInfo variableInfo1 = new VariableInfo() - { - ID = (int) efoEmboss.DirectionID, - Type = Dx9VariableType.Integer, - IsDynamic = efoEmboss.IsDynamicProperty("Direction") - }; - variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efoEmboss.Name + "Direction") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efoEmboss.Name + "Direction"); - variableInfo1.DefaultValue = (object) efoEmboss.Direction; - effectBuilder.AddPropertyVariable(variableInfo1); - VariableInfo variableInfo2 = new VariableInfo() - { - ID = (int) efoEmboss.GrayLevelID, - Type = Dx9VariableType.Float, - IsDynamic = efoEmboss.IsDynamicProperty("GrayLevel") - }; - variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efoEmboss.Name + "GrayLevel") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efoEmboss.Name + "GrayLevel"); - variableInfo2.DefaultValue = (object) efoEmboss.GrayLevel; - effectBuilder.AddPropertyVariable(variableInfo2); - effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // Sample neightbour pixel\r\n float4 vNeightbourPixel;\r\n if ({5} == 0)\r\n {{\r\n vNeightbourPixel = tex2D({1}, {2} + float2(-{3}.x, -{3}.y));\r\n }}\r\n else\r\n {{\r\n vNeightbourPixel = tex2D({1}, {2} + float2(+{3}.x, +{3}.y));\r\n }}\r\n float4 vDiff = {0} - vNeightbourPixel;\r\n float maxDiffColor = vDiff.r;\r\n if (abs(vDiff.g) > abs(maxDiffColor))\r\n {{\r\n maxDiffColor = vDiff.g;\r\n }}\r\n if (abs(vDiff.b) > abs(maxDiffColor))\r\n {{\r\n maxDiffColor = vDiff.b;\r\n }}\r\n maxDiffColor += {4};\r\n float minGray = min(maxDiffColor, 1.0f);\r\n float grayLevel = max(minGray, 0.0f);\r\n {0}.rgb = grayLevel;\r\n }}\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput, (object) textureInfo.TexelSize, (object) variableInfo2.Name, (object) variableInfo1.Name)); + internal static void Generate(EmbossElement efoEmboss, ref Dx9EffectBuilder effectBuilder) + { + Dx9TextureInfo textureInfo = effectBuilder.GetTextureInfo(effectBuilder.ImageCount - 1); + effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object)null); + VariableInfo variableInfo1 = new VariableInfo() + { + ID = (int)efoEmboss.DirectionID, + Type = Dx9VariableType.Integer, + IsDynamic = efoEmboss.IsDynamicProperty("Direction") + }; + variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efoEmboss.Name + "Direction") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efoEmboss.Name + "Direction"); + variableInfo1.DefaultValue = (object)efoEmboss.Direction; + effectBuilder.AddPropertyVariable(variableInfo1); + VariableInfo variableInfo2 = new VariableInfo() + { + ID = (int)efoEmboss.GrayLevelID, + Type = Dx9VariableType.Float, + IsDynamic = efoEmboss.IsDynamicProperty("GrayLevel") + }; + variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efoEmboss.Name + "GrayLevel") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efoEmboss.Name + "GrayLevel"); + variableInfo2.DefaultValue = (object)efoEmboss.GrayLevel; + effectBuilder.AddPropertyVariable(variableInfo2); + effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // Sample neightbour pixel\r\n float4 vNeightbourPixel;\r\n if ({5} == 0)\r\n {{\r\n vNeightbourPixel = tex2D({1}, {2} + float2(-{3}.x, -{3}.y));\r\n }}\r\n else\r\n {{\r\n vNeightbourPixel = tex2D({1}, {2} + float2(+{3}.x, +{3}.y));\r\n }}\r\n float4 vDiff = {0} - vNeightbourPixel;\r\n float maxDiffColor = vDiff.r;\r\n if (abs(vDiff.g) > abs(maxDiffColor))\r\n {{\r\n maxDiffColor = vDiff.g;\r\n }}\r\n if (abs(vDiff.b) > abs(maxDiffColor))\r\n {{\r\n maxDiffColor = vDiff.b;\r\n }}\r\n maxDiffColor += {4};\r\n float minGray = min(maxDiffColor, 1.0f);\r\n float grayLevel = max(minGray, 0.0f);\r\n {0}.rgb = grayLevel;\r\n }}\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput, (object)textureInfo.TexelSize, (object)variableInfo2.Name, (object)variableInfo1.Name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9GaussianBlurElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9GaussianBlurElement.cs index 0a41e49..e819ef1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9GaussianBlurElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9GaussianBlurElement.cs @@ -10,107 +10,107 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9GaussianBlurElement - { - private static void GenerateWeights1D(int nKernelRadius, double flDeviation, double[] arKernel) + internal class Dx9GaussianBlurElement { - Debug2.Validate(flDeviation > 0.0, typeof (ArgumentOutOfRangeException), "Standard deviation must be > 0.0"); - Debug2.Validate(nKernelRadius >= 1, typeof (ArgumentOutOfRangeException), "Kernel radius must be >= 1"); - int num1 = 1 + 2 * nKernelRadius; - double num2 = 0.0; - Debug2.Validate(arKernel != null && num1 == arKernel.GetLength(0), typeof (ArgumentException), nameof (arKernel)); - double num3 = 2.0 * (flDeviation * flDeviation); - double num4 = Math.Sqrt(2.0 * Math.PI) * flDeviation; - for (int index = 0; index < num1; ++index) - { - double num5 = (double) (index - nKernelRadius); - double num6 = Math.Exp(-(num5 * num5) / num3); - arKernel[index] = num6 / num4; - num2 += arKernel[index]; - } - for (int index = 0; index < num1; ++index) - arKernel[index] /= num2; - } - - private static void GenerateWeights2D( - int nKernelRadius, - double flDeviation, - double[,] arKernel) - { - Debug2.Validate(flDeviation > 0.0, typeof (ArgumentOutOfRangeException), "Standard deviation must be > 0.0"); - Debug2.Validate(nKernelRadius >= 1, typeof (ArgumentOutOfRangeException), "Kernel radius must be >= 1"); - double num1 = 0.0; - int num2 = 1 + 2 * nKernelRadius; - Debug2.Validate(arKernel != null && num2 == arKernel.GetLength(0) && num2 == arKernel.GetLength(1), typeof (ArgumentException), nameof (arKernel)); - double num3 = flDeviation * flDeviation; - double num4 = 2.0 * num3; - double num5 = 2.0 * Math.PI * num3; - for (int index1 = 0; index1 < num2; ++index1) - { - for (int index2 = 0; index2 < num2; ++index2) + private static void GenerateWeights1D(int nKernelRadius, double flDeviation, double[] arKernel) { - double num6 = (double) (index2 - nKernelRadius); - double num7 = (double) (index1 - nKernelRadius); - double num8 = Math.Exp(-(num6 * num6 + num7 * num7) / num4); - arKernel[index2, index1] = num8 / num5; - num1 += arKernel[index2, index1]; - } - } - for (int index1 = 0; index1 < num2; ++index1) - { - for (int index2 = 0; index2 < num2; ++index2) - arKernel[index2, index1] /= num1; - } - } - - internal static void Generate(GaussianBlurElement efoBlur, ref Dx9EffectBuilder effectBuilder) - { - Dx9TextureInfo textureInfo = effectBuilder.GetTextureInfo(effectBuilder.ImageCount - 1); - effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object) null); - switch (efoBlur.Mode) - { - case GaussianBlurMode.Normal: - int length1 = 1 + efoBlur.KernelRadius * 2; - double[,] arKernel1 = new double[length1, length1]; - Dx9GaussianBlurElement.GenerateWeights2D(efoBlur.KernelRadius, (double) efoBlur.Bluriness, arKernel1); - effectBuilder.EmitPixelFragment(" {\r\n // Gaussian filter\r\n float4 vBlur = 0;\r\n"); - for (int index1 = 0; index1 < length1; ++index1) - { - for (int index2 = 0; index2 < length1; ++index2) + Debug2.Validate(flDeviation > 0.0, typeof(ArgumentOutOfRangeException), "Standard deviation must be > 0.0"); + Debug2.Validate(nKernelRadius >= 1, typeof(ArgumentOutOfRangeException), "Kernel radius must be >= 1"); + int num1 = 1 + 2 * nKernelRadius; + double num2 = 0.0; + Debug2.Validate(arKernel != null && num1 == arKernel.GetLength(0), typeof(ArgumentException), nameof(arKernel)); + double num3 = 2.0 * (flDeviation * flDeviation); + double num4 = Math.Sqrt(2.0 * Math.PI) * flDeviation; + for (int index = 0; index < num1; ++index) { - int num1 = index2 - efoBlur.KernelRadius; - int num2 = index1 - efoBlur.KernelRadius; - if (num1 == 0 && num2 == 0) - effectBuilder.EmitPixelFragment(InvariantString.Format(" vBlur += {0} * {1};\r\n", (object) effectBuilder.PixelShaderOutput, (object) arKernel1[index2, index1])); - else - effectBuilder.EmitPixelFragment(InvariantString.Format(" vBlur += tex2D({0}, {1} + float2({2}.x * {3}, {2}.y * {4})) * {5};\r\n", (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput, (object) textureInfo.TexelSize, (object) num1, (object) num2, (object) arKernel1[index2, index1])); + double num5 = (double)(index - nKernelRadius); + double num6 = Math.Exp(-(num5 * num5) / num3); + arKernel[index] = num6 / num4; + num2 += arKernel[index]; } - } - effectBuilder.EmitPixelFragment(InvariantString.Format(" {0} = vBlur;\r\n }}\r\n\r\n", (object) effectBuilder.PixelShaderOutput)); - break; - case GaussianBlurMode.Horizontal: - case GaussianBlurMode.Vertical: - bool flag = efoBlur.Mode == GaussianBlurMode.Horizontal; - int length2 = 1 + efoBlur.KernelRadius * 2; - double[] arKernel2 = new double[length2]; - Dx9GaussianBlurElement.GenerateWeights1D(efoBlur.KernelRadius, (double) efoBlur.Bluriness, arKernel2); - effectBuilder.EmitPixelFragment(" {\r\n // Gaussian filter\r\n float4 vBlur = 0;\r\n"); - for (int index = 0; index < length2; ++index) - { - int num = index - efoBlur.KernelRadius; - if (num == 0) - effectBuilder.EmitPixelFragment(InvariantString.Format(" vBlur += {0} * {1};\r\n", (object) effectBuilder.PixelShaderOutput, (object) arKernel2[index])); - else if (flag) - effectBuilder.EmitPixelFragment(InvariantString.Format(" vBlur += tex2D({0}, {1} + float2({2}.x * {3}, 0)) * {4};\r\n", (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput, (object) textureInfo.TexelSize, (object) num, (object) arKernel2[index])); - else - effectBuilder.EmitPixelFragment(InvariantString.Format(" vBlur += tex2D({0}, {1} + float2(0, {2}.y * {3})) * {4};\r\n", (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput, (object) textureInfo.TexelSize, (object) num, (object) arKernel2[index])); - } - effectBuilder.EmitPixelFragment(InvariantString.Format(" {0} = vBlur;\r\n }}\r\n\r\n", (object) effectBuilder.PixelShaderOutput)); - break; - default: - Debug2.Validate(false, typeof (InvalidOperationException), "Unknown blur mode"); - break; - } + for (int index = 0; index < num1; ++index) + arKernel[index] /= num2; + } + + private static void GenerateWeights2D( + int nKernelRadius, + double flDeviation, + double[,] arKernel) + { + Debug2.Validate(flDeviation > 0.0, typeof(ArgumentOutOfRangeException), "Standard deviation must be > 0.0"); + Debug2.Validate(nKernelRadius >= 1, typeof(ArgumentOutOfRangeException), "Kernel radius must be >= 1"); + double num1 = 0.0; + int num2 = 1 + 2 * nKernelRadius; + Debug2.Validate(arKernel != null && num2 == arKernel.GetLength(0) && num2 == arKernel.GetLength(1), typeof(ArgumentException), nameof(arKernel)); + double num3 = flDeviation * flDeviation; + double num4 = 2.0 * num3; + double num5 = 2.0 * Math.PI * num3; + for (int index1 = 0; index1 < num2; ++index1) + { + for (int index2 = 0; index2 < num2; ++index2) + { + double num6 = (double)(index2 - nKernelRadius); + double num7 = (double)(index1 - nKernelRadius); + double num8 = Math.Exp(-(num6 * num6 + num7 * num7) / num4); + arKernel[index2, index1] = num8 / num5; + num1 += arKernel[index2, index1]; + } + } + for (int index1 = 0; index1 < num2; ++index1) + { + for (int index2 = 0; index2 < num2; ++index2) + arKernel[index2, index1] /= num1; + } + } + + internal static void Generate(GaussianBlurElement efoBlur, ref Dx9EffectBuilder effectBuilder) + { + Dx9TextureInfo textureInfo = effectBuilder.GetTextureInfo(effectBuilder.ImageCount - 1); + effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object)null); + switch (efoBlur.Mode) + { + case GaussianBlurMode.Normal: + int length1 = 1 + efoBlur.KernelRadius * 2; + double[,] arKernel1 = new double[length1, length1]; + Dx9GaussianBlurElement.GenerateWeights2D(efoBlur.KernelRadius, (double)efoBlur.Bluriness, arKernel1); + effectBuilder.EmitPixelFragment(" {\r\n // Gaussian filter\r\n float4 vBlur = 0;\r\n"); + for (int index1 = 0; index1 < length1; ++index1) + { + for (int index2 = 0; index2 < length1; ++index2) + { + int num1 = index2 - efoBlur.KernelRadius; + int num2 = index1 - efoBlur.KernelRadius; + if (num1 == 0 && num2 == 0) + effectBuilder.EmitPixelFragment(InvariantString.Format(" vBlur += {0} * {1};\r\n", (object)effectBuilder.PixelShaderOutput, (object)arKernel1[index2, index1])); + else + effectBuilder.EmitPixelFragment(InvariantString.Format(" vBlur += tex2D({0}, {1} + float2({2}.x * {3}, {2}.y * {4})) * {5};\r\n", (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput, (object)textureInfo.TexelSize, (object)num1, (object)num2, (object)arKernel1[index2, index1])); + } + } + effectBuilder.EmitPixelFragment(InvariantString.Format(" {0} = vBlur;\r\n }}\r\n\r\n", (object)effectBuilder.PixelShaderOutput)); + break; + case GaussianBlurMode.Horizontal: + case GaussianBlurMode.Vertical: + bool flag = efoBlur.Mode == GaussianBlurMode.Horizontal; + int length2 = 1 + efoBlur.KernelRadius * 2; + double[] arKernel2 = new double[length2]; + Dx9GaussianBlurElement.GenerateWeights1D(efoBlur.KernelRadius, (double)efoBlur.Bluriness, arKernel2); + effectBuilder.EmitPixelFragment(" {\r\n // Gaussian filter\r\n float4 vBlur = 0;\r\n"); + for (int index = 0; index < length2; ++index) + { + int num = index - efoBlur.KernelRadius; + if (num == 0) + effectBuilder.EmitPixelFragment(InvariantString.Format(" vBlur += {0} * {1};\r\n", (object)effectBuilder.PixelShaderOutput, (object)arKernel2[index])); + else if (flag) + effectBuilder.EmitPixelFragment(InvariantString.Format(" vBlur += tex2D({0}, {1} + float2({2}.x * {3}, 0)) * {4};\r\n", (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput, (object)textureInfo.TexelSize, (object)num, (object)arKernel2[index])); + else + effectBuilder.EmitPixelFragment(InvariantString.Format(" vBlur += tex2D({0}, {1} + float2(0, {2}.y * {3})) * {4};\r\n", (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput, (object)textureInfo.TexelSize, (object)num, (object)arKernel2[index])); + } + effectBuilder.EmitPixelFragment(InvariantString.Format(" {0} = vBlur;\r\n }}\r\n\r\n", (object)effectBuilder.PixelShaderOutput)); + break; + default: + Debug2.Validate(false, typeof(InvalidOperationException), "Unknown blur mode"); + break; + } + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9GraphicsDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9GraphicsDevice.cs index c9ae96d..dba9f3f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9GraphicsDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9GraphicsDevice.cs @@ -8,121 +8,121 @@ using Microsoft.Iris.Render.Internal; namespace Microsoft.Iris.Render.Graphics { - internal abstract class Dx9GraphicsDevice : GraphicsDevice - { - private Dx9EffectManager m_effectManager; - - protected Dx9GraphicsDevice( - RenderSession session, - string stDisplayName, - GraphicsDeviceType type, - GraphicsRenderingQuality renderingQuality) - : base(session, stDisplayName) + internal abstract class Dx9GraphicsDevice : GraphicsDevice { - this.m_deviceType = type; - this.m_graphicsCaps = session.GetGraphicsCaps(type); - this.m_renderingQuality = renderingQuality; - if (this.m_renderingQuality != GraphicsRenderingQuality.MinQuality) - { - Dx9GraphicsDevice.PixelShaderProfileType pixelShaderProfile = (Dx9GraphicsDevice.PixelShaderProfileType) this.m_graphicsCaps.PixelShaderProfile; - if ((byte) this.m_graphicsCaps.VertexShaderProfile < (byte) 1 || pixelShaderProfile < Dx9GraphicsDevice.PixelShaderProfileType.PS_2_0) - this.m_renderingQuality = GraphicsRenderingQuality.MinQuality; - } - this.m_sizeGutterPxl = new Size(1, 1); - this.m_effectManager = new Dx9EffectManager(session, this); - } + private Dx9EffectManager m_effectManager; - protected override void Dispose(bool fInDispose) - { - try - { - if (!fInDispose || this.m_effectManager == null) - return; - this.m_effectManager.Dispose(); - this.m_effectManager = (Dx9EffectManager) null; - } - finally - { - base.Dispose(fInDispose); - } - } - - public override bool IsVideoComposited => true; - - public override bool CanPlayAnimations => true; - - internal Dx9EffectManager EffectManager => this.m_effectManager; - - internal string PixelShaderProfile - { - get - { - switch ((byte) this.m_graphicsCaps.PixelShaderProfile) + protected Dx9GraphicsDevice( + RenderSession session, + string stDisplayName, + GraphicsDeviceType type, + GraphicsRenderingQuality renderingQuality) + : base(session, stDisplayName) { - case 0: - return "ps_1_1"; - case 1: - return "ps_1_2"; - case 2: - return "ps_1_3"; - case 3: - return "ps_1_4"; - case 4: - return "ps_2_0"; - case 5: - return "ps_2_a"; - case 6: - return "ps_2_b"; - case 7: - return "ps_3_0"; - default: - return "ps_1_1"; + this.m_deviceType = type; + this.m_graphicsCaps = session.GetGraphicsCaps(type); + this.m_renderingQuality = renderingQuality; + if (this.m_renderingQuality != GraphicsRenderingQuality.MinQuality) + { + Dx9GraphicsDevice.PixelShaderProfileType pixelShaderProfile = (Dx9GraphicsDevice.PixelShaderProfileType)this.m_graphicsCaps.PixelShaderProfile; + if ((byte)this.m_graphicsCaps.VertexShaderProfile < (byte)1 || pixelShaderProfile < Dx9GraphicsDevice.PixelShaderProfileType.PS_2_0) + this.m_renderingQuality = GraphicsRenderingQuality.MinQuality; + } + this.m_sizeGutterPxl = new Size(1, 1); + this.m_effectManager = new Dx9EffectManager(session, this); } - } - } - internal string VertexShaderProfile - { - get - { - switch ((byte) this.m_graphicsCaps.VertexShaderProfile) + protected override void Dispose(bool fInDispose) { - case 0: - return "vs_1_1"; - case 1: - return "vs_2_0"; - case 2: - return "vs_2_a"; - case 3: - return "vs_3_0"; - default: - return "vs_1_1"; + try + { + if (!fInDispose || this.m_effectManager == null) + return; + this.m_effectManager.Dispose(); + this.m_effectManager = (Dx9EffectManager)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + public override bool IsVideoComposited => true; + + public override bool CanPlayAnimations => true; + + internal Dx9EffectManager EffectManager => this.m_effectManager; + + internal string PixelShaderProfile + { + get + { + switch ((byte)this.m_graphicsCaps.PixelShaderProfile) + { + case 0: + return "ps_1_1"; + case 1: + return "ps_1_2"; + case 2: + return "ps_1_3"; + case 3: + return "ps_1_4"; + case 4: + return "ps_2_0"; + case 5: + return "ps_2_a"; + case 6: + return "ps_2_b"; + case 7: + return "ps_3_0"; + default: + return "ps_1_1"; + } + } + } + + internal string VertexShaderProfile + { + get + { + switch ((byte)this.m_graphicsCaps.VertexShaderProfile) + { + case 0: + return "vs_1_1"; + case 1: + return "vs_2_0"; + case 2: + return "vs_2_a"; + case 3: + return "vs_3_0"; + default: + return "vs_1_1"; + } + } + } + + public override bool CanPlayAnimationType(AnimationInputType type) => true; + + internal override EffectTemplate CreateEffectTemplate(string stName) => (EffectTemplate)new Dx9EffectTemplate(this.m_session, (GraphicsDevice)this, stName); + + private enum PixelShaderProfileType : byte + { + PS_1_1, + PS_1_2, + PS_1_3, + PS_1_4, + PS_2_0, + PS_2_A, + PS_2_B, + PS_3_0, + } + + private enum VertexShaderProfileType : byte + { + VS_1_1, + VS_2_0, + VS_2_A, + VS_3_0, } - } } - - public override bool CanPlayAnimationType(AnimationInputType type) => true; - - internal override EffectTemplate CreateEffectTemplate(string stName) => (EffectTemplate) new Dx9EffectTemplate(this.m_session, (GraphicsDevice) this, stName); - - private enum PixelShaderProfileType : byte - { - PS_1_1, - PS_1_2, - PS_1_3, - PS_1_4, - PS_2_0, - PS_2_A, - PS_2_B, - PS_3_0, - } - - private enum VertexShaderProfileType : byte - { - VS_1_1, - VS_2_0, - VS_2_A, - VS_3_0, - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9HSLElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9HSLElement.cs index bfaafe7..286f093 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9HSLElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9HSLElement.cs @@ -8,39 +8,39 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9HSLElement - { - internal static void Generate(HSLElement efoHSL, ref Dx9EffectBuilder effectBuilder) + internal class Dx9HSLElement { - effectBuilder.EmitIncludesFragment("\"HSL.fx\""); - VariableInfo variableInfo1 = new VariableInfo() - { - ID = (int) efoHSL.HueID, - Type = Dx9VariableType.Float, - IsDynamic = efoHSL.IsDynamicProperty("Hue") - }; - variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efoHSL.Name + "Hue") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efoHSL.Name + "Hue"); - variableInfo1.DefaultValue = (object) efoHSL.Hue; - effectBuilder.AddPropertyVariable(variableInfo1); - VariableInfo variableInfo2 = new VariableInfo() - { - ID = (int) efoHSL.SaturationID, - Type = Dx9VariableType.Float, - IsDynamic = efoHSL.IsDynamicProperty("Saturation") - }; - variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efoHSL.Name + "Saturation") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efoHSL.Name + "Saturation"); - variableInfo2.DefaultValue = (object) efoHSL.Saturation; - effectBuilder.AddPropertyVariable(variableInfo2); - VariableInfo variableInfo3 = new VariableInfo() - { - ID = (int) efoHSL.LightnessID, - Type = Dx9VariableType.Float, - IsDynamic = efoHSL.IsDynamicProperty("Lightness") - }; - variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, efoHSL.Name + "Lightness") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, efoHSL.Name + "Lightness"); - variableInfo3.DefaultValue = (object) efoHSL.Lightness; - effectBuilder.AddPropertyVariable(variableInfo3); - effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // convert to HSL color space\r\n float3 fHSL = RGBToHSL({0});\r\n\r\n // adjust Hue, Sat and Luma\r\n fHSL *= float3({1}, {2}, {3});\r\n fHSL = saturate(fHSL);\r\n\r\n // convert back to RGB space\r\n float3 fBackToRGB = HSLToRGB(fHSL);\r\n {0}.rgb = fBackToRGB;\r\n }}\r\n", (object) effectBuilder.PixelShaderOutput, (object) variableInfo1.Name, (object) variableInfo2.Name, (object) variableInfo3.Name)); + internal static void Generate(HSLElement efoHSL, ref Dx9EffectBuilder effectBuilder) + { + effectBuilder.EmitIncludesFragment("\"HSL.fx\""); + VariableInfo variableInfo1 = new VariableInfo() + { + ID = (int)efoHSL.HueID, + Type = Dx9VariableType.Float, + IsDynamic = efoHSL.IsDynamicProperty("Hue") + }; + variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efoHSL.Name + "Hue") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efoHSL.Name + "Hue"); + variableInfo1.DefaultValue = (object)efoHSL.Hue; + effectBuilder.AddPropertyVariable(variableInfo1); + VariableInfo variableInfo2 = new VariableInfo() + { + ID = (int)efoHSL.SaturationID, + Type = Dx9VariableType.Float, + IsDynamic = efoHSL.IsDynamicProperty("Saturation") + }; + variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efoHSL.Name + "Saturation") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efoHSL.Name + "Saturation"); + variableInfo2.DefaultValue = (object)efoHSL.Saturation; + effectBuilder.AddPropertyVariable(variableInfo2); + VariableInfo variableInfo3 = new VariableInfo() + { + ID = (int)efoHSL.LightnessID, + Type = Dx9VariableType.Float, + IsDynamic = efoHSL.IsDynamicProperty("Lightness") + }; + variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, efoHSL.Name + "Lightness") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, efoHSL.Name + "Lightness"); + variableInfo3.DefaultValue = (object)efoHSL.Lightness; + effectBuilder.AddPropertyVariable(variableInfo3); + effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // convert to HSL color space\r\n float3 fHSL = RGBToHSL({0});\r\n\r\n // adjust Hue, Sat and Luma\r\n fHSL *= float3({1}, {2}, {3});\r\n fHSL = saturate(fHSL);\r\n\r\n // convert back to RGB space\r\n float3 fBackToRGB = HSLToRGB(fHSL);\r\n {0}.rgb = fBackToRGB;\r\n }}\r\n", (object)effectBuilder.PixelShaderOutput, (object)variableInfo1.Name, (object)variableInfo2.Name, (object)variableInfo3.Name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9HSVElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9HSVElement.cs index 9710816..f57ac3e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9HSVElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9HSVElement.cs @@ -8,39 +8,39 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9HSVElement - { - internal static void Generate(HSVElement efoHSV, ref Dx9EffectBuilder effectBuilder) + internal class Dx9HSVElement { - effectBuilder.EmitIncludesFragment("\"HSV.fx\""); - VariableInfo variableInfo1 = new VariableInfo() - { - ID = (int) efoHSV.HueID, - Type = Dx9VariableType.Float, - IsDynamic = efoHSV.IsDynamicProperty("Hue") - }; - variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efoHSV.Name + "Hue") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efoHSV.Name + "Hue"); - variableInfo1.DefaultValue = (object) efoHSV.Hue; - effectBuilder.AddPropertyVariable(variableInfo1); - VariableInfo variableInfo2 = new VariableInfo() - { - ID = (int) efoHSV.SaturationID, - Type = Dx9VariableType.Float, - IsDynamic = efoHSV.IsDynamicProperty("Saturation") - }; - variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efoHSV.Name + "Saturation") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efoHSV.Name + "Saturation"); - variableInfo2.DefaultValue = (object) efoHSV.Saturation; - effectBuilder.AddPropertyVariable(variableInfo2); - VariableInfo variableInfo3 = new VariableInfo() - { - ID = (int) efoHSV.ValueID, - Type = Dx9VariableType.Float, - IsDynamic = efoHSV.IsDynamicProperty("Value") - }; - variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, efoHSV.Name + "Value") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, efoHSV.Name + "Value"); - variableInfo3.DefaultValue = (object) efoHSV.Value; - effectBuilder.AddPropertyVariable(variableInfo3); - effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // convert to HSV color space\r\n float3 fHSV = RGBToHSV({0});\r\n\r\n // adjust Hue, Sat and Value\r\n fHSV *= float3(1.0f, {2}, {3});\r\n fHSV[0] += {0};\r\n fHSV = saturate(fHSV);\r\n\r\n // convert back to RGB space\r\n float3 fBackToRGB = HSVToRGB(fHSV);\r\n {0}.rgb = fBackToRGB;\r\n }}\r\n", (object) effectBuilder.PixelShaderOutput, (object) variableInfo1.Name, (object) variableInfo2.Name, (object) variableInfo3.Name)); + internal static void Generate(HSVElement efoHSV, ref Dx9EffectBuilder effectBuilder) + { + effectBuilder.EmitIncludesFragment("\"HSV.fx\""); + VariableInfo variableInfo1 = new VariableInfo() + { + ID = (int)efoHSV.HueID, + Type = Dx9VariableType.Float, + IsDynamic = efoHSV.IsDynamicProperty("Hue") + }; + variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efoHSV.Name + "Hue") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efoHSV.Name + "Hue"); + variableInfo1.DefaultValue = (object)efoHSV.Hue; + effectBuilder.AddPropertyVariable(variableInfo1); + VariableInfo variableInfo2 = new VariableInfo() + { + ID = (int)efoHSV.SaturationID, + Type = Dx9VariableType.Float, + IsDynamic = efoHSV.IsDynamicProperty("Saturation") + }; + variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efoHSV.Name + "Saturation") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efoHSV.Name + "Saturation"); + variableInfo2.DefaultValue = (object)efoHSV.Saturation; + effectBuilder.AddPropertyVariable(variableInfo2); + VariableInfo variableInfo3 = new VariableInfo() + { + ID = (int)efoHSV.ValueID, + Type = Dx9VariableType.Float, + IsDynamic = efoHSV.IsDynamicProperty("Value") + }; + variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, efoHSV.Name + "Value") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, efoHSV.Name + "Value"); + variableInfo3.DefaultValue = (object)efoHSV.Value; + effectBuilder.AddPropertyVariable(variableInfo3); + effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n // convert to HSV color space\r\n float3 fHSV = RGBToHSV({0});\r\n\r\n // adjust Hue, Sat and Value\r\n fHSV *= float3(1.0f, {2}, {3});\r\n fHSV[0] += {0};\r\n fHSV = saturate(fHSV);\r\n\r\n // convert back to RGB space\r\n float3 fBackToRGB = HSVToRGB(fHSV);\r\n {0}.rgb = fBackToRGB;\r\n }}\r\n", (object)effectBuilder.PixelShaderOutput, (object)variableInfo1.Name, (object)variableInfo2.Name, (object)variableInfo3.Name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ImageElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ImageElement.cs index f816a9d..482c350 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ImageElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9ImageElement.cs @@ -8,37 +8,37 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9ImageElement - { - internal static void Generate(ImageElement efiImage, ref Dx9EffectBuilder effectBuilder) + internal class Dx9ImageElement { - Dx9TextureInfo textureInfo = effectBuilder.AllocateTexture(); - effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object) null); - TextureVariableInfo textureVariableInfo = new TextureVariableInfo(); - textureVariableInfo.ID = (int) efiImage.ImageID; - textureVariableInfo.Type = Dx9VariableType.Texture; - textureVariableInfo.Name = effectBuilder.GenerateGlobalVariable(textureVariableInfo.Type, efiImage.Name); - textureVariableInfo.DefaultValue = (object) efiImage.Image; - textureVariableInfo.SamplerName = textureInfo.Sampler; - textureVariableInfo.MinFilter = "Linear"; - textureVariableInfo.MagFilter = "Linear"; - textureVariableInfo.CoordinateMapID = -1; - textureVariableInfo.ImageIndexID = -1; - effectBuilder.AddPropertyVariable((VariableInfo) textureVariableInfo); - VariableInfo variableInfo = new VariableInfo() - { - ID = (int) efiImage.UVOffsetID, - Type = Dx9VariableType.Vector2, - IsDynamic = efiImage.IsDynamicProperty("UVOffset") - }; - variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, "UVOffset") : effectBuilder.GenerateGlobalConstant(variableInfo.Type, "UVOffset"); - variableInfo.DefaultValue = (object) efiImage.UVOffset; - effectBuilder.AddPropertyVariable(variableInfo); - effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiImage.Name); - if (variableInfo.IsDynamic || !efiImage.UVOffset.IsApproximate(Vector2.Zero)) - effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2} + float2({3}.x * {4}.x, {3}.y * {4}.y));\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput, (object) textureInfo.TexelSize, (object) variableInfo.Name)); - else - effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2});\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput)); + internal static void Generate(ImageElement efiImage, ref Dx9EffectBuilder effectBuilder) + { + Dx9TextureInfo textureInfo = effectBuilder.AllocateTexture(); + effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object)null); + TextureVariableInfo textureVariableInfo = new TextureVariableInfo(); + textureVariableInfo.ID = (int)efiImage.ImageID; + textureVariableInfo.Type = Dx9VariableType.Texture; + textureVariableInfo.Name = effectBuilder.GenerateGlobalVariable(textureVariableInfo.Type, efiImage.Name); + textureVariableInfo.DefaultValue = (object)efiImage.Image; + textureVariableInfo.SamplerName = textureInfo.Sampler; + textureVariableInfo.MinFilter = "Linear"; + textureVariableInfo.MagFilter = "Linear"; + textureVariableInfo.CoordinateMapID = -1; + textureVariableInfo.ImageIndexID = -1; + effectBuilder.AddPropertyVariable((VariableInfo)textureVariableInfo); + VariableInfo variableInfo = new VariableInfo() + { + ID = (int)efiImage.UVOffsetID, + Type = Dx9VariableType.Vector2, + IsDynamic = efiImage.IsDynamicProperty("UVOffset") + }; + variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, "UVOffset") : effectBuilder.GenerateGlobalConstant(variableInfo.Type, "UVOffset"); + variableInfo.DefaultValue = (object)efiImage.UVOffset; + effectBuilder.AddPropertyVariable(variableInfo); + effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiImage.Name); + if (variableInfo.IsDynamic || !efiImage.UVOffset.IsApproximate(Vector2.Zero)) + effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2} + float2({3}.x * {4}.x, {3}.y * {4}.y));\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput, (object)textureInfo.TexelSize, (object)variableInfo.Name)); + else + effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2});\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InterpolateElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InterpolateElement.cs index 6a9042b..640bd86 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InterpolateElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InterpolateElement.cs @@ -8,25 +8,25 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9InterpolateElement - { - internal static void Generate( - InterpolateElement efiInterpolate, - string stSource1, - string stSource2, - ref Dx9EffectBuilder effectBuilder) + internal class Dx9InterpolateElement { - VariableInfo variableInfo = new VariableInfo() - { - ID = (int) efiInterpolate.ValueID, - Type = Dx9VariableType.Float, - IsDynamic = efiInterpolate.IsDynamicProperty("Value") - }; - variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efiInterpolate.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efiInterpolate.Name); - variableInfo.DefaultValue = (object) efiInterpolate.Value; - effectBuilder.AddPropertyVariable(variableInfo); - effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiInterpolate.Name); - effectBuilder.EmitPixelFragment(InvariantString.Format(" // Interpolate the result\r\n float4 {0} = lerp({1}, {2}, {3});\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) stSource1, (object) stSource2, (object) variableInfo.Name)); + internal static void Generate( + InterpolateElement efiInterpolate, + string stSource1, + string stSource2, + ref Dx9EffectBuilder effectBuilder) + { + VariableInfo variableInfo = new VariableInfo() + { + ID = (int)efiInterpolate.ValueID, + Type = Dx9VariableType.Float, + IsDynamic = efiInterpolate.IsDynamicProperty("Value") + }; + variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, efiInterpolate.Name) : effectBuilder.GenerateGlobalConstant(variableInfo.Type, efiInterpolate.Name); + variableInfo.DefaultValue = (object)efiInterpolate.Value; + effectBuilder.AddPropertyVariable(variableInfo); + effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiInterpolate.Name); + effectBuilder.EmitPixelFragment(InvariantString.Format(" // Interpolate the result\r\n float4 {0} = lerp({1}, {2}, {3});\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)stSource1, (object)stSource2, (object)variableInfo.Name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvAlphaElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvAlphaElement.cs index 6a4be6d..af43e38 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvAlphaElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvAlphaElement.cs @@ -8,12 +8,12 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9InvAlphaElement - { - internal static void Generate(EffectOperation efo, ref Dx9EffectBuilder effectBuilder) + internal class Dx9InvAlphaElement { - string localVariable = effectBuilder.GenerateLocalVariable(Dx9VariableType.Float, "InvAlpha"); - effectBuilder.EmitPixelFragment(InvariantString.Format(" // Invert the alpha value\r\n float {1} = 1.0 - {0}.a;\r\n {0}.a = {1};\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) localVariable)); + internal static void Generate(EffectOperation efo, ref Dx9EffectBuilder effectBuilder) + { + string localVariable = effectBuilder.GenerateLocalVariable(Dx9VariableType.Float, "InvAlpha"); + effectBuilder.EmitPixelFragment(InvariantString.Format(" // Invert the alpha value\r\n float {1} = 1.0 - {0}.a;\r\n {0}.a = {1};\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)localVariable)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvColorElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvColorElement.cs index 51fe3b6..dc43d91 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvColorElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvColorElement.cs @@ -8,8 +8,8 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9InvColorElement - { - internal static void Generate(EffectOperation efo, ref Dx9EffectBuilder effectBuilder) => effectBuilder.EmitPixelFragment(InvariantString.Format(" // Invert the color value\r\n {0}.rgb = float3(1.0-{0}.r, 1.0-{0}.g, 1.0-{0}.b);\r\n\r\n", (object) effectBuilder.PixelShaderOutput)); - } + internal class Dx9InvColorElement + { + internal static void Generate(EffectOperation efo, ref Dx9EffectBuilder effectBuilder) => effectBuilder.EmitPixelFragment(InvariantString.Format(" // Invert the color value\r\n {0}.rgb = float3(1.0-{0}.r, 1.0-{0}.g, 1.0-{0}.b);\r\n\r\n", (object)effectBuilder.PixelShaderOutput)); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvertElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvertElement.cs index 9c7c590..be8156d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvertElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9InvertElement.cs @@ -8,8 +8,8 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9InvertElement - { - internal static void Generate(InvertElement efoInvert, ref Dx9EffectBuilder effectBuilder) => effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n {0}.rgb = 1.0f - {0}.rgb;\r\n }}\r\n", (object) effectBuilder.PixelShaderOutput)); - } + internal class Dx9InvertElement + { + internal static void Generate(InvertElement efoInvert, ref Dx9EffectBuilder effectBuilder) => effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n {0}.rgb = 1.0f - {0}.rgb;\r\n }}\r\n", (object)effectBuilder.PixelShaderOutput)); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9LightShaftElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9LightShaftElement.cs index 4d8ad5a..5a2c475 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9LightShaftElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9LightShaftElement.cs @@ -8,70 +8,70 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9LightShaftElement - { - internal static void Generate( - LightShaftElement efoLightShaft, - ref Dx9EffectBuilder effectBuilder) + internal class Dx9LightShaftElement { - Dx9TextureInfo textureInfo = effectBuilder.GetTextureInfo(effectBuilder.ImageCount - 1); - effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexUVSize, (object) null); - effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexUVRefPoint, (object) null); - VariableInfo variableInfo1 = new VariableInfo() - { - ID = (int) efoLightShaft.PositionID, - Type = Dx9VariableType.Vector3, - IsDynamic = efoLightShaft.IsDynamicProperty("Position") - }; - variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efoLightShaft.Name + "Position") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efoLightShaft.Name + "Position"); - variableInfo1.DefaultValue = (object) efoLightShaft.Position; - effectBuilder.AddPropertyVariable(variableInfo1); - VariableInfo variableInfo2 = new VariableInfo() - { - ID = (int) efoLightShaft.DecayID, - Type = Dx9VariableType.Float, - IsDynamic = efoLightShaft.IsDynamicProperty("Decay") - }; - variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efoLightShaft.Name + "Decay") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efoLightShaft.Name + "Decay"); - variableInfo2.DefaultValue = (object) efoLightShaft.Decay; - effectBuilder.AddPropertyVariable(variableInfo2); - VariableInfo variableInfo3 = new VariableInfo() - { - ID = (int) efoLightShaft.DensityID, - Type = Dx9VariableType.Float, - IsDynamic = efoLightShaft.IsDynamicProperty("Density") - }; - variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, efoLightShaft.Name + "Density") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, efoLightShaft.Name + "Density"); - variableInfo3.DefaultValue = (object) efoLightShaft.Density; - effectBuilder.AddPropertyVariable(variableInfo3); - VariableInfo variableInfo4 = new VariableInfo() - { - ID = (int) efoLightShaft.FallOffID, - Type = Dx9VariableType.Float, - IsDynamic = efoLightShaft.IsDynamicProperty("FallOff") - }; - variableInfo4.Name = variableInfo4.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo4.Type, efoLightShaft.Name + "FallOff") : effectBuilder.GenerateGlobalConstant(variableInfo4.Type, efoLightShaft.Name + "FallOff"); - variableInfo4.DefaultValue = (object) efoLightShaft.FallOff; - effectBuilder.AddPropertyVariable(variableInfo4); - VariableInfo variableInfo5 = new VariableInfo() - { - ID = (int) efoLightShaft.IntensityID, - Type = Dx9VariableType.Float, - IsDynamic = efoLightShaft.IsDynamicProperty("Intensity") - }; - variableInfo5.Name = variableInfo5.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo5.Type, efoLightShaft.Name + "Intensity") : effectBuilder.GenerateGlobalConstant(variableInfo5.Type, efoLightShaft.Name + "Intensity"); - variableInfo5.DefaultValue = (object) efoLightShaft.Intensity; - effectBuilder.AddPropertyVariable(variableInfo5); - VariableInfo variableInfo6 = new VariableInfo() - { - ID = (int) efoLightShaft.WeightID, - Type = Dx9VariableType.Float, - IsDynamic = efoLightShaft.IsDynamicProperty("Weight") - }; - variableInfo6.Name = variableInfo6.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo6.Type, efoLightShaft.Name + "Weight") : effectBuilder.GenerateGlobalConstant(variableInfo6.Type, efoLightShaft.Name + "Weight"); - variableInfo6.DefaultValue = (object) efoLightShaft.Weight; - effectBuilder.AddPropertyVariable(variableInfo6); - effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n float2 diff = {2} - ({4} + {3}.xy * {5});\r\n float2 rayStep = diff / 15 * {6};\r\n float4 color = tex2D({1}, {2});\r\n float fadeFactor = 1.0f;\r\n for (int i=0; i<15; i++)\r\n {{\r\n {2} -= rayStep;\r\n float4 sample = tex2D({1}, {2});\r\n sample *= fadeFactor * {7};\r\n color += sample;\r\n fadeFactor *= {8};\r\n }}\r\n color.rgb *= {9};\r\n {0} = color * ({10} - length(diff));\r\n }}\r\n", (object) effectBuilder.PixelShaderOutput, (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput, (object) variableInfo1.Name, (object) textureInfo.TexUVRefPoint, (object) textureInfo.TexUVSize, (object) variableInfo3.Name, (object) variableInfo6.Name, (object) variableInfo2.Name, (object) variableInfo5.Name, (object) variableInfo4.Name)); + internal static void Generate( + LightShaftElement efoLightShaft, + ref Dx9EffectBuilder effectBuilder) + { + Dx9TextureInfo textureInfo = effectBuilder.GetTextureInfo(effectBuilder.ImageCount - 1); + effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexUVSize, (object)null); + effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexUVRefPoint, (object)null); + VariableInfo variableInfo1 = new VariableInfo() + { + ID = (int)efoLightShaft.PositionID, + Type = Dx9VariableType.Vector3, + IsDynamic = efoLightShaft.IsDynamicProperty("Position") + }; + variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efoLightShaft.Name + "Position") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efoLightShaft.Name + "Position"); + variableInfo1.DefaultValue = (object)efoLightShaft.Position; + effectBuilder.AddPropertyVariable(variableInfo1); + VariableInfo variableInfo2 = new VariableInfo() + { + ID = (int)efoLightShaft.DecayID, + Type = Dx9VariableType.Float, + IsDynamic = efoLightShaft.IsDynamicProperty("Decay") + }; + variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efoLightShaft.Name + "Decay") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efoLightShaft.Name + "Decay"); + variableInfo2.DefaultValue = (object)efoLightShaft.Decay; + effectBuilder.AddPropertyVariable(variableInfo2); + VariableInfo variableInfo3 = new VariableInfo() + { + ID = (int)efoLightShaft.DensityID, + Type = Dx9VariableType.Float, + IsDynamic = efoLightShaft.IsDynamicProperty("Density") + }; + variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, efoLightShaft.Name + "Density") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, efoLightShaft.Name + "Density"); + variableInfo3.DefaultValue = (object)efoLightShaft.Density; + effectBuilder.AddPropertyVariable(variableInfo3); + VariableInfo variableInfo4 = new VariableInfo() + { + ID = (int)efoLightShaft.FallOffID, + Type = Dx9VariableType.Float, + IsDynamic = efoLightShaft.IsDynamicProperty("FallOff") + }; + variableInfo4.Name = variableInfo4.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo4.Type, efoLightShaft.Name + "FallOff") : effectBuilder.GenerateGlobalConstant(variableInfo4.Type, efoLightShaft.Name + "FallOff"); + variableInfo4.DefaultValue = (object)efoLightShaft.FallOff; + effectBuilder.AddPropertyVariable(variableInfo4); + VariableInfo variableInfo5 = new VariableInfo() + { + ID = (int)efoLightShaft.IntensityID, + Type = Dx9VariableType.Float, + IsDynamic = efoLightShaft.IsDynamicProperty("Intensity") + }; + variableInfo5.Name = variableInfo5.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo5.Type, efoLightShaft.Name + "Intensity") : effectBuilder.GenerateGlobalConstant(variableInfo5.Type, efoLightShaft.Name + "Intensity"); + variableInfo5.DefaultValue = (object)efoLightShaft.Intensity; + effectBuilder.AddPropertyVariable(variableInfo5); + VariableInfo variableInfo6 = new VariableInfo() + { + ID = (int)efoLightShaft.WeightID, + Type = Dx9VariableType.Float, + IsDynamic = efoLightShaft.IsDynamicProperty("Weight") + }; + variableInfo6.Name = variableInfo6.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo6.Type, efoLightShaft.Name + "Weight") : effectBuilder.GenerateGlobalConstant(variableInfo6.Type, efoLightShaft.Name + "Weight"); + variableInfo6.DefaultValue = (object)efoLightShaft.Weight; + effectBuilder.AddPropertyVariable(variableInfo6); + effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n float2 diff = {2} - ({4} + {3}.xy * {5});\r\n float2 rayStep = diff / 15 * {6};\r\n float4 color = tex2D({1}, {2});\r\n float fadeFactor = 1.0f;\r\n for (int i=0; i<15; i++)\r\n {{\r\n {2} -= rayStep;\r\n float4 sample = tex2D({1}, {2});\r\n sample *= fadeFactor * {7};\r\n color += sample;\r\n fadeFactor *= {8};\r\n }}\r\n color.rgb *= {9};\r\n {0} = color * ({10} - length(diff));\r\n }}\r\n", (object)effectBuilder.PixelShaderOutput, (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput, (object)variableInfo1.Name, (object)textureInfo.TexUVRefPoint, (object)textureInfo.TexUVSize, (object)variableInfo3.Name, (object)variableInfo6.Name, (object)variableInfo2.Name, (object)variableInfo5.Name, (object)variableInfo4.Name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9PointLight2DElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9PointLight2DElement.cs index e2de645..7f56f2b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9PointLight2DElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9PointLight2DElement.cs @@ -8,64 +8,64 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9PointLight2DElement - { - internal static void Generate( - PointLight2DElement efiPointLight2D, - ref Dx9EffectBuilder effectBuilder) + internal class Dx9PointLight2DElement { - VariableInfo variableInfo1 = new VariableInfo() - { - ID = (int) efiPointLight2D.PositionID, - Type = Dx9VariableType.Vector3, - IsDynamic = efiPointLight2D.IsDynamicProperty("Position") - }; - variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, "Position") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, "Position"); - variableInfo1.DefaultValue = (object) efiPointLight2D.Position; - effectBuilder.AddPropertyVariable(variableInfo1); - VariableInfo variableInfo2 = new VariableInfo() - { - ID = (int) efiPointLight2D.RadiusID, - Type = Dx9VariableType.Float, - IsDynamic = efiPointLight2D.IsDynamicProperty("Radius") - }; - variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, "Radius") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, "Radius"); - variableInfo2.DefaultValue = (object) efiPointLight2D.Radius; - effectBuilder.AddPropertyVariable(variableInfo2); - VariableInfo variableInfo3 = new VariableInfo() - { - ID = (int) efiPointLight2D.LightColorID, - Type = Dx9VariableType.Vector4, - IsDynamic = efiPointLight2D.IsDynamicProperty("LightColor") - }; - variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, "LightColor") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, "LightColor"); - variableInfo3.DefaultValue = (object) efiPointLight2D.LightColor.ToVector4(); - effectBuilder.AddPropertyVariable(variableInfo3); - VariableInfo variableInfo4 = new VariableInfo() - { - ID = (int) efiPointLight2D.AmbientColorID, - Type = Dx9VariableType.Vector4, - IsDynamic = efiPointLight2D.IsDynamicProperty("AmbientColor") - }; - variableInfo4.Name = variableInfo4.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo4.Type, "AmbientColor") : effectBuilder.GenerateGlobalConstant(variableInfo4.Type, "AmbientColor"); - variableInfo4.DefaultValue = (object) efiPointLight2D.AmbientColor.ToVector4(); - effectBuilder.AddPropertyVariable(variableInfo4); - VariableInfo variableInfo5 = new VariableInfo() - { - ID = (int) efiPointLight2D.AttenuationID, - Type = Dx9VariableType.Vector3, - IsDynamic = efiPointLight2D.IsDynamicProperty("Attenuation") - }; - variableInfo5.Name = variableInfo5.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo5.Type, "Attenuation") : effectBuilder.GenerateGlobalConstant(variableInfo5.Type, "Attenuation"); - variableInfo5.DefaultValue = (object) efiPointLight2D.Attenuation; - effectBuilder.AddPropertyVariable(variableInfo5); - effectBuilder.AddRequirement(EffectRequirements.ViewPosition); - effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiPointLight2D.Name); - string str = InvariantString.Format(" float4 {0} = {3};\r\n {{\r\n float2 vPositionDelta = {1}.xy - Input.ViewPos.xy;\r\n float flDist = length(vPositionDelta);\r\n float flFalloff = saturate({2} / ({4}.x + flDist*{4}.y + flDist*flDist*{4}.z));\r\n {0} *= flFalloff;\r\n", (object) effectBuilder.PixelShaderOutput, (object) variableInfo1.Name, (object) variableInfo2.Name, (object) variableInfo3.Name, (object) variableInfo5.Name); - if (variableInfo4.IsDynamic || !efiPointLight2D.AmbientColor.ToVector4().IsApproximate(Vector4.Zero)) - effectBuilder.EmitPixelFragment(InvariantString.Format("{0} {1} += {2};\r\n }}\r\n", (object) str, (object) effectBuilder.PixelShaderOutput, (object) variableInfo4.Name)); - else - effectBuilder.EmitPixelFragment(InvariantString.Format("{0} }}\r\n", (object) str)); + internal static void Generate( + PointLight2DElement efiPointLight2D, + ref Dx9EffectBuilder effectBuilder) + { + VariableInfo variableInfo1 = new VariableInfo() + { + ID = (int)efiPointLight2D.PositionID, + Type = Dx9VariableType.Vector3, + IsDynamic = efiPointLight2D.IsDynamicProperty("Position") + }; + variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, "Position") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, "Position"); + variableInfo1.DefaultValue = (object)efiPointLight2D.Position; + effectBuilder.AddPropertyVariable(variableInfo1); + VariableInfo variableInfo2 = new VariableInfo() + { + ID = (int)efiPointLight2D.RadiusID, + Type = Dx9VariableType.Float, + IsDynamic = efiPointLight2D.IsDynamicProperty("Radius") + }; + variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, "Radius") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, "Radius"); + variableInfo2.DefaultValue = (object)efiPointLight2D.Radius; + effectBuilder.AddPropertyVariable(variableInfo2); + VariableInfo variableInfo3 = new VariableInfo() + { + ID = (int)efiPointLight2D.LightColorID, + Type = Dx9VariableType.Vector4, + IsDynamic = efiPointLight2D.IsDynamicProperty("LightColor") + }; + variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, "LightColor") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, "LightColor"); + variableInfo3.DefaultValue = (object)efiPointLight2D.LightColor.ToVector4(); + effectBuilder.AddPropertyVariable(variableInfo3); + VariableInfo variableInfo4 = new VariableInfo() + { + ID = (int)efiPointLight2D.AmbientColorID, + Type = Dx9VariableType.Vector4, + IsDynamic = efiPointLight2D.IsDynamicProperty("AmbientColor") + }; + variableInfo4.Name = variableInfo4.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo4.Type, "AmbientColor") : effectBuilder.GenerateGlobalConstant(variableInfo4.Type, "AmbientColor"); + variableInfo4.DefaultValue = (object)efiPointLight2D.AmbientColor.ToVector4(); + effectBuilder.AddPropertyVariable(variableInfo4); + VariableInfo variableInfo5 = new VariableInfo() + { + ID = (int)efiPointLight2D.AttenuationID, + Type = Dx9VariableType.Vector3, + IsDynamic = efiPointLight2D.IsDynamicProperty("Attenuation") + }; + variableInfo5.Name = variableInfo5.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo5.Type, "Attenuation") : effectBuilder.GenerateGlobalConstant(variableInfo5.Type, "Attenuation"); + variableInfo5.DefaultValue = (object)efiPointLight2D.Attenuation; + effectBuilder.AddPropertyVariable(variableInfo5); + effectBuilder.AddRequirement(EffectRequirements.ViewPosition); + effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiPointLight2D.Name); + string str = InvariantString.Format(" float4 {0} = {3};\r\n {{\r\n float2 vPositionDelta = {1}.xy - Input.ViewPos.xy;\r\n float flDist = length(vPositionDelta);\r\n float flFalloff = saturate({2} / ({4}.x + flDist*{4}.y + flDist*flDist*{4}.z));\r\n {0} *= flFalloff;\r\n", (object)effectBuilder.PixelShaderOutput, (object)variableInfo1.Name, (object)variableInfo2.Name, (object)variableInfo3.Name, (object)variableInfo5.Name); + if (variableInfo4.IsDynamic || !efiPointLight2D.AmbientColor.ToVector4().IsApproximate(Vector4.Zero)) + effectBuilder.EmitPixelFragment(InvariantString.Format("{0} {1} += {2};\r\n }}\r\n", (object)str, (object)effectBuilder.PixelShaderOutput, (object)variableInfo4.Name)); + else + effectBuilder.EmitPixelFragment(InvariantString.Format("{0} }}\r\n", (object)str)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9SepiaElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9SepiaElement.cs index 00db1fb..4cda1fc 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9SepiaElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9SepiaElement.cs @@ -8,47 +8,47 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9SepiaElement - { - internal static void Generate(SepiaElement efoSepia, ref Dx9EffectBuilder effectBuilder) + internal class Dx9SepiaElement { - VariableInfo variableInfo1 = new VariableInfo() - { - ID = (int) efoSepia.LightColorID, - Type = Dx9VariableType.Vector4, - IsDynamic = efoSepia.IsDynamicProperty("LightColor") - }; - variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efoSepia.Name + "LightColor") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efoSepia.Name + "LightColor"); - variableInfo1.DefaultValue = (object) efoSepia.LightColor.ToVector4(); - effectBuilder.AddPropertyVariable(variableInfo1); - VariableInfo variableInfo2 = new VariableInfo() - { - ID = (int) efoSepia.DarkColorID, - Type = Dx9VariableType.Vector4, - IsDynamic = efoSepia.IsDynamicProperty("DarkColor") - }; - variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efoSepia.Name + "DarkColor") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efoSepia.Name + "DarkColor"); - variableInfo2.DefaultValue = (object) efoSepia.DarkColor.ToVector4(); - effectBuilder.AddPropertyVariable(variableInfo2); - VariableInfo variableInfo3 = new VariableInfo() - { - ID = (int) efoSepia.DesaturateID, - Type = Dx9VariableType.Float, - IsDynamic = efoSepia.IsDynamicProperty("Desaturate") - }; - variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, efoSepia.Name + "Desaturate") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, efoSepia.Name + "Desaturate"); - variableInfo3.DefaultValue = (object) efoSepia.Desaturate; - effectBuilder.AddPropertyVariable(variableInfo3); - VariableInfo variableInfo4 = new VariableInfo() - { - ID = (int) efoSepia.ToneID, - Type = Dx9VariableType.Float, - IsDynamic = efoSepia.IsDynamicProperty("Tone") - }; - variableInfo4.Name = variableInfo4.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo4.Type, efoSepia.Name + "Tone") : effectBuilder.GenerateGlobalConstant(variableInfo4.Type, efoSepia.Name + "Tone"); - variableInfo4.DefaultValue = (object) efoSepia.Tone; - effectBuilder.AddPropertyVariable(variableInfo4); - effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n {0}.rgb *= {1}.rgb;\r\n float3 grayer = float3(0.3f, 0.59f, 0.11f);\r\n float gray = dot({0}.rgb, grayer);\r\n float3 muted = lerp({0}.rgb, gray.xxx, {3});\r\n float3 sepia = lerp({2}.rgb, {1}.rgb, gray);\r\n {0}.rgb = lerp(muted, sepia, {4});\r\n }}\r\n", (object) effectBuilder.PixelShaderOutput, (object) variableInfo1.Name, (object) variableInfo2.Name, (object) variableInfo3.Name, (object) variableInfo4.Name)); + internal static void Generate(SepiaElement efoSepia, ref Dx9EffectBuilder effectBuilder) + { + VariableInfo variableInfo1 = new VariableInfo() + { + ID = (int)efoSepia.LightColorID, + Type = Dx9VariableType.Vector4, + IsDynamic = efoSepia.IsDynamicProperty("LightColor") + }; + variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, efoSepia.Name + "LightColor") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, efoSepia.Name + "LightColor"); + variableInfo1.DefaultValue = (object)efoSepia.LightColor.ToVector4(); + effectBuilder.AddPropertyVariable(variableInfo1); + VariableInfo variableInfo2 = new VariableInfo() + { + ID = (int)efoSepia.DarkColorID, + Type = Dx9VariableType.Vector4, + IsDynamic = efoSepia.IsDynamicProperty("DarkColor") + }; + variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, efoSepia.Name + "DarkColor") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, efoSepia.Name + "DarkColor"); + variableInfo2.DefaultValue = (object)efoSepia.DarkColor.ToVector4(); + effectBuilder.AddPropertyVariable(variableInfo2); + VariableInfo variableInfo3 = new VariableInfo() + { + ID = (int)efoSepia.DesaturateID, + Type = Dx9VariableType.Float, + IsDynamic = efoSepia.IsDynamicProperty("Desaturate") + }; + variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, efoSepia.Name + "Desaturate") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, efoSepia.Name + "Desaturate"); + variableInfo3.DefaultValue = (object)efoSepia.Desaturate; + effectBuilder.AddPropertyVariable(variableInfo3); + VariableInfo variableInfo4 = new VariableInfo() + { + ID = (int)efoSepia.ToneID, + Type = Dx9VariableType.Float, + IsDynamic = efoSepia.IsDynamicProperty("Tone") + }; + variableInfo4.Name = variableInfo4.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo4.Type, efoSepia.Name + "Tone") : effectBuilder.GenerateGlobalConstant(variableInfo4.Type, efoSepia.Name + "Tone"); + variableInfo4.DefaultValue = (object)efoSepia.Tone; + effectBuilder.AddPropertyVariable(variableInfo4); + effectBuilder.EmitPixelFragment(InvariantString.Format(" {{\r\n {0}.rgb *= {1}.rgb;\r\n float3 grayer = float3(0.3f, 0.59f, 0.11f);\r\n float gray = dot({0}.rgb, grayer);\r\n float3 muted = lerp({0}.rgb, gray.xxx, {3});\r\n float3 sepia = lerp({2}.rgb, {1}.rgb, gray);\r\n {0}.rgb = lerp(muted, sepia, {4});\r\n }}\r\n", (object)effectBuilder.PixelShaderOutput, (object)variableInfo1.Name, (object)variableInfo2.Name, (object)variableInfo3.Name, (object)variableInfo4.Name)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9SpotLight2DElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9SpotLight2DElement.cs index 3e07a4f..5e77acb 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9SpotLight2DElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9SpotLight2DElement.cs @@ -8,91 +8,91 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9SpotLight2DElement - { - internal static void Generate( - SpotLight2DElement efiSpotlight2D, - ref Dx9EffectBuilder effectBuilder) + internal class Dx9SpotLight2DElement { - VariableInfo variableInfo1 = new VariableInfo() - { - ID = (int) efiSpotlight2D.PositionID, - Type = Dx9VariableType.Vector3, - IsDynamic = efiSpotlight2D.IsDynamicProperty("Position") - }; - variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, "Position") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, "Position"); - variableInfo1.DefaultValue = (object) efiSpotlight2D.Position; - effectBuilder.AddPropertyVariable(variableInfo1); - VariableInfo variableInfo2 = new VariableInfo() - { - ID = (int) efiSpotlight2D.DirectionAngleID, - Type = Dx9VariableType.Float, - IsDynamic = efiSpotlight2D.IsDynamicProperty("DirectionAngle") - }; - variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, "DirectionAngle") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, "DirectionAngle"); - variableInfo2.DefaultValue = (object) efiSpotlight2D.DirectionAngle; - effectBuilder.AddPropertyVariable(variableInfo2); - VariableInfo variableInfo3 = new VariableInfo() - { - ID = (int) efiSpotlight2D.LightColorID, - Type = Dx9VariableType.Vector4, - IsDynamic = efiSpotlight2D.IsDynamicProperty("LightColor") - }; - variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, "LightColor") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, "LightColor"); - variableInfo3.DefaultValue = (object) efiSpotlight2D.LightColor.ToVector4(); - effectBuilder.AddPropertyVariable(variableInfo3); - VariableInfo variableInfo4 = new VariableInfo() - { - ID = (int) efiSpotlight2D.AmbientColorID, - Type = Dx9VariableType.Vector4, - IsDynamic = efiSpotlight2D.IsDynamicProperty("AmbientColor") - }; - variableInfo4.Name = variableInfo4.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo4.Type, "AmbientColor") : effectBuilder.GenerateGlobalConstant(variableInfo4.Type, "AmbientColor"); - variableInfo4.DefaultValue = (object) efiSpotlight2D.AmbientColor.ToVector4(); - effectBuilder.AddPropertyVariable(variableInfo4); - VariableInfo variableInfo5 = new VariableInfo() - { - ID = (int) efiSpotlight2D.InnerConeAngleID, - Type = Dx9VariableType.Float, - IsDynamic = efiSpotlight2D.IsDynamicProperty("InnerConeAngle") - }; - variableInfo5.Name = variableInfo5.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo5.Type, "InnerConeAngle") : effectBuilder.GenerateGlobalConstant(variableInfo5.Type, "InnerConeAngle"); - variableInfo5.DefaultValue = (object) efiSpotlight2D.InnerConeAngle; - effectBuilder.AddPropertyVariable(variableInfo5); - VariableInfo variableInfo6 = new VariableInfo() - { - ID = (int) efiSpotlight2D.OuterConeAngleID, - Type = Dx9VariableType.Float, - IsDynamic = efiSpotlight2D.IsDynamicProperty("OuterConeAngle") - }; - variableInfo6.Name = variableInfo6.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo6.Type, "OuterConeAngle") : effectBuilder.GenerateGlobalConstant(variableInfo6.Type, "OuterConeAngle"); - variableInfo6.DefaultValue = (object) efiSpotlight2D.OuterConeAngle; - effectBuilder.AddPropertyVariable(variableInfo6); - VariableInfo variableInfo7 = new VariableInfo() - { - ID = (int) efiSpotlight2D.IntensityID, - Type = Dx9VariableType.Float, - IsDynamic = efiSpotlight2D.IsDynamicProperty("Intensity") - }; - variableInfo7.Name = variableInfo7.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo7.Type, "Intensity") : effectBuilder.GenerateGlobalConstant(variableInfo7.Type, "Intensity"); - variableInfo7.DefaultValue = (object) efiSpotlight2D.Intensity; - effectBuilder.AddPropertyVariable(variableInfo7); - VariableInfo variableInfo8 = new VariableInfo() - { - ID = (int) efiSpotlight2D.AttenuationID, - Type = Dx9VariableType.Vector3, - IsDynamic = efiSpotlight2D.IsDynamicProperty("Attenuation") - }; - variableInfo8.Name = variableInfo8.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo8.Type, "Attenuation") : effectBuilder.GenerateGlobalConstant(variableInfo8.Type, "Attenuation"); - variableInfo8.DefaultValue = (object) efiSpotlight2D.Attenuation; - effectBuilder.AddPropertyVariable(variableInfo8); - effectBuilder.AddRequirement(EffectRequirements.ViewPosition); - effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiSpotlight2D.Name); - string str = InvariantString.Format(" float4 {0} = {3};\r\n {{\r\n // Compute the direction of the spotlight and the distance from the current pixel\r\n // 0.0001 prevents div by zero while using smoothstep interpolation\r\n float flCosOuterCone = cos(radians(({4}+{5}+0.0001)/2.0f));\r\n float flCosInnerCone = cos(radians({4}/2.0f));\r\n float flDirectionAngle = radians({2});\r\n float2 vLightDir = {{cos(flDirectionAngle), -sin(flDirectionAngle)}};\r\n float2 vLightPosition = {1}.xy - vLightDir;\r\n float2 vPositionDelta = Input.ViewPos.xy - vLightPosition;\r\n\r\n // Compute the cone region, attenuation and falloff\r\n float flDist = length(vPositionDelta);\r\n float flFalloff = {6} / ({7}.x + flDist*{7}.y + flDist*flDist*{7}.z);\r\n float flCone = dot(normalize(vPositionDelta), vLightDir);\r\n\r\n {0} *= smoothstep(flCosOuterCone, flCosInnerCone, flCone) * flFalloff;\r\n", (object) effectBuilder.PixelShaderOutput, (object) variableInfo1.Name, (object) variableInfo2.Name, (object) variableInfo3.Name, (object) variableInfo5.Name, (object) variableInfo6.Name, (object) variableInfo7.Name, (object) variableInfo8.Name); - if (variableInfo4.IsDynamic || !efiSpotlight2D.AmbientColor.ToVector4().IsApproximate(Vector4.Zero)) - effectBuilder.EmitPixelFragment(InvariantString.Format("{0} {1} += {2};\r\n }}\r\n", (object) str, (object) effectBuilder.PixelShaderOutput, (object) variableInfo4.Name)); - else - effectBuilder.EmitPixelFragment(InvariantString.Format("{0} }}\r\n", (object) str)); + internal static void Generate( + SpotLight2DElement efiSpotlight2D, + ref Dx9EffectBuilder effectBuilder) + { + VariableInfo variableInfo1 = new VariableInfo() + { + ID = (int)efiSpotlight2D.PositionID, + Type = Dx9VariableType.Vector3, + IsDynamic = efiSpotlight2D.IsDynamicProperty("Position") + }; + variableInfo1.Name = variableInfo1.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo1.Type, "Position") : effectBuilder.GenerateGlobalConstant(variableInfo1.Type, "Position"); + variableInfo1.DefaultValue = (object)efiSpotlight2D.Position; + effectBuilder.AddPropertyVariable(variableInfo1); + VariableInfo variableInfo2 = new VariableInfo() + { + ID = (int)efiSpotlight2D.DirectionAngleID, + Type = Dx9VariableType.Float, + IsDynamic = efiSpotlight2D.IsDynamicProperty("DirectionAngle") + }; + variableInfo2.Name = variableInfo2.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo2.Type, "DirectionAngle") : effectBuilder.GenerateGlobalConstant(variableInfo2.Type, "DirectionAngle"); + variableInfo2.DefaultValue = (object)efiSpotlight2D.DirectionAngle; + effectBuilder.AddPropertyVariable(variableInfo2); + VariableInfo variableInfo3 = new VariableInfo() + { + ID = (int)efiSpotlight2D.LightColorID, + Type = Dx9VariableType.Vector4, + IsDynamic = efiSpotlight2D.IsDynamicProperty("LightColor") + }; + variableInfo3.Name = variableInfo3.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo3.Type, "LightColor") : effectBuilder.GenerateGlobalConstant(variableInfo3.Type, "LightColor"); + variableInfo3.DefaultValue = (object)efiSpotlight2D.LightColor.ToVector4(); + effectBuilder.AddPropertyVariable(variableInfo3); + VariableInfo variableInfo4 = new VariableInfo() + { + ID = (int)efiSpotlight2D.AmbientColorID, + Type = Dx9VariableType.Vector4, + IsDynamic = efiSpotlight2D.IsDynamicProperty("AmbientColor") + }; + variableInfo4.Name = variableInfo4.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo4.Type, "AmbientColor") : effectBuilder.GenerateGlobalConstant(variableInfo4.Type, "AmbientColor"); + variableInfo4.DefaultValue = (object)efiSpotlight2D.AmbientColor.ToVector4(); + effectBuilder.AddPropertyVariable(variableInfo4); + VariableInfo variableInfo5 = new VariableInfo() + { + ID = (int)efiSpotlight2D.InnerConeAngleID, + Type = Dx9VariableType.Float, + IsDynamic = efiSpotlight2D.IsDynamicProperty("InnerConeAngle") + }; + variableInfo5.Name = variableInfo5.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo5.Type, "InnerConeAngle") : effectBuilder.GenerateGlobalConstant(variableInfo5.Type, "InnerConeAngle"); + variableInfo5.DefaultValue = (object)efiSpotlight2D.InnerConeAngle; + effectBuilder.AddPropertyVariable(variableInfo5); + VariableInfo variableInfo6 = new VariableInfo() + { + ID = (int)efiSpotlight2D.OuterConeAngleID, + Type = Dx9VariableType.Float, + IsDynamic = efiSpotlight2D.IsDynamicProperty("OuterConeAngle") + }; + variableInfo6.Name = variableInfo6.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo6.Type, "OuterConeAngle") : effectBuilder.GenerateGlobalConstant(variableInfo6.Type, "OuterConeAngle"); + variableInfo6.DefaultValue = (object)efiSpotlight2D.OuterConeAngle; + effectBuilder.AddPropertyVariable(variableInfo6); + VariableInfo variableInfo7 = new VariableInfo() + { + ID = (int)efiSpotlight2D.IntensityID, + Type = Dx9VariableType.Float, + IsDynamic = efiSpotlight2D.IsDynamicProperty("Intensity") + }; + variableInfo7.Name = variableInfo7.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo7.Type, "Intensity") : effectBuilder.GenerateGlobalConstant(variableInfo7.Type, "Intensity"); + variableInfo7.DefaultValue = (object)efiSpotlight2D.Intensity; + effectBuilder.AddPropertyVariable(variableInfo7); + VariableInfo variableInfo8 = new VariableInfo() + { + ID = (int)efiSpotlight2D.AttenuationID, + Type = Dx9VariableType.Vector3, + IsDynamic = efiSpotlight2D.IsDynamicProperty("Attenuation") + }; + variableInfo8.Name = variableInfo8.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo8.Type, "Attenuation") : effectBuilder.GenerateGlobalConstant(variableInfo8.Type, "Attenuation"); + variableInfo8.DefaultValue = (object)efiSpotlight2D.Attenuation; + effectBuilder.AddPropertyVariable(variableInfo8); + effectBuilder.AddRequirement(EffectRequirements.ViewPosition); + effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiSpotlight2D.Name); + string str = InvariantString.Format(" float4 {0} = {3};\r\n {{\r\n // Compute the direction of the spotlight and the distance from the current pixel\r\n // 0.0001 prevents div by zero while using smoothstep interpolation\r\n float flCosOuterCone = cos(radians(({4}+{5}+0.0001)/2.0f));\r\n float flCosInnerCone = cos(radians({4}/2.0f));\r\n float flDirectionAngle = radians({2});\r\n float2 vLightDir = {{cos(flDirectionAngle), -sin(flDirectionAngle)}};\r\n float2 vLightPosition = {1}.xy - vLightDir;\r\n float2 vPositionDelta = Input.ViewPos.xy - vLightPosition;\r\n\r\n // Compute the cone region, attenuation and falloff\r\n float flDist = length(vPositionDelta);\r\n float flFalloff = {6} / ({7}.x + flDist*{7}.y + flDist*flDist*{7}.z);\r\n float flCone = dot(normalize(vPositionDelta), vLightDir);\r\n\r\n {0} *= smoothstep(flCosOuterCone, flCosInnerCone, flCone) * flFalloff;\r\n", (object)effectBuilder.PixelShaderOutput, (object)variableInfo1.Name, (object)variableInfo2.Name, (object)variableInfo3.Name, (object)variableInfo5.Name, (object)variableInfo6.Name, (object)variableInfo7.Name, (object)variableInfo8.Name); + if (variableInfo4.IsDynamic || !efiSpotlight2D.AmbientColor.ToVector4().IsApproximate(Vector4.Zero)) + effectBuilder.EmitPixelFragment(InvariantString.Format("{0} {1} += {2};\r\n }}\r\n", (object)str, (object)effectBuilder.PixelShaderOutput, (object)variableInfo4.Name)); + else + effectBuilder.EmitPixelFragment(InvariantString.Format("{0} }}\r\n", (object)str)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9TextureInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9TextureInfo.cs index 162ac0b..f2085a6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9TextureInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9TextureInfo.cs @@ -6,15 +6,15 @@ namespace Microsoft.Iris.Render.Graphics { - internal class Dx9TextureInfo - { - public int ImageIndex; - public string TexCoordInput; - public string Sampler; - public string TexelSize; - public string TexUVRefPoint; - public string TexUVSize; - public int DownsamplePropertyID; - public int Requirements; - } + internal class Dx9TextureInfo + { + public int ImageIndex; + public string TexCoordInput; + public string Sampler; + public string TexelSize; + public string TexUVRefPoint; + public string TexUVSize; + public int DownsamplePropertyID; + public int Requirements; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9TextureRequirements.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9TextureRequirements.cs index 1d76faa..5f4ef5e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9TextureRequirements.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9TextureRequirements.cs @@ -8,14 +8,14 @@ using System; namespace Microsoft.Iris.Render.Graphics { - [Flags] - internal enum Dx9TextureRequirements - { - TexelSize = 1, - SampleBackbuffer = 2, - TexUVSize = 4, - TexUVRefPoint = 8, - DisablePerspectiveCorrection = 16, // 0x00000010 - ValidMask = DisablePerspectiveCorrection | TexUVRefPoint | TexUVSize | SampleBackbuffer | TexelSize, // 0x0000001F - } + [Flags] + internal enum Dx9TextureRequirements + { + TexelSize = 1, + SampleBackbuffer = 2, + TexUVSize = 4, + TexUVRefPoint = 8, + DisablePerspectiveCorrection = 16, // 0x00000010 + ValidMask = DisablePerspectiveCorrection | TexUVRefPoint | TexUVSize | SampleBackbuffer | TexelSize, // 0x0000001F + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9VariableType.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9VariableType.cs index 30d564d..0991943 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9VariableType.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9VariableType.cs @@ -6,13 +6,13 @@ namespace Microsoft.Iris.Render.Graphics { - internal enum Dx9VariableType : byte - { - Integer, - Float, - Vector2, - Vector3, - Vector4, - Texture, - } + internal enum Dx9VariableType : byte + { + Integer, + Float, + Vector2, + Vector3, + Vector4, + Texture, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9VideoElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9VideoElement.cs index 08cbd7e..b97c92d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9VideoElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Dx9VideoElement.cs @@ -8,24 +8,24 @@ using Microsoft.Iris.Library; namespace Microsoft.Iris.Render.Graphics { - internal class Dx9VideoElement - { - internal static void Generate(VideoElement efiVideo, ref Dx9EffectBuilder effectBuilder) + internal class Dx9VideoElement { - Dx9TextureInfo dx9TextureInfo = effectBuilder.AllocateTexture(); - TextureVariableInfo textureVariableInfo = new TextureVariableInfo(); - textureVariableInfo.ID = (int) efiVideo.VideoStreamID; - textureVariableInfo.Type = Dx9VariableType.Texture; - textureVariableInfo.Name = effectBuilder.GenerateGlobalVariable(textureVariableInfo.Type, efiVideo.Name); - textureVariableInfo.DefaultValue = (object) efiVideo.VideoStream; - textureVariableInfo.SamplerName = dx9TextureInfo.Sampler; - textureVariableInfo.MinFilter = "Linear"; - textureVariableInfo.MagFilter = "Linear"; - textureVariableInfo.CoordinateMapID = -1; - textureVariableInfo.ImageIndexID = -1; - effectBuilder.AddPropertyVariable((VariableInfo) textureVariableInfo); - effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiVideo.Name); - effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the surface\r\n float4 {0} = tex2D({1}, {2});\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) dx9TextureInfo.Sampler, (object) dx9TextureInfo.TexCoordInput)); + internal static void Generate(VideoElement efiVideo, ref Dx9EffectBuilder effectBuilder) + { + Dx9TextureInfo dx9TextureInfo = effectBuilder.AllocateTexture(); + TextureVariableInfo textureVariableInfo = new TextureVariableInfo(); + textureVariableInfo.ID = (int)efiVideo.VideoStreamID; + textureVariableInfo.Type = Dx9VariableType.Texture; + textureVariableInfo.Name = effectBuilder.GenerateGlobalVariable(textureVariableInfo.Type, efiVideo.Name); + textureVariableInfo.DefaultValue = (object)efiVideo.VideoStream; + textureVariableInfo.SamplerName = dx9TextureInfo.Sampler; + textureVariableInfo.MinFilter = "Linear"; + textureVariableInfo.MagFilter = "Linear"; + textureVariableInfo.CoordinateMapID = -1; + textureVariableInfo.ImageIndexID = -1; + effectBuilder.AddPropertyVariable((VariableInfo)textureVariableInfo); + effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Vector4, efiVideo.Name); + effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the surface\r\n float4 {0} = tex2D({1}, {2});\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)dx9TextureInfo.Sampler, (object)dx9TextureInfo.TexCoordInput)); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicBlock.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicBlock.cs index 6e0a5d0..5a04b32 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicBlock.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicBlock.cs @@ -11,119 +11,119 @@ using System.Diagnostics; namespace Microsoft.Iris.Render.Graphics { - internal sealed class DynamicBlock : IDynamicBlock - { - private DynamicRow m_rowOwner; - private Rectangle m_rcLocationPxl; - private Size m_sizeContentPxl; - private Surface m_surface; - private bool m_fRotated; - private Size m_sizeGutter; - - internal DynamicBlock( - DynamicRow rowOwner, - Rectangle rcLocationPxl, - Size sizeContentPxl, - Size sizeGutter, - bool fRotated) + internal sealed class DynamicBlock : IDynamicBlock { - this.m_rowOwner = rowOwner; - this.m_fRotated = fRotated; - this.m_rcLocationPxl = rcLocationPxl; - this.m_sizeContentPxl = sizeContentPxl; - this.m_sizeGutter = sizeGutter; + private DynamicRow m_rowOwner; + private Rectangle m_rcLocationPxl; + private Size m_sizeContentPxl; + private Surface m_surface; + private bool m_fRotated; + private Size m_sizeGutter; + + internal DynamicBlock( + DynamicRow rowOwner, + Rectangle rcLocationPxl, + Size sizeContentPxl, + Size sizeGutter, + bool fRotated) + { + this.m_rowOwner = rowOwner; + this.m_fRotated = fRotated; + this.m_rcLocationPxl = rcLocationPxl; + this.m_sizeContentPxl = sizeContentPxl; + this.m_sizeGutter = sizeGutter; + } + + internal Surface Create(ISurfaceContentOwner surfaceOwner) + { + Surface surface = new Surface(this.m_rowOwner.DynamicPool.SurfacePool, surfaceOwner, this.m_sizeContentPxl, this.m_sizeGutter); + this.m_surface = surface; + RemoteSurface remoteStub = surface.RemoteStub; + remoteStub.SendRemapLocation(this.m_rcLocationPxl); + remoteStub.SendSetRotation(this.m_fRotated); + remoteStub.SendSetGutter(this.m_sizeGutter); + return surface; + } + + ~DynamicBlock() => this.Dispose(false); + + public void Dispose() + { + GC.SuppressFinalize((object)this); + this.Dispose(true); + } + + private void Dispose(bool fInDispose) + { + this.m_surface = (Surface)null; + if (!fInDispose) + return; + this.m_rowOwner.NotifyBlockDestroyed(this); + } + + public int NearEdge => this.m_rcLocationPxl.Left; + + public int FarEdge => this.m_rcLocationPxl.Right; + + internal Point StoragePosition + { + get => this.m_rcLocationPxl.Location; + set + { + if (!(this.m_rcLocationPxl.Location != value)) + return; + this.m_rcLocationPxl.Location = value; + } + } + + internal Size StorageSize + { + get => this.m_rcLocationPxl.Size; + set + { + if (!(this.m_rcLocationPxl.Size != value)) + return; + this.m_rcLocationPxl.Size = value; + } + } + + public Surface Surface => this.m_surface; + + public DynamicRow Row => this.m_rowOwner; + + internal void NotifyPositionChanged(ArrayList alReloadContent, Point ptNewOffsetPxl) + { + if (!(ptNewOffsetPxl != this.m_rcLocationPxl.Location)) + return; + this.m_rcLocationPxl.Location = ptNewOffsetPxl; + Surface surface = this.Surface; + if (surface == null) + return; + RemoteSurface remoteStub = surface.RemoteStub; + switch (surface.SurfacePool.StorageState) + { + case SurfacePoolAllocationResult.NotAllocated: + case SurfacePoolAllocationResult.Requested: + case SurfacePoolAllocationResult.Immoveable: + remoteStub.SendRemapLocation(this.m_rcLocationPxl); + alReloadContent.Add((object)surface); + break; + } + } + + internal void NotifyRowChanged( + ArrayList alReloadContent, + DynamicRow rowNewOwner, + DynamicRow rowOldOwner, + Point ptNewOffsetPxl) + { + this.m_rowOwner = rowNewOwner; + this.NotifyPositionChanged(alReloadContent, ptNewOffsetPxl); + } + + [Conditional("DEBUG")] + private void OnPositionChanged() + { + } } - - internal Surface Create(ISurfaceContentOwner surfaceOwner) - { - Surface surface = new Surface(this.m_rowOwner.DynamicPool.SurfacePool, surfaceOwner, this.m_sizeContentPxl, this.m_sizeGutter); - this.m_surface = surface; - RemoteSurface remoteStub = surface.RemoteStub; - remoteStub.SendRemapLocation(this.m_rcLocationPxl); - remoteStub.SendSetRotation(this.m_fRotated); - remoteStub.SendSetGutter(this.m_sizeGutter); - return surface; - } - - ~DynamicBlock() => this.Dispose(false); - - public void Dispose() - { - GC.SuppressFinalize((object) this); - this.Dispose(true); - } - - private void Dispose(bool fInDispose) - { - this.m_surface = (Surface) null; - if (!fInDispose) - return; - this.m_rowOwner.NotifyBlockDestroyed(this); - } - - public int NearEdge => this.m_rcLocationPxl.Left; - - public int FarEdge => this.m_rcLocationPxl.Right; - - internal Point StoragePosition - { - get => this.m_rcLocationPxl.Location; - set - { - if (!(this.m_rcLocationPxl.Location != value)) - return; - this.m_rcLocationPxl.Location = value; - } - } - - internal Size StorageSize - { - get => this.m_rcLocationPxl.Size; - set - { - if (!(this.m_rcLocationPxl.Size != value)) - return; - this.m_rcLocationPxl.Size = value; - } - } - - public Surface Surface => this.m_surface; - - public DynamicRow Row => this.m_rowOwner; - - internal void NotifyPositionChanged(ArrayList alReloadContent, Point ptNewOffsetPxl) - { - if (!(ptNewOffsetPxl != this.m_rcLocationPxl.Location)) - return; - this.m_rcLocationPxl.Location = ptNewOffsetPxl; - Surface surface = this.Surface; - if (surface == null) - return; - RemoteSurface remoteStub = surface.RemoteStub; - switch (surface.SurfacePool.StorageState) - { - case SurfacePoolAllocationResult.NotAllocated: - case SurfacePoolAllocationResult.Requested: - case SurfacePoolAllocationResult.Immoveable: - remoteStub.SendRemapLocation(this.m_rcLocationPxl); - alReloadContent.Add((object) surface); - break; - } - } - - internal void NotifyRowChanged( - ArrayList alReloadContent, - DynamicRow rowNewOwner, - DynamicRow rowOldOwner, - Point ptNewOffsetPxl) - { - this.m_rowOwner = rowNewOwner; - this.NotifyPositionChanged(alReloadContent, ptNewOffsetPxl); - } - - [Conditional("DEBUG")] - private void OnPositionChanged() - { - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicBucket.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicBucket.cs index f10f134..53f134e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicBucket.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicBucket.cs @@ -8,208 +8,208 @@ using System.Collections; namespace Microsoft.Iris.Render.Graphics { - internal sealed class DynamicBucket - { - private DynamicPool m_poolOwner; - private int m_nHeightPxl; - private ArrayList m_alRows; - private bool m_fCompacting; - - public DynamicBucket(DynamicPool poolOwner, int nHeightPxl) + internal sealed class DynamicBucket { - this.m_poolOwner = poolOwner; - this.m_nHeightPxl = nHeightPxl; - this.m_alRows = new ArrayList(); - } + private DynamicPool m_poolOwner; + private int m_nHeightPxl; + private ArrayList m_alRows; + private bool m_fCompacting; - public int RowHeight => this.m_nHeightPxl; - - internal DynamicPool DynamicPool => this.m_poolOwner; - - public Surface CreateSurface( - ISurfaceContentOwner surfaceOwner, - Size sizeRequestPxl, - Size sizeContentPxl, - Size sizeGutter, - bool fRotated, - PoolAllocMethod allocMethod) - { - ArrayList alReloadContent = (ArrayList) null; - DynamicRow dynamicRow = (DynamicRow) null; - switch (allocMethod) - { - case PoolAllocMethod.Available: - dynamicRow = this.FindTrivialFreeSpaceRow(sizeRequestPxl.Width); - break; - case PoolAllocMethod.New: - case PoolAllocMethod.CompactDead: - case PoolAllocMethod.CompactAll: - alReloadContent = new ArrayList(); - dynamicRow = this.m_poolOwner.CreateRow(alReloadContent, this, surfaceOwner, sizeRequestPxl, allocMethod); - if (dynamicRow != null) - { - this.m_alRows.Add((object) dynamicRow); - break; - } - break; - case PoolAllocMethod.ScavengeDead: - alReloadContent = new ArrayList(); - dynamicRow = this.ScavengeForAvailableSpace(alReloadContent, sizeRequestPxl); - break; - } - if (alReloadContent != null) - this.m_poolOwner.ProcessDeferredContent(alReloadContent); - return dynamicRow?.CreateSurface(surfaceOwner, sizeRequestPxl, sizeContentPxl, sizeGutter, fRotated); - } - - public void NotifyEmpty(DynamicRow rowEmpty) - { - if (this.m_fCompacting) - return; - this.NotifyEmptyWorker(this.m_alRows.IndexOf((object) rowEmpty)); - } - - private void NotifyEmptyWorker(int idxRow) - { - DynamicRow alRow = (DynamicRow) this.m_alRows[idxRow]; - this.m_alRows.RemoveAt(idxRow); - this.m_poolOwner.NotifyEmpty(alRow); - if (this.m_alRows.Count != 0) - return; - this.m_poolOwner.NotifyEmpty(this); - } - - private DynamicRow FindTrivialFreeSpaceRow(int nRequestedWidth) - { - for (int index = 0; index < this.m_alRows.Count; ++index) - { - DynamicRow alRow = (DynamicRow) this.m_alRows[index]; - if (nRequestedWidth <= alRow.LargestFree) - return alRow; - } - return (DynamicRow) null; - } - - private DynamicRow ScavengeForAvailableSpace( - ArrayList alReloadContent, - Size sizeRequested) - { - uint uAvgTimestampsNoCompact; - uint uAvgTimestampsWithCompact; - object objResultOfSpeculation = this.m_poolOwner.SpeculateScavengeRows(this.RowHeight, this, out uAvgTimestampsNoCompact, out uAvgTimestampsWithCompact); - DynamicRow dynamicRow = (DynamicRow) null; - if (uAvgTimestampsNoCompact == uint.MaxValue) - dynamicRow = this.ScavengeLocalRows(alReloadContent, sizeRequested.Width); - if (uAvgTimestampsNoCompact != uint.MaxValue || uAvgTimestampsWithCompact != uint.MaxValue) - { - int nRequestedHeight = 0; - if (dynamicRow == null) - nRequestedHeight = this.RowHeight; - this.m_poolOwner.FinishScavengeRows(alReloadContent, nRequestedHeight, objResultOfSpeculation); - } - return dynamicRow; - } - - private DynamicRow ScavengeLocalRows(ArrayList alReloadContent, int nRequestedWidth) - { - DynamicRow dynamicRow1 = (DynamicRow) null; - object obj1 = (object) null; - uint num1 = uint.MaxValue; - DynamicRow dynamicRow2 = (DynamicRow) null; - object obj2 = (object) null; - uint num2 = uint.MaxValue; - for (int index = 0; index < this.m_alRows.Count; ++index) - { - DynamicRow alRow = (DynamicRow) this.m_alRows[index]; - uint uAvgTimestampsNoCompact; - uint uAvgTimestampsWithCompact; - object obj3 = alRow.SpeculateScavengeBlocks(nRequestedWidth, out uAvgTimestampsNoCompact, out uAvgTimestampsWithCompact); - if (num1 > uAvgTimestampsNoCompact) + public DynamicBucket(DynamicPool poolOwner, int nHeightPxl) { - num1 = uAvgTimestampsNoCompact; - obj1 = obj3; - dynamicRow1 = alRow; + this.m_poolOwner = poolOwner; + this.m_nHeightPxl = nHeightPxl; + this.m_alRows = new ArrayList(); } - if (num2 > uAvgTimestampsWithCompact) + + public int RowHeight => this.m_nHeightPxl; + + internal DynamicPool DynamicPool => this.m_poolOwner; + + public Surface CreateSurface( + ISurfaceContentOwner surfaceOwner, + Size sizeRequestPxl, + Size sizeContentPxl, + Size sizeGutter, + bool fRotated, + PoolAllocMethod allocMethod) { - num2 = uAvgTimestampsWithCompact; - obj2 = obj3; - dynamicRow2 = alRow; + ArrayList alReloadContent = (ArrayList)null; + DynamicRow dynamicRow = (DynamicRow)null; + switch (allocMethod) + { + case PoolAllocMethod.Available: + dynamicRow = this.FindTrivialFreeSpaceRow(sizeRequestPxl.Width); + break; + case PoolAllocMethod.New: + case PoolAllocMethod.CompactDead: + case PoolAllocMethod.CompactAll: + alReloadContent = new ArrayList(); + dynamicRow = this.m_poolOwner.CreateRow(alReloadContent, this, surfaceOwner, sizeRequestPxl, allocMethod); + if (dynamicRow != null) + { + this.m_alRows.Add((object)dynamicRow); + break; + } + break; + case PoolAllocMethod.ScavengeDead: + alReloadContent = new ArrayList(); + dynamicRow = this.ScavengeForAvailableSpace(alReloadContent, sizeRequestPxl); + break; + } + if (alReloadContent != null) + this.m_poolOwner.ProcessDeferredContent(alReloadContent); + return dynamicRow?.CreateSurface(surfaceOwner, sizeRequestPxl, sizeContentPxl, sizeGutter, fRotated); } - } - DynamicRow dynamicRow3 = dynamicRow1; - object objResultOfPotentialCalculation = obj1; - if (dynamicRow3 == null) - { - dynamicRow3 = dynamicRow2; - objResultOfPotentialCalculation = obj2; - } - if (dynamicRow3 != null && !dynamicRow3.FinishScavengeBlocks(alReloadContent, nRequestedWidth, objResultOfPotentialCalculation)) - dynamicRow3 = (DynamicRow) null; - if (dynamicRow3 != null && !this.m_alRows.Contains((object) dynamicRow3)) - dynamicRow3 = (DynamicRow) null; - return dynamicRow3; - } - internal void CollectDeadBlocks() - { - if (this.m_alRows.Count <= 0) - return; - this.m_fCompacting = true; - try - { - for (int index = 0; index < this.m_alRows.Count; ++index) - ((DynamicRow) this.m_alRows[index]).CollectDeadBlocks(); - this.RemoveEmptyRows(); - } - finally - { - this.m_fCompacting = false; - } - } - - internal void CompactBlocks(ArrayList alReloadContent, bool fCompactToRight) - { - if (this.m_alRows.Count <= 0) - return; - this.m_fCompacting = true; - try - { - int index = 0; - for (; index < this.m_alRows.Count; ++index) + public void NotifyEmpty(DynamicRow rowEmpty) { - DynamicRow alRow1 = (DynamicRow) this.m_alRows[index]; - alRow1.CompactBlocks(alReloadContent, fCompactToRight); - int num = index + 1; - while (num < this.m_alRows.Count) - { - DynamicRow alRow2 = (DynamicRow) this.m_alRows[num++]; - if (!DynamicRow.MoveBlocksToEnd(alReloadContent, alRow1, alRow2, fCompactToRight)) - break; - } + if (this.m_fCompacting) + return; + this.NotifyEmptyWorker(this.m_alRows.IndexOf((object)rowEmpty)); } - this.RemoveEmptyRows(); - } - finally - { - this.m_fCompacting = false; - } + + private void NotifyEmptyWorker(int idxRow) + { + DynamicRow alRow = (DynamicRow)this.m_alRows[idxRow]; + this.m_alRows.RemoveAt(idxRow); + this.m_poolOwner.NotifyEmpty(alRow); + if (this.m_alRows.Count != 0) + return; + this.m_poolOwner.NotifyEmpty(this); + } + + private DynamicRow FindTrivialFreeSpaceRow(int nRequestedWidth) + { + for (int index = 0; index < this.m_alRows.Count; ++index) + { + DynamicRow alRow = (DynamicRow)this.m_alRows[index]; + if (nRequestedWidth <= alRow.LargestFree) + return alRow; + } + return (DynamicRow)null; + } + + private DynamicRow ScavengeForAvailableSpace( + ArrayList alReloadContent, + Size sizeRequested) + { + uint uAvgTimestampsNoCompact; + uint uAvgTimestampsWithCompact; + object objResultOfSpeculation = this.m_poolOwner.SpeculateScavengeRows(this.RowHeight, this, out uAvgTimestampsNoCompact, out uAvgTimestampsWithCompact); + DynamicRow dynamicRow = (DynamicRow)null; + if (uAvgTimestampsNoCompact == uint.MaxValue) + dynamicRow = this.ScavengeLocalRows(alReloadContent, sizeRequested.Width); + if (uAvgTimestampsNoCompact != uint.MaxValue || uAvgTimestampsWithCompact != uint.MaxValue) + { + int nRequestedHeight = 0; + if (dynamicRow == null) + nRequestedHeight = this.RowHeight; + this.m_poolOwner.FinishScavengeRows(alReloadContent, nRequestedHeight, objResultOfSpeculation); + } + return dynamicRow; + } + + private DynamicRow ScavengeLocalRows(ArrayList alReloadContent, int nRequestedWidth) + { + DynamicRow dynamicRow1 = (DynamicRow)null; + object obj1 = (object)null; + uint num1 = uint.MaxValue; + DynamicRow dynamicRow2 = (DynamicRow)null; + object obj2 = (object)null; + uint num2 = uint.MaxValue; + for (int index = 0; index < this.m_alRows.Count; ++index) + { + DynamicRow alRow = (DynamicRow)this.m_alRows[index]; + uint uAvgTimestampsNoCompact; + uint uAvgTimestampsWithCompact; + object obj3 = alRow.SpeculateScavengeBlocks(nRequestedWidth, out uAvgTimestampsNoCompact, out uAvgTimestampsWithCompact); + if (num1 > uAvgTimestampsNoCompact) + { + num1 = uAvgTimestampsNoCompact; + obj1 = obj3; + dynamicRow1 = alRow; + } + if (num2 > uAvgTimestampsWithCompact) + { + num2 = uAvgTimestampsWithCompact; + obj2 = obj3; + dynamicRow2 = alRow; + } + } + DynamicRow dynamicRow3 = dynamicRow1; + object objResultOfPotentialCalculation = obj1; + if (dynamicRow3 == null) + { + dynamicRow3 = dynamicRow2; + objResultOfPotentialCalculation = obj2; + } + if (dynamicRow3 != null && !dynamicRow3.FinishScavengeBlocks(alReloadContent, nRequestedWidth, objResultOfPotentialCalculation)) + dynamicRow3 = (DynamicRow)null; + if (dynamicRow3 != null && !this.m_alRows.Contains((object)dynamicRow3)) + dynamicRow3 = (DynamicRow)null; + return dynamicRow3; + } + + internal void CollectDeadBlocks() + { + if (this.m_alRows.Count <= 0) + return; + this.m_fCompacting = true; + try + { + for (int index = 0; index < this.m_alRows.Count; ++index) + ((DynamicRow)this.m_alRows[index]).CollectDeadBlocks(); + this.RemoveEmptyRows(); + } + finally + { + this.m_fCompacting = false; + } + } + + internal void CompactBlocks(ArrayList alReloadContent, bool fCompactToRight) + { + if (this.m_alRows.Count <= 0) + return; + this.m_fCompacting = true; + try + { + int index = 0; + for (; index < this.m_alRows.Count; ++index) + { + DynamicRow alRow1 = (DynamicRow)this.m_alRows[index]; + alRow1.CompactBlocks(alReloadContent, fCompactToRight); + int num = index + 1; + while (num < this.m_alRows.Count) + { + DynamicRow alRow2 = (DynamicRow)this.m_alRows[num++]; + if (!DynamicRow.MoveBlocksToEnd(alReloadContent, alRow1, alRow2, fCompactToRight)) + break; + } + } + this.RemoveEmptyRows(); + } + finally + { + this.m_fCompacting = false; + } + } + + internal void RemoveEmptyRows() + { + int num = 0; + while (num < this.m_alRows.Count) + { + if (((DynamicRow)this.m_alRows[num]).IsEmpty) + this.NotifyEmptyWorker(num); + else + ++num; + } + } + + public int ID => 0; + + internal void AssertOwningThread() => this.m_poolOwner.AssertOwningThread(); } - - internal void RemoveEmptyRows() - { - int num = 0; - while (num < this.m_alRows.Count) - { - if (((DynamicRow) this.m_alRows[num]).IsEmpty) - this.NotifyEmptyWorker(num); - else - ++num; - } - } - - public int ID => 0; - - internal void AssertOwningThread() => this.m_poolOwner.AssertOwningThread(); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicPool.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicPool.cs index 50488a8..d75ee1c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicPool.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicPool.cs @@ -11,481 +11,481 @@ using System.Diagnostics; namespace Microsoft.Iris.Render.Graphics { - internal sealed class DynamicPool : IComparer - { - private RenderSession m_session; - private GraphicsDevice m_device; - private SurfacePool m_poolSurface; - private ArrayList m_alBuckets; - private ArrayList m_alRows; - private Size m_sizeTotalPxl; - private int m_nLargestFreePxl; - private int m_nTotalFreePxl; - private int m_nMinimumHeightPxl; - private int m_nMaximumHeightPxl; - private uint m_nCompact; - private bool m_fCollectDeadSurfacesDuringDebugCompact; - - internal DynamicPool(SurfacePool poolSurface, int nMinimumHeightPxl, int nMaximumHeightPxl) + internal sealed class DynamicPool : IComparer { - this.m_device = poolSurface.Device; - this.m_session = this.m_device.Session; - this.m_poolSurface = poolSurface; - this.m_alBuckets = new ArrayList(); - this.m_alRows = new ArrayList(); - this.m_sizeTotalPxl = poolSurface.StorageSize; - this.m_nLargestFreePxl = this.m_sizeTotalPxl.Height; - this.m_nMinimumHeightPxl = nMinimumHeightPxl; - this.m_nMaximumHeightPxl = nMaximumHeightPxl; - } + private RenderSession m_session; + private GraphicsDevice m_device; + private SurfacePool m_poolSurface; + private ArrayList m_alBuckets; + private ArrayList m_alRows; + private Size m_sizeTotalPxl; + private int m_nLargestFreePxl; + private int m_nTotalFreePxl; + private int m_nMinimumHeightPxl; + private int m_nMaximumHeightPxl; + private uint m_nCompact; + private bool m_fCollectDeadSurfacesDuringDebugCompact; - public void Dispose() - { - foreach (DynamicRow alRow in this.m_alRows) - alRow.Dispose(); - this.m_alBuckets = (ArrayList) null; - this.m_alRows = (ArrayList) null; - this.m_poolSurface.Dispose(); - this.m_poolSurface = (SurfacePool) null; - } - - internal SurfacePool SurfacePool => this.m_poolSurface; - - public Size TotalSize => this.m_sizeTotalPxl; - - public SurfaceFormat Format => this.m_poolSurface.Format; - - internal void AssertOwningThread() => this.m_session.AssertOwningThread(); - - public uint DebugCompactInterval - { - get => 0; - set - { - } - } - - public bool CollectDeadSurfacesDuringDebugCompact - { - get => this.m_fCollectDeadSurfacesDuringDebugCompact; - set => this.m_fCollectDeadSurfacesDuringDebugCompact = value; - } - - public Surface CreateSurface( - ISurfaceContentOwner surfaceOwner, - Size sizeRequestPxl, - Size sizeContentPxl, - Size sizeGutter, - bool fRotated, - PoolAllocMethod allocMethod) - { - int nHeightPxl = Math2.FindPowerOf2(sizeRequestPxl.Height, this.m_nMinimumHeightPxl); - if (nHeightPxl > this.m_nMaximumHeightPxl) - { - if (sizeRequestPxl.Height <= this.m_nMaximumHeightPxl) - nHeightPxl = this.m_nMaximumHeightPxl; - } - else if (sizeRequestPxl.Width <= this.m_sizeTotalPxl.Width) - { - int height = this.m_sizeTotalPxl.Height; - } - DynamicBucket dynamicBucket = (DynamicBucket) null; - for (int index = 0; index < this.m_alBuckets.Count; ++index) - { - DynamicBucket alBucket = (DynamicBucket) this.m_alBuckets[index]; - if (alBucket.RowHeight == nHeightPxl) + internal DynamicPool(SurfacePool poolSurface, int nMinimumHeightPxl, int nMaximumHeightPxl) { - dynamicBucket = alBucket; - break; + this.m_device = poolSurface.Device; + this.m_session = this.m_device.Session; + this.m_poolSurface = poolSurface; + this.m_alBuckets = new ArrayList(); + this.m_alRows = new ArrayList(); + this.m_sizeTotalPxl = poolSurface.StorageSize; + this.m_nLargestFreePxl = this.m_sizeTotalPxl.Height; + this.m_nMinimumHeightPxl = nMinimumHeightPxl; + this.m_nMaximumHeightPxl = nMaximumHeightPxl; } - } - if (dynamicBucket == null) - { - dynamicBucket = new DynamicBucket(this, nHeightPxl); - this.m_alBuckets.Add((object) dynamicBucket); - } - return dynamicBucket.CreateSurface(surfaceOwner, sizeRequestPxl, sizeContentPxl, sizeGutter, fRotated, allocMethod); - } - public static void FindInsertionPoint( - ArrayList alItems, - int nTotalPxl, - int nNeededPxl, - out int idxInsert, - out int nOffsetNewPxl) - { - idxInsert = 0; - nOffsetNewPxl = 0; - int num1 = int.MaxValue; - if (alItems.Count <= 0) - return; - idxInsert = -1; - IDynamicBlock dynamicBlock1 = (IDynamicBlock) null; - int index = 0; - while (index <= alItems.Count) - { - IDynamicBlock dynamicBlock2 = (IDynamicBlock) null; - int num2; - if (index < alItems.Count) + public void Dispose() { - dynamicBlock2 = (IDynamicBlock) alItems[index]; - num2 = dynamicBlock2.NearEdge; + foreach (DynamicRow alRow in this.m_alRows) + alRow.Dispose(); + this.m_alBuckets = (ArrayList)null; + this.m_alRows = (ArrayList)null; + this.m_poolSurface.Dispose(); + this.m_poolSurface = (SurfacePool)null; } - else - num2 = nTotalPxl; - if (dynamicBlock1 != null) - num2 -= dynamicBlock1.FarEdge; - int num3 = num2 - nNeededPxl; - if (num3 >= 0 && num3 < num1) - { - nOffsetNewPxl = dynamicBlock1 != null ? dynamicBlock1.FarEdge : 0; - num1 = num3; - idxInsert = index; - } - ++index; - dynamicBlock1 = dynamicBlock2; - } - } - public static void RecomputeAvailable( - ArrayList alItems, - int nTotalPxl, - out int nOutLargestFreePxl, - out int nOutTotalFreePxl) - { - int num1 = nTotalPxl; - int num2 = nTotalPxl; - if (alItems.Count >= 0) - { - num1 = 0; - num2 = 0; - IDynamicBlock dynamicBlock1 = (IDynamicBlock) null; - int index = 0; - while (index <= alItems.Count) - { - IDynamicBlock dynamicBlock2; - int num3; - if (index < alItems.Count) - { - dynamicBlock2 = (IDynamicBlock) alItems[index]; - num3 = dynamicBlock2.NearEdge; - } - else - { - dynamicBlock2 = (IDynamicBlock) null; - num3 = nTotalPxl; - } - if (dynamicBlock1 != null) - num3 -= dynamicBlock1.FarEdge; - if (num1 < num3) - num1 = num3; - num2 += num3; - ++index; - dynamicBlock1 = dynamicBlock2; - } - } - nOutLargestFreePxl = num1; - nOutTotalFreePxl = num2; - } + internal SurfacePool SurfacePool => this.m_poolSurface; - [Conditional("DEBUG")] - public static void ValidateItems( - ArrayList alItems, - int nTotalPxl, - int nCachedLargestAvailable, - bool fTightPacking) - { - if (alItems.Count <= 0) - return; - int num1 = 0; - IDynamicBlock dynamicBlock1 = (IDynamicBlock) null; - int index = 0; - while (index <= alItems.Count) - { - IDynamicBlock dynamicBlock2; - int num2; - if (index < alItems.Count) - { - dynamicBlock2 = (IDynamicBlock) alItems[index]; - num2 = dynamicBlock2.NearEdge; - } - else - { - dynamicBlock2 = (IDynamicBlock) null; - num2 = nTotalPxl; - } - if (dynamicBlock1 != null) - num2 -= dynamicBlock1.FarEdge; - if (num1 < num2) - num1 = num2; - if (fTightPacking && index > 0) - { - int count = alItems.Count; - } - ++index; - dynamicBlock1 = dynamicBlock2; - } - } + public Size TotalSize => this.m_sizeTotalPxl; - public DynamicRow CreateRow( - ArrayList alReloadContent, - DynamicBucket bktOwner, - ISurfaceContentOwner surfaceOwner, - Size sizeRequestPxl, - PoolAllocMethod allocMethod) - { - int rowHeight = bktOwner.RowHeight; - switch (allocMethod) - { - case PoolAllocMethod.CompactDead: - this.CollectDeadSurfaces(); - break; - case PoolAllocMethod.CompactAll: - this.FullCompact(alReloadContent); - break; - } - DynamicRow dynamicRow = (DynamicRow) null; - if (rowHeight <= this.m_nLargestFreePxl) - { - int idxInsert; - int nOffsetNewPxl; - DynamicPool.FindInsertionPoint(this.m_alRows, this.m_sizeTotalPxl.Height, rowHeight, out idxInsert, out nOffsetNewPxl); - dynamicRow = new DynamicRow(bktOwner, rowHeight, nOffsetNewPxl); - this.m_alRows.Insert(idxInsert, (object) dynamicRow); - DynamicPool.RecomputeAvailable(this.m_alRows, this.m_sizeTotalPxl.Height, out this.m_nLargestFreePxl, out this.m_nTotalFreePxl); - } - return dynamicRow; - } + public SurfaceFormat Format => this.m_poolSurface.Format; - internal object SpeculateScavengeRows( - int nRequestedHeight, - DynamicBucket bktIgnore, - out uint uAvgTimestampsNoCompact, - out uint uAvgTimestampsWithCompact) - { - uAvgTimestampsNoCompact = uint.MaxValue; - uAvgTimestampsWithCompact = uint.MaxValue; - if (nRequestedHeight <= this.m_nLargestFreePxl) - { - uAvgTimestampsNoCompact = 0U; - return (object) null; - } - int count = this.m_alRows.Count; - int length = 0; - DynamicRow[] dynamicRowArray = new DynamicRow[count]; - int num1 = 0; - DynamicRow dynamicRow1 = (DynamicRow) null; - uint num2 = uint.MaxValue; - for (int index = 0; index < count; ++index) - { - DynamicRow alRow = (DynamicRow) this.m_alRows[index]; - if (alRow.Bucket != bktIgnore) + internal void AssertOwningThread() => this.m_session.AssertOwningThread(); + + public uint DebugCompactInterval { - alRow.UpdateLivenessAndAge(); - if (alRow.LastFullyEmpty) - { - dynamicRowArray[length++] = alRow; - num1 += alRow.StorageSize.Height; - if (alRow.LastAvgAge < num2) + get => 0; + set { - int num3 = 0; - if (index > 0) - num3 = ((DynamicRow) this.m_alRows[index - 1]).FarEdge; - int num4 = this.m_sizeTotalPxl.Height; - if (index < count - 1) - num4 = ((DynamicRow) this.m_alRows[index + 1]).NearEdge; - if (num4 - num3 >= nRequestedHeight) - { - dynamicRow1 = alRow; - num2 = alRow.LastAvgAge; - } } - } } - } - if (dynamicRow1 != null) - { - uAvgTimestampsNoCompact = num2; - return (object) dynamicRow1; - } - if (nRequestedHeight <= this.m_nTotalFreePxl) - { - uAvgTimestampsWithCompact = 0U; - return (object) null; - } - if (nRequestedHeight > num1 + this.m_nTotalFreePxl) - return (object) null; - Array.Sort((Array) dynamicRowArray, 0, length, (IComparer) this); - int nTotalFreePxl = this.m_nTotalFreePxl; - int num5 = 0; - ulong num6 = 0; - while (num5 < length) - { - DynamicRow dynamicRow2 = dynamicRowArray[num5++]; - nTotalFreePxl += dynamicRow2.StorageSize.Height; - num6 += (ulong) dynamicRow2.LastAvgAge; - if (nTotalFreePxl >= nRequestedHeight) - break; - } - uAvgTimestampsWithCompact = (uint) (num6 / (ulong) num5); - while (num5 < length) - dynamicRowArray[num5++] = (DynamicRow) null; - return (object) dynamicRowArray; - } - internal bool FinishScavengeRows( - ArrayList alReloadContent, - int nRequestedHeight, - object objResultOfSpeculation) - { - if (objResultOfSpeculation != null) - { - if (objResultOfSpeculation is DynamicRow dynamicRow1) + public bool CollectDeadSurfacesDuringDebugCompact { - dynamicRow1.CollectDeadBlocks(); - this.RemoveEmptyRows(); + get => this.m_fCollectDeadSurfacesDuringDebugCompact; + set => this.m_fCollectDeadSurfacesDuringDebugCompact = value; } - else + + public Surface CreateSurface( + ISurfaceContentOwner surfaceOwner, + Size sizeRequestPxl, + Size sizeContentPxl, + Size sizeGutter, + bool fRotated, + PoolAllocMethod allocMethod) { - foreach (DynamicRow dynamicRow2 in objResultOfSpeculation as DynamicRow[]) - { - if (dynamicRow2 != null) + int nHeightPxl = Math2.FindPowerOf2(sizeRequestPxl.Height, this.m_nMinimumHeightPxl); + if (nHeightPxl > this.m_nMaximumHeightPxl) { - dynamicRow2.CollectDeadBlocks(); - this.RemoveEmptyRows(); - if (nRequestedHeight <= this.m_nLargestFreePxl) - break; + if (sizeRequestPxl.Height <= this.m_nMaximumHeightPxl) + nHeightPxl = this.m_nMaximumHeightPxl; } - } + else if (sizeRequestPxl.Width <= this.m_sizeTotalPxl.Width) + { + int height = this.m_sizeTotalPxl.Height; + } + DynamicBucket dynamicBucket = (DynamicBucket)null; + for (int index = 0; index < this.m_alBuckets.Count; ++index) + { + DynamicBucket alBucket = (DynamicBucket)this.m_alBuckets[index]; + if (alBucket.RowHeight == nHeightPxl) + { + dynamicBucket = alBucket; + break; + } + } + if (dynamicBucket == null) + { + dynamicBucket = new DynamicBucket(this, nHeightPxl); + this.m_alBuckets.Add((object)dynamicBucket); + } + return dynamicBucket.CreateSurface(surfaceOwner, sizeRequestPxl, sizeContentPxl, sizeGutter, fRotated, allocMethod); } - } - if (nRequestedHeight > this.m_nLargestFreePxl) - this.CompactRows(alReloadContent, false); - return nRequestedHeight <= this.m_nLargestFreePxl; - } - int IComparer.Compare(object oL, object oR) - { - DynamicRow dynamicRow1 = oL as DynamicRow; - DynamicRow dynamicRow2 = oR as DynamicRow; - uint lastAvgAge1 = dynamicRow1.LastAvgAge; - uint lastAvgAge2 = dynamicRow2.LastAvgAge; - if (lastAvgAge1 < lastAvgAge2) - return -1; - return lastAvgAge1 > lastAvgAge2 ? 1 : 0; - } - - public void NotifyEmpty(DynamicRow rowEmpty) - { - this.m_alRows.Remove((object) rowEmpty); - DynamicPool.RecomputeAvailable(this.m_alRows, this.m_sizeTotalPxl.Height, out this.m_nLargestFreePxl, out this.m_nTotalFreePxl); - } - - public void NotifyEmpty(DynamicBucket bktEmpty) - { - } - - public void CollectDeadSurfaces() - { - for (int index = 0; index < this.m_alBuckets.Count; ++index) - ((DynamicBucket) this.m_alBuckets[index]).CollectDeadBlocks(); - } - - internal IList ExtractAllSurfaces() - { - if (this.m_poolSurface == null) - return (IList) null; - IList allSurfaces = this.m_poolSurface.AllSurfaces; - if (allSurfaces == null) - return (IList) null; - foreach (Surface surCur in (IEnumerable) allSurfaces) - SurfacePool.RemapSurface(surCur, new SurfacePool(this.m_device, surCur.ContentSize, SurfaceFormat.ARGB32) + public static void FindInsertionPoint( + ArrayList alItems, + int nTotalPxl, + int nNeededPxl, + out int idxInsert, + out int nOffsetNewPxl) { - DestroyWhenEmpty = true - }); - this.m_poolSurface = (SurfacePool) null; - this.m_alBuckets = new ArrayList(); - this.m_alRows = new ArrayList(); - return allSurfaces; - } - - private void RemoveEmptyRows() - { - for (int index = 0; index < this.m_alBuckets.Count; ++index) - ((DynamicBucket) this.m_alBuckets[index]).RemoveEmptyRows(); - } - - private int TestCollect() - { - if (this.CollectDeadSurfacesDuringDebugCompact) - this.CollectDeadSurfaces(); - ArrayList alReloadContent = new ArrayList(); - this.FullCompact(alReloadContent); - this.ProcessDeferredContent(alReloadContent); - return alReloadContent.Count; - } - - private void DebugCompactTimeout(object sender, EventArgs args) => this.TestCollect(); - - internal void ProcessDeferredContent(ArrayList alReloadContent) - { - if (alReloadContent.Count <= 0) - return; - foreach (Surface surface in alReloadContent) - surface.RestoreContent(); - } - - private void FullCompact(ArrayList alReloadContent) - { - ++this.m_nCompact; - bool fCompactToRight = false; - bool fCompactDownward = false; - for (int index = 0; index < this.m_alBuckets.Count; ++index) - ((DynamicBucket) this.m_alBuckets[index]).CompactBlocks(alReloadContent, fCompactToRight); - this.CompactRows(alReloadContent, fCompactDownward); - this.m_nLargestFreePxl = this.m_sizeTotalPxl.Height; - int count = this.m_alRows.Count; - if (count <= 0) - return; - if (fCompactDownward) - this.m_nLargestFreePxl = ((DynamicRow) this.m_alRows[0]).NearEdge; - else - this.m_nLargestFreePxl = this.m_sizeTotalPxl.Height - ((DynamicRow) this.m_alRows[count - 1]).FarEdge; - } - - private void CompactRows(ArrayList alReloadContent, bool fCompactDownward) - { - if (fCompactDownward) - { - int height = this.m_sizeTotalPxl.Height; - for (int index = this.m_alRows.Count - 1; index >= 0; --index) - { - DynamicRow alRow = (DynamicRow) this.m_alRows[index]; - height -= alRow.StorageSize.Height; - alRow.NotifyPositionChanged(alReloadContent, height); + idxInsert = 0; + nOffsetNewPxl = 0; + int num1 = int.MaxValue; + if (alItems.Count <= 0) + return; + idxInsert = -1; + IDynamicBlock dynamicBlock1 = (IDynamicBlock)null; + int index = 0; + while (index <= alItems.Count) + { + IDynamicBlock dynamicBlock2 = (IDynamicBlock)null; + int num2; + if (index < alItems.Count) + { + dynamicBlock2 = (IDynamicBlock)alItems[index]; + num2 = dynamicBlock2.NearEdge; + } + else + num2 = nTotalPxl; + if (dynamicBlock1 != null) + num2 -= dynamicBlock1.FarEdge; + int num3 = num2 - nNeededPxl; + if (num3 >= 0 && num3 < num1) + { + nOffsetNewPxl = dynamicBlock1 != null ? dynamicBlock1.FarEdge : 0; + num1 = num3; + idxInsert = index; + } + ++index; + dynamicBlock1 = dynamicBlock2; + } } - } - else - { - int nNewOffsetYPxl = 0; - for (int index = 0; index < this.m_alRows.Count; ++index) - { - DynamicRow alRow = (DynamicRow) this.m_alRows[index]; - alRow.NotifyPositionChanged(alReloadContent, nNewOffsetYPxl); - nNewOffsetYPxl += alRow.StorageSize.Height; - } - } - } - internal void Dump() - { - foreach (DynamicBucket alBucket in this.m_alBuckets) - ; - foreach (DynamicRow alRow in this.m_alRows) - { - foreach (DynamicBlock block in (IEnumerable) alRow.Blocks) - ; - } + public static void RecomputeAvailable( + ArrayList alItems, + int nTotalPxl, + out int nOutLargestFreePxl, + out int nOutTotalFreePxl) + { + int num1 = nTotalPxl; + int num2 = nTotalPxl; + if (alItems.Count >= 0) + { + num1 = 0; + num2 = 0; + IDynamicBlock dynamicBlock1 = (IDynamicBlock)null; + int index = 0; + while (index <= alItems.Count) + { + IDynamicBlock dynamicBlock2; + int num3; + if (index < alItems.Count) + { + dynamicBlock2 = (IDynamicBlock)alItems[index]; + num3 = dynamicBlock2.NearEdge; + } + else + { + dynamicBlock2 = (IDynamicBlock)null; + num3 = nTotalPxl; + } + if (dynamicBlock1 != null) + num3 -= dynamicBlock1.FarEdge; + if (num1 < num3) + num1 = num3; + num2 += num3; + ++index; + dynamicBlock1 = dynamicBlock2; + } + } + nOutLargestFreePxl = num1; + nOutTotalFreePxl = num2; + } + + [Conditional("DEBUG")] + public static void ValidateItems( + ArrayList alItems, + int nTotalPxl, + int nCachedLargestAvailable, + bool fTightPacking) + { + if (alItems.Count <= 0) + return; + int num1 = 0; + IDynamicBlock dynamicBlock1 = (IDynamicBlock)null; + int index = 0; + while (index <= alItems.Count) + { + IDynamicBlock dynamicBlock2; + int num2; + if (index < alItems.Count) + { + dynamicBlock2 = (IDynamicBlock)alItems[index]; + num2 = dynamicBlock2.NearEdge; + } + else + { + dynamicBlock2 = (IDynamicBlock)null; + num2 = nTotalPxl; + } + if (dynamicBlock1 != null) + num2 -= dynamicBlock1.FarEdge; + if (num1 < num2) + num1 = num2; + if (fTightPacking && index > 0) + { + int count = alItems.Count; + } + ++index; + dynamicBlock1 = dynamicBlock2; + } + } + + public DynamicRow CreateRow( + ArrayList alReloadContent, + DynamicBucket bktOwner, + ISurfaceContentOwner surfaceOwner, + Size sizeRequestPxl, + PoolAllocMethod allocMethod) + { + int rowHeight = bktOwner.RowHeight; + switch (allocMethod) + { + case PoolAllocMethod.CompactDead: + this.CollectDeadSurfaces(); + break; + case PoolAllocMethod.CompactAll: + this.FullCompact(alReloadContent); + break; + } + DynamicRow dynamicRow = (DynamicRow)null; + if (rowHeight <= this.m_nLargestFreePxl) + { + int idxInsert; + int nOffsetNewPxl; + DynamicPool.FindInsertionPoint(this.m_alRows, this.m_sizeTotalPxl.Height, rowHeight, out idxInsert, out nOffsetNewPxl); + dynamicRow = new DynamicRow(bktOwner, rowHeight, nOffsetNewPxl); + this.m_alRows.Insert(idxInsert, (object)dynamicRow); + DynamicPool.RecomputeAvailable(this.m_alRows, this.m_sizeTotalPxl.Height, out this.m_nLargestFreePxl, out this.m_nTotalFreePxl); + } + return dynamicRow; + } + + internal object SpeculateScavengeRows( + int nRequestedHeight, + DynamicBucket bktIgnore, + out uint uAvgTimestampsNoCompact, + out uint uAvgTimestampsWithCompact) + { + uAvgTimestampsNoCompact = uint.MaxValue; + uAvgTimestampsWithCompact = uint.MaxValue; + if (nRequestedHeight <= this.m_nLargestFreePxl) + { + uAvgTimestampsNoCompact = 0U; + return (object)null; + } + int count = this.m_alRows.Count; + int length = 0; + DynamicRow[] dynamicRowArray = new DynamicRow[count]; + int num1 = 0; + DynamicRow dynamicRow1 = (DynamicRow)null; + uint num2 = uint.MaxValue; + for (int index = 0; index < count; ++index) + { + DynamicRow alRow = (DynamicRow)this.m_alRows[index]; + if (alRow.Bucket != bktIgnore) + { + alRow.UpdateLivenessAndAge(); + if (alRow.LastFullyEmpty) + { + dynamicRowArray[length++] = alRow; + num1 += alRow.StorageSize.Height; + if (alRow.LastAvgAge < num2) + { + int num3 = 0; + if (index > 0) + num3 = ((DynamicRow)this.m_alRows[index - 1]).FarEdge; + int num4 = this.m_sizeTotalPxl.Height; + if (index < count - 1) + num4 = ((DynamicRow)this.m_alRows[index + 1]).NearEdge; + if (num4 - num3 >= nRequestedHeight) + { + dynamicRow1 = alRow; + num2 = alRow.LastAvgAge; + } + } + } + } + } + if (dynamicRow1 != null) + { + uAvgTimestampsNoCompact = num2; + return (object)dynamicRow1; + } + if (nRequestedHeight <= this.m_nTotalFreePxl) + { + uAvgTimestampsWithCompact = 0U; + return (object)null; + } + if (nRequestedHeight > num1 + this.m_nTotalFreePxl) + return (object)null; + Array.Sort((Array)dynamicRowArray, 0, length, (IComparer)this); + int nTotalFreePxl = this.m_nTotalFreePxl; + int num5 = 0; + ulong num6 = 0; + while (num5 < length) + { + DynamicRow dynamicRow2 = dynamicRowArray[num5++]; + nTotalFreePxl += dynamicRow2.StorageSize.Height; + num6 += (ulong)dynamicRow2.LastAvgAge; + if (nTotalFreePxl >= nRequestedHeight) + break; + } + uAvgTimestampsWithCompact = (uint)(num6 / (ulong)num5); + while (num5 < length) + dynamicRowArray[num5++] = (DynamicRow)null; + return (object)dynamicRowArray; + } + + internal bool FinishScavengeRows( + ArrayList alReloadContent, + int nRequestedHeight, + object objResultOfSpeculation) + { + if (objResultOfSpeculation != null) + { + if (objResultOfSpeculation is DynamicRow dynamicRow1) + { + dynamicRow1.CollectDeadBlocks(); + this.RemoveEmptyRows(); + } + else + { + foreach (DynamicRow dynamicRow2 in objResultOfSpeculation as DynamicRow[]) + { + if (dynamicRow2 != null) + { + dynamicRow2.CollectDeadBlocks(); + this.RemoveEmptyRows(); + if (nRequestedHeight <= this.m_nLargestFreePxl) + break; + } + } + } + } + if (nRequestedHeight > this.m_nLargestFreePxl) + this.CompactRows(alReloadContent, false); + return nRequestedHeight <= this.m_nLargestFreePxl; + } + + int IComparer.Compare(object oL, object oR) + { + DynamicRow dynamicRow1 = oL as DynamicRow; + DynamicRow dynamicRow2 = oR as DynamicRow; + uint lastAvgAge1 = dynamicRow1.LastAvgAge; + uint lastAvgAge2 = dynamicRow2.LastAvgAge; + if (lastAvgAge1 < lastAvgAge2) + return -1; + return lastAvgAge1 > lastAvgAge2 ? 1 : 0; + } + + public void NotifyEmpty(DynamicRow rowEmpty) + { + this.m_alRows.Remove((object)rowEmpty); + DynamicPool.RecomputeAvailable(this.m_alRows, this.m_sizeTotalPxl.Height, out this.m_nLargestFreePxl, out this.m_nTotalFreePxl); + } + + public void NotifyEmpty(DynamicBucket bktEmpty) + { + } + + public void CollectDeadSurfaces() + { + for (int index = 0; index < this.m_alBuckets.Count; ++index) + ((DynamicBucket)this.m_alBuckets[index]).CollectDeadBlocks(); + } + + internal IList ExtractAllSurfaces() + { + if (this.m_poolSurface == null) + return (IList)null; + IList allSurfaces = this.m_poolSurface.AllSurfaces; + if (allSurfaces == null) + return (IList)null; + foreach (Surface surCur in (IEnumerable)allSurfaces) + SurfacePool.RemapSurface(surCur, new SurfacePool(this.m_device, surCur.ContentSize, SurfaceFormat.ARGB32) + { + DestroyWhenEmpty = true + }); + this.m_poolSurface = (SurfacePool)null; + this.m_alBuckets = new ArrayList(); + this.m_alRows = new ArrayList(); + return allSurfaces; + } + + private void RemoveEmptyRows() + { + for (int index = 0; index < this.m_alBuckets.Count; ++index) + ((DynamicBucket)this.m_alBuckets[index]).RemoveEmptyRows(); + } + + private int TestCollect() + { + if (this.CollectDeadSurfacesDuringDebugCompact) + this.CollectDeadSurfaces(); + ArrayList alReloadContent = new ArrayList(); + this.FullCompact(alReloadContent); + this.ProcessDeferredContent(alReloadContent); + return alReloadContent.Count; + } + + private void DebugCompactTimeout(object sender, EventArgs args) => this.TestCollect(); + + internal void ProcessDeferredContent(ArrayList alReloadContent) + { + if (alReloadContent.Count <= 0) + return; + foreach (Surface surface in alReloadContent) + surface.RestoreContent(); + } + + private void FullCompact(ArrayList alReloadContent) + { + ++this.m_nCompact; + bool fCompactToRight = false; + bool fCompactDownward = false; + for (int index = 0; index < this.m_alBuckets.Count; ++index) + ((DynamicBucket)this.m_alBuckets[index]).CompactBlocks(alReloadContent, fCompactToRight); + this.CompactRows(alReloadContent, fCompactDownward); + this.m_nLargestFreePxl = this.m_sizeTotalPxl.Height; + int count = this.m_alRows.Count; + if (count <= 0) + return; + if (fCompactDownward) + this.m_nLargestFreePxl = ((DynamicRow)this.m_alRows[0]).NearEdge; + else + this.m_nLargestFreePxl = this.m_sizeTotalPxl.Height - ((DynamicRow)this.m_alRows[count - 1]).FarEdge; + } + + private void CompactRows(ArrayList alReloadContent, bool fCompactDownward) + { + if (fCompactDownward) + { + int height = this.m_sizeTotalPxl.Height; + for (int index = this.m_alRows.Count - 1; index >= 0; --index) + { + DynamicRow alRow = (DynamicRow)this.m_alRows[index]; + height -= alRow.StorageSize.Height; + alRow.NotifyPositionChanged(alReloadContent, height); + } + } + else + { + int nNewOffsetYPxl = 0; + for (int index = 0; index < this.m_alRows.Count; ++index) + { + DynamicRow alRow = (DynamicRow)this.m_alRows[index]; + alRow.NotifyPositionChanged(alReloadContent, nNewOffsetYPxl); + nNewOffsetYPxl += alRow.StorageSize.Height; + } + } + } + + internal void Dump() + { + foreach (DynamicBucket alBucket in this.m_alBuckets) + ; + foreach (DynamicRow alRow in this.m_alRows) + { + foreach (DynamicBlock block in (IEnumerable)alRow.Blocks) + ; + } + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicPoolSet.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicPoolSet.cs index e7d3037..6b97c4e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicPoolSet.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicPoolSet.cs @@ -10,88 +10,88 @@ using System.Collections; namespace Microsoft.Iris.Render.Graphics { - internal class DynamicPoolSet : RenderObject - { - private GraphicsDevice m_device; - private ArrayList m_alPools; - private SurfaceFormat m_nFormat; - private int m_idxLastAlloc; - - internal DynamicPoolSet(GraphicsDevice device, SurfaceFormat nFormat) + internal class DynamicPoolSet : RenderObject { - this.m_device = device; - this.m_alPools = new ArrayList(); - this.m_nFormat = nFormat; - this.m_idxLastAlloc = 0; - } + private GraphicsDevice m_device; + private ArrayList m_alPools; + private SurfaceFormat m_nFormat; + private int m_idxLastAlloc; - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + internal DynamicPoolSet(GraphicsDevice device, SurfaceFormat nFormat) { - foreach (DynamicPool alPool in this.m_alPools) - alPool.Dispose(); + this.m_device = device; + this.m_alPools = new ArrayList(); + this.m_nFormat = nFormat; + this.m_idxLastAlloc = 0; } - this.m_alPools = (ArrayList) null; - this.m_device = (GraphicsDevice) null; - } - finally - { - base.Dispose(fInDispose); - } - } - internal SurfaceFormat Format => this.m_nFormat; - - internal ArrayList Pools => this.m_alPools; - - internal DynamicPool AllocateDynamicPool( - Size sizeDynamicPoolPxl, - int nMinHeightPxl, - int nMaxHeightPxl) - { - SurfacePool poolSurface = new SurfacePool(this.m_device, sizeDynamicPoolPxl, this.m_nFormat); - poolSurface.DestroyWhenEmpty = false; - poolSurface.RemoteStub.SendSetPriority(-10); - DynamicPool dynamicPool = new DynamicPool(poolSurface, nMinHeightPxl, nMaxHeightPxl); - this.m_alPools.Add((object) dynamicPool); - return dynamicPool; - } - - internal Surface RequestSurface( - ISurfaceContentOwner surfaceOwner, - Size sizeRequestPxl, - Size sizeContentPxl, - Size sizeGutter, - bool fRotated, - PoolAllocMethod minAllocMethod, - PoolAllocMethod maxAllocMethod) - { - Debug2.Validate(surfaceOwner != null, typeof (ArgumentNullException), "Must provide valid surface owner"); - Debug2.Validate(sizeContentPxl.Width > 0 && sizeContentPxl.Height > 0, typeof (ArgumentOutOfRangeException), "Must provide positive area for surface"); - Surface surface = (Surface) null; - for (int index1 = 0; index1 < this.m_alPools.Count; ++index1) - { - for (int index2 = (int) minAllocMethod; (PoolAllocMethod) index2 <= maxAllocMethod; ++index2) + protected override void Dispose(bool fInDispose) { - int index3 = (this.m_idxLastAlloc + index1) % this.m_alPools.Count; - surface = ((DynamicPool) this.m_alPools[index3]).CreateSurface(surfaceOwner, sizeRequestPxl, sizeContentPxl, sizeGutter, fRotated, (PoolAllocMethod) index2); - if (surface != null) - { - this.m_idxLastAlloc = index3; - break; - } + try + { + if (fInDispose) + { + foreach (DynamicPool alPool in this.m_alPools) + alPool.Dispose(); + } + this.m_alPools = (ArrayList)null; + this.m_device = (GraphicsDevice)null; + } + finally + { + base.Dispose(fInDispose); + } } - if (surface != null) - break; - } - return surface; - } - protected override void Invariant() - { + internal SurfaceFormat Format => this.m_nFormat; + + internal ArrayList Pools => this.m_alPools; + + internal DynamicPool AllocateDynamicPool( + Size sizeDynamicPoolPxl, + int nMinHeightPxl, + int nMaxHeightPxl) + { + SurfacePool poolSurface = new SurfacePool(this.m_device, sizeDynamicPoolPxl, this.m_nFormat); + poolSurface.DestroyWhenEmpty = false; + poolSurface.RemoteStub.SendSetPriority(-10); + DynamicPool dynamicPool = new DynamicPool(poolSurface, nMinHeightPxl, nMaxHeightPxl); + this.m_alPools.Add((object)dynamicPool); + return dynamicPool; + } + + internal Surface RequestSurface( + ISurfaceContentOwner surfaceOwner, + Size sizeRequestPxl, + Size sizeContentPxl, + Size sizeGutter, + bool fRotated, + PoolAllocMethod minAllocMethod, + PoolAllocMethod maxAllocMethod) + { + Debug2.Validate(surfaceOwner != null, typeof(ArgumentNullException), "Must provide valid surface owner"); + Debug2.Validate(sizeContentPxl.Width > 0 && sizeContentPxl.Height > 0, typeof(ArgumentOutOfRangeException), "Must provide positive area for surface"); + Surface surface = (Surface)null; + for (int index1 = 0; index1 < this.m_alPools.Count; ++index1) + { + for (int index2 = (int)minAllocMethod; (PoolAllocMethod)index2 <= maxAllocMethod; ++index2) + { + int index3 = (this.m_idxLastAlloc + index1) % this.m_alPools.Count; + surface = ((DynamicPool)this.m_alPools[index3]).CreateSurface(surfaceOwner, sizeRequestPxl, sizeContentPxl, sizeGutter, fRotated, (PoolAllocMethod)index2); + if (surface != null) + { + this.m_idxLastAlloc = index3; + break; + } + } + if (surface != null) + break; + } + return surface; + } + + protected override void Invariant() + { + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicRow.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicRow.cs index 1b89cf0..a8564de 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicRow.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/DynamicRow.cs @@ -10,372 +10,372 @@ using System.Diagnostics; namespace Microsoft.Iris.Render.Graphics { - internal sealed class DynamicRow : IDynamicBlock, IComparer - { - private DynamicBucket m_bktOwner; - private Size m_sizeRowPxl; - private int m_nOffsetYPxl; - private int m_nLargestFreePxl; - private int m_nTotalFreePxl; - private ArrayList m_alBlocks; - private uint m_uLastAvgAge; - - internal DynamicRow(DynamicBucket bktOwner, int nHeightPxl, int nOffsetPxl) + internal sealed class DynamicRow : IDynamicBlock, IComparer { - this.m_bktOwner = bktOwner; - this.m_sizeRowPxl = new Size(bktOwner.DynamicPool.SurfacePool.StorageSize.Width, nHeightPxl); - this.m_nOffsetYPxl = nOffsetPxl; - this.m_alBlocks = new ArrayList(); - this.m_nLargestFreePxl = this.m_sizeRowPxl.Width; - } + private DynamicBucket m_bktOwner; + private Size m_sizeRowPxl; + private int m_nOffsetYPxl; + private int m_nLargestFreePxl; + private int m_nTotalFreePxl; + private ArrayList m_alBlocks; + private uint m_uLastAvgAge; - public void Dispose() - { - this.m_bktOwner.AssertOwningThread(); - this.m_bktOwner = (DynamicBucket) null; - foreach (DynamicBlock alBlock in this.m_alBlocks) - alBlock.Dispose(); - this.m_alBlocks = (ArrayList) null; - } - - public int NearEdge => this.m_nOffsetYPxl; - - public int FarEdge => this.m_nOffsetYPxl + this.m_sizeRowPxl.Height; - - public int LargestFree => this.m_nLargestFreePxl; - - public int TotalFree => this.m_nTotalFreePxl; - - public DynamicPool DynamicPool => this.m_bktOwner.DynamicPool; - - public DynamicBucket Bucket => this.m_bktOwner; - - public ICollection Blocks => (ICollection) this.m_alBlocks; - - internal bool IsEmpty => this.m_alBlocks.Count == 0; - - internal Size StorageSize => this.m_sizeRowPxl; - - internal bool LastFullyEmpty => this.m_uLastAvgAge != uint.MaxValue; - - internal uint LastAvgAge => this.m_uLastAvgAge; - - internal Surface CreateSurface( - ISurfaceContentOwner surfaceOwner, - Size sizeRequestPxl, - Size sizeContentPxl, - Size sizeGutter, - bool fRotated) - { - int idxInsert; - int nOffsetNewPxl; - DynamicPool.FindInsertionPoint(this.m_alBlocks, this.m_sizeRowPxl.Width, sizeRequestPxl.Width, out idxInsert, out nOffsetNewPxl); - DynamicBlock dynamicBlock = new DynamicBlock(this, new Rectangle(new Point(nOffsetNewPxl, this.m_nOffsetYPxl), sizeRequestPxl), sizeContentPxl, sizeGutter, fRotated); - Surface surface = dynamicBlock.Create(surfaceOwner); - surface.RegisterUsage((object) this.DynamicPool.SurfacePool); - this.m_alBlocks.Insert(idxInsert, (object) dynamicBlock); - this.RecomputeAvailable(); - return surface; - } - - internal void UpdateLivenessAndAge() - { - ulong num = 0; - int count = this.m_alBlocks.Count; - for (int index = 0; index < count; ++index) - { - Surface surface = ((DynamicBlock) this.m_alBlocks[index]).Surface; - if (surface.InUse) + internal DynamicRow(DynamicBucket bktOwner, int nHeightPxl, int nOffsetPxl) { - this.m_uLastAvgAge = uint.MaxValue; - return; + this.m_bktOwner = bktOwner; + this.m_sizeRowPxl = new Size(bktOwner.DynamicPool.SurfacePool.StorageSize.Width, nHeightPxl); + this.m_nOffsetYPxl = nOffsetPxl; + this.m_alBlocks = new ArrayList(); + this.m_nLargestFreePxl = this.m_sizeRowPxl.Width; } - num += (ulong) surface.LastUsage; - } - this.m_uLastAvgAge = (uint) (num / (ulong) count); - } - internal object SpeculateScavengeBlocks( - int nRequestedWidth, - out uint uAvgTimestampsNoCompact, - out uint uAvgTimestampsWithCompact) - { - uAvgTimestampsNoCompact = uint.MaxValue; - uAvgTimestampsWithCompact = uint.MaxValue; - if (nRequestedWidth <= this.m_nLargestFreePxl) - { - uAvgTimestampsNoCompact = 0U; - return (object) null; - } - int count = this.m_alBlocks.Count; - int length = 0; - DynamicBlock[] dynamicBlockArray = new DynamicBlock[count]; - int num1 = 0; - DynamicBlock dynamicBlock1 = (DynamicBlock) null; - uint num2 = uint.MaxValue; - for (int index = 0; index < count; ++index) - { - DynamicBlock alBlock = (DynamicBlock) this.m_alBlocks[index]; - Surface surface = alBlock.Surface; - if (!surface.InUse) + public void Dispose() { - dynamicBlockArray[length++] = alBlock; - num1 += alBlock.StorageSize.Width; - if (surface.LastUsage < num2) - { - int num3 = 0; - if (index > 0) - num3 = ((DynamicBlock) this.m_alBlocks[index - 1]).FarEdge; - int num4 = this.m_sizeRowPxl.Width; - if (index < count - 1) - num4 = ((DynamicBlock) this.m_alBlocks[index + 1]).NearEdge; - if (num4 - num3 >= nRequestedWidth) + this.m_bktOwner.AssertOwningThread(); + this.m_bktOwner = (DynamicBucket)null; + foreach (DynamicBlock alBlock in this.m_alBlocks) + alBlock.Dispose(); + this.m_alBlocks = (ArrayList)null; + } + + public int NearEdge => this.m_nOffsetYPxl; + + public int FarEdge => this.m_nOffsetYPxl + this.m_sizeRowPxl.Height; + + public int LargestFree => this.m_nLargestFreePxl; + + public int TotalFree => this.m_nTotalFreePxl; + + public DynamicPool DynamicPool => this.m_bktOwner.DynamicPool; + + public DynamicBucket Bucket => this.m_bktOwner; + + public ICollection Blocks => (ICollection)this.m_alBlocks; + + internal bool IsEmpty => this.m_alBlocks.Count == 0; + + internal Size StorageSize => this.m_sizeRowPxl; + + internal bool LastFullyEmpty => this.m_uLastAvgAge != uint.MaxValue; + + internal uint LastAvgAge => this.m_uLastAvgAge; + + internal Surface CreateSurface( + ISurfaceContentOwner surfaceOwner, + Size sizeRequestPxl, + Size sizeContentPxl, + Size sizeGutter, + bool fRotated) + { + int idxInsert; + int nOffsetNewPxl; + DynamicPool.FindInsertionPoint(this.m_alBlocks, this.m_sizeRowPxl.Width, sizeRequestPxl.Width, out idxInsert, out nOffsetNewPxl); + DynamicBlock dynamicBlock = new DynamicBlock(this, new Rectangle(new Point(nOffsetNewPxl, this.m_nOffsetYPxl), sizeRequestPxl), sizeContentPxl, sizeGutter, fRotated); + Surface surface = dynamicBlock.Create(surfaceOwner); + surface.RegisterUsage((object)this.DynamicPool.SurfacePool); + this.m_alBlocks.Insert(idxInsert, (object)dynamicBlock); + this.RecomputeAvailable(); + return surface; + } + + internal void UpdateLivenessAndAge() + { + ulong num = 0; + int count = this.m_alBlocks.Count; + for (int index = 0; index < count; ++index) { - dynamicBlock1 = alBlock; - num2 = surface.LastUsage; + Surface surface = ((DynamicBlock)this.m_alBlocks[index]).Surface; + if (surface.InUse) + { + this.m_uLastAvgAge = uint.MaxValue; + return; + } + num += (ulong)surface.LastUsage; } - } + this.m_uLastAvgAge = (uint)(num / (ulong)count); } - } - if (dynamicBlock1 != null) - { - uAvgTimestampsNoCompact = num2; - return (object) dynamicBlock1; - } - if (nRequestedWidth <= this.m_nTotalFreePxl) - { - uAvgTimestampsWithCompact = 0U; - return (object) null; - } - if (nRequestedWidth > num1 + this.m_nTotalFreePxl) - return (object) null; - Array.Sort((Array) dynamicBlockArray, 0, length, (IComparer) this); - int nTotalFreePxl = this.m_nTotalFreePxl; - int num5 = 0; - ulong num6 = 0; - while (num5 < length) - { - DynamicBlock dynamicBlock2 = dynamicBlockArray[num5++]; - nTotalFreePxl += dynamicBlock2.StorageSize.Width; - num6 += (ulong) dynamicBlock2.Surface.LastUsage; - if (nTotalFreePxl >= nRequestedWidth) - break; - } - uAvgTimestampsWithCompact = (uint) (num6 / (ulong) num5); - while (num5 < length) - dynamicBlockArray[num5++] = (DynamicBlock) null; - return (object) dynamicBlockArray; - } - internal bool FinishScavengeBlocks( - ArrayList alReloadContent, - int nRequestedWidth, - object objResultOfPotentialCalculation) - { - if (objResultOfPotentialCalculation != null) - { - if (objResultOfPotentialCalculation is DynamicBlock blk1) + internal object SpeculateScavengeBlocks( + int nRequestedWidth, + out uint uAvgTimestampsNoCompact, + out uint uAvgTimestampsWithCompact) { - this.CollectDeadBlockSurface(blk1, blk1.Surface); - } - else - { - foreach (DynamicBlock blk2 in objResultOfPotentialCalculation as DynamicBlock[]) - { - if (blk2 != null) - this.CollectDeadBlockSurface(blk2, blk2.Surface); + uAvgTimestampsNoCompact = uint.MaxValue; + uAvgTimestampsWithCompact = uint.MaxValue; if (nRequestedWidth <= this.m_nLargestFreePxl) - break; - } + { + uAvgTimestampsNoCompact = 0U; + return (object)null; + } + int count = this.m_alBlocks.Count; + int length = 0; + DynamicBlock[] dynamicBlockArray = new DynamicBlock[count]; + int num1 = 0; + DynamicBlock dynamicBlock1 = (DynamicBlock)null; + uint num2 = uint.MaxValue; + for (int index = 0; index < count; ++index) + { + DynamicBlock alBlock = (DynamicBlock)this.m_alBlocks[index]; + Surface surface = alBlock.Surface; + if (!surface.InUse) + { + dynamicBlockArray[length++] = alBlock; + num1 += alBlock.StorageSize.Width; + if (surface.LastUsage < num2) + { + int num3 = 0; + if (index > 0) + num3 = ((DynamicBlock)this.m_alBlocks[index - 1]).FarEdge; + int num4 = this.m_sizeRowPxl.Width; + if (index < count - 1) + num4 = ((DynamicBlock)this.m_alBlocks[index + 1]).NearEdge; + if (num4 - num3 >= nRequestedWidth) + { + dynamicBlock1 = alBlock; + num2 = surface.LastUsage; + } + } + } + } + if (dynamicBlock1 != null) + { + uAvgTimestampsNoCompact = num2; + return (object)dynamicBlock1; + } + if (nRequestedWidth <= this.m_nTotalFreePxl) + { + uAvgTimestampsWithCompact = 0U; + return (object)null; + } + if (nRequestedWidth > num1 + this.m_nTotalFreePxl) + return (object)null; + Array.Sort((Array)dynamicBlockArray, 0, length, (IComparer)this); + int nTotalFreePxl = this.m_nTotalFreePxl; + int num5 = 0; + ulong num6 = 0; + while (num5 < length) + { + DynamicBlock dynamicBlock2 = dynamicBlockArray[num5++]; + nTotalFreePxl += dynamicBlock2.StorageSize.Width; + num6 += (ulong)dynamicBlock2.Surface.LastUsage; + if (nTotalFreePxl >= nRequestedWidth) + break; + } + uAvgTimestampsWithCompact = (uint)(num6 / (ulong)num5); + while (num5 < length) + dynamicBlockArray[num5++] = (DynamicBlock)null; + return (object)dynamicBlockArray; } - } - if (nRequestedWidth > this.m_nLargestFreePxl) - this.CompactBlocks(alReloadContent, false); - return nRequestedWidth <= this.m_nLargestFreePxl; - } - int IComparer.Compare(object oL, object oR) - { - DynamicBlock dynamicBlock1 = oL as DynamicBlock; - DynamicBlock dynamicBlock2 = oR as DynamicBlock; - Surface surface1 = dynamicBlock1.Surface; - Surface surface2 = dynamicBlock2.Surface; - uint lastUsage1 = surface1.LastUsage; - uint lastUsage2 = surface2.LastUsage; - if (lastUsage1 < lastUsage2) - return -1; - return lastUsage1 > lastUsage2 ? 1 : 0; - } - - internal void CollectDeadBlocks() - { - int index = 0; - while (index < this.m_alBlocks.Count) - { - DynamicBlock alBlock = (DynamicBlock) this.m_alBlocks[index]; - Surface surface = alBlock.Surface; - if (!surface.InUse) - this.CollectDeadBlockSurface(alBlock, surface); - else - ++index; - } - } - - private void CollectDeadBlockSurface(DynamicBlock blk, Surface sur) - { - sur.UnregisterUsage((object) this.DynamicPool.SurfacePool); - blk.Dispose(); - } - - internal void CompactBlocks(ArrayList alReloadContent, bool fCompactToRight) - { - if (this.m_alBlocks.Count <= 0) - return; - DynamicBlock dynamicBlock = (DynamicBlock) null; - try - { - if (fCompactToRight) + internal bool FinishScavengeBlocks( + ArrayList alReloadContent, + int nRequestedWidth, + object objResultOfPotentialCalculation) { - Point ptNewOffsetPxl = new Point(this.m_sizeRowPxl.Width, this.m_nOffsetYPxl); - for (int index = this.m_alBlocks.Count - 1; index >= 0; --index) - { - DynamicBlock alBlock = (DynamicBlock) this.m_alBlocks[index]; - ptNewOffsetPxl.X -= alBlock.StorageSize.Width; - alBlock.NotifyPositionChanged(alReloadContent, ptNewOffsetPxl); - dynamicBlock = alBlock; - } + if (objResultOfPotentialCalculation != null) + { + if (objResultOfPotentialCalculation is DynamicBlock blk1) + { + this.CollectDeadBlockSurface(blk1, blk1.Surface); + } + else + { + foreach (DynamicBlock blk2 in objResultOfPotentialCalculation as DynamicBlock[]) + { + if (blk2 != null) + this.CollectDeadBlockSurface(blk2, blk2.Surface); + if (nRequestedWidth <= this.m_nLargestFreePxl) + break; + } + } + } + if (nRequestedWidth > this.m_nLargestFreePxl) + this.CompactBlocks(alReloadContent, false); + return nRequestedWidth <= this.m_nLargestFreePxl; } - else + + int IComparer.Compare(object oL, object oR) { - Point ptNewOffsetPxl = new Point(0, this.m_nOffsetYPxl); - for (int index = 0; index < this.m_alBlocks.Count; ++index) - { - DynamicBlock alBlock = (DynamicBlock) this.m_alBlocks[index]; - alBlock.NotifyPositionChanged(alReloadContent, ptNewOffsetPxl); - ptNewOffsetPxl.X = alBlock.FarEdge; - dynamicBlock = alBlock; - } + DynamicBlock dynamicBlock1 = oL as DynamicBlock; + DynamicBlock dynamicBlock2 = oR as DynamicBlock; + Surface surface1 = dynamicBlock1.Surface; + Surface surface2 = dynamicBlock2.Surface; + uint lastUsage1 = surface1.LastUsage; + uint lastUsage2 = surface2.LastUsage; + if (lastUsage1 < lastUsage2) + return -1; + return lastUsage1 > lastUsage2 ? 1 : 0; } - } - finally - { - if (fCompactToRight) + + internal void CollectDeadBlocks() { - this.m_nLargestFreePxl = this.m_sizeRowPxl.Width; - if (dynamicBlock != null) - this.m_nLargestFreePxl = dynamicBlock.NearEdge; + int index = 0; + while (index < this.m_alBlocks.Count) + { + DynamicBlock alBlock = (DynamicBlock)this.m_alBlocks[index]; + Surface surface = alBlock.Surface; + if (!surface.InUse) + this.CollectDeadBlockSurface(alBlock, surface); + else + ++index; + } } - else + + private void CollectDeadBlockSurface(DynamicBlock blk, Surface sur) { - this.m_nLargestFreePxl = this.m_sizeRowPxl.Width; - if (dynamicBlock != null) - this.m_nLargestFreePxl -= dynamicBlock.FarEdge; + sur.UnregisterUsage((object)this.DynamicPool.SurfacePool); + blk.Dispose(); } - } - } - internal static bool MoveBlocksToEnd( - ArrayList alReloadContent, - DynamicRow rowDest, - DynamicRow rowSrc, - bool fCompactToRight) - { - bool flag = true; - while (rowSrc.m_alBlocks.Count > 0) - { - int index = fCompactToRight ? rowSrc.m_alBlocks.Count - 1 : 0; - DynamicBlock alBlock = (DynamicBlock) rowSrc.m_alBlocks[index]; - if (!DynamicRow.MoveBlockToEnd(alReloadContent, alBlock, rowDest, rowSrc, fCompactToRight)) + internal void CompactBlocks(ArrayList alReloadContent, bool fCompactToRight) { - flag = false; - break; + if (this.m_alBlocks.Count <= 0) + return; + DynamicBlock dynamicBlock = (DynamicBlock)null; + try + { + if (fCompactToRight) + { + Point ptNewOffsetPxl = new Point(this.m_sizeRowPxl.Width, this.m_nOffsetYPxl); + for (int index = this.m_alBlocks.Count - 1; index >= 0; --index) + { + DynamicBlock alBlock = (DynamicBlock)this.m_alBlocks[index]; + ptNewOffsetPxl.X -= alBlock.StorageSize.Width; + alBlock.NotifyPositionChanged(alReloadContent, ptNewOffsetPxl); + dynamicBlock = alBlock; + } + } + else + { + Point ptNewOffsetPxl = new Point(0, this.m_nOffsetYPxl); + for (int index = 0; index < this.m_alBlocks.Count; ++index) + { + DynamicBlock alBlock = (DynamicBlock)this.m_alBlocks[index]; + alBlock.NotifyPositionChanged(alReloadContent, ptNewOffsetPxl); + ptNewOffsetPxl.X = alBlock.FarEdge; + dynamicBlock = alBlock; + } + } + } + finally + { + if (fCompactToRight) + { + this.m_nLargestFreePxl = this.m_sizeRowPxl.Width; + if (dynamicBlock != null) + this.m_nLargestFreePxl = dynamicBlock.NearEdge; + } + else + { + this.m_nLargestFreePxl = this.m_sizeRowPxl.Width; + if (dynamicBlock != null) + this.m_nLargestFreePxl -= dynamicBlock.FarEdge; + } + } } - } - return flag; - } - private static bool MoveBlockToEnd( - ArrayList alReloadContent, - DynamicBlock blkMove, - DynamicRow rowDest, - DynamicRow rowSrc, - bool fCompactToRight) - { - int num1 = blkMove.FarEdge - blkMove.NearEdge; - int count = rowDest.m_alBlocks.Count; - int x = 0; - int num2; - if (fCompactToRight) - { - if (count > 0) - x = ((DynamicBlock) rowDest.m_alBlocks[0]).NearEdge; - num2 = x; - } - else - { - if (count > 0) - x = ((DynamicBlock) rowDest.m_alBlocks[count - 1]).FarEdge; - num2 = rowDest.m_sizeRowPxl.Width - x; - } - if (num1 > num2) - return false; - try - { - if (fCompactToRight) - rowDest.m_alBlocks.Insert(0, (object) blkMove); - else - rowDest.m_alBlocks.Add((object) blkMove); - int index = rowSrc.m_alBlocks.IndexOf((object) blkMove); - rowSrc.m_alBlocks.RemoveAt(index); - if (fCompactToRight) - x -= num1; - Point ptNewOffsetPxl = new Point(x, rowDest.m_nOffsetYPxl); - blkMove.NotifyRowChanged(alReloadContent, rowDest, rowSrc, ptNewOffsetPxl); - } - finally - { - rowDest.RecomputeAvailable(); - rowSrc.RecomputeAvailable(); - } - return true; - } - - private void RecomputeAvailable() - { - this.m_uLastAvgAge = this.IsEmpty ? 0U : uint.MaxValue; - DynamicPool.RecomputeAvailable(this.m_alBlocks, this.m_sizeRowPxl.Width, out this.m_nLargestFreePxl, out this.m_nTotalFreePxl); - } - - [Conditional("DEBUG")] - private void Validate(bool fTightPacking) - { - } - - internal int NotifyPositionChanged(ArrayList alReloadContent, int nNewOffsetYPxl) - { - if (this.m_nOffsetYPxl != nNewOffsetYPxl) - { - this.m_nOffsetYPxl = nNewOffsetYPxl; - for (int index = 0; index < this.m_alBlocks.Count; ++index) + internal static bool MoveBlocksToEnd( + ArrayList alReloadContent, + DynamicRow rowDest, + DynamicRow rowSrc, + bool fCompactToRight) { - DynamicBlock alBlock = (DynamicBlock) this.m_alBlocks[index]; - alBlock.NotifyPositionChanged(alReloadContent, new Point(alBlock.NearEdge, this.m_nOffsetYPxl)); + bool flag = true; + while (rowSrc.m_alBlocks.Count > 0) + { + int index = fCompactToRight ? rowSrc.m_alBlocks.Count - 1 : 0; + DynamicBlock alBlock = (DynamicBlock)rowSrc.m_alBlocks[index]; + if (!DynamicRow.MoveBlockToEnd(alReloadContent, alBlock, rowDest, rowSrc, fCompactToRight)) + { + flag = false; + break; + } + } + return flag; } - } - return this.m_sizeRowPxl.Height; - } - internal void NotifyBlockDestroyed(DynamicBlock blkRemove) - { - if (this.m_bktOwner == null) - return; - this.m_alBlocks.RemoveAt(this.m_alBlocks.IndexOf((object) blkRemove)); - this.RecomputeAvailable(); - if (this.m_nLargestFreePxl != this.m_sizeRowPxl.Width) - return; - this.m_bktOwner.NotifyEmpty(this); - } + private static bool MoveBlockToEnd( + ArrayList alReloadContent, + DynamicBlock blkMove, + DynamicRow rowDest, + DynamicRow rowSrc, + bool fCompactToRight) + { + int num1 = blkMove.FarEdge - blkMove.NearEdge; + int count = rowDest.m_alBlocks.Count; + int x = 0; + int num2; + if (fCompactToRight) + { + if (count > 0) + x = ((DynamicBlock)rowDest.m_alBlocks[0]).NearEdge; + num2 = x; + } + else + { + if (count > 0) + x = ((DynamicBlock)rowDest.m_alBlocks[count - 1]).FarEdge; + num2 = rowDest.m_sizeRowPxl.Width - x; + } + if (num1 > num2) + return false; + try + { + if (fCompactToRight) + rowDest.m_alBlocks.Insert(0, (object)blkMove); + else + rowDest.m_alBlocks.Add((object)blkMove); + int index = rowSrc.m_alBlocks.IndexOf((object)blkMove); + rowSrc.m_alBlocks.RemoveAt(index); + if (fCompactToRight) + x -= num1; + Point ptNewOffsetPxl = new Point(x, rowDest.m_nOffsetYPxl); + blkMove.NotifyRowChanged(alReloadContent, rowDest, rowSrc, ptNewOffsetPxl); + } + finally + { + rowDest.RecomputeAvailable(); + rowSrc.RecomputeAvailable(); + } + return true; + } - public int ID => 0; - } + private void RecomputeAvailable() + { + this.m_uLastAvgAge = this.IsEmpty ? 0U : uint.MaxValue; + DynamicPool.RecomputeAvailable(this.m_alBlocks, this.m_sizeRowPxl.Width, out this.m_nLargestFreePxl, out this.m_nTotalFreePxl); + } + + [Conditional("DEBUG")] + private void Validate(bool fTightPacking) + { + } + + internal int NotifyPositionChanged(ArrayList alReloadContent, int nNewOffsetYPxl) + { + if (this.m_nOffsetYPxl != nNewOffsetYPxl) + { + this.m_nOffsetYPxl = nNewOffsetYPxl; + for (int index = 0; index < this.m_alBlocks.Count; ++index) + { + DynamicBlock alBlock = (DynamicBlock)this.m_alBlocks[index]; + alBlock.NotifyPositionChanged(alReloadContent, new Point(alBlock.NearEdge, this.m_nOffsetYPxl)); + } + } + return this.m_sizeRowPxl.Height; + } + + internal void NotifyBlockDestroyed(DynamicBlock blkRemove) + { + if (this.m_bktOwner == null) + return; + this.m_alBlocks.RemoveAt(this.m_alBlocks.IndexOf((object)blkRemove)); + this.RecomputeAvailable(); + if (this.m_nLargestFreePxl != this.m_sizeRowPxl.Width) + return; + this.m_bktOwner.NotifyEmpty(this); + } + + public int ID => 0; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Effect.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Effect.cs index ba4cc15..94273c8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Effect.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Effect.cs @@ -12,537 +12,537 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal abstract class Effect : - CachedRenderObject, - IEffect, - IAnimatableObject, - IAnimatable, - ISharedRenderObject, - IRenderHandleOwner - { - protected Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect m_remoteEffect; - protected EffectTemplate m_effectTemplate; - protected Vector m_propertyCache; - private static RemoteSurface[] s_EmptySurfaceArray = new RemoteSurface[0]; - - internal Effect(EffectTemplate effectTemplate) + internal abstract class Effect : + CachedRenderObject, + IEffect, + IAnimatableObject, + IAnimatable, + ISharedRenderObject, + IRenderHandleOwner { - this.m_effectTemplate = effectTemplate; - this.m_effectTemplate.RegisterUsage((object) this); - } + protected Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect m_remoteEffect; + protected EffectTemplate m_effectTemplate; + protected Vector m_propertyCache; + private static RemoteSurface[] s_EmptySurfaceArray = new RemoteSurface[0]; - protected override void Dispose(bool fInDispose) - { - try - { - if (!fInDispose) - return; - if (this.m_remoteEffect != null) - this.m_remoteEffect.Dispose(); - if (this.m_propertyCache != null) + internal Effect(EffectTemplate effectTemplate) { - foreach (EffectProperty effectProperty in this.m_propertyCache) - { + this.m_effectTemplate = effectTemplate; + this.m_effectTemplate.RegisterUsage((object)this); + } + + protected override void Dispose(bool fInDispose) + { + try + { + if (!fInDispose) + return; + if (this.m_remoteEffect != null) + this.m_remoteEffect.Dispose(); + if (this.m_propertyCache != null) + { + foreach (EffectProperty effectProperty in this.m_propertyCache) + { + switch (effectProperty.Type) + { + case EffectPropertyType.Image: + this.FreeResource((Image)effectProperty.Value); + break; + case EffectPropertyType.ImageArray: + this.FreeResource((SharedResourceArray)effectProperty.Value); + break; + case EffectPropertyType.Video: + this.FreeResource((VideoStream)effectProperty.Value); + break; + } + effectProperty.Dispose(); + } + } + this.m_effectTemplate.UnregisterUsage((object)this); + this.m_effectTemplate = (EffectTemplate)null; + this.m_propertyCache = (Vector)null; + this.m_remoteEffect = (Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteEffect = (Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect)null; + + internal Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect RemoteStub => this.m_remoteEffect; + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteEffect.RenderHandle; + + public string Name => this.m_effectTemplate.Name; + + public IEffectTemplate Template => (IEffectTemplate)this.m_effectTemplate; + + void IEffect.SetProperty(string stPropertyName, int nValue) => this.SetProperty(stPropertyName, nValue); + + void IEffect.SetProperty(string stPropertyName, float flValue) => this.SetProperty(stPropertyName, flValue); + + void IEffect.SetProperty(string stPropertyName, Vector2 vValue) => this.SetProperty(stPropertyName, vValue); + + void IEffect.SetProperty(string stPropertyName, Vector3 vValue) => this.SetProperty(stPropertyName, vValue); + + void IEffect.SetProperty(string stPropertyName, Vector4 vValue) => this.SetProperty(stPropertyName, vValue); + + void IEffect.SetProperty(string stPropertyName, IImage image) => this.SetProperty(stPropertyName, (Image)image); + + void IEffect.SetProperty(string stPropertyName, IImage[] images) => this.SetProperty(stPropertyName, images); + + void IEffect.SetProperty(string stPropertyName, ColorF color) => this.SetProperty(stPropertyName, color); + + void IEffect.SetProperty(string stPropertyName, IVideoStream videoStream) => this.SetProperty(stPropertyName, videoStream as VideoStream); + + RENDERHANDLE IAnimatableObject.GetObjectId() => this.RemoteStub.RenderHandle; + + uint IAnimatableObject.GetPropertyId(string propertyName) + { + Debug2.Validate(propertyName != null, typeof(ArgumentNullException), nameof(propertyName)); + Map dynamicProperties = this.m_effectTemplate.DynamicProperties; + if (dynamicProperties.ContainsKey(propertyName)) + return this.GenerateAnimationPropertyId(dynamicProperties[propertyName]); + Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported property: ", (object)propertyName); + return 0; + } + + AnimationInputType IAnimatableObject.GetPropertyType( + string propertyName) + { + Debug2.Validate(propertyName != null, typeof(ArgumentNullException), nameof(propertyName)); + Map dynamicProperties = this.m_effectTemplate.DynamicProperties; + if (dynamicProperties.ContainsKey(propertyName)) + return this.MapEffectPropertyTypeToAnimationType(dynamicProperties[propertyName]); + Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported property: ", (object)propertyName); + return AnimationInputType.Float; + } + + private uint GenerateAnimationPropertyId(EffectProperty effectProperty) + { + uint num1 = 7; + uint num2 = 16777215; + Debug2.Validate((effectProperty.Type & (EffectPropertyType)~(int)num1) == EffectPropertyType.Integer, typeof(ArgumentException), (object)"Unsupported effect property type: {0}", (object)effectProperty.Type); + Debug2.Validate(((int)effectProperty.ID & ~(int)num2) == 0, typeof(ArgumentException), "Only 24-bits of effect property IDs are supported"); + return (uint)(effectProperty.Type & (EffectPropertyType)num1) << 28 | (uint)effectProperty.ID & num2; + } + + private AnimationInputType MapEffectPropertyTypeToAnimationType( + EffectProperty effectProperty) + { + AnimationInputType animationInputType; switch (effectProperty.Type) { - case EffectPropertyType.Image: - this.FreeResource((Image) effectProperty.Value); - break; - case EffectPropertyType.ImageArray: - this.FreeResource((SharedResourceArray) effectProperty.Value); - break; - case EffectPropertyType.Video: - this.FreeResource((VideoStream) effectProperty.Value); - break; + case EffectPropertyType.Integer: + case EffectPropertyType.Float: + animationInputType = AnimationInputType.Float; + break; + case EffectPropertyType.Vector2: + animationInputType = AnimationInputType.Vector2; + break; + case EffectPropertyType.Vector3: + animationInputType = AnimationInputType.Vector3; + break; + case EffectPropertyType.Vector4: + animationInputType = AnimationInputType.Vector4; + break; + case EffectPropertyType.Color: + animationInputType = AnimationInputType.Vector4; + break; + default: + Debug2.Throw(false, "{0} is not supported as animatable property", (object)effectProperty.Type); + animationInputType = AnimationInputType.Float; + break; } - effectProperty.Dispose(); - } + return animationInputType; } - this.m_effectTemplate.UnregisterUsage((object) this); - this.m_effectTemplate = (EffectTemplate) null; - this.m_propertyCache = (Vector) null; - this.m_remoteEffect = (Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect) null; - } - finally - { - base.Dispose(fInDispose); - } - } - void IRenderHandleOwner.OnDisconnect() => this.m_remoteEffect = (Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect) null; + internal void SetProperty(string stPropertyName, int nValue) + { + EffectProperty effectProperty; + if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Integer, out effectProperty)) + return; + this.RemoteProperty(effectProperty, nValue); + } - internal Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect RemoteStub => this.m_remoteEffect; + internal void SetProperty(string stPropertyName, float flValue) + { + EffectProperty effectProperty; + if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Float, out effectProperty)) + return; + this.RemoteProperty(effectProperty, flValue); + } - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteEffect.RenderHandle; + internal void SetProperty(string stPropertyName, Vector2 vValue) + { + EffectProperty effectProperty; + if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Vector2, out effectProperty)) + return; + this.RemoteProperty(effectProperty, vValue); + } - public string Name => this.m_effectTemplate.Name; + internal void SetProperty(string stPropertyName, Vector3 vValue) + { + EffectProperty effectProperty; + if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Vector3, out effectProperty)) + return; + this.RemoteProperty(effectProperty, vValue); + } - public IEffectTemplate Template => (IEffectTemplate) this.m_effectTemplate; + internal void SetProperty(string stPropertyName, Vector4 vValue) + { + EffectProperty effectProperty; + if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Vector4, out effectProperty)) + return; + this.RemoteProperty(effectProperty, vValue); + } - void IEffect.SetProperty(string stPropertyName, int nValue) => this.SetProperty(stPropertyName, nValue); + internal void SetProperty(string stPropertyName, ColorF color) + { + EffectProperty effectProperty; + if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Color, out effectProperty)) + return; + this.RemoteProperty(effectProperty, color); + } - void IEffect.SetProperty(string stPropertyName, float flValue) => this.SetProperty(stPropertyName, flValue); - - void IEffect.SetProperty(string stPropertyName, Vector2 vValue) => this.SetProperty(stPropertyName, vValue); - - void IEffect.SetProperty(string stPropertyName, Vector3 vValue) => this.SetProperty(stPropertyName, vValue); - - void IEffect.SetProperty(string stPropertyName, Vector4 vValue) => this.SetProperty(stPropertyName, vValue); - - void IEffect.SetProperty(string stPropertyName, IImage image) => this.SetProperty(stPropertyName, (Image) image); - - void IEffect.SetProperty(string stPropertyName, IImage[] images) => this.SetProperty(stPropertyName, images); - - void IEffect.SetProperty(string stPropertyName, ColorF color) => this.SetProperty(stPropertyName, color); - - void IEffect.SetProperty(string stPropertyName, IVideoStream videoStream) => this.SetProperty(stPropertyName, videoStream as VideoStream); - - RENDERHANDLE IAnimatableObject.GetObjectId() => this.RemoteStub.RenderHandle; - - uint IAnimatableObject.GetPropertyId(string propertyName) - { - Debug2.Validate(propertyName != null, typeof (ArgumentNullException), nameof (propertyName)); - Map dynamicProperties = this.m_effectTemplate.DynamicProperties; - if (dynamicProperties.ContainsKey(propertyName)) - return this.GenerateAnimationPropertyId(dynamicProperties[propertyName]); - Debug2.Validate(false, typeof (ArgumentException), (object) "Unsupported property: ", (object) propertyName); - return 0; - } - - AnimationInputType IAnimatableObject.GetPropertyType( - string propertyName) - { - Debug2.Validate(propertyName != null, typeof (ArgumentNullException), nameof (propertyName)); - Map dynamicProperties = this.m_effectTemplate.DynamicProperties; - if (dynamicProperties.ContainsKey(propertyName)) - return this.MapEffectPropertyTypeToAnimationType(dynamicProperties[propertyName]); - Debug2.Validate(false, typeof (ArgumentException), (object) "Unsupported property: ", (object) propertyName); - return AnimationInputType.Float; - } - - private uint GenerateAnimationPropertyId(EffectProperty effectProperty) - { - uint num1 = 7; - uint num2 = 16777215; - Debug2.Validate((effectProperty.Type & (EffectPropertyType) ~(int) num1) == EffectPropertyType.Integer, typeof (ArgumentException), (object) "Unsupported effect property type: {0}", (object) effectProperty.Type); - Debug2.Validate(((int) effectProperty.ID & ~(int) num2) == 0, typeof (ArgumentException), "Only 24-bits of effect property IDs are supported"); - return (uint) (effectProperty.Type & (EffectPropertyType) num1) << 28 | (uint) effectProperty.ID & num2; - } - - private AnimationInputType MapEffectPropertyTypeToAnimationType( - EffectProperty effectProperty) - { - AnimationInputType animationInputType; - switch (effectProperty.Type) - { - case EffectPropertyType.Integer: - case EffectPropertyType.Float: - animationInputType = AnimationInputType.Float; - break; - case EffectPropertyType.Vector2: - animationInputType = AnimationInputType.Vector2; - break; - case EffectPropertyType.Vector3: - animationInputType = AnimationInputType.Vector3; - break; - case EffectPropertyType.Vector4: - animationInputType = AnimationInputType.Vector4; - break; - case EffectPropertyType.Color: - animationInputType = AnimationInputType.Vector4; - break; - default: - Debug2.Throw(false, "{0} is not supported as animatable property", (object) effectProperty.Type); - animationInputType = AnimationInputType.Float; - break; - } - return animationInputType; - } - - internal void SetProperty(string stPropertyName, int nValue) - { - EffectProperty effectProperty; - if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Integer, out effectProperty)) - return; - this.RemoteProperty(effectProperty, nValue); - } - - internal void SetProperty(string stPropertyName, float flValue) - { - EffectProperty effectProperty; - if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Float, out effectProperty)) - return; - this.RemoteProperty(effectProperty, flValue); - } - - internal void SetProperty(string stPropertyName, Vector2 vValue) - { - EffectProperty effectProperty; - if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Vector2, out effectProperty)) - return; - this.RemoteProperty(effectProperty, vValue); - } - - internal void SetProperty(string stPropertyName, Vector3 vValue) - { - EffectProperty effectProperty; - if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Vector3, out effectProperty)) - return; - this.RemoteProperty(effectProperty, vValue); - } - - internal void SetProperty(string stPropertyName, Vector4 vValue) - { - EffectProperty effectProperty; - if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Vector4, out effectProperty)) - return; - this.RemoteProperty(effectProperty, vValue); - } - - internal void SetProperty(string stPropertyName, ColorF color) - { - EffectProperty effectProperty; - if (!this.IsValidProperty(stPropertyName, EffectPropertyType.Color, out effectProperty)) - return; - this.RemoteProperty(effectProperty, color); - } - - internal virtual void SetProperty(string stPropertyName, Image image) - { - EffectProperty propertyFromCache = this.GetPropertyFromCache(stPropertyName); - Debug2.Validate(propertyFromCache != null, typeof (InvalidOperationException), "Invalid property name"); - Debug2.Validate(propertyFromCache.Type == EffectPropertyType.Image || propertyFromCache.Type == EffectPropertyType.ImageArray, typeof (InvalidOperationException), "Invalid property type"); - if (propertyFromCache.Type == EffectPropertyType.Image) - { - if (propertyFromCache.HasIdenticalValue((object) image)) - return; - this.SetSharedResourceProperty(propertyFromCache, image); - } - else - { - if (propertyFromCache.Value != null && (Image) ((SharedResourceArray) propertyFromCache.Value).Resources[0] == image) - return; - this.SetSharedResourceProperty(propertyFromCache, new SharedResourceArray((SharedResource) image)); - } - } - - internal virtual void SetProperty(string stPropertyName, IImage[] images) - { - Debug2.Validate(images != null, typeof (ArgumentNullException), nameof (images)); - Debug2.Validate(images.Length > 0, typeof (ArgumentException), "images.Length"); - EffectProperty propertyFromCache = this.GetPropertyFromCache(stPropertyName); - Debug2.Validate(propertyFromCache != null, typeof (InvalidOperationException), "Invalid property name"); - Debug2.Validate(propertyFromCache.Type == EffectPropertyType.ImageArray, typeof (InvalidOperationException), "Invalid property type"); - SharedResource[] rgResources = new SharedResource[images.Length]; - for (int index = 0; index < images.Length; ++index) - rgResources[index] = (SharedResource) images[index]; - SharedResourceArray oValue = new SharedResourceArray(rgResources); - oValue.RegisterUsage((object) this); - if (propertyFromCache.HasIdenticalValue((object) oValue)) - { - oValue.UnregisterUsage((object) this); - } - else - { - this.SetSharedResourceProperty(propertyFromCache, oValue); - oValue.UnregisterUsage((object) this); - } - } - - internal void SetProperty(string stPropertyName, VideoStream videoStream) - { - Debug2.Validate(videoStream != null, typeof (ArgumentNullException), "VideoStream"); - Debug2.Validate(videoStream.Surface != null, typeof (ArgumentException), "VideoStream.Surface"); - EffectProperty propertyFromCache = this.GetPropertyFromCache(stPropertyName); - Debug2.Validate(propertyFromCache != null, typeof (InvalidOperationException), "Invalid property name"); - Debug2.Validate(propertyFromCache.Type == EffectPropertyType.Video, typeof (InvalidOperationException), "Invalid property type"); - if (propertyFromCache.HasIdenticalValue((object) videoStream)) - return; - this.SetSharedResourceProperty(propertyFromCache, videoStream); - } - - private bool IsValidProperty( - string stPropertyName, - EffectPropertyType type, - out EffectProperty effectProperty) - { - EffectProperty dynamicProperty = this.m_effectTemplate.DynamicProperties[stPropertyName]; - Debug2.Validate(dynamicProperty != null, typeof (InvalidOperationException), "Invalid property name"); - Debug2.Validate(dynamicProperty.Type == type, typeof (InvalidOperationException), "Invalid property type"); - effectProperty = dynamicProperty; - return true; - } - - private void SetSharedResourceProperty(EffectProperty property, SharedResourceArray oValue) - { - Debug2.Validate(property.Type == EffectPropertyType.ImageArray || property.Type == EffectPropertyType.Image, typeof (InvalidOperationException), "Not an Image type"); - this.FreeResource(property.Value as SharedResourceArray); - property.Value = (object) oValue; - this.AcquireNewResource(oValue); - this.RemoteProperty(property, (object) oValue); - } - - private void SetSharedResourceProperty(EffectProperty property, Image oValue) - { - Debug2.Validate(property.Type == EffectPropertyType.Image, typeof (InvalidOperationException), "Not an Image type"); - this.FreeResource(property.Value as Image); - property.Value = (object) oValue; - this.AcquireNewResource(oValue); - this.RemoteProperty(property, (object) oValue); - } - - private void SetSharedResourceProperty(EffectProperty property, VideoStream oValue) - { - Debug2.Validate(property.Type == EffectPropertyType.Video, typeof (InvalidOperationException), "Not a Video type"); - this.FreeResource(property.Value as VideoStream); - property.Value = (object) oValue; - this.AcquireNewResource(oValue); - this.RemoteProperty(property, (object) oValue); - } - - private EffectProperty GetPropertyFromCache(string propertyName) - { - Map dynamicProperties = this.m_effectTemplate.DynamicProperties; - if (!dynamicProperties.ContainsKey(propertyName)) - Debug2.Validate(false, typeof (InvalidOperationException), (object) "Invalid property name", (object) propertyName); - EffectProperty effectProperty = dynamicProperties[propertyName]; - Debug2.Validate(effectProperty.IsSharedResource, typeof (InvalidOperationException), "Invalid property type"); - return this.GetPropertyFromCache((int) effectProperty.ID); - } - - private EffectProperty GetPropertyFromCache(int nPropertyId) - { - foreach (EffectProperty effectProperty in this.m_propertyCache) - { - if ((int) effectProperty.ID == nPropertyId) - return effectProperty; - } - return (EffectProperty) null; - } - - private void RemoteProperty(EffectProperty property, object oValue) - { - switch (property.Type) - { - case EffectPropertyType.Integer: - this.m_remoteEffect.SendSetProperty((int) property.ID, (int) oValue); - break; - case EffectPropertyType.Float: - this.m_remoteEffect.SendSetProperty((int) property.ID, (float) oValue); - break; - case EffectPropertyType.Vector2: - this.m_remoteEffect.SendSetProperty((int) property.ID, (Vector2) oValue); - break; - case EffectPropertyType.Vector3: - this.m_remoteEffect.SendSetProperty((int) property.ID, (Vector3) oValue); - break; - case EffectPropertyType.Vector4: - this.m_remoteEffect.SendSetProperty((int) property.ID, (Vector4) oValue); - break; - case EffectPropertyType.Image: - Image image = (Image) oValue; - RemoteSurface surface1 = (RemoteSurface) null; - if (image != null && image.Surface != null) - surface1 = image.Surface.RemoteStub; - this.m_remoteEffect.SendSetProperty((int) property.ID, surface1); - break; - case EffectPropertyType.Color: - this.m_remoteEffect.SendSetProperty((int) property.ID, ((ColorF) oValue).ToVector4()); - break; - case EffectPropertyType.ImageArray: - SharedResource[] resources = ((SharedResourceArray) oValue).Resources; - RemoteSurface[] surfaceArray = new RemoteSurface[resources.Length]; - bool flag = true; - for (int index = 0; index < resources.Length; ++index) - { - if (resources[index] == null || ((Image) resources[index]).Surface == null) + internal virtual void SetProperty(string stPropertyName, Image image) + { + EffectProperty propertyFromCache = this.GetPropertyFromCache(stPropertyName); + Debug2.Validate(propertyFromCache != null, typeof(InvalidOperationException), "Invalid property name"); + Debug2.Validate(propertyFromCache.Type == EffectPropertyType.Image || propertyFromCache.Type == EffectPropertyType.ImageArray, typeof(InvalidOperationException), "Invalid property type"); + if (propertyFromCache.Type == EffectPropertyType.Image) { - flag = false; - break; + if (propertyFromCache.HasIdenticalValue((object)image)) + return; + this.SetSharedResourceProperty(propertyFromCache, image); } - surfaceArray[index] = ((Image) resources[index]).Surface.RemoteStub; - } - if (flag) - { - this.m_remoteEffect.SendSetProperty((int) property.ID, surfaceArray); - break; - } - this.m_remoteEffect.SendSetProperty((int) property.ID, Effect.s_EmptySurfaceArray); - break; - case EffectPropertyType.Video: - VideoStream videoStream = (VideoStream) oValue; - RemoteSurface surface2 = (RemoteSurface) null; - if (videoStream != null && videoStream.Surface != null) - surface2 = videoStream.Surface.RemoteStub; - this.m_remoteEffect.SendSetProperty((int) property.ID, surface2); - break; - default: - Debug2.Throw(false, "Unknown property type"); - break; - } - } - - private void RemoteProperty(EffectProperty property, float flValue) => this.m_remoteEffect.SendSetProperty((int) property.ID, flValue); - - private void RemoteProperty(EffectProperty property, int nValue) => this.m_remoteEffect.SendSetProperty((int) property.ID, nValue); - - private void RemoteProperty(EffectProperty property, Vector2 vValue) => this.m_remoteEffect.SendSetProperty((int) property.ID, vValue); - - private void RemoteProperty(EffectProperty property, Vector3 vValue) => this.m_remoteEffect.SendSetProperty((int) property.ID, vValue); - - private void RemoteProperty(EffectProperty property, Vector4 vValue) => this.m_remoteEffect.SendSetProperty((int) property.ID, vValue); - - private void RemoteProperty(EffectProperty property, ColorF color) => this.m_remoteEffect.SendSetProperty((int) property.ID, color.ToVector4()); - - private void AddSharedResourcesToCache() - { - foreach (EffectProperty property in this.m_effectTemplate.DynamicProperties.Values) - { - switch (property.Type) - { - case EffectPropertyType.Image: - this.AcquireNewResource(property.Value as Image); - this.AddPropertyToCache(property); - continue; - case EffectPropertyType.ImageArray: - this.AcquireNewResource(property.Value as SharedResourceArray); - this.AddPropertyToCache(property); - continue; - case EffectPropertyType.Video: - this.AcquireNewResource(property.Value as VideoStream); - this.AddPropertyToCache(property); - continue; - default: - continue; - } - } - } - - private void AddPropertyToCache(EffectProperty property) - { - if (this.m_propertyCache == null) - this.m_propertyCache = new Vector(3); - this.m_propertyCache.Add(property.Clone()); - } - - protected void Initialize() - { - Debug2.Validate(this.m_propertyCache == null, typeof (InvalidOperationException), "Initialize() should be called once"); - this.AddSharedResourcesToCache(); - if (this.m_propertyCache != null) - this.m_propertyCache.TrimExcess(); - this.CommitTemplateDefaults(false); - } - - private void CommitTemplateDefaults(bool fUpdateCache) - { - foreach (EffectProperty property in this.m_effectTemplate.DynamicProperties.Values) - { - if (fUpdateCache && property.IsSharedResource) - { - EffectProperty propertyFromCache = this.GetPropertyFromCache((int) property.ID); - switch (property.Type) - { - case EffectPropertyType.Image: - this.SetSharedResourceProperty(propertyFromCache, (Image) property.Value); - break; - case EffectPropertyType.ImageArray: - this.SetSharedResourceProperty(propertyFromCache, (SharedResourceArray) property.Value); - break; - case EffectPropertyType.Video: - this.SetSharedResourceProperty(propertyFromCache, (VideoStream) property.Value); - break; - } - } - this.RemoteProperty(property, property.Value); - } - } - - private void AcquireNewResource(Image image) - { - if (image == null) - return; - image.RegisterUsage((object) this); - image.ContentReloadedEvent += new Image.ContentReloadedHandler(this.ImageContentReloadedHandler); - image.AddActiveUser((object) this); - } - - private void AcquireNewResource(SharedResourceArray imageArray) - { - if (imageArray == null) - return; - imageArray.RegisterUsage((object) this); - foreach (SharedResource resource in imageArray.Resources) - (resource as Image).ContentReloadedEvent += new Image.ContentReloadedHandler(this.ImageContentReloadedHandler); - imageArray.AddActiveUser((object) this); - } - - private void AcquireNewResource(VideoStream videoStream) - { - if (videoStream == null) - return; - videoStream.RegisterUsage((object) this); - videoStream.AddActiveUser((object) this); - } - - internal void FreeResource(Image image) - { - if (image == null) - return; - image.ContentReloadedEvent -= new Image.ContentReloadedHandler(this.ImageContentReloadedHandler); - image.RemoveActiveUser((object) this); - image.UnregisterUsage((object) this); - } - - internal void FreeResource(SharedResourceArray imageArray) - { - if (imageArray == null) - return; - foreach (SharedResource resource in imageArray.Resources) - (resource as Image).ContentReloadedEvent -= new Image.ContentReloadedHandler(this.ImageContentReloadedHandler); - imageArray.RemoveActiveUser((object) this); - imageArray.UnregisterUsage((object) this); - } - - internal void FreeResource(VideoStream videoStream) - { - if (videoStream == null) - return; - videoStream.RemoveActiveUser((object) this); - videoStream.UnregisterUsage((object) this); - } - - internal void ImageContentReloadedHandler(Image image) - { - bool condition = false; - foreach (EffectProperty property in this.m_propertyCache) - { - if (property.Type == EffectPropertyType.Image) - { - if ((Image) property.Value == image) - { - condition = true; - this.RemoteProperty(property, property.Value); - } - } - else if (property.Type == EffectPropertyType.ImageArray) - { - SharedResource[] resources = ((SharedResourceArray) property.Value).Resources; - for (int index = 0; index < resources.Length; ++index) - { - if (resources[index] != null && (Image) resources[index] == image) + else { - condition = true; - this.RemoteProperty(property, property.Value); + if (propertyFromCache.Value != null && (Image)((SharedResourceArray)propertyFromCache.Value).Resources[0] == image) + return; + this.SetSharedResourceProperty(propertyFromCache, new SharedResourceArray((SharedResource)image)); } - } } - } - Debug2.Validate(condition, typeof (ArgumentException), "Could not find an Image property"); + + internal virtual void SetProperty(string stPropertyName, IImage[] images) + { + Debug2.Validate(images != null, typeof(ArgumentNullException), nameof(images)); + Debug2.Validate(images.Length > 0, typeof(ArgumentException), "images.Length"); + EffectProperty propertyFromCache = this.GetPropertyFromCache(stPropertyName); + Debug2.Validate(propertyFromCache != null, typeof(InvalidOperationException), "Invalid property name"); + Debug2.Validate(propertyFromCache.Type == EffectPropertyType.ImageArray, typeof(InvalidOperationException), "Invalid property type"); + SharedResource[] rgResources = new SharedResource[images.Length]; + for (int index = 0; index < images.Length; ++index) + rgResources[index] = (SharedResource)images[index]; + SharedResourceArray oValue = new SharedResourceArray(rgResources); + oValue.RegisterUsage((object)this); + if (propertyFromCache.HasIdenticalValue((object)oValue)) + { + oValue.UnregisterUsage((object)this); + } + else + { + this.SetSharedResourceProperty(propertyFromCache, oValue); + oValue.UnregisterUsage((object)this); + } + } + + internal void SetProperty(string stPropertyName, VideoStream videoStream) + { + Debug2.Validate(videoStream != null, typeof(ArgumentNullException), "VideoStream"); + Debug2.Validate(videoStream.Surface != null, typeof(ArgumentException), "VideoStream.Surface"); + EffectProperty propertyFromCache = this.GetPropertyFromCache(stPropertyName); + Debug2.Validate(propertyFromCache != null, typeof(InvalidOperationException), "Invalid property name"); + Debug2.Validate(propertyFromCache.Type == EffectPropertyType.Video, typeof(InvalidOperationException), "Invalid property type"); + if (propertyFromCache.HasIdenticalValue((object)videoStream)) + return; + this.SetSharedResourceProperty(propertyFromCache, videoStream); + } + + private bool IsValidProperty( + string stPropertyName, + EffectPropertyType type, + out EffectProperty effectProperty) + { + EffectProperty dynamicProperty = this.m_effectTemplate.DynamicProperties[stPropertyName]; + Debug2.Validate(dynamicProperty != null, typeof(InvalidOperationException), "Invalid property name"); + Debug2.Validate(dynamicProperty.Type == type, typeof(InvalidOperationException), "Invalid property type"); + effectProperty = dynamicProperty; + return true; + } + + private void SetSharedResourceProperty(EffectProperty property, SharedResourceArray oValue) + { + Debug2.Validate(property.Type == EffectPropertyType.ImageArray || property.Type == EffectPropertyType.Image, typeof(InvalidOperationException), "Not an Image type"); + this.FreeResource(property.Value as SharedResourceArray); + property.Value = (object)oValue; + this.AcquireNewResource(oValue); + this.RemoteProperty(property, (object)oValue); + } + + private void SetSharedResourceProperty(EffectProperty property, Image oValue) + { + Debug2.Validate(property.Type == EffectPropertyType.Image, typeof(InvalidOperationException), "Not an Image type"); + this.FreeResource(property.Value as Image); + property.Value = (object)oValue; + this.AcquireNewResource(oValue); + this.RemoteProperty(property, (object)oValue); + } + + private void SetSharedResourceProperty(EffectProperty property, VideoStream oValue) + { + Debug2.Validate(property.Type == EffectPropertyType.Video, typeof(InvalidOperationException), "Not a Video type"); + this.FreeResource(property.Value as VideoStream); + property.Value = (object)oValue; + this.AcquireNewResource(oValue); + this.RemoteProperty(property, (object)oValue); + } + + private EffectProperty GetPropertyFromCache(string propertyName) + { + Map dynamicProperties = this.m_effectTemplate.DynamicProperties; + if (!dynamicProperties.ContainsKey(propertyName)) + Debug2.Validate(false, typeof(InvalidOperationException), (object)"Invalid property name", (object)propertyName); + EffectProperty effectProperty = dynamicProperties[propertyName]; + Debug2.Validate(effectProperty.IsSharedResource, typeof(InvalidOperationException), "Invalid property type"); + return this.GetPropertyFromCache((int)effectProperty.ID); + } + + private EffectProperty GetPropertyFromCache(int nPropertyId) + { + foreach (EffectProperty effectProperty in this.m_propertyCache) + { + if ((int)effectProperty.ID == nPropertyId) + return effectProperty; + } + return (EffectProperty)null; + } + + private void RemoteProperty(EffectProperty property, object oValue) + { + switch (property.Type) + { + case EffectPropertyType.Integer: + this.m_remoteEffect.SendSetProperty((int)property.ID, (int)oValue); + break; + case EffectPropertyType.Float: + this.m_remoteEffect.SendSetProperty((int)property.ID, (float)oValue); + break; + case EffectPropertyType.Vector2: + this.m_remoteEffect.SendSetProperty((int)property.ID, (Vector2)oValue); + break; + case EffectPropertyType.Vector3: + this.m_remoteEffect.SendSetProperty((int)property.ID, (Vector3)oValue); + break; + case EffectPropertyType.Vector4: + this.m_remoteEffect.SendSetProperty((int)property.ID, (Vector4)oValue); + break; + case EffectPropertyType.Image: + Image image = (Image)oValue; + RemoteSurface surface1 = (RemoteSurface)null; + if (image != null && image.Surface != null) + surface1 = image.Surface.RemoteStub; + this.m_remoteEffect.SendSetProperty((int)property.ID, surface1); + break; + case EffectPropertyType.Color: + this.m_remoteEffect.SendSetProperty((int)property.ID, ((ColorF)oValue).ToVector4()); + break; + case EffectPropertyType.ImageArray: + SharedResource[] resources = ((SharedResourceArray)oValue).Resources; + RemoteSurface[] surfaceArray = new RemoteSurface[resources.Length]; + bool flag = true; + for (int index = 0; index < resources.Length; ++index) + { + if (resources[index] == null || ((Image)resources[index]).Surface == null) + { + flag = false; + break; + } + surfaceArray[index] = ((Image)resources[index]).Surface.RemoteStub; + } + if (flag) + { + this.m_remoteEffect.SendSetProperty((int)property.ID, surfaceArray); + break; + } + this.m_remoteEffect.SendSetProperty((int)property.ID, Effect.s_EmptySurfaceArray); + break; + case EffectPropertyType.Video: + VideoStream videoStream = (VideoStream)oValue; + RemoteSurface surface2 = (RemoteSurface)null; + if (videoStream != null && videoStream.Surface != null) + surface2 = videoStream.Surface.RemoteStub; + this.m_remoteEffect.SendSetProperty((int)property.ID, surface2); + break; + default: + Debug2.Throw(false, "Unknown property type"); + break; + } + } + + private void RemoteProperty(EffectProperty property, float flValue) => this.m_remoteEffect.SendSetProperty((int)property.ID, flValue); + + private void RemoteProperty(EffectProperty property, int nValue) => this.m_remoteEffect.SendSetProperty((int)property.ID, nValue); + + private void RemoteProperty(EffectProperty property, Vector2 vValue) => this.m_remoteEffect.SendSetProperty((int)property.ID, vValue); + + private void RemoteProperty(EffectProperty property, Vector3 vValue) => this.m_remoteEffect.SendSetProperty((int)property.ID, vValue); + + private void RemoteProperty(EffectProperty property, Vector4 vValue) => this.m_remoteEffect.SendSetProperty((int)property.ID, vValue); + + private void RemoteProperty(EffectProperty property, ColorF color) => this.m_remoteEffect.SendSetProperty((int)property.ID, color.ToVector4()); + + private void AddSharedResourcesToCache() + { + foreach (EffectProperty property in this.m_effectTemplate.DynamicProperties.Values) + { + switch (property.Type) + { + case EffectPropertyType.Image: + this.AcquireNewResource(property.Value as Image); + this.AddPropertyToCache(property); + continue; + case EffectPropertyType.ImageArray: + this.AcquireNewResource(property.Value as SharedResourceArray); + this.AddPropertyToCache(property); + continue; + case EffectPropertyType.Video: + this.AcquireNewResource(property.Value as VideoStream); + this.AddPropertyToCache(property); + continue; + default: + continue; + } + } + } + + private void AddPropertyToCache(EffectProperty property) + { + if (this.m_propertyCache == null) + this.m_propertyCache = new Vector(3); + this.m_propertyCache.Add(property.Clone()); + } + + protected void Initialize() + { + Debug2.Validate(this.m_propertyCache == null, typeof(InvalidOperationException), "Initialize() should be called once"); + this.AddSharedResourcesToCache(); + if (this.m_propertyCache != null) + this.m_propertyCache.TrimExcess(); + this.CommitTemplateDefaults(false); + } + + private void CommitTemplateDefaults(bool fUpdateCache) + { + foreach (EffectProperty property in this.m_effectTemplate.DynamicProperties.Values) + { + if (fUpdateCache && property.IsSharedResource) + { + EffectProperty propertyFromCache = this.GetPropertyFromCache((int)property.ID); + switch (property.Type) + { + case EffectPropertyType.Image: + this.SetSharedResourceProperty(propertyFromCache, (Image)property.Value); + break; + case EffectPropertyType.ImageArray: + this.SetSharedResourceProperty(propertyFromCache, (SharedResourceArray)property.Value); + break; + case EffectPropertyType.Video: + this.SetSharedResourceProperty(propertyFromCache, (VideoStream)property.Value); + break; + } + } + this.RemoteProperty(property, property.Value); + } + } + + private void AcquireNewResource(Image image) + { + if (image == null) + return; + image.RegisterUsage((object)this); + image.ContentReloadedEvent += new Image.ContentReloadedHandler(this.ImageContentReloadedHandler); + image.AddActiveUser((object)this); + } + + private void AcquireNewResource(SharedResourceArray imageArray) + { + if (imageArray == null) + return; + imageArray.RegisterUsage((object)this); + foreach (SharedResource resource in imageArray.Resources) + (resource as Image).ContentReloadedEvent += new Image.ContentReloadedHandler(this.ImageContentReloadedHandler); + imageArray.AddActiveUser((object)this); + } + + private void AcquireNewResource(VideoStream videoStream) + { + if (videoStream == null) + return; + videoStream.RegisterUsage((object)this); + videoStream.AddActiveUser((object)this); + } + + internal void FreeResource(Image image) + { + if (image == null) + return; + image.ContentReloadedEvent -= new Image.ContentReloadedHandler(this.ImageContentReloadedHandler); + image.RemoveActiveUser((object)this); + image.UnregisterUsage((object)this); + } + + internal void FreeResource(SharedResourceArray imageArray) + { + if (imageArray == null) + return; + foreach (SharedResource resource in imageArray.Resources) + (resource as Image).ContentReloadedEvent -= new Image.ContentReloadedHandler(this.ImageContentReloadedHandler); + imageArray.RemoveActiveUser((object)this); + imageArray.UnregisterUsage((object)this); + } + + internal void FreeResource(VideoStream videoStream) + { + if (videoStream == null) + return; + videoStream.RemoveActiveUser((object)this); + videoStream.UnregisterUsage((object)this); + } + + internal void ImageContentReloadedHandler(Image image) + { + bool condition = false; + foreach (EffectProperty property in this.m_propertyCache) + { + if (property.Type == EffectPropertyType.Image) + { + if ((Image)property.Value == image) + { + condition = true; + this.RemoteProperty(property, property.Value); + } + } + else if (property.Type == EffectPropertyType.ImageArray) + { + SharedResource[] resources = ((SharedResourceArray)property.Value).Resources; + for (int index = 0; index < resources.Length; ++index) + { + if (resources[index] != null && (Image)resources[index] == image) + { + condition = true; + this.RemoteProperty(property, property.Value); + } + } + } + } + Debug2.Validate(condition, typeof(ArgumentException), "Could not find an Image property"); + } + + internal abstract void RemoteEffect(); + + internal override void Reset() => this.CommitTemplateDefaults(true); } - - internal abstract void RemoteEffect(); - - internal override void Reset() => this.CommitTemplateDefaults(true); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectProperty.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectProperty.cs index 95a9809..11cf2ac 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectProperty.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectProperty.cs @@ -9,134 +9,134 @@ using Microsoft.Iris.Render.Internal; namespace Microsoft.Iris.Render.Graphics { - internal class EffectProperty : RenderObject - { - private const byte k_dynamicFlag = 128; - private byte m_nID; - private object m_oValue; - private byte m_propertyType; - - internal EffectProperty( - string stName, - EffectPropertyType eptType, - bool fIsDynamic, - object oValue, - byte nID) + internal class EffectProperty : RenderObject { - this.m_propertyType = (byte) eptType; - this.IsDynamic = fIsDynamic; - this.m_nID = nID; - this.Value = oValue; + private const byte k_dynamicFlag = 128; + private byte m_nID; + private object m_oValue; + private byte m_propertyType; + + internal EffectProperty( + string stName, + EffectPropertyType eptType, + bool fIsDynamic, + object oValue, + byte nID) + { + this.m_propertyType = (byte)eptType; + this.IsDynamic = fIsDynamic; + this.m_nID = nID; + this.Value = oValue; + } + + private EffectProperty(EffectProperty copy) + { + this.m_propertyType = copy.m_propertyType; + this.IsDynamic = copy.IsDynamic; + this.m_nID = copy.m_nID; + this.Value = copy.Value; + } + + protected override void Dispose(bool fInDispose) + { + try + { + if (!fInDispose || this.m_oValue == null) + return; + this.ModifyUsage(false); + this.m_oValue = (object)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + internal object Value + { + get => this.m_oValue; + set + { + this.ModifyUsage(false); + this.m_oValue = value; + this.ModifyUsage(true); + } + } + + internal bool IsDynamic + { + get => ((int)this.m_propertyType & 128) == 128; + set + { + if (value) + this.m_propertyType |= (byte)128; + else + this.m_propertyType &= (byte)127; + } + } + + internal bool IsSharedResource => this.Type == EffectPropertyType.Image || this.Type == EffectPropertyType.ImageArray || this.Type == EffectPropertyType.Video; + + internal EffectPropertyType Type => (EffectPropertyType)((uint)this.m_propertyType & 4294967167U); + + internal byte ID + { + get => this.m_nID; + set => this.m_nID = value; + } + + internal bool HasIdenticalValue(object oValue) + { + switch (this.Type) + { + case EffectPropertyType.Integer: + return (int)this.Value == (int)oValue; + case EffectPropertyType.Float: + return !Math2.WithinEpsilon((float)this.Value, (float)oValue); + case EffectPropertyType.Vector2: + return (Vector2)this.Value == (Vector2)oValue; + case EffectPropertyType.Vector3: + return (Vector3)this.Value == (Vector3)oValue; + case EffectPropertyType.Vector4: + return (Vector4)this.Value == (Vector4)oValue; + case EffectPropertyType.Image: + return (Image)this.Value == (Image)oValue; + case EffectPropertyType.Color: + return (ColorF)this.Value == (ColorF)oValue; + case EffectPropertyType.ImageArray: + SharedResource[] resources1 = ((SharedResourceArray)oValue).Resources; + SharedResource[] resources2 = ((SharedResourceArray)this.Value).Resources; + if (resources1.Length != resources1.Length) + return false; + for (int index = 0; index < resources2.Length; ++index) + { + if (resources2[index] != resources1[index]) + return false; + } + return true; + case EffectPropertyType.Video: + return (VideoStream)this.Value == (VideoStream)oValue; + default: + return false; + } + } + + internal EffectProperty Clone() => new EffectProperty(this); + + private void ModifyUsage(bool fLock) + { + if (this.m_oValue == null || !(this.m_oValue is SharedResource oValue)) + return; + if (fLock) + { + oValue.RegisterUsage((object)this); + oValue.AddActiveUser((object)this); + } + else + { + oValue.RemoveActiveUser((object)this); + oValue.UnregisterUsage((object)this); + } + } } - - private EffectProperty(EffectProperty copy) - { - this.m_propertyType = copy.m_propertyType; - this.IsDynamic = copy.IsDynamic; - this.m_nID = copy.m_nID; - this.Value = copy.Value; - } - - protected override void Dispose(bool fInDispose) - { - try - { - if (!fInDispose || this.m_oValue == null) - return; - this.ModifyUsage(false); - this.m_oValue = (object) null; - } - finally - { - base.Dispose(fInDispose); - } - } - - internal object Value - { - get => this.m_oValue; - set - { - this.ModifyUsage(false); - this.m_oValue = value; - this.ModifyUsage(true); - } - } - - internal bool IsDynamic - { - get => ((int) this.m_propertyType & 128) == 128; - set - { - if (value) - this.m_propertyType |= (byte) 128; - else - this.m_propertyType &= (byte) 127; - } - } - - internal bool IsSharedResource => this.Type == EffectPropertyType.Image || this.Type == EffectPropertyType.ImageArray || this.Type == EffectPropertyType.Video; - - internal EffectPropertyType Type => (EffectPropertyType) ((uint) this.m_propertyType & 4294967167U); - - internal byte ID - { - get => this.m_nID; - set => this.m_nID = value; - } - - internal bool HasIdenticalValue(object oValue) - { - switch (this.Type) - { - case EffectPropertyType.Integer: - return (int) this.Value == (int) oValue; - case EffectPropertyType.Float: - return !Math2.WithinEpsilon((float) this.Value, (float) oValue); - case EffectPropertyType.Vector2: - return (Vector2) this.Value == (Vector2) oValue; - case EffectPropertyType.Vector3: - return (Vector3) this.Value == (Vector3) oValue; - case EffectPropertyType.Vector4: - return (Vector4) this.Value == (Vector4) oValue; - case EffectPropertyType.Image: - return (Image) this.Value == (Image) oValue; - case EffectPropertyType.Color: - return (ColorF) this.Value == (ColorF) oValue; - case EffectPropertyType.ImageArray: - SharedResource[] resources1 = ((SharedResourceArray) oValue).Resources; - SharedResource[] resources2 = ((SharedResourceArray) this.Value).Resources; - if (resources1.Length != resources1.Length) - return false; - for (int index = 0; index < resources2.Length; ++index) - { - if (resources2[index] != resources1[index]) - return false; - } - return true; - case EffectPropertyType.Video: - return (VideoStream) this.Value == (VideoStream) oValue; - default: - return false; - } - } - - internal EffectProperty Clone() => new EffectProperty(this); - - private void ModifyUsage(bool fLock) - { - if (this.m_oValue == null || !(this.m_oValue is SharedResource oValue)) - return; - if (fLock) - { - oValue.RegisterUsage((object) this); - oValue.AddActiveUser((object) this); - } - else - { - oValue.RemoveActiveUser((object) this); - oValue.UnregisterUsage((object) this); - } - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectPropertyType.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectPropertyType.cs index a9cfdc2..8410354 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectPropertyType.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectPropertyType.cs @@ -6,18 +6,18 @@ namespace Microsoft.Iris.Render.Graphics { - internal enum EffectPropertyType : byte - { - Integer, - Float, - Vector2, - Vector3, - Vector4, - Image, - Color, - ImageArray, - Video, - Byte, - Max, - } + internal enum EffectPropertyType : byte + { + Integer, + Float, + Vector2, + Vector3, + Vector4, + Image, + Color, + ImageArray, + Video, + Byte, + Max, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectRequirements.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectRequirements.cs index 3801883..0fe5041 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectRequirements.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectRequirements.cs @@ -8,10 +8,10 @@ using System; namespace Microsoft.Iris.Render.Graphics { - [Flags] - internal enum EffectRequirements - { - ViewPosition = 1, - ValidMask = ViewPosition, // 0x00000001 - } + [Flags] + internal enum EffectRequirements + { + ViewPosition = 1, + ValidMask = ViewPosition, // 0x00000001 + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectTemplate.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectTemplate.cs index 05472a3..e1ce758 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectTemplate.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/EffectTemplate.cs @@ -10,129 +10,129 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal abstract class EffectTemplate : SharedRenderObject, IEffectTemplate, ISharedRenderObject - { - protected string m_stName; - protected GraphicsDevice m_graphicsDevice; - protected RenderSession m_session; - protected Map m_dynamicProperties; - protected bool m_fBuilt; - protected ObjectCache m_cache; - private bool m_fReleasingCache; - - internal EffectTemplate(RenderSession session, GraphicsDevice device, string stName) + internal abstract class EffectTemplate : SharedRenderObject, IEffectTemplate, ISharedRenderObject { - this.m_dynamicProperties = new Map(10); - this.m_graphicsDevice = device; - this.m_session = session; - this.m_fBuilt = false; - this.m_stName = stName; - ObjectCacheManager cacheManager = session.CacheManager; - if (cacheManager == null) - return; - this.m_cache = new ObjectCache(100, 300, 100); - this.m_cache.DebugDescription = stName; - cacheManager.RegisterCache(this.m_cache); - } + protected string m_stName; + protected GraphicsDevice m_graphicsDevice; + protected RenderSession m_session; + protected Map m_dynamicProperties; + protected bool m_fBuilt; + protected ObjectCache m_cache; + private bool m_fReleasingCache; - protected override void Dispose(bool fInDispose) - { - try - { - if (!fInDispose) - return; - if (this.m_dynamicProperties != null) + internal EffectTemplate(RenderSession session, GraphicsDevice device, string stName) { - foreach (KeyValueEntry dynamicProperty in this.m_dynamicProperties) - { - EffectProperty effectProperty = dynamicProperty.Value; - if (effectProperty != null && effectProperty.Value != null && effectProperty.IsSharedResource) - ((SharedRenderObject) effectProperty.Value).UnregisterUsage((object) this); - effectProperty.Dispose(); - } - this.m_dynamicProperties = (Map) null; + this.m_dynamicProperties = new Map(10); + this.m_graphicsDevice = device; + this.m_session = session; + this.m_fBuilt = false; + this.m_stName = stName; + ObjectCacheManager cacheManager = session.CacheManager; + if (cacheManager == null) + return; + this.m_cache = new ObjectCache(100, 300, 100); + this.m_cache.DebugDescription = stName; + cacheManager.RegisterCache(this.m_cache); } - if (this.m_cache == null) - return; - this.m_session.CacheManager.UnregisterCache(this.m_cache); - this.m_cache.Dispose(); - this.m_cache = (ObjectCache) null; - } - finally - { - base.Dispose(fInDispose); - } + + protected override void Dispose(bool fInDispose) + { + try + { + if (!fInDispose) + return; + if (this.m_dynamicProperties != null) + { + foreach (KeyValueEntry dynamicProperty in this.m_dynamicProperties) + { + EffectProperty effectProperty = dynamicProperty.Value; + if (effectProperty != null && effectProperty.Value != null && effectProperty.IsSharedResource) + ((SharedRenderObject)effectProperty.Value).UnregisterUsage((object)this); + effectProperty.Dispose(); + } + this.m_dynamicProperties = (Map)null; + } + if (this.m_cache == null) + return; + this.m_session.CacheManager.UnregisterCache(this.m_cache); + this.m_cache.Dispose(); + this.m_cache = (ObjectCache)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + internal override void UnregisterUsage(object objUser) + { + if (!this.m_fReleasingCache && this.m_cache != null && this.UsageCount == this.m_cache.Size + 1) + { + this.m_fReleasingCache = true; + this.m_cache.RemoveAll(); + this.m_fReleasingCache = false; + } + base.UnregisterUsage(objUser); + } + + internal GraphicsDevice Device => this.m_graphicsDevice; + + internal RenderSession Session => this.m_session; + + internal Map DynamicProperties => this.m_dynamicProperties; + + public bool IsBuilt => this.m_fBuilt; + + public string Name => this.m_stName; + + void IEffectTemplate.AddEffectProperty(string stProp) => this.m_dynamicProperties.Add(stProp, (EffectProperty)null); + + bool IEffectTemplate.Build(EffectInput input) + { + Debug2.Validate(input != null, typeof(ArgumentNullException), "IEffectTemplate.Build null argument"); + Debug2.Validate(!this.m_fBuilt, typeof(ArgumentNullException), "IEffectTemplate.Build called twice"); + if (!this.MeetQualityBar(input)) + { + this.ResetInternalState(); + return false; + } + if (!this.Build(input)) + { + this.ResetInternalState(); + return false; + } + foreach (KeyValueEntry dynamicProperty in this.m_dynamicProperties) + { + EffectProperty effectProperty = dynamicProperty.Value; + if (effectProperty != null && effectProperty.Value != null && effectProperty.IsSharedResource) + ((SharedRenderObject)effectProperty.Value).RegisterUsage((object)this); + } + this.m_fBuilt = true; + return true; + } + + protected virtual void ResetInternalState() + { + foreach (KeyValueEntry dynamicProperty in this.m_dynamicProperties) + dynamicProperty.Value?.Dispose(); + this.m_dynamicProperties.Clear(); + this.m_fBuilt = false; + } + + protected bool GenerateProperties( + EffectInput input, + Map dictionary, + out int nPropCacheSize) + { + byte nNextUniqueID = 0; + nPropCacheSize = input.PreProcessProperties(dictionary, ref nNextUniqueID); + return input.Process(dictionary); + } + + private bool MeetQualityBar(EffectInput input) => this.m_graphicsDevice.RenderingQuality != GraphicsRenderingQuality.MinQuality || input.Type == EffectInputType.Color || (input.Type == EffectInputType.Image || input.Type == EffectInputType.Video); + + protected abstract bool Build(EffectInput element); + + public abstract IEffect CreateInstance(object objUser); } - - internal override void UnregisterUsage(object objUser) - { - if (!this.m_fReleasingCache && this.m_cache != null && this.UsageCount == this.m_cache.Size + 1) - { - this.m_fReleasingCache = true; - this.m_cache.RemoveAll(); - this.m_fReleasingCache = false; - } - base.UnregisterUsage(objUser); - } - - internal GraphicsDevice Device => this.m_graphicsDevice; - - internal RenderSession Session => this.m_session; - - internal Map DynamicProperties => this.m_dynamicProperties; - - public bool IsBuilt => this.m_fBuilt; - - public string Name => this.m_stName; - - void IEffectTemplate.AddEffectProperty(string stProp) => this.m_dynamicProperties.Add(stProp, (EffectProperty) null); - - bool IEffectTemplate.Build(EffectInput input) - { - Debug2.Validate(input != null, typeof (ArgumentNullException), "IEffectTemplate.Build null argument"); - Debug2.Validate(!this.m_fBuilt, typeof (ArgumentNullException), "IEffectTemplate.Build called twice"); - if (!this.MeetQualityBar(input)) - { - this.ResetInternalState(); - return false; - } - if (!this.Build(input)) - { - this.ResetInternalState(); - return false; - } - foreach (KeyValueEntry dynamicProperty in this.m_dynamicProperties) - { - EffectProperty effectProperty = dynamicProperty.Value; - if (effectProperty != null && effectProperty.Value != null && effectProperty.IsSharedResource) - ((SharedRenderObject) effectProperty.Value).RegisterUsage((object) this); - } - this.m_fBuilt = true; - return true; - } - - protected virtual void ResetInternalState() - { - foreach (KeyValueEntry dynamicProperty in this.m_dynamicProperties) - dynamicProperty.Value?.Dispose(); - this.m_dynamicProperties.Clear(); - this.m_fBuilt = false; - } - - protected bool GenerateProperties( - EffectInput input, - Map dictionary, - out int nPropCacheSize) - { - byte nNextUniqueID = 0; - nPropCacheSize = input.PreProcessProperties(dictionary, ref nNextUniqueID); - return input.Process(dictionary); - } - - private bool MeetQualityBar(EffectInput input) => this.m_graphicsDevice.RenderingQuality != GraphicsRenderingQuality.MinQuality || input.Type == EffectInputType.Color || (input.Type == EffectInputType.Image || input.Type == EffectInputType.Video); - - protected abstract bool Build(EffectInput element); - - public abstract IEffect CreateInstance(object objUser); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffect.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffect.cs index d26bb39..8ecf3d8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffect.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffect.cs @@ -8,16 +8,16 @@ using Microsoft.Iris.Render.Protocols.Splash.Rendering.Nt; namespace Microsoft.Iris.Render.Graphics { - internal class GdiEffect : Effect - { - internal GdiEffect(GdiEffectTemplate effectTemplate) - : base((EffectTemplate) effectTemplate) - => this.m_remoteEffect = (Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect) this.m_effectTemplate.Session.BuildRemoteGdiEffect(this); - - internal override void RemoteEffect() + internal class GdiEffect : Effect { - ((RemoteGdiEffect) this.m_remoteEffect).SendSetType((int) ((GdiEffectTemplate) this.m_effectTemplate).Type); - this.Initialize(); + internal GdiEffect(GdiEffectTemplate effectTemplate) + : base((EffectTemplate)effectTemplate) + => this.m_remoteEffect = (Microsoft.Iris.Render.Protocols.Splash.Rendering.RemoteEffect)this.m_effectTemplate.Session.BuildRemoteGdiEffect(this); + + internal override void RemoteEffect() + { + ((RemoteGdiEffect)this.m_remoteEffect).SendSetType((int)((GdiEffectTemplate)this.m_effectTemplate).Type); + this.Initialize(); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffectTemplate.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffectTemplate.cs index a500566..1a1a3ca 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffectTemplate.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffectTemplate.cs @@ -10,71 +10,71 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal class GdiEffectTemplate : EffectTemplate - { - private GdiEffectType m_type; - - internal GdiEffectTemplate(RenderSession session, GraphicsDevice device, string stName) - : base(session, device, stName) - => this.m_type = GdiEffectType.None; - - internal GdiEffectType Type => this.m_type; - - public override IEffect CreateInstance(object objUser) + internal class GdiEffectTemplate : EffectTemplate { - Debug2.Validate(this.m_fBuilt, typeof (InvalidOperationException), "Cannot create instance if the template is not built"); - GdiEffect gdiEffect = (GdiEffect) null; - if (this.m_cache != null) - gdiEffect = (GdiEffect) this.m_cache.Remove(objUser); - if (gdiEffect == null) - { - gdiEffect = new GdiEffect(this); - gdiEffect.Cache = this.m_cache; - gdiEffect.RegisterUsage(objUser); - gdiEffect.RemoteEffect(); - } - return (IEffect) gdiEffect; - } + private GdiEffectType m_type; - protected override bool Build(EffectInput input) - { - if (!this.ProcessEffectElement(input)) - return false; - int nPropCacheSize = 0; - if (!this.GenerateProperties(input, this.m_dynamicProperties, out nPropCacheSize)) - return false; - Map.Enumerator enumerator = this.m_dynamicProperties.GetEnumerator(); - while (enumerator.MoveNext()) - { - EffectProperty effectProperty = enumerator.Current.Value; - if (effectProperty == null || !effectProperty.IsDynamic) + internal GdiEffectTemplate(RenderSession session, GraphicsDevice device, string stName) + : base(session, device, stName) + => this.m_type = GdiEffectType.None; + + internal GdiEffectType Type => this.m_type; + + public override IEffect CreateInstance(object objUser) { - this.m_dynamicProperties.Remove(enumerator.Current.Key); - enumerator = this.m_dynamicProperties.GetEnumerator(); + Debug2.Validate(this.m_fBuilt, typeof(InvalidOperationException), "Cannot create instance if the template is not built"); + GdiEffect gdiEffect = (GdiEffect)null; + if (this.m_cache != null) + gdiEffect = (GdiEffect)this.m_cache.Remove(objUser); + if (gdiEffect == null) + { + gdiEffect = new GdiEffect(this); + gdiEffect.Cache = this.m_cache; + gdiEffect.RegisterUsage(objUser); + gdiEffect.RemoteEffect(); + } + return (IEffect)gdiEffect; } - } - return true; - } - private bool ProcessEffectElement(EffectInput element) - { - switch (element.Type) - { - case EffectInputType.Color: - this.m_type = GdiEffectType.LoadColor; - return true; - case EffectInputType.Image: - this.m_type = GdiEffectType.LoadImage; - return true; - default: - return false; - } - } + protected override bool Build(EffectInput input) + { + if (!this.ProcessEffectElement(input)) + return false; + int nPropCacheSize = 0; + if (!this.GenerateProperties(input, this.m_dynamicProperties, out nPropCacheSize)) + return false; + Map.Enumerator enumerator = this.m_dynamicProperties.GetEnumerator(); + while (enumerator.MoveNext()) + { + EffectProperty effectProperty = enumerator.Current.Value; + if (effectProperty == null || !effectProperty.IsDynamic) + { + this.m_dynamicProperties.Remove(enumerator.Current.Key); + enumerator = this.m_dynamicProperties.GetEnumerator(); + } + } + return true; + } - protected override void ResetInternalState() - { - base.ResetInternalState(); - this.m_type = GdiEffectType.None; + private bool ProcessEffectElement(EffectInput element) + { + switch (element.Type) + { + case EffectInputType.Color: + this.m_type = GdiEffectType.LoadColor; + return true; + case EffectInputType.Image: + this.m_type = GdiEffectType.LoadImage; + return true; + default: + return false; + } + } + + protected override void ResetInternalState() + { + base.ResetInternalState(); + this.m_type = GdiEffectType.None; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffectType.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffectType.cs index 84bfc77..e6ec4ff 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffectType.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiEffectType.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render.Graphics { - internal enum GdiEffectType : byte - { - LoadColor, - LoadImage, - None, - } + internal enum GdiEffectType : byte + { + LoadColor, + LoadImage, + None, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiGraphicsDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiGraphicsDevice.cs index bcb30f2..b95226c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiGraphicsDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GdiGraphicsDevice.cs @@ -11,173 +11,173 @@ using Microsoft.Iris.Render.Protocols.Splash.Rendering.Nt; namespace Microsoft.Iris.Render.Graphics { - internal sealed class GdiGraphicsDevice : GraphicsDevice, IRenderHandleOwner - { - private RemoteGdiDevice m_remoteDevice; - private bool m_fAllowAlpha; - private bool m_fAllowAnimations; - private bool m_fEnableBackBuffer; - private bool m_fSystemMemoryBitmaps; - private ColorF m_clrBackground; - private bool m_fEnableAlphaTracking; - private VideoZoomMode m_vzmZoomMode; - private bool m_fSecureDesktopMode; - - internal GdiGraphicsDevice(RenderSession session) - : base(session, "Gdi") + internal sealed class GdiGraphicsDevice : GraphicsDevice, IRenderHandleOwner { - this.m_remoteDevice = session.BuildRemoteGdiDevice(this); - this.m_fAllowAlpha = true; - this.m_fAllowAnimations = true; - this.m_fEnableBackBuffer = true; - this.m_fSystemMemoryBitmaps = false; - this.m_clrBackground = new ColorF((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); - this.m_deviceType = GraphicsDeviceType.Gdi; - this.m_graphicsCaps = session.GetGraphicsCaps(this.m_deviceType); - this.m_renderingQuality = GraphicsRenderingQuality.MinQuality; + private RemoteGdiDevice m_remoteDevice; + private bool m_fAllowAlpha; + private bool m_fAllowAnimations; + private bool m_fEnableBackBuffer; + private bool m_fSystemMemoryBitmaps; + private ColorF m_clrBackground; + private bool m_fEnableAlphaTracking; + private VideoZoomMode m_vzmZoomMode; + private bool m_fSecureDesktopMode; + + internal GdiGraphicsDevice(RenderSession session) + : base(session, "Gdi") + { + this.m_remoteDevice = session.BuildRemoteGdiDevice(this); + this.m_fAllowAlpha = true; + this.m_fAllowAnimations = true; + this.m_fEnableBackBuffer = true; + this.m_fSystemMemoryBitmaps = false; + this.m_clrBackground = new ColorF((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue); + this.m_deviceType = GraphicsDeviceType.Gdi; + this.m_graphicsCaps = session.GetGraphicsCaps(this.m_deviceType); + this.m_renderingQuality = GraphicsRenderingQuality.MinQuality; + } + + protected override void Dispose(bool fInDispose) + { + if (fInDispose && this.m_remoteDevice != null) + this.m_remoteDevice.Dispose(); + this.m_remoteDevice = (RemoteGdiDevice)null; + base.Dispose(fInDispose); + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteDevice.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteDevice = (RemoteGdiDevice)null; + + public override bool IsVideoComposited => false; + + internal override RemoteDevice RemoteDevice => (RemoteDevice)this.m_remoteDevice; + + public override bool CanPlayAnimations => this.AllowAnimations; + + public bool AllowAlpha + { + get => this.m_fAllowAlpha; + set + { + if (this.m_fAllowAlpha == value) + return; + this.m_remoteDevice.SendSetAllowAlpha(value); + this.m_fAllowAlpha = value; + } + } + + public bool AllowAnimations + { + get => this.m_fAllowAnimations; + set + { + if (this.m_fAllowAnimations == value) + return; + this.m_remoteDevice.SendSetAllowAnimations(value); + this.m_fAllowAnimations = value; + } + } + + public bool EnableBackBuffer + { + get => this.m_fEnableBackBuffer; + set + { + if (value == this.m_fEnableBackBuffer) + return; + this.m_remoteDevice.SendSetEnableBackBuffer(value); + this.m_fEnableBackBuffer = value; + } + } + + public bool EnableAlphaTracking + { + get => this.m_fEnableAlphaTracking; + set + { + if (value == this.m_fEnableAlphaTracking) + return; + this.m_remoteDevice.SendSetEnableAlphaTracking(value); + this.m_fEnableAlphaTracking = value; + } + } + + public VideoZoomMode ZoomMode + { + get => this.m_vzmZoomMode; + set + { + if (value == this.m_vzmZoomMode) + return; + this.m_remoteDevice.SendSetZoomMode(value); + this.m_vzmZoomMode = value; + } + } + + public bool SystemMemoryBitmaps + { + get => this.m_fSystemMemoryBitmaps; + set + { + if (value == this.m_fSystemMemoryBitmaps) + return; + this.m_remoteDevice.SendSetUseSystemMemoryBitmaps(value); + this.m_fSystemMemoryBitmaps = value; + } + } + + public ColorF BackgroundColor + { + get => this.m_clrBackground; + set + { + if (!(value != this.m_clrBackground)) + return; + this.m_remoteDevice.SendSetBackgroundColor(value); + this.m_clrBackground = value; + } + } + + internal bool SecureDesktopMode + { + get => this.m_fSecureDesktopMode; + set + { + if (value == this.m_fSecureDesktopMode) + return; + this.m_remoteDevice.SendSecureDesktopMode(value); + this.m_fSecureDesktopMode = value; + } + } + + internal override bool IsSurfaceFormatSupported(SurfaceFormat nFormat) + { + switch (nFormat) + { + case SurfaceFormat.RGB24: + case SurfaceFormat.RGB32: + case SurfaceFormat.ARGB32: + return true; + case SurfaceFormat.External: + return false; + default: + return false; + } + } + + protected override void CreateSurfacePoolWorker( + object oSurfacePool, + object oHandle, + SurfaceFormat nFormat) + { + this.m_remoteDevice.SendCreateSurfacePool((RENDERHANDLE)oHandle, nFormat); + } + + protected override void RestartRendering(uint nRenderGeneration) => this.m_remoteDevice.SendRestart(nRenderGeneration); + + public override bool CanPlayAnimationType(AnimationInputType type) => false; + + internal override EffectTemplate CreateEffectTemplate(string stName) => (EffectTemplate)new GdiEffectTemplate(this.m_session, (GraphicsDevice)this, stName); } - - protected override void Dispose(bool fInDispose) - { - if (fInDispose && this.m_remoteDevice != null) - this.m_remoteDevice.Dispose(); - this.m_remoteDevice = (RemoteGdiDevice) null; - base.Dispose(fInDispose); - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteDevice.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteDevice = (RemoteGdiDevice) null; - - public override bool IsVideoComposited => false; - - internal override RemoteDevice RemoteDevice => (RemoteDevice) this.m_remoteDevice; - - public override bool CanPlayAnimations => this.AllowAnimations; - - public bool AllowAlpha - { - get => this.m_fAllowAlpha; - set - { - if (this.m_fAllowAlpha == value) - return; - this.m_remoteDevice.SendSetAllowAlpha(value); - this.m_fAllowAlpha = value; - } - } - - public bool AllowAnimations - { - get => this.m_fAllowAnimations; - set - { - if (this.m_fAllowAnimations == value) - return; - this.m_remoteDevice.SendSetAllowAnimations(value); - this.m_fAllowAnimations = value; - } - } - - public bool EnableBackBuffer - { - get => this.m_fEnableBackBuffer; - set - { - if (value == this.m_fEnableBackBuffer) - return; - this.m_remoteDevice.SendSetEnableBackBuffer(value); - this.m_fEnableBackBuffer = value; - } - } - - public bool EnableAlphaTracking - { - get => this.m_fEnableAlphaTracking; - set - { - if (value == this.m_fEnableAlphaTracking) - return; - this.m_remoteDevice.SendSetEnableAlphaTracking(value); - this.m_fEnableAlphaTracking = value; - } - } - - public VideoZoomMode ZoomMode - { - get => this.m_vzmZoomMode; - set - { - if (value == this.m_vzmZoomMode) - return; - this.m_remoteDevice.SendSetZoomMode(value); - this.m_vzmZoomMode = value; - } - } - - public bool SystemMemoryBitmaps - { - get => this.m_fSystemMemoryBitmaps; - set - { - if (value == this.m_fSystemMemoryBitmaps) - return; - this.m_remoteDevice.SendSetUseSystemMemoryBitmaps(value); - this.m_fSystemMemoryBitmaps = value; - } - } - - public ColorF BackgroundColor - { - get => this.m_clrBackground; - set - { - if (!(value != this.m_clrBackground)) - return; - this.m_remoteDevice.SendSetBackgroundColor(value); - this.m_clrBackground = value; - } - } - - internal bool SecureDesktopMode - { - get => this.m_fSecureDesktopMode; - set - { - if (value == this.m_fSecureDesktopMode) - return; - this.m_remoteDevice.SendSecureDesktopMode(value); - this.m_fSecureDesktopMode = value; - } - } - - internal override bool IsSurfaceFormatSupported(SurfaceFormat nFormat) - { - switch (nFormat) - { - case SurfaceFormat.RGB24: - case SurfaceFormat.RGB32: - case SurfaceFormat.ARGB32: - return true; - case SurfaceFormat.External: - return false; - default: - return false; - } - } - - protected override void CreateSurfacePoolWorker( - object oSurfacePool, - object oHandle, - SurfaceFormat nFormat) - { - this.m_remoteDevice.SendCreateSurfacePool((RENDERHANDLE) oHandle, nFormat); - } - - protected override void RestartRendering(uint nRenderGeneration) => this.m_remoteDevice.SendRestart(nRenderGeneration); - - public override bool CanPlayAnimationType(AnimationInputType type) => false; - - internal override EffectTemplate CreateEffectTemplate(string stName) => (EffectTemplate) new GdiEffectTemplate(this.m_session, (GraphicsDevice) this, stName); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Gradient.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Gradient.cs index 66e2673..2bb7d7c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Gradient.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Gradient.cs @@ -12,104 +12,104 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal class Gradient : SharedRenderObject, IGradient, ISharedRenderObject, IRenderHandleOwner - { - private RemoteGradient m_remoteGradient; - private Orientation m_orientation; - private ColorF m_colorMask; - private float m_flOffset; - - internal Gradient(RenderSession session, RemoteDevice remoteDevice) + internal class Gradient : SharedRenderObject, IGradient, ISharedRenderObject, IRenderHandleOwner { - Debug2.Validate(session != null, typeof (ArgumentNullException), "Must have valid RenderSession"); - session.AssertOwningThread(); - Debug2.Validate(remoteDevice != null, typeof (ArgumentNullException), "Must have a valid remoteDevice in-param"); - RenderPort renderingPort = session.RenderingPort; - RENDERHANDLE renderhandle = renderingPort.AllocHandle((IRenderHandleOwner) this); - try - { - remoteDevice.SendCreateGradient(renderhandle); - this.m_remoteGradient = RemoteGradient.CreateFromHandle(renderingPort, renderhandle); - } - finally - { - if (this.m_remoteGradient != null && !this.m_remoteGradient.IsValid) - renderingPort.FreeHandle(renderhandle); - } + private RemoteGradient m_remoteGradient; + private Orientation m_orientation; + private ColorF m_colorMask; + private float m_flOffset; + + internal Gradient(RenderSession session, RemoteDevice remoteDevice) + { + Debug2.Validate(session != null, typeof(ArgumentNullException), "Must have valid RenderSession"); + session.AssertOwningThread(); + Debug2.Validate(remoteDevice != null, typeof(ArgumentNullException), "Must have a valid remoteDevice in-param"); + RenderPort renderingPort = session.RenderingPort; + RENDERHANDLE renderhandle = renderingPort.AllocHandle((IRenderHandleOwner)this); + try + { + remoteDevice.SendCreateGradient(renderhandle); + this.m_remoteGradient = RemoteGradient.CreateFromHandle(renderingPort, renderhandle); + } + finally + { + if (this.m_remoteGradient != null && !this.m_remoteGradient.IsValid) + renderingPort.FreeHandle(renderhandle); + } + } + + protected override void Dispose(bool fInDispose) + { + try + { + if (fInDispose && this.m_remoteGradient != null) + this.m_remoteGradient.Dispose(); + this.m_remoteGradient = (RemoteGradient)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + Orientation IGradient.Orientation + { + get => this.m_orientation; + set + { + if (this.m_orientation == value) + return; + this.m_orientation = value; + this.m_remoteGradient.SendSetOrientation(this.m_orientation); + } + } + + ColorF IGradient.ColorMask + { + get => this.m_colorMask; + set + { + if (!(this.m_colorMask != value)) + return; + this.m_colorMask = value; + this.m_remoteGradient.SendSetColorMask(this.m_colorMask); + } + } + + float IGradient.Offset + { + get => this.m_flOffset; + set + { + if ((double)this.m_flOffset == (double)value) + return; + this.m_flOffset = value; + this.m_remoteGradient.SendSetOffset(this.m_flOffset); + } + } + + void IGradient.AddValue(float flPosition, float flValue, RelativeSpace rsSpace) => this.m_remoteGradient.SendAddValue(flValue, flPosition, rsSpace); + + void IGradient.Clear() => this.m_remoteGradient.SendClear(); + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteGradient.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteGradient = (RemoteGradient)null; + + internal RemoteGradient RemoteGradient => this.m_remoteGradient; + + internal struct GradientSample + { + public float position; + public float value; + public RelativeSpace relSpace; + + internal GradientSample(float pos, float val, RelativeSpace rs) + { + this.position = pos; + this.value = val; + this.relSpace = rs; + } + } } - - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose && this.m_remoteGradient != null) - this.m_remoteGradient.Dispose(); - this.m_remoteGradient = (RemoteGradient) null; - } - finally - { - base.Dispose(fInDispose); - } - } - - Orientation IGradient.Orientation - { - get => this.m_orientation; - set - { - if (this.m_orientation == value) - return; - this.m_orientation = value; - this.m_remoteGradient.SendSetOrientation(this.m_orientation); - } - } - - ColorF IGradient.ColorMask - { - get => this.m_colorMask; - set - { - if (!(this.m_colorMask != value)) - return; - this.m_colorMask = value; - this.m_remoteGradient.SendSetColorMask(this.m_colorMask); - } - } - - float IGradient.Offset - { - get => this.m_flOffset; - set - { - if ((double) this.m_flOffset == (double) value) - return; - this.m_flOffset = value; - this.m_remoteGradient.SendSetOffset(this.m_flOffset); - } - } - - void IGradient.AddValue(float flPosition, float flValue, RelativeSpace rsSpace) => this.m_remoteGradient.SendAddValue(flValue, flPosition, rsSpace); - - void IGradient.Clear() => this.m_remoteGradient.SendClear(); - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteGradient.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteGradient = (RemoteGradient) null; - - internal RemoteGradient RemoteGradient => this.m_remoteGradient; - - internal struct GradientSample - { - public float position; - public float value; - public RelativeSpace relSpace; - - internal GradientSample(float pos, float val, RelativeSpace rs) - { - this.position = pos; - this.value = val; - this.relSpace = rs; - } - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GraphicsDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GraphicsDevice.cs index ee4f56e..4eb7588 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GraphicsDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/GraphicsDevice.cs @@ -12,244 +12,244 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal abstract class GraphicsDevice : RenderObject, IGraphicsDevice, IDeviceCallback - { - protected RenderSession m_session; - private string m_stDisplayName; - private SurfaceManager m_manSurfaces; - private ObjectTracker m_trackerSurfacePools; - private ObjectTracker m_trackerWindows; - private uint m_cRenderGeneration; - private readonly DeferredHandler m_cbRestartRenderer; - private bool m_fQueuedRestart; - private bool m_fCreated; - private bool m_fAllowDynamicPool; - private bool m_fInVsaBlock; - protected GraphicsCaps m_graphicsCaps; - protected GraphicsDeviceType m_deviceType; - protected GraphicsRenderingQuality m_renderingQuality; - private readonly DeferredHandler m_cbTrackerUpdate; - private bool m_fQueuedTrackerUpdate; - protected Size m_sizeGutterPxl; - private static readonly TrackerBase.ObjectTest s_testUnused = new TrackerBase.ObjectTest(GraphicsDevice.TestIsUnused); - private bool m_fBeginCaptureBackBuffer; - private bool m_fEndCaptureBackBuffer; - - internal GraphicsDevice(RenderSession session, string stDisplayName) + internal abstract class GraphicsDevice : RenderObject, IGraphicsDevice, IDeviceCallback { - this.m_session = session; - this.m_stDisplayName = stDisplayName; - this.m_trackerSurfacePools = new ObjectTracker(session, (object) this); - this.m_trackerWindows = new ObjectTracker(session, (object) this); - this.m_cRenderGeneration = 1U; - this.m_cbRestartRenderer = new DeferredHandler(this.OnRestartRenderer); - this.m_cbTrackerUpdate = new DeferredHandler(this.OnTrackerUpdate); - } + protected RenderSession m_session; + private string m_stDisplayName; + private SurfaceManager m_manSurfaces; + private ObjectTracker m_trackerSurfacePools; + private ObjectTracker m_trackerWindows; + private uint m_cRenderGeneration; + private readonly DeferredHandler m_cbRestartRenderer; + private bool m_fQueuedRestart; + private bool m_fCreated; + private bool m_fAllowDynamicPool; + private bool m_fInVsaBlock; + protected GraphicsCaps m_graphicsCaps; + protected GraphicsDeviceType m_deviceType; + protected GraphicsRenderingQuality m_renderingQuality; + private readonly DeferredHandler m_cbTrackerUpdate; + private bool m_fQueuedTrackerUpdate; + protected Size m_sizeGutterPxl; + private static readonly TrackerBase.ObjectTest s_testUnused = new TrackerBase.ObjectTest(GraphicsDevice.TestIsUnused); + private bool m_fBeginCaptureBackBuffer; + private bool m_fEndCaptureBackBuffer; - public virtual void PostCreate() => this.m_manSurfaces = new SurfaceManager(this, this.m_session); - - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + internal GraphicsDevice(RenderSession session, string stDisplayName) { - this.m_session.AssertOwningThread(); - if (this.m_manSurfaces != null) - this.m_manSurfaces.Dispose(); - if (this.m_trackerSurfacePools != null) - this.m_trackerSurfacePools.Dispose(); - if (this.m_trackerWindows != null) - this.m_trackerWindows.Dispose(); + this.m_session = session; + this.m_stDisplayName = stDisplayName; + this.m_trackerSurfacePools = new ObjectTracker(session, (object)this); + this.m_trackerWindows = new ObjectTracker(session, (object)this); + this.m_cRenderGeneration = 1U; + this.m_cbRestartRenderer = new DeferredHandler(this.OnRestartRenderer); + this.m_cbTrackerUpdate = new DeferredHandler(this.OnTrackerUpdate); } - this.m_trackerWindows = (ObjectTracker) null; - this.m_trackerSurfacePools = (ObjectTracker) null; - this.m_manSurfaces = (SurfaceManager) null; - this.m_session = (RenderSession) null; - } - finally - { - base.Dispose(fInDispose); - } + + public virtual void PostCreate() => this.m_manSurfaces = new SurfaceManager(this, this.m_session); + + protected override void Dispose(bool fInDispose) + { + try + { + if (fInDispose) + { + this.m_session.AssertOwningThread(); + if (this.m_manSurfaces != null) + this.m_manSurfaces.Dispose(); + if (this.m_trackerSurfacePools != null) + this.m_trackerSurfacePools.Dispose(); + if (this.m_trackerWindows != null) + this.m_trackerWindows.Dispose(); + } + this.m_trackerWindows = (ObjectTracker)null; + this.m_trackerSurfacePools = (ObjectTracker)null; + this.m_manSurfaces = (SurfaceManager)null; + this.m_session = (RenderSession)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + GraphicsDeviceType IGraphicsDevice.DeviceType => this.m_deviceType; + + Size IGraphicsDevice.MaximumImageSize => new Size(this.m_graphicsCaps.MaxTextureWidth, this.m_graphicsCaps.MaxTextureHeight); + + internal RenderSession Session => this.m_session; + + public string DisplayName => this.m_stDisplayName; + + internal SurfaceManager SurfaceManager => this.m_manSurfaces; + + public abstract bool IsVideoComposited { get; } + + public GraphicsRenderingQuality RenderingQuality => this.m_renderingQuality; + + public abstract bool CanPlayAnimations { get; } + + public bool InVsaBlock => this.m_fInVsaBlock; + + internal bool AllowDynamicPool => this.m_fAllowDynamicPool; + + internal abstract RemoteDevice RemoteDevice { get; } + + internal GraphicsCaps GraphicsCaps => this.m_graphicsCaps; + + internal abstract bool IsSurfaceFormatSupported(SurfaceFormat nFormat); + + internal void CreateSurfacePool(SurfacePool spNew, RENDERHANDLE handle, SurfaceFormat nFormat) + { + this.CreateSurfacePoolWorker((object)spNew, (object)handle, nFormat); + this.m_trackerSurfacePools.AddObject((object)spNew); + } + + internal void OnSurfacePoolDispose() + { + if (this.m_fQueuedTrackerUpdate) + return; + this.m_session.DeferredInvoke((Delegate)this.m_cbTrackerUpdate, (object)null, DeferredInvokePriority.Idle, new TimeSpan(0, 0, 10)); + this.m_fQueuedTrackerUpdate = true; + } + + private void OnTrackerUpdate(object args) + { + this.m_trackerSurfacePools.RemoveObjects(GraphicsDevice.s_testUnused); + this.m_fQueuedTrackerUpdate = false; + } + + private static bool TestIsUnused(object objSubject, object objParam) => ((SurfacePool)objSubject).RemoteStub == null; + + public void AllocateSurfacePool(int nPoolID, SurfaceFormat nFormat, Size sizeStoragePxl) => this.m_manSurfaces.AllocateNamedSurface(nPoolID, nFormat, sizeStoragePxl); + + public void FreeSurfacePool(int nPoolID) => this.m_manSurfaces.FreeNamedSurface(nPoolID); + + protected abstract void CreateSurfacePoolWorker( + object oSurfacePool, + object oHandle, + SurfaceFormat nFormat); + + internal void CreateVideoPool(VideoPool spNew, RENDERHANDLE handle) + { + this.CreateVideoPoolWorker((object)spNew, (object)handle); + this.m_trackerSurfacePools.AddObject((object)spNew); + } + + internal virtual void CreateVideoPoolWorker(object oSurfacePool, object oHandle) => Debug2.Validate(false, (Type)null, "GraphicsDevice type does not support Video Pool"); + + internal void RegisterWindow(RenderWindow win) => this.m_trackerWindows.AddObject((object)win); + + public virtual bool CanPlayAnimationType(AnimationInputType type) => false; + + internal SurfaceManager.VideoMemoryBreakdown ComputeBreakdown() => (SurfaceManager.VideoMemoryBreakdown)this.InternalComputeBreakdown(); + + internal abstract EffectTemplate CreateEffectTemplate(string stName); + + internal Image CreateImage(string identifier, ContentNotifyHandler handler) => new Image(this.m_session, this.m_manSurfaces, identifier, handler, this.m_sizeGutterPxl); + + protected virtual object InternalComputeBreakdown() => (object)new SurfaceManager.VideoMemoryBreakdown(); + + private void RestoreAllSurfaces() + { + this.m_session.AssertOwningThread(); + foreach (SurfacePool liveObject in this.m_trackerSurfacePools.LiveObjects) + liveObject.Restore(); + } + + protected abstract void RestartRendering(uint nRenderGeneration); + + void IDeviceCallback.OnCreated(RENDERHANDLE target, bool fAllowDynamicPool) + { + this.m_fCreated = true; + this.m_fAllowDynamicPool = fAllowDynamicPool; + } + + void IDeviceCallback.OnLostDevice( + RENDERHANDLE target, + uint cRenderGeneration, + bool fLost) + { + if (fLost) + { + this.m_cRenderGeneration = cRenderGeneration; + } + else + { + this.ResetDeviceContent(); + if (this.m_fQueuedRestart) + return; + this.m_session.DeferredInvoke((Delegate)this.m_cbRestartRenderer, (object)null, DeferredInvokePriority.Low); + this.m_fQueuedRestart = true; + } + } + + internal virtual void ResetDeviceContent() + { + if (this.m_manSurfaces != null) + this.m_manSurfaces.CollectDeadSurfaces(); + this.RestoreAllSurfaces(); + } + + void IDeviceCallback.OnVsaBlock(RENDERHANDLE target, bool fInBlock) => this.m_fInVsaBlock = fInBlock; + + void IDeviceCallback.OnSurfacePoolAllocation( + RENDERHANDLE target, + RENDERHANDLE idSurfacePool, + SurfacePoolAllocationResult nResult) + { + IRenderHandleOwner handleOwner = this.Session.RenderingPort.TryGetHandleOwner(idSurfacePool); + if (handleOwner == null) + return; + if (handleOwner is SurfacePool surfacePool) + surfacePool.NotifyAllocation(nResult); + else + Debug2.Throw(false, "invalid surface pool owner"); + } + + private void OnRestartRenderer(object arg) + { + this.RestartRendering(this.m_cRenderGeneration); + this.m_fQueuedRestart = false; + } + + public virtual void RenderNowIfPossible() + { + } + + public void BeginCaptureBackBuffer(string stFileName) + { + Debug2.Validate(!this.m_fBeginCaptureBackBuffer, typeof(InvalidOperationException), "BeginCaptureBackBuffer() called but m_fBeginCaptureBackBuffer = true"); + Debug2.Validate(!this.m_fEndCaptureBackBuffer, typeof(InvalidOperationException), "EndCaptureBackBuffer() called but m_fEndCaptureBackBuffer = true"); + this.m_fBeginCaptureBackBuffer = true; + this.RemoteDevice.SendBeginCaptureBackBuffer(stFileName); + } + + public void EndCaptureBackBuffer() + { + Debug2.Validate(this.m_fBeginCaptureBackBuffer, typeof(InvalidOperationException), "BeginCaptureBackBuffer() called but m_fBeginCaptureBackBuffer = false"); + Debug2.Validate(!this.m_fEndCaptureBackBuffer, typeof(InvalidOperationException), "EndCaptureBackBuffer() called but m_fEndCaptureBackBuffer = true"); + this.m_session.DeferredInvoke((Delegate)new DeferredHandler(this.DeferredEndCaptureBackBuffer), (object)null, DeferredInvokePriority.VisualUpdate); + } + + private void DeferredEndCaptureBackBuffer(object args) + { + Debug2.Validate(this.m_fBeginCaptureBackBuffer, typeof(InvalidOperationException), "DeferredEndCaptureBackBuffer() called but m_fBeginCaptureBackBuffer = false"); + Debug2.Validate(!this.m_fEndCaptureBackBuffer, typeof(InvalidOperationException), "DeferredEndCaptureBackBuffer() called but m_fEndCaptureBackBuffer = true"); + this.m_fEndCaptureBackBuffer = true; + this.RemoteDevice.SendEndCaptureBackBuffer(); + } + + void IDeviceCallback.OnBackBufferCaptured(RENDERHANDLE target) + { + Debug2.Validate(this.BackBufferCapturedEvent != null, typeof(InvalidOperationException), "No event handler registered: BackBufferCapturedEvent = null"); + this.m_fBeginCaptureBackBuffer = false; + this.m_fEndCaptureBackBuffer = false; + this.BackBufferCapturedEvent(); + } + + public void TriggerDeviceReset() => this.RemoteDevice.SendTriggerDeviceReset(); + + public event BackBufferCapturedHandler BackBufferCapturedEvent; } - - GraphicsDeviceType IGraphicsDevice.DeviceType => this.m_deviceType; - - Size IGraphicsDevice.MaximumImageSize => new Size(this.m_graphicsCaps.MaxTextureWidth, this.m_graphicsCaps.MaxTextureHeight); - - internal RenderSession Session => this.m_session; - - public string DisplayName => this.m_stDisplayName; - - internal SurfaceManager SurfaceManager => this.m_manSurfaces; - - public abstract bool IsVideoComposited { get; } - - public GraphicsRenderingQuality RenderingQuality => this.m_renderingQuality; - - public abstract bool CanPlayAnimations { get; } - - public bool InVsaBlock => this.m_fInVsaBlock; - - internal bool AllowDynamicPool => this.m_fAllowDynamicPool; - - internal abstract RemoteDevice RemoteDevice { get; } - - internal GraphicsCaps GraphicsCaps => this.m_graphicsCaps; - - internal abstract bool IsSurfaceFormatSupported(SurfaceFormat nFormat); - - internal void CreateSurfacePool(SurfacePool spNew, RENDERHANDLE handle, SurfaceFormat nFormat) - { - this.CreateSurfacePoolWorker((object) spNew, (object) handle, nFormat); - this.m_trackerSurfacePools.AddObject((object) spNew); - } - - internal void OnSurfacePoolDispose() - { - if (this.m_fQueuedTrackerUpdate) - return; - this.m_session.DeferredInvoke((Delegate) this.m_cbTrackerUpdate, (object) null, DeferredInvokePriority.Idle, new TimeSpan(0, 0, 10)); - this.m_fQueuedTrackerUpdate = true; - } - - private void OnTrackerUpdate(object args) - { - this.m_trackerSurfacePools.RemoveObjects(GraphicsDevice.s_testUnused); - this.m_fQueuedTrackerUpdate = false; - } - - private static bool TestIsUnused(object objSubject, object objParam) => ((SurfacePool) objSubject).RemoteStub == null; - - public void AllocateSurfacePool(int nPoolID, SurfaceFormat nFormat, Size sizeStoragePxl) => this.m_manSurfaces.AllocateNamedSurface(nPoolID, nFormat, sizeStoragePxl); - - public void FreeSurfacePool(int nPoolID) => this.m_manSurfaces.FreeNamedSurface(nPoolID); - - protected abstract void CreateSurfacePoolWorker( - object oSurfacePool, - object oHandle, - SurfaceFormat nFormat); - - internal void CreateVideoPool(VideoPool spNew, RENDERHANDLE handle) - { - this.CreateVideoPoolWorker((object) spNew, (object) handle); - this.m_trackerSurfacePools.AddObject((object) spNew); - } - - internal virtual void CreateVideoPoolWorker(object oSurfacePool, object oHandle) => Debug2.Validate(false, (Type) null, "GraphicsDevice type does not support Video Pool"); - - internal void RegisterWindow(RenderWindow win) => this.m_trackerWindows.AddObject((object) win); - - public virtual bool CanPlayAnimationType(AnimationInputType type) => false; - - internal SurfaceManager.VideoMemoryBreakdown ComputeBreakdown() => (SurfaceManager.VideoMemoryBreakdown) this.InternalComputeBreakdown(); - - internal abstract EffectTemplate CreateEffectTemplate(string stName); - - internal Image CreateImage(string identifier, ContentNotifyHandler handler) => new Image(this.m_session, this.m_manSurfaces, identifier, handler, this.m_sizeGutterPxl); - - protected virtual object InternalComputeBreakdown() => (object) new SurfaceManager.VideoMemoryBreakdown(); - - private void RestoreAllSurfaces() - { - this.m_session.AssertOwningThread(); - foreach (SurfacePool liveObject in this.m_trackerSurfacePools.LiveObjects) - liveObject.Restore(); - } - - protected abstract void RestartRendering(uint nRenderGeneration); - - void IDeviceCallback.OnCreated(RENDERHANDLE target, bool fAllowDynamicPool) - { - this.m_fCreated = true; - this.m_fAllowDynamicPool = fAllowDynamicPool; - } - - void IDeviceCallback.OnLostDevice( - RENDERHANDLE target, - uint cRenderGeneration, - bool fLost) - { - if (fLost) - { - this.m_cRenderGeneration = cRenderGeneration; - } - else - { - this.ResetDeviceContent(); - if (this.m_fQueuedRestart) - return; - this.m_session.DeferredInvoke((Delegate) this.m_cbRestartRenderer, (object) null, DeferredInvokePriority.Low); - this.m_fQueuedRestart = true; - } - } - - internal virtual void ResetDeviceContent() - { - if (this.m_manSurfaces != null) - this.m_manSurfaces.CollectDeadSurfaces(); - this.RestoreAllSurfaces(); - } - - void IDeviceCallback.OnVsaBlock(RENDERHANDLE target, bool fInBlock) => this.m_fInVsaBlock = fInBlock; - - void IDeviceCallback.OnSurfacePoolAllocation( - RENDERHANDLE target, - RENDERHANDLE idSurfacePool, - SurfacePoolAllocationResult nResult) - { - IRenderHandleOwner handleOwner = this.Session.RenderingPort.TryGetHandleOwner(idSurfacePool); - if (handleOwner == null) - return; - if (handleOwner is SurfacePool surfacePool) - surfacePool.NotifyAllocation(nResult); - else - Debug2.Throw(false, "invalid surface pool owner"); - } - - private void OnRestartRenderer(object arg) - { - this.RestartRendering(this.m_cRenderGeneration); - this.m_fQueuedRestart = false; - } - - public virtual void RenderNowIfPossible() - { - } - - public void BeginCaptureBackBuffer(string stFileName) - { - Debug2.Validate(!this.m_fBeginCaptureBackBuffer, typeof (InvalidOperationException), "BeginCaptureBackBuffer() called but m_fBeginCaptureBackBuffer = true"); - Debug2.Validate(!this.m_fEndCaptureBackBuffer, typeof (InvalidOperationException), "EndCaptureBackBuffer() called but m_fEndCaptureBackBuffer = true"); - this.m_fBeginCaptureBackBuffer = true; - this.RemoteDevice.SendBeginCaptureBackBuffer(stFileName); - } - - public void EndCaptureBackBuffer() - { - Debug2.Validate(this.m_fBeginCaptureBackBuffer, typeof (InvalidOperationException), "BeginCaptureBackBuffer() called but m_fBeginCaptureBackBuffer = false"); - Debug2.Validate(!this.m_fEndCaptureBackBuffer, typeof (InvalidOperationException), "EndCaptureBackBuffer() called but m_fEndCaptureBackBuffer = true"); - this.m_session.DeferredInvoke((Delegate) new DeferredHandler(this.DeferredEndCaptureBackBuffer), (object) null, DeferredInvokePriority.VisualUpdate); - } - - private void DeferredEndCaptureBackBuffer(object args) - { - Debug2.Validate(this.m_fBeginCaptureBackBuffer, typeof (InvalidOperationException), "DeferredEndCaptureBackBuffer() called but m_fBeginCaptureBackBuffer = false"); - Debug2.Validate(!this.m_fEndCaptureBackBuffer, typeof (InvalidOperationException), "DeferredEndCaptureBackBuffer() called but m_fEndCaptureBackBuffer = true"); - this.m_fEndCaptureBackBuffer = true; - this.RemoteDevice.SendEndCaptureBackBuffer(); - } - - void IDeviceCallback.OnBackBufferCaptured(RENDERHANDLE target) - { - Debug2.Validate(this.BackBufferCapturedEvent != null, typeof (InvalidOperationException), "No event handler registered: BackBufferCapturedEvent = null"); - this.m_fBeginCaptureBackBuffer = false; - this.m_fEndCaptureBackBuffer = false; - this.BackBufferCapturedEvent(); - } - - public void TriggerDeviceReset() => this.RemoteDevice.SendTriggerDeviceReset(); - - public event BackBufferCapturedHandler BackBufferCapturedEvent; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/IDynamicBlock.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/IDynamicBlock.cs index d6131ee..7ac5db8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/IDynamicBlock.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/IDynamicBlock.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render.Graphics { - internal interface IDynamicBlock - { - int NearEdge { get; } + internal interface IDynamicBlock + { + int NearEdge { get; } - int FarEdge { get; } - } + int FarEdge { get; } + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ISurfaceContentOwner.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ISurfaceContentOwner.cs index 248983c..8714cd1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ISurfaceContentOwner.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ISurfaceContentOwner.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render.Graphics { - internal interface ISurfaceContentOwner - { - void OnSurfaceDisposed(Surface surface); + internal interface ISurfaceContentOwner + { + void OnSurfaceDisposed(Surface surface); - void OnRestoreContent(Surface surface); - } + void OnRestoreContent(Surface surface); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ITreeOwner.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ITreeOwner.cs index d92b30d..6a8238f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ITreeOwner.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ITreeOwner.cs @@ -6,8 +6,8 @@ namespace Microsoft.Iris.Render.Graphics { - internal interface ITreeOwner - { - TreeNode Root { get; } - } + internal interface ITreeOwner + { + TreeNode Root { get; } + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/IVideoPoolNotification.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/IVideoPoolNotification.cs index b638303..b5b976a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/IVideoPoolNotification.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/IVideoPoolNotification.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render.Graphics { - internal interface IVideoPoolNotification - { - void InvalidateClients(); + internal interface IVideoPoolNotification + { + void InvalidateClients(); - void NotifySourceChanged(Size sizeTargetPxl, Size sizeAspectRatio); - } + void NotifySourceChanged(Size sizeTargetPxl, Size sizeAspectRatio); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Image.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Image.cs index 0977a38..4935033 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Image.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Image.cs @@ -13,262 +13,262 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Graphics { - internal class Image : SharedResource, IImage, ISharedRenderObject, ISurfaceContentOwner - { - private SurfaceManager m_surfaceManager; - private Surface m_surface; - private ImageFormat m_imageFormat; - private Size m_sizeImage; - private Size m_sizeGutterPxl; - private DataBufferTracker m_dataTracker; - private ContentNotifyHandler m_handlerContent; - private string m_stIdentifier; - private ImageLoadInfo m_loadInfo; - private bool m_insideReleaseCallback; - - internal Image( - RenderSession session, - SurfaceManager surfaceManager, - string identifier, - ContentNotifyHandler handler, - Size sizeGutter) - : base(session) + internal class Image : SharedResource, IImage, ISharedRenderObject, ISurfaceContentOwner { - session.AssertOwningThread(); - this.m_session = session; - this.m_surfaceManager = surfaceManager; - this.m_stIdentifier = identifier; - this.m_handlerContent = handler; - this.m_sizeGutterPxl = sizeGutter; - } + private SurfaceManager m_surfaceManager; + private Surface m_surface; + private ImageFormat m_imageFormat; + private Size m_sizeImage; + private Size m_sizeGutterPxl; + private DataBufferTracker m_dataTracker; + private ContentNotifyHandler m_handlerContent; + private string m_stIdentifier; + private ImageLoadInfo m_loadInfo; + private bool m_insideReleaseCallback; - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose && this.m_dataTracker != null) - MessagingSession.Current.ReturnDataBufferTracker(this.m_dataTracker); - this.m_surface = (Surface) null; - this.m_surfaceManager = (SurfaceManager) null; - this.m_dataTracker = (DataBufferTracker) null; - this.m_handlerContent = (ContentNotifyHandler) null; - this.m_session = (RenderSession) null; - } - finally - { - base.Dispose(fInDispose); - } - } - - internal Size Size => this.m_sizeImage; - - internal ImageFormat Format => this.m_imageFormat; - - internal Surface Surface => this.m_surface; - - internal string Identifier => this.m_stIdentifier; - - internal Size GutterSize - { - get => this.m_sizeGutterPxl; - set - { - if (value.Width <= this.m_sizeGutterPxl.Width && value.Height <= this.m_sizeGutterPxl.Height) - return; - this.m_sizeGutterPxl.Width = Math.Max(value.Width, this.m_sizeGutterPxl.Width); - this.m_sizeGutterPxl.Height = Math.Max(value.Height, this.m_sizeGutterPxl.Height); - if (!this.InUse) - return; - this.AcquireContent(); - } - } - - void ISurfaceContentOwner.OnSurfaceDisposed(Surface surface) - { - if (this.m_surface != surface) - return; - this.m_surface = (Surface) null; - } - - void ISurfaceContentOwner.OnRestoreContent(Surface surface) - { - if (this.m_surface != surface) - return; - this.AcquireContent(); - } - - Size IImage.Size => this.m_sizeImage; - - ImageFormat IImage.Format => this.m_imageFormat; - - string IImage.Identifier => this.m_stIdentifier; - - bool IImage.LoadContent( - ImageFormat imageFormat, - Size sizeImage, - int nStride, - IntPtr rgData) - { - this.m_session.AssertOwningThread(); - bool flag1 = false; - bool flag2 = false; - DataBuffer buffer = (DataBuffer) null; - try - { - SurfaceFormat nFormat = SurfaceFormatInfo.FromImageFormat(imageFormat); - if (nFormat == SurfaceFormat.RGB32) - nFormat = SurfaceFormat.ARGB32; - if (this.m_surface != null && (this.m_imageFormat != imageFormat || this.m_sizeImage != sizeImage || this.m_sizeGutterPxl != this.m_surface.GutterSize)) + internal Image( + RenderSession session, + SurfaceManager surfaceManager, + string identifier, + ContentNotifyHandler handler, + Size sizeGutter) + : base(session) { - if (this.InUse) - this.m_surface.RemoveActiveUser((object) this); - this.m_surface = (Surface) null; + session.AssertOwningThread(); + this.m_session = session; + this.m_surfaceManager = surfaceManager; + this.m_stIdentifier = identifier; + this.m_handlerContent = handler; + this.m_sizeGutterPxl = sizeGutter; } - if (this.m_surface == null) + + protected override void Dispose(bool fInDispose) { - this.m_surface = this.m_surfaceManager.RequestSurface((ISurfaceContentOwner) this, nFormat, sizeImage, this.m_sizeGutterPxl); - flag2 = true; - if (this.InUse) - this.m_surface.AddActiveUser((object) this); + try + { + if (fInDispose && this.m_dataTracker != null) + MessagingSession.Current.ReturnDataBufferTracker(this.m_dataTracker); + this.m_surface = (Surface)null; + this.m_surfaceManager = (SurfaceManager)null; + this.m_dataTracker = (DataBufferTracker)null; + this.m_handlerContent = (ContentNotifyHandler)null; + this.m_session = (RenderSession)null; + } + finally + { + base.Dispose(fInDispose); + } } - IntPtr num1 = IntPtr.Zero; - if (this.m_session.IsForeignByteOrderOnWindowing) + + internal Size Size => this.m_sizeImage; + + internal ImageFormat Format => this.m_imageFormat; + + internal Surface Surface => this.m_surface; + + internal string Identifier => this.m_stIdentifier; + + internal Size GutterSize { - int bitsPerPixel = SurfaceFormatInfo.GetBitsPerPixel(nFormat); - int num2 = sizeImage.Height * nStride; - num1 = Marshal.AllocHGlobal(num2); - Memory.ConvertEndian(num1, rgData, num2, bitsPerPixel); + get => this.m_sizeGutterPxl; + set + { + if (value.Width <= this.m_sizeGutterPxl.Width && value.Height <= this.m_sizeGutterPxl.Height) + return; + this.m_sizeGutterPxl.Width = Math.Max(value.Width, this.m_sizeGutterPxl.Width); + this.m_sizeGutterPxl.Height = Math.Max(value.Height, this.m_sizeGutterPxl.Height); + if (!this.InUse) + return; + this.AcquireContent(); + } } - 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); - this.Track(buffer, num1, rgData, nStride); - buffer.Commit(); - ++this.m_loadInfo.nLoadsInProgress; - ImageHeader header; - header.sizeActualPxl = this.m_sizeImage; - header.sizeOriginalPxl = this.m_sizeImage; - header.nStride = nStride; - header.nFormat = nFormat; - this.m_session.LoadSurface(buffer, this.m_surface, header); - if (flag2 && this.ContentReloadedEvent != null) - this.ContentReloadedEvent(this); - flag1 = true; - return flag1; - } - finally - { - if (!flag1) + + void ISurfaceContentOwner.OnSurfaceDisposed(Surface surface) { - if (buffer != null) - this.StopTracking(buffer); - this.m_surface = (Surface) null; + if (this.m_surface != surface) + return; + this.m_surface = (Surface)null; } - } - } - internal event Image.ContentReloadedHandler ContentReloadedEvent; - - private void AcquireContent() - { - Debug2.Validate(!this.m_insideReleaseCallback, typeof (InvalidOperationException), "AcquireContent must not be called while inside ContentNotify(Release) callback"); - ContentNotifyHandler handlerContent = this.m_handlerContent; - if (this.m_handlerContent != null) - { - if (this.m_loadInfo != null && this.m_loadInfo.nLoadsInProgress > 0) + void ISurfaceContentOwner.OnRestoreContent(Surface surface) { - ++this.m_loadInfo.nSystemLoadRequests; - ((IImage) this).LoadContent(this.m_imageFormat, this.m_sizeImage, this.m_loadInfo.nStride, this.m_loadInfo.rgAppData); + if (this.m_surface != surface) + return; + this.AcquireContent(); } - else - this.m_handlerContent(ContentNotification.Acquire, (IImage) this, IntPtr.Zero); - } - Surface surface = this.m_surface; - } - protected override void OnUsageChange(bool fUsed) - { - if (fUsed) - { - if (this.m_surface == null) - this.AcquireContent(); - else - this.m_surface.AddActiveUser((object) this); - } - else - { - if (this.m_surface == null) - return; - this.m_surface.RemoveActiveUser((object) this); - } - } + Size IImage.Size => this.m_sizeImage; - private void Track(DataBuffer buffer, IntPtr rgConvertData, IntPtr rgAppData, int nStride) - { - ImageLoadInfo imageLoadInfo; - if (this.m_loadInfo != null && this.m_loadInfo.rgAppData == rgAppData && this.m_loadInfo.nStride == nStride) - { - imageLoadInfo = this.m_loadInfo; - } - else - { - imageLoadInfo = new ImageLoadInfo(); - imageLoadInfo.imageOwner = this; - imageLoadInfo.nLoadsInProgress = 0; - imageLoadInfo.nSystemLoadRequests = 0; - imageLoadInfo.handlerNotify = this.m_handlerContent; - imageLoadInfo.rgAppData = rgAppData; - imageLoadInfo.nStride = nStride; - if (this.m_dataTracker != null) + ImageFormat IImage.Format => this.m_imageFormat; + + string IImage.Identifier => this.m_stIdentifier; + + bool IImage.LoadContent( + ImageFormat imageFormat, + Size sizeImage, + int nStride, + IntPtr rgData) { - MessagingSession.Current.ReturnDataBufferTracker(this.m_dataTracker); - this.m_dataTracker = (DataBufferTracker) null; + this.m_session.AssertOwningThread(); + bool flag1 = false; + bool flag2 = false; + DataBuffer buffer = (DataBuffer)null; + try + { + SurfaceFormat nFormat = SurfaceFormatInfo.FromImageFormat(imageFormat); + if (nFormat == SurfaceFormat.RGB32) + nFormat = SurfaceFormat.ARGB32; + if (this.m_surface != null && (this.m_imageFormat != imageFormat || this.m_sizeImage != sizeImage || this.m_sizeGutterPxl != this.m_surface.GutterSize)) + { + if (this.InUse) + this.m_surface.RemoveActiveUser((object)this); + this.m_surface = (Surface)null; + } + if (this.m_surface == null) + { + this.m_surface = this.m_surfaceManager.RequestSurface((ISurfaceContentOwner)this, nFormat, sizeImage, this.m_sizeGutterPxl); + flag2 = true; + if (this.InUse) + this.m_surface.AddActiveUser((object)this); + } + IntPtr num1 = IntPtr.Zero; + 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); + } + 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); + this.Track(buffer, num1, rgData, nStride); + buffer.Commit(); + ++this.m_loadInfo.nLoadsInProgress; + ImageHeader header; + header.sizeActualPxl = this.m_sizeImage; + header.sizeOriginalPxl = this.m_sizeImage; + header.nStride = nStride; + header.nFormat = nFormat; + this.m_session.LoadSurface(buffer, this.m_surface, header); + if (flag2 && this.ContentReloadedEvent != null) + this.ContentReloadedEvent(this); + flag1 = true; + return flag1; + } + finally + { + if (!flag1) + { + if (buffer != null) + this.StopTracking(buffer); + this.m_surface = (Surface)null; + } + } } - this.m_dataTracker = MessagingSession.Current.CreateDataBufferTracker((object) this); - } - DataBufferCleanupInfo bufferCleanupInfo = new DataBufferCleanupInfo(); - bufferCleanupInfo.rgConvertData = rgConvertData; - bufferCleanupInfo.imageLoadInfo = imageLoadInfo; - DataBufferTracker.CleanupEventHandler handler = new DataBufferTracker.CleanupEventHandler(Image.OnDataBufferConsumed); - this.m_dataTracker.Track(buffer, handler, (object) bufferCleanupInfo); - this.m_loadInfo = imageLoadInfo; - } - private void StopTracking(DataBuffer buffer) - { - if (this.m_dataTracker == null) - return; - this.m_dataTracker.Release(buffer, DataBufferTracker.Users.Valid); - } + internal event Image.ContentReloadedHandler ContentReloadedEvent; - private static void OnDataBufferConsumed(object sender, DataBufferTracker.CleanupEventArgs args) - { - DataBufferCleanupInfo contextData = (DataBufferCleanupInfo) args.ContextData; - ImageLoadInfo imageLoadInfo = contextData.imageLoadInfo; - --imageLoadInfo.nLoadsInProgress; - if (imageLoadInfo.nSystemLoadRequests > 0) - { - --imageLoadInfo.nSystemLoadRequests; - } - else - { - if (imageLoadInfo.handlerNotify != null) + private void AcquireContent() { - imageLoadInfo.imageOwner.m_insideReleaseCallback = true; - imageLoadInfo.handlerNotify(ContentNotification.Release, (IImage) imageLoadInfo.imageOwner, imageLoadInfo.rgAppData); - imageLoadInfo.imageOwner.m_insideReleaseCallback = false; + Debug2.Validate(!this.m_insideReleaseCallback, typeof(InvalidOperationException), "AcquireContent must not be called while inside ContentNotify(Release) callback"); + ContentNotifyHandler handlerContent = this.m_handlerContent; + if (this.m_handlerContent != null) + { + if (this.m_loadInfo != null && this.m_loadInfo.nLoadsInProgress > 0) + { + ++this.m_loadInfo.nSystemLoadRequests; + ((IImage)this).LoadContent(this.m_imageFormat, this.m_sizeImage, this.m_loadInfo.nStride, this.m_loadInfo.rgAppData); + } + else + this.m_handlerContent(ContentNotification.Acquire, (IImage)this, IntPtr.Zero); + } + Surface surface = this.m_surface; } - imageLoadInfo.rgAppData = IntPtr.Zero; - imageLoadInfo.handlerNotify = (ContentNotifyHandler) null; - imageLoadInfo.imageOwner = (Image) null; - } - if (!(contextData.rgConvertData != IntPtr.Zero)) - return; - Marshal.FreeHGlobal(contextData.rgConvertData); - contextData.rgConvertData = IntPtr.Zero; - } - internal delegate void ContentReloadedHandler(Image image); - } + protected override void OnUsageChange(bool fUsed) + { + if (fUsed) + { + if (this.m_surface == null) + this.AcquireContent(); + else + this.m_surface.AddActiveUser((object)this); + } + else + { + if (this.m_surface == null) + return; + this.m_surface.RemoveActiveUser((object)this); + } + } + + private void Track(DataBuffer buffer, IntPtr rgConvertData, IntPtr rgAppData, int nStride) + { + ImageLoadInfo imageLoadInfo; + if (this.m_loadInfo != null && this.m_loadInfo.rgAppData == rgAppData && this.m_loadInfo.nStride == nStride) + { + imageLoadInfo = this.m_loadInfo; + } + else + { + imageLoadInfo = new ImageLoadInfo(); + imageLoadInfo.imageOwner = this; + imageLoadInfo.nLoadsInProgress = 0; + imageLoadInfo.nSystemLoadRequests = 0; + imageLoadInfo.handlerNotify = this.m_handlerContent; + imageLoadInfo.rgAppData = rgAppData; + imageLoadInfo.nStride = nStride; + if (this.m_dataTracker != null) + { + MessagingSession.Current.ReturnDataBufferTracker(this.m_dataTracker); + this.m_dataTracker = (DataBufferTracker)null; + } + this.m_dataTracker = MessagingSession.Current.CreateDataBufferTracker((object)this); + } + DataBufferCleanupInfo bufferCleanupInfo = new DataBufferCleanupInfo(); + bufferCleanupInfo.rgConvertData = rgConvertData; + bufferCleanupInfo.imageLoadInfo = imageLoadInfo; + DataBufferTracker.CleanupEventHandler handler = new DataBufferTracker.CleanupEventHandler(Image.OnDataBufferConsumed); + this.m_dataTracker.Track(buffer, handler, (object)bufferCleanupInfo); + this.m_loadInfo = imageLoadInfo; + } + + private void StopTracking(DataBuffer buffer) + { + if (this.m_dataTracker == null) + return; + this.m_dataTracker.Release(buffer, DataBufferTracker.Users.Valid); + } + + private static void OnDataBufferConsumed(object sender, DataBufferTracker.CleanupEventArgs args) + { + DataBufferCleanupInfo contextData = (DataBufferCleanupInfo)args.ContextData; + ImageLoadInfo imageLoadInfo = contextData.imageLoadInfo; + --imageLoadInfo.nLoadsInProgress; + if (imageLoadInfo.nSystemLoadRequests > 0) + { + --imageLoadInfo.nSystemLoadRequests; + } + else + { + if (imageLoadInfo.handlerNotify != null) + { + imageLoadInfo.imageOwner.m_insideReleaseCallback = true; + imageLoadInfo.handlerNotify(ContentNotification.Release, (IImage)imageLoadInfo.imageOwner, imageLoadInfo.rgAppData); + imageLoadInfo.imageOwner.m_insideReleaseCallback = false; + } + imageLoadInfo.rgAppData = IntPtr.Zero; + imageLoadInfo.handlerNotify = (ContentNotifyHandler)null; + imageLoadInfo.imageOwner = (Image)null; + } + if (!(contextData.rgConvertData != IntPtr.Zero)) + return; + Marshal.FreeHGlobal(contextData.rgConvertData); + contextData.rgConvertData = IntPtr.Zero; + } + + 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 7ba8de8..ef115d0 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ImageLoadInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ImageLoadInfo.cs @@ -8,13 +8,13 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal class ImageLoadInfo - { - public Image imageOwner; - public IntPtr rgAppData; - public int nStride; - public int nLoadsInProgress; - public int nSystemLoadRequests; - public ContentNotifyHandler handlerNotify; - } + internal class ImageLoadInfo + { + public Image imageOwner; + public IntPtr rgAppData; + public int nStride; + public int nLoadsInProgress; + public int nSystemLoadRequests; + public ContentNotifyHandler handlerNotify; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/NtGraphicsDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/NtGraphicsDevice.cs index 712fe85..bada603 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/NtGraphicsDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/NtGraphicsDevice.cs @@ -13,139 +13,139 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal sealed class NtGraphicsDevice : Dx9GraphicsDevice, IRenderHandleOwner - { - private RemoteNtDevice m_remoteDevice; - private float m_flDisplayOverscan; - private float m_flMaxOverscan; - - internal NtGraphicsDevice(RenderSession session, GraphicsRenderingQuality renderingQuality) - : base(session, "Nt Dx9", GraphicsDeviceType.Direct3D9, renderingQuality) - => this.m_remoteDevice = session.BuildRemoteNtDevice(this); - - protected override void Dispose(bool fInDispose) + internal sealed class NtGraphicsDevice : Dx9GraphicsDevice, IRenderHandleOwner { - try - { - if (fInDispose && this.m_remoteDevice != null) - this.m_remoteDevice.Dispose(); - this.m_remoteDevice = (RemoteNtDevice) null; - } - finally - { - base.Dispose(fInDispose); - } + private RemoteNtDevice m_remoteDevice; + private float m_flDisplayOverscan; + private float m_flMaxOverscan; + + internal NtGraphicsDevice(RenderSession session, GraphicsRenderingQuality renderingQuality) + : base(session, "Nt Dx9", GraphicsDeviceType.Direct3D9, renderingQuality) + => this.m_remoteDevice = session.BuildRemoteNtDevice(this); + + protected override void Dispose(bool fInDispose) + { + try + { + if (fInDispose && this.m_remoteDevice != null) + this.m_remoteDevice.Dispose(); + this.m_remoteDevice = (RemoteNtDevice)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteDevice.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteDevice = (RemoteNtDevice)null; + + internal RemoteNtDevice RemoteStub => this.m_remoteDevice; + + internal override RemoteDevice RemoteDevice => (RemoteDevice)this.m_remoteDevice; + + public Size EstimatedMaxPerformantResolution + { + get + { + Debug2.Validate(this.SurfaceManager != null, typeof(InvalidOperationException), "Dx9 driver must be fully initialized before querying resolution performance"); + return this.SurfaceManager.EstimatedMaxPerformantResolution; + } + } + + public float DisplayOverscan + { + get => this.m_flDisplayOverscan; + set + { + if (Math2.WithinEpsilon(this.m_flDisplayOverscan, value)) + return; + this.m_flDisplayOverscan = value; + this.m_remoteDevice.SendSetDisplayOverscan(value); + } + } + + public float MaxOverscan + { + get => this.m_flMaxOverscan; + set + { + if (Math2.WithinEpsilon(this.m_flMaxOverscan, value)) + return; + this.m_flMaxOverscan = value; + this.m_remoteDevice.SendSetMaxOverscan(value); + } + } + + public override void PostCreate() + { + base.PostCreate(); + SurfaceFormat nFormat = SurfaceFormat.ARGB32; + this.m_remoteDevice.SendCreateTransferBuffer(new Size(2048, 512), nFormat); + for (int index = 0; index < 2; ++index) + this.m_remoteDevice.SendCreateTransferBuffer(new Size(1024, 256), nFormat); + for (int index = 0; index < 4; ++index) + this.m_remoteDevice.SendCreateTransferBuffer(new Size(256, 256), nFormat); + for (int index = 0; index < 8; ++index) + this.m_remoteDevice.SendCreateTransferBuffer(new Size(128, 64), nFormat); + } + + internal override bool IsSurfaceFormatSupported(SurfaceFormat nFormat) + { + switch (nFormat) + { + case SurfaceFormat.A8: + case SurfaceFormat.RGB24: + case SurfaceFormat.RGB32: + case SurfaceFormat.ARGB32: + return true; + case SurfaceFormat.External: + return true; + default: + return false; + } + } + + protected override void CreateSurfacePoolWorker( + object oSurfacePool, + object oHandle, + SurfaceFormat nFormat) + { + this.m_remoteDevice.SendCreateSurfacePool((RENDERHANDLE)oHandle, nFormat); + } + + internal override void CreateVideoPoolWorker(object oSurfacePool, object oHandle) => this.m_remoteDevice.SendCreateVideoPool(this.m_session.RenderingProtocol.LocalVideoPoolCallbackHandle, (RENDERHANDLE)oHandle); + + protected override void RestartRendering(uint nRenderGeneration) => this.m_remoteDevice.SendRestart(nRenderGeneration); + + public override void RenderNowIfPossible() => this.m_remoteDevice.SendRenderNowIfPossible(); + + private static uint GetPixelCB(Size sizeSurfacePxl) => (uint)(Math2.FindPowerOf2(sizeSurfacePxl.Width) * Math2.FindPowerOf2(sizeSurfacePxl.Height) * 4); + + protected override object InternalComputeBreakdown() + { + SurfaceManager.VideoMemoryBreakdown videoMemoryBreakdown = new SurfaceManager.VideoMemoryBreakdown(); + ulong totalVideoMemory = this.m_graphicsCaps.TotalVideoMemory; + ulong dedicatedVideoMemory = this.m_graphicsCaps.DedicatedVideoMemory; + ulong num1 = totalVideoMemory; + videoMemoryBreakdown.sizeBuffersPxl = new Size(Win32Api.GetSystemMetrics(0), Win32Api.GetSystemMetrics(1)); + Size sizeSurfacePxl = new Size(1280, 1024); + if (totalVideoMemory > 67108864UL) + sizeSurfacePxl = totalVideoMemory <= 134217728UL ? new Size(1920, 1280) : new Size(2048, 1600); + videoMemoryBreakdown.sizeLargeBuffersPxl = sizeSurfacePxl; + uint num2 = NtGraphicsDevice.GetPixelCB(sizeSurfacePxl) * 3U; + ulong num3 = num1 - (ulong)num2; + videoMemoryBreakdown.cbVideo = 16777216U; + ulong num4 = num3 - (ulong)videoMemoryBreakdown.cbVideo; + videoMemoryBreakdown.sizeBackgroundPxl = new Size(1024, 768); + uint pixelCb = NtGraphicsDevice.GetPixelCB(videoMemoryBreakdown.sizeBackgroundPxl); + ulong num5 = num4 - (ulong)pixelCb - totalVideoMemory / 20UL; + videoMemoryBreakdown.sizeDynamicPoolPxl = dedicatedVideoMemory >= 121634816UL ? new Size(2048, 2048) : new Size(1920, 548); + uint num6 = (uint)(videoMemoryBreakdown.sizeDynamicPoolPxl.Width * videoMemoryBreakdown.sizeDynamicPoolPxl.Height * 4); + for (uint index = 33554432; videoMemoryBreakdown.cbMinimumPool < index && num5 > (ulong)num6; num5 -= (ulong)num6) + videoMemoryBreakdown.cbMinimumPool += num6; + return (object)videoMemoryBreakdown; + } } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteDevice.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteDevice = (RemoteNtDevice) null; - - internal RemoteNtDevice RemoteStub => this.m_remoteDevice; - - internal override RemoteDevice RemoteDevice => (RemoteDevice) this.m_remoteDevice; - - public Size EstimatedMaxPerformantResolution - { - get - { - Debug2.Validate(this.SurfaceManager != null, typeof (InvalidOperationException), "Dx9 driver must be fully initialized before querying resolution performance"); - return this.SurfaceManager.EstimatedMaxPerformantResolution; - } - } - - public float DisplayOverscan - { - get => this.m_flDisplayOverscan; - set - { - if (Math2.WithinEpsilon(this.m_flDisplayOverscan, value)) - return; - this.m_flDisplayOverscan = value; - this.m_remoteDevice.SendSetDisplayOverscan(value); - } - } - - public float MaxOverscan - { - get => this.m_flMaxOverscan; - set - { - if (Math2.WithinEpsilon(this.m_flMaxOverscan, value)) - return; - this.m_flMaxOverscan = value; - this.m_remoteDevice.SendSetMaxOverscan(value); - } - } - - public override void PostCreate() - { - base.PostCreate(); - SurfaceFormat nFormat = SurfaceFormat.ARGB32; - this.m_remoteDevice.SendCreateTransferBuffer(new Size(2048, 512), nFormat); - for (int index = 0; index < 2; ++index) - this.m_remoteDevice.SendCreateTransferBuffer(new Size(1024, 256), nFormat); - for (int index = 0; index < 4; ++index) - this.m_remoteDevice.SendCreateTransferBuffer(new Size(256, 256), nFormat); - for (int index = 0; index < 8; ++index) - this.m_remoteDevice.SendCreateTransferBuffer(new Size(128, 64), nFormat); - } - - internal override bool IsSurfaceFormatSupported(SurfaceFormat nFormat) - { - switch (nFormat) - { - case SurfaceFormat.A8: - case SurfaceFormat.RGB24: - case SurfaceFormat.RGB32: - case SurfaceFormat.ARGB32: - return true; - case SurfaceFormat.External: - return true; - default: - return false; - } - } - - protected override void CreateSurfacePoolWorker( - object oSurfacePool, - object oHandle, - SurfaceFormat nFormat) - { - this.m_remoteDevice.SendCreateSurfacePool((RENDERHANDLE) oHandle, nFormat); - } - - internal override void CreateVideoPoolWorker(object oSurfacePool, object oHandle) => this.m_remoteDevice.SendCreateVideoPool(this.m_session.RenderingProtocol.LocalVideoPoolCallbackHandle, (RENDERHANDLE) oHandle); - - protected override void RestartRendering(uint nRenderGeneration) => this.m_remoteDevice.SendRestart(nRenderGeneration); - - public override void RenderNowIfPossible() => this.m_remoteDevice.SendRenderNowIfPossible(); - - private static uint GetPixelCB(Size sizeSurfacePxl) => (uint) (Math2.FindPowerOf2(sizeSurfacePxl.Width) * Math2.FindPowerOf2(sizeSurfacePxl.Height) * 4); - - protected override object InternalComputeBreakdown() - { - SurfaceManager.VideoMemoryBreakdown videoMemoryBreakdown = new SurfaceManager.VideoMemoryBreakdown(); - ulong totalVideoMemory = this.m_graphicsCaps.TotalVideoMemory; - ulong dedicatedVideoMemory = this.m_graphicsCaps.DedicatedVideoMemory; - ulong num1 = totalVideoMemory; - videoMemoryBreakdown.sizeBuffersPxl = new Size(Win32Api.GetSystemMetrics(0), Win32Api.GetSystemMetrics(1)); - Size sizeSurfacePxl = new Size(1280, 1024); - if (totalVideoMemory > 67108864UL) - sizeSurfacePxl = totalVideoMemory <= 134217728UL ? new Size(1920, 1280) : new Size(2048, 1600); - videoMemoryBreakdown.sizeLargeBuffersPxl = sizeSurfacePxl; - uint num2 = NtGraphicsDevice.GetPixelCB(sizeSurfacePxl) * 3U; - ulong num3 = num1 - (ulong) num2; - videoMemoryBreakdown.cbVideo = 16777216U; - ulong num4 = num3 - (ulong) videoMemoryBreakdown.cbVideo; - videoMemoryBreakdown.sizeBackgroundPxl = new Size(1024, 768); - uint pixelCb = NtGraphicsDevice.GetPixelCB(videoMemoryBreakdown.sizeBackgroundPxl); - ulong num5 = num4 - (ulong) pixelCb - totalVideoMemory / 20UL; - videoMemoryBreakdown.sizeDynamicPoolPxl = dedicatedVideoMemory >= 121634816UL ? new Size(2048, 2048) : new Size(1920, 548); - uint num6 = (uint) (videoMemoryBreakdown.sizeDynamicPoolPxl.Width * videoMemoryBreakdown.sizeDynamicPoolPxl.Height * 4); - for (uint index = 33554432; videoMemoryBreakdown.cbMinimumPool < index && num5 > (ulong) num6; num5 -= (ulong) num6) - videoMemoryBreakdown.cbMinimumPool += num6; - return (object) videoMemoryBreakdown; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/NullGraphicsDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/NullGraphicsDevice.cs index 357e49f..aee90dd 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/NullGraphicsDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/NullGraphicsDevice.cs @@ -11,53 +11,53 @@ using Microsoft.Iris.Render.Protocols.Splash.Rendering; namespace Microsoft.Iris.Render.Graphics { - internal sealed class NullGraphicsDevice : GraphicsDevice, IRenderHandleOwner - { - private RemoteNullDevice m_remoteDevice; - - internal NullGraphicsDevice(RenderSession session, bool fUseSplitWindowingPort) - : base(session, "Null") + internal sealed class NullGraphicsDevice : GraphicsDevice, IRenderHandleOwner { - session.AssertOwningThread(); - this.m_remoteDevice = session.BuildRemoteNullDevice(this, fUseSplitWindowingPort); + private RemoteNullDevice m_remoteDevice; + + internal NullGraphicsDevice(RenderSession session, bool fUseSplitWindowingPort) + : base(session, "Null") + { + session.AssertOwningThread(); + this.m_remoteDevice = session.BuildRemoteNullDevice(this, fUseSplitWindowingPort); + } + + protected override void Dispose(bool fInDispose) + { + if (fInDispose && this.m_remoteDevice != null) + this.m_remoteDevice.Dispose(); + this.m_remoteDevice = (RemoteNullDevice)null; + base.Dispose(fInDispose); + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteDevice.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteDevice = (RemoteNullDevice)null; + + public override bool IsVideoComposited => false; + + internal override RemoteDevice RemoteDevice => (RemoteDevice)this.m_remoteDevice; + + public override bool CanPlayAnimations => false; + + internal override bool IsSurfaceFormatSupported(SurfaceFormat nFormat) => nFormat != SurfaceFormat.None; + + protected override void CreateSurfacePoolWorker( + object oSurfacePool, + object oHandle, + SurfaceFormat nFormat) + { + this.m_remoteDevice.SendCreateSurfacePool((RENDERHANDLE)oHandle, nFormat); + } + + protected override void RestartRendering(uint nRenderGeneration) => this.m_remoteDevice.SendRestart(nRenderGeneration); + + public override bool CanPlayAnimationType(AnimationInputType type) => false; + + internal override EffectTemplate CreateEffectTemplate(string stName) + { + Debug2.Throw(false, "Not yet implemented"); + return (EffectTemplate)null; + } } - - protected override void Dispose(bool fInDispose) - { - if (fInDispose && this.m_remoteDevice != null) - this.m_remoteDevice.Dispose(); - this.m_remoteDevice = (RemoteNullDevice) null; - base.Dispose(fInDispose); - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteDevice.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteDevice = (RemoteNullDevice) null; - - public override bool IsVideoComposited => false; - - internal override RemoteDevice RemoteDevice => (RemoteDevice) this.m_remoteDevice; - - public override bool CanPlayAnimations => false; - - internal override bool IsSurfaceFormatSupported(SurfaceFormat nFormat) => nFormat != SurfaceFormat.None; - - protected override void CreateSurfacePoolWorker( - object oSurfacePool, - object oHandle, - SurfaceFormat nFormat) - { - this.m_remoteDevice.SendCreateSurfacePool((RENDERHANDLE) oHandle, nFormat); - } - - protected override void RestartRendering(uint nRenderGeneration) => this.m_remoteDevice.SendRestart(nRenderGeneration); - - public override bool CanPlayAnimationType(AnimationInputType type) => false; - - internal override EffectTemplate CreateEffectTemplate(string stName) - { - Debug2.Throw(false, "Not yet implemented"); - return (EffectTemplate) null; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/PoolAllocMethod.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/PoolAllocMethod.cs index 5632019..8f8a752 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/PoolAllocMethod.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/PoolAllocMethod.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render.Graphics { - internal enum PoolAllocMethod - { - Available, - New, - ScavengeDead, - CompactDead, - CompactAll, - } + internal enum PoolAllocMethod + { + Available, + New, + ScavengeDead, + CompactDead, + CompactAll, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Sprite.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Sprite.cs index f5bb92b..21eaaf6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Sprite.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Sprite.cs @@ -13,214 +13,214 @@ using System.Collections; namespace Microsoft.Iris.Render.Graphics { - internal class Sprite : Visual, ISprite, IVisual, IRawInputSite, IAnimatable, ISharedRenderObject - { - private RemoteSprite m_remoteSprite; - private Effect m_effect; - - public Sprite(RenderSession session, RenderWindow window, object objOwnerData) - : base(session, window, objOwnerData) + internal class Sprite : Visual, ISprite, IVisual, IRawInputSite, IAnimatable, ISharedRenderObject { - this.m_remoteSprite = session.BuildRemoteSprite(this, window); - this.m_remoteSprite.SendSetVisible(true); - this.m_remoteVisual = (RemoteVisual) this.m_remoteSprite; - } + private RemoteSprite m_remoteSprite; + private Effect m_effect; - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose && this.m_effect != null) + public Sprite(RenderSession session, RenderWindow window, object objOwnerData) + : base(session, window, objOwnerData) { - this.m_effect.UnregisterUsage((object) this); - this.m_effect = (Effect) null; + this.m_remoteSprite = session.BuildRemoteSprite(this, window); + this.m_remoteSprite.SendSetVisible(true); + this.m_remoteVisual = (RemoteVisual)this.m_remoteSprite; } - this.PropertyManager.RemoveCoordmapProp((Visual) this); - this.m_remoteSprite = (RemoteSprite) null; - this.m_effect = (Effect) null; - } - finally - { - base.Dispose(fInDispose); - } - } - Vector3 ISprite.Position - { - get => this.Position; - set => this.Position = value; - } - - Vector2 ISprite.Size - { - get => this.Size; - set => this.Size = value; - } - - bool ISprite.Visible - { - get => this.Visible; - set => this.Visible = value; - } - - Vector3 ISprite.Scale - { - get => this.Scale; - set => this.Scale = value; - } - - AxisAngle ISprite.Rotation - { - get => this.Rotation; - set => this.Rotation = value; - } - - float ISprite.Alpha - { - get => this.Alpha; - set => this.Alpha = value; - } - - Vector3 ISprite.CenterPoint - { - get => this.CenterPointScale; - set => this.CenterPointScale = value; - } - - uint ISprite.Layer - { - get => this.Layer; - set => this.Layer = value; - } - - IEffect ISprite.Effect - { - get => (IEffect) this.Effect; - set => this.Effect = (Effect) value; - } - - internal Effect Effect - { - get => this.m_effect; - set - { - Effect effect = value; - if (this.m_effect == effect) - return; - if (this.m_effect != null) - this.m_effect.UnregisterUsage((object) this); - this.m_effect = effect; - if (this.m_effect != null) - this.m_effect.RegisterUsage((object) this); - this.m_remoteSprite.SendSetEffect(this.m_effect == null ? (RemoteEffect) null : this.m_effect.RemoteStub); - } - } - - bool ISprite.RelativeSize - { - get => this.RelativeSize; - set => this.RelativeSize = value; - } - - void ISprite.AddGradient(IGradient gradient) => this.AddGradient((Gradient) gradient); - - void ISprite.RemoveAllGradients() => this.RemoveAllGradients(); - - void ISprite.SetNineGrid(int left, int top, int right, int bottom) - { - Debug2.Validate(left >= 0 && right >= 0 && top >= 0 && bottom >= 0, typeof (ArgumentNullException), "invalid nine grid params"); - this.PropertyManager.RemoveCoordmapProp((Visual) this); - this.m_remoteSprite.SendSetNineGrid(left, top, right, bottom); - this.SetPropFlag(Visual.PropId.MaxDynamicProp, true); - } - - void ISprite.SetCoordMap(int idxLayer, CoordMap coordMap) - { - Debug2.Validate(idxLayer >= 0, typeof (ArgumentOutOfRangeException), "idxLayer must be >= 0"); - Debug2.Validate(idxLayer < 4, typeof (ArgumentOutOfRangeException), "quick-check, currently we only support 4 layers/stages"); - if (this.IsPropFlagSet(Visual.PropId.MaxDynamicProp)) - { - this.m_remoteSprite.SendClearCoordMaps(); - this.SetPropFlag(Visual.PropId.MaxDynamicProp, false); - } - if (!this.UpdateCoordMap(idxLayer, coordMap)) - return; - this.m_remoteSprite.SendClearCoordMaps(); - if (!this.IsDynamicValueSet(Visual.PropId.CoordMap)) - return; - ArrayList result; - this.PropertyManager.GetCoordmapProp((Visual) this, out result); - 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); - } - } - - private bool UpdateCoordMap(int idxLayer, CoordMap coordMap) - { - ArrayList result; - if (this.IsDynamicValueSet(Visual.PropId.CoordMap)) - { - this.PropertyManager.GetCoordmapProp((Visual) this, out result); - } - else - { - if (coordMap == null) - return false; - result = new ArrayList(); - this.PropertyManager.SetCoordmapProp((Visual) this, result); - } - Sprite.CoordMapEntry coordMapEntry1 = (Sprite.CoordMapEntry) null; - foreach (Sprite.CoordMapEntry coordMapEntry2 in result) - { - if (coordMapEntry2.idxLayer == idxLayer) + protected override void Dispose(bool fInDispose) { - coordMapEntry1 = coordMapEntry2; - break; + try + { + if (fInDispose && this.m_effect != null) + { + this.m_effect.UnregisterUsage((object)this); + this.m_effect = (Effect)null; + } + this.PropertyManager.RemoveCoordmapProp((Visual)this); + this.m_remoteSprite = (RemoteSprite)null; + this.m_effect = (Effect)null; + } + finally + { + base.Dispose(fInDispose); + } } - } - if (coordMapEntry1 == null) - { - if (coordMap == null) - return false; - result.Add((object) new Sprite.CoordMapEntry(idxLayer, coordMap)); - return true; - } - if (coordMap == null) - result.Remove((object) coordMapEntry1); - else - coordMapEntry1.coordMap = coordMap; - return true; - } - private void ResetCoordmaps() - { - if (this.IsPropFlagSet(Visual.PropId.MaxDynamicProp) || this.IsDynamicValueSet(Visual.PropId.CoordMap)) - { - this.m_remoteSprite.SendClearCoordMaps(); - this.SetPropFlag(Visual.PropId.MaxDynamicProp, false); - } - this.PropertyManager.RemoveCoordmapProp((Visual) this); - } + Vector3 ISprite.Position + { + get => this.Position; + set => this.Position = value; + } - internal override void Reset() - { - base.Reset(); - this.ResetCoordmaps(); - this.Effect = (Effect) null; - } + Vector2 ISprite.Size + { + get => this.Size; + set => this.Size = value; + } - private class CoordMapEntry - { - internal int idxLayer; - internal CoordMap coordMap; + bool ISprite.Visible + { + get => this.Visible; + set => this.Visible = value; + } - internal CoordMapEntry(int idxLayerParam, CoordMap coordMapParam) - { - this.idxLayer = idxLayerParam; - this.coordMap = coordMapParam; - } + Vector3 ISprite.Scale + { + get => this.Scale; + set => this.Scale = value; + } + + AxisAngle ISprite.Rotation + { + get => this.Rotation; + set => this.Rotation = value; + } + + float ISprite.Alpha + { + get => this.Alpha; + set => this.Alpha = value; + } + + Vector3 ISprite.CenterPoint + { + get => this.CenterPointScale; + set => this.CenterPointScale = value; + } + + uint ISprite.Layer + { + get => this.Layer; + set => this.Layer = value; + } + + IEffect ISprite.Effect + { + get => (IEffect)this.Effect; + set => this.Effect = (Effect)value; + } + + internal Effect Effect + { + get => this.m_effect; + set + { + Effect effect = value; + if (this.m_effect == effect) + return; + if (this.m_effect != null) + this.m_effect.UnregisterUsage((object)this); + this.m_effect = effect; + if (this.m_effect != null) + this.m_effect.RegisterUsage((object)this); + this.m_remoteSprite.SendSetEffect(this.m_effect == null ? (RemoteEffect)null : this.m_effect.RemoteStub); + } + } + + bool ISprite.RelativeSize + { + get => this.RelativeSize; + set => this.RelativeSize = value; + } + + void ISprite.AddGradient(IGradient gradient) => this.AddGradient((Gradient)gradient); + + void ISprite.RemoveAllGradients() => this.RemoveAllGradients(); + + void ISprite.SetNineGrid(int left, int top, int right, int bottom) + { + Debug2.Validate(left >= 0 && right >= 0 && top >= 0 && bottom >= 0, typeof(ArgumentNullException), "invalid nine grid params"); + this.PropertyManager.RemoveCoordmapProp((Visual)this); + this.m_remoteSprite.SendSetNineGrid(left, top, right, bottom); + this.SetPropFlag(Visual.PropId.MaxDynamicProp, true); + } + + void ISprite.SetCoordMap(int idxLayer, CoordMap coordMap) + { + Debug2.Validate(idxLayer >= 0, typeof(ArgumentOutOfRangeException), "idxLayer must be >= 0"); + Debug2.Validate(idxLayer < 4, typeof(ArgumentOutOfRangeException), "quick-check, currently we only support 4 layers/stages"); + if (this.IsPropFlagSet(Visual.PropId.MaxDynamicProp)) + { + this.m_remoteSprite.SendClearCoordMaps(); + this.SetPropFlag(Visual.PropId.MaxDynamicProp, false); + } + if (!this.UpdateCoordMap(idxLayer, coordMap)) + return; + this.m_remoteSprite.SendClearCoordMaps(); + if (!this.IsDynamicValueSet(Visual.PropId.CoordMap)) + return; + ArrayList result; + this.PropertyManager.GetCoordmapProp((Visual)this, out result); + 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); + } + } + + private bool UpdateCoordMap(int idxLayer, CoordMap coordMap) + { + ArrayList result; + if (this.IsDynamicValueSet(Visual.PropId.CoordMap)) + { + this.PropertyManager.GetCoordmapProp((Visual)this, out result); + } + else + { + if (coordMap == null) + return false; + result = new ArrayList(); + this.PropertyManager.SetCoordmapProp((Visual)this, result); + } + Sprite.CoordMapEntry coordMapEntry1 = (Sprite.CoordMapEntry)null; + foreach (Sprite.CoordMapEntry coordMapEntry2 in result) + { + if (coordMapEntry2.idxLayer == idxLayer) + { + coordMapEntry1 = coordMapEntry2; + break; + } + } + if (coordMapEntry1 == null) + { + if (coordMap == null) + return false; + result.Add((object)new Sprite.CoordMapEntry(idxLayer, coordMap)); + return true; + } + if (coordMap == null) + result.Remove((object)coordMapEntry1); + else + coordMapEntry1.coordMap = coordMap; + return true; + } + + private void ResetCoordmaps() + { + if (this.IsPropFlagSet(Visual.PropId.MaxDynamicProp) || this.IsDynamicValueSet(Visual.PropId.CoordMap)) + { + this.m_remoteSprite.SendClearCoordMaps(); + this.SetPropFlag(Visual.PropId.MaxDynamicProp, false); + } + this.PropertyManager.RemoveCoordmapProp((Visual)this); + } + + internal override void Reset() + { + base.Reset(); + this.ResetCoordmaps(); + this.Effect = (Effect)null; + } + + private class CoordMapEntry + { + internal int idxLayer; + internal CoordMap coordMap; + + internal CoordMapEntry(int idxLayerParam, CoordMap coordMapParam) + { + this.idxLayer = idxLayerParam; + this.coordMap = coordMapParam; + } + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Surface.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Surface.cs index f9d11dd..46b55bf 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Surface.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Surface.cs @@ -11,141 +11,141 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal sealed class Surface : SharedResource, IRenderHandleOwner - { - private ISurfaceContentOwner m_surfaceOwner; - private RemoteSurface m_remoteSurface; - private SurfacePool m_poolOwner; - private Size m_sizeContentPxl; - private Size m_sizeGutterPxl; - private int m_nInstanceID; - private bool m_fPrimaryOwner; - - internal Surface(SurfacePool poolOwner, ISurfaceContentOwner surfaceOwner, Size sizeContentPxl) - : this(poolOwner, surfaceOwner, sizeContentPxl, Size.Zero, RENDERHANDLE.NULL) + internal sealed class Surface : SharedResource, IRenderHandleOwner { - } + private ISurfaceContentOwner m_surfaceOwner; + private RemoteSurface m_remoteSurface; + private SurfacePool m_poolOwner; + private Size m_sizeContentPxl; + private Size m_sizeGutterPxl; + private int m_nInstanceID; + private bool m_fPrimaryOwner; - internal Surface( - SurfacePool poolOwner, - ISurfaceContentOwner surfaceOwner, - Size sizeContentPxl, - Size sizeGutter) - : this(poolOwner, surfaceOwner, sizeContentPxl, sizeGutter, RENDERHANDLE.NULL) - { - } - - internal Surface( - SurfacePool poolOwner, - ISurfaceContentOwner surfaceOwner, - Size sizeContentPxl, - Size sizeGutterPxl, - RENDERHANDLE rhExternal) - : base(poolOwner.Device.Session) - { - this.m_surfaceOwner = surfaceOwner; - this.m_poolOwner = poolOwner; - this.m_remoteSurface = (RemoteSurface) null; - this.m_sizeContentPxl = new Size(); - this.m_sizeGutterPxl = sizeGutterPxl; - RenderPort renderingPort = this.m_poolOwner.Device.Session.RenderingPort; - RENDERHANDLE handle = rhExternal; - if (handle == RENDERHANDLE.NULL) - { - handle = renderingPort.AllocHandle((IRenderHandleOwner) this); - this.m_fPrimaryOwner = true; - } - try - { - if (this.m_fPrimaryOwner) + internal Surface(SurfacePool poolOwner, ISurfaceContentOwner surfaceOwner, Size sizeContentPxl) + : this(poolOwner, surfaceOwner, sizeContentPxl, Size.Zero, RENDERHANDLE.NULL) { - this.m_nInstanceID = this.m_poolOwner.CreateSurface(this, handle); - this.m_remoteSurface = RemoteSurface.CreateFromHandle(renderingPort, handle); } - else + + internal Surface( + SurfacePool poolOwner, + ISurfaceContentOwner surfaceOwner, + Size sizeContentPxl, + Size sizeGutter) + : this(poolOwner, surfaceOwner, sizeContentPxl, sizeGutter, RENDERHANDLE.NULL) { - this.m_nInstanceID = this.m_poolOwner.AttachSurface(this); - this.m_remoteSurface = RemoteSurface.CreateFromExternalHandle(renderingPort, handle, (IRenderHandleOwner) this); } - this.m_sizeContentPxl = sizeContentPxl; - Size sizeStoragePxl = new Size(sizeContentPxl.Width + this.m_sizeGutterPxl.Width * 2, sizeContentPxl.Height + this.m_sizeGutterPxl.Height * 2); - if (!this.m_fPrimaryOwner) - return; - this.m_remoteSurface.SendSetStorageSize(sizeStoragePxl); - } - finally - { - if (this.m_remoteSurface == null) + + internal Surface( + SurfacePool poolOwner, + ISurfaceContentOwner surfaceOwner, + Size sizeContentPxl, + Size sizeGutterPxl, + RENDERHANDLE rhExternal) + : base(poolOwner.Device.Session) { - GC.SuppressFinalize((object) this); - if (this.m_fPrimaryOwner) - renderingPort.FreeHandle(handle); + this.m_surfaceOwner = surfaceOwner; + this.m_poolOwner = poolOwner; + this.m_remoteSurface = (RemoteSurface)null; + this.m_sizeContentPxl = new Size(); + this.m_sizeGutterPxl = sizeGutterPxl; + RenderPort renderingPort = this.m_poolOwner.Device.Session.RenderingPort; + RENDERHANDLE handle = rhExternal; + if (handle == RENDERHANDLE.NULL) + { + handle = renderingPort.AllocHandle((IRenderHandleOwner)this); + this.m_fPrimaryOwner = true; + } + try + { + if (this.m_fPrimaryOwner) + { + this.m_nInstanceID = this.m_poolOwner.CreateSurface(this, handle); + this.m_remoteSurface = RemoteSurface.CreateFromHandle(renderingPort, handle); + } + else + { + this.m_nInstanceID = this.m_poolOwner.AttachSurface(this); + this.m_remoteSurface = RemoteSurface.CreateFromExternalHandle(renderingPort, handle, (IRenderHandleOwner)this); + } + this.m_sizeContentPxl = sizeContentPxl; + Size sizeStoragePxl = new Size(sizeContentPxl.Width + this.m_sizeGutterPxl.Width * 2, sizeContentPxl.Height + this.m_sizeGutterPxl.Height * 2); + if (!this.m_fPrimaryOwner) + return; + this.m_remoteSurface.SendSetStorageSize(sizeStoragePxl); + } + finally + { + if (this.m_remoteSurface == null) + { + GC.SuppressFinalize((object)this); + if (this.m_fPrimaryOwner) + renderingPort.FreeHandle(handle); + } + } } - } - } - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + protected override void Dispose(bool fInDispose) + { + try + { + if (fInDispose) + { + if (this.m_remoteSurface != null) + this.m_remoteSurface.Dispose(); + try + { + this.m_surfaceOwner.OnSurfaceDisposed(this); + } + finally + { + this.m_poolOwner.NotifyDisposeSurface(this.m_nInstanceID); + this.m_nInstanceID = 0; + } + } + this.m_remoteSurface = (RemoteSurface)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteSurface.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteSurface = (RemoteSurface)null; + + internal RemoteSurface RemoteStub => this.m_remoteSurface; + + internal SurfacePool SurfacePool => this.m_poolOwner; + + internal int SurfacePoolInstanceID => this.m_nInstanceID; + + internal Size ContentSize => this.m_sizeContentPxl; + + internal ISurfaceContentOwner ContentOwner => this.m_surfaceOwner; + + internal Size GutterSize => this.m_sizeGutterPxl; + + internal void RestoreContent() + { + if (!this.m_remoteSurface.IsValid) + return; + this.m_surfaceOwner.OnRestoreContent(this); + } + + internal void NotifyNewPool(SurfacePool poolNew, int nNewInstanceID) + { + this.m_poolOwner = poolNew; + this.m_nInstanceID = nNewInstanceID; + Rectangle rcContentPxl = new Rectangle(0, 0, this.m_sizeContentPxl.Width, this.m_sizeContentPxl.Height); + this.m_remoteSurface.SendRemapContainer(this.m_poolOwner.RemoteStub); + this.m_remoteSurface.SendRemapLocation(rcContentPxl); + this.m_remoteSurface.SendSetRotation(false); + this.m_remoteSurface.SendSetGutter(this.m_sizeGutterPxl); + } + + protected override void OnUsageChange(bool fUsed) { - if (this.m_remoteSurface != null) - this.m_remoteSurface.Dispose(); - try - { - this.m_surfaceOwner.OnSurfaceDisposed(this); - } - finally - { - this.m_poolOwner.NotifyDisposeSurface(this.m_nInstanceID); - this.m_nInstanceID = 0; - } } - this.m_remoteSurface = (RemoteSurface) null; - } - finally - { - base.Dispose(fInDispose); - } } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteSurface.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteSurface = (RemoteSurface) null; - - internal RemoteSurface RemoteStub => this.m_remoteSurface; - - internal SurfacePool SurfacePool => this.m_poolOwner; - - internal int SurfacePoolInstanceID => this.m_nInstanceID; - - internal Size ContentSize => this.m_sizeContentPxl; - - internal ISurfaceContentOwner ContentOwner => this.m_surfaceOwner; - - internal Size GutterSize => this.m_sizeGutterPxl; - - internal void RestoreContent() - { - if (!this.m_remoteSurface.IsValid) - return; - this.m_surfaceOwner.OnRestoreContent(this); - } - - internal void NotifyNewPool(SurfacePool poolNew, int nNewInstanceID) - { - this.m_poolOwner = poolNew; - this.m_nInstanceID = nNewInstanceID; - Rectangle rcContentPxl = new Rectangle(0, 0, this.m_sizeContentPxl.Width, this.m_sizeContentPxl.Height); - this.m_remoteSurface.SendRemapContainer(this.m_poolOwner.RemoteStub); - this.m_remoteSurface.SendRemapLocation(rcContentPxl); - this.m_remoteSurface.SendSetRotation(false); - this.m_remoteSurface.SendSetGutter(this.m_sizeGutterPxl); - } - - protected override void OnUsageChange(bool fUsed) - { - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfaceManager.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfaceManager.cs index 498584a..e8a8fc5 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfaceManager.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfaceManager.cs @@ -12,211 +12,211 @@ using System.Collections.Generic; namespace Microsoft.Iris.Render.Graphics { - internal sealed class SurfaceManager : RenderObject - { - private GraphicsDevice m_device; - private ArrayList m_alDynamicSets; - private Map m_dictNamedPools; - private Size m_sizeThresholdPxl; - private LinkedList m_listLargeSurfaces; - private SurfaceManager.VideoMemoryBreakdown m_vmbStartup; - private bool m_fAllowDynamicPool; - - internal SurfaceManager(GraphicsDevice device, RenderSession session) + internal sealed class SurfaceManager : RenderObject { - session.AssertOwningThread(); - Debug2.Validate(session != null, typeof (InvalidOperationException), "Creating a SurfaceManager requires a valid RenderSession"); - this.m_device = device; - this.m_alDynamicSets = new ArrayList(); - this.m_dictNamedPools = new Map(); - this.m_listLargeSurfaces = new LinkedList(); - this.m_vmbStartup = this.m_device.ComputeBreakdown(); - this.m_fAllowDynamicPool = this.m_device.AllowDynamicPool; - if (!this.m_fAllowDynamicPool || this.m_vmbStartup.sizeDynamicPoolPxl.Height <= 0) - return; - this.PreallocateDynamicPools(this.m_vmbStartup); - } + private GraphicsDevice m_device; + private ArrayList m_alDynamicSets; + private Map m_dictNamedPools; + private Size m_sizeThresholdPxl; + private LinkedList m_listLargeSurfaces; + private SurfaceManager.VideoMemoryBreakdown m_vmbStartup; + private bool m_fAllowDynamicPool; - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + internal SurfaceManager(GraphicsDevice device, RenderSession session) { - foreach (RenderObject alDynamicSet in this.m_alDynamicSets) - alDynamicSet.Dispose(); - this.CollectLargeSurfaces(); + session.AssertOwningThread(); + Debug2.Validate(session != null, typeof(InvalidOperationException), "Creating a SurfaceManager requires a valid RenderSession"); + this.m_device = device; + this.m_alDynamicSets = new ArrayList(); + this.m_dictNamedPools = new Map(); + this.m_listLargeSurfaces = new LinkedList(); + this.m_vmbStartup = this.m_device.ComputeBreakdown(); + this.m_fAllowDynamicPool = this.m_device.AllowDynamicPool; + if (!this.m_fAllowDynamicPool || this.m_vmbStartup.sizeDynamicPoolPxl.Height <= 0) + return; + this.PreallocateDynamicPools(this.m_vmbStartup); } - this.m_listLargeSurfaces = (LinkedList) null; - this.m_alDynamicSets = (ArrayList) null; - this.m_device = (GraphicsDevice) null; - } - finally - { - base.Dispose(fInDispose); - } - } - private void PreallocateDynamicPools(SurfaceManager.VideoMemoryBreakdown vmb) - { - this.m_alDynamicSets.Add((object) new DynamicPoolSet(this.m_device, SurfaceFormat.ARGB32)); - int num = 0; - int index = 0; - while ((long) num < (long) vmb.cbMinimumPool) - { - DynamicPool dynamicPool = ((DynamicPoolSet) this.m_alDynamicSets[index]).AllocateDynamicPool(vmb.sizeDynamicPoolPxl, 8, vmb.ThresholdHeightPxl); - num += dynamicPool.TotalSize.Width * dynamicPool.TotalSize.Height * SurfaceFormatInfo.GetBitsPerPixel(dynamicPool.Format) / 8; - index = (index + 1) % this.m_alDynamicSets.Count; - } - this.m_sizeThresholdPxl = new Size(vmb.sizeDynamicPoolPxl.Width, vmb.ThresholdHeightPxl); - } - - public Size EstimatedMaxPerformantResolution => this.m_vmbStartup.sizeLargeBuffersPxl; - - public Size MaximumSmallPoolBlockSize => this.m_sizeThresholdPxl; - - public Surface RequestSurface( - ISurfaceContentOwner surfaceOwner, - SurfaceFormat nFormat, - Size sizeContentPxl, - Size sizeGutter) - { - Debug2.Validate(surfaceOwner != null, typeof (ArgumentNullException), "Must provide valid surface owner"); - Debug2.Validate(this.m_device.IsSurfaceFormatSupported(nFormat), typeof (ArgumentException), "Surface format is not supported"); - Debug2.Validate(sizeContentPxl.Width > 0 && sizeContentPxl.Height > 0, typeof (ArgumentOutOfRangeException), "Must provide positive area for surface"); - bool flag1 = false; - bool flag2 = false; - Surface surface = (Surface) null; - DynamicPoolSet dynamicPoolSet = (DynamicPoolSet) null; - for (int index = 0; index < this.m_alDynamicSets.Count; ++index) - { - dynamicPoolSet = (DynamicPoolSet) this.m_alDynamicSets[index]; - if (dynamicPoolSet.Format == nFormat) + protected override void Dispose(bool fInDispose) { - flag1 = true; - break; + try + { + if (fInDispose) + { + foreach (RenderObject alDynamicSet in this.m_alDynamicSets) + alDynamicSet.Dispose(); + this.CollectLargeSurfaces(); + } + this.m_listLargeSurfaces = (LinkedList)null; + this.m_alDynamicSets = (ArrayList)null; + this.m_device = (GraphicsDevice)null; + } + finally + { + base.Dispose(fInDispose); + } } - } - if (flag1) - { - Size sizeRequestPxl; - bool fRotated; - if (sizeContentPxl.Width >= sizeContentPxl.Height) + + private void PreallocateDynamicPools(SurfaceManager.VideoMemoryBreakdown vmb) { - sizeRequestPxl = sizeContentPxl; - fRotated = false; + this.m_alDynamicSets.Add((object)new DynamicPoolSet(this.m_device, SurfaceFormat.ARGB32)); + int num = 0; + int index = 0; + while ((long)num < (long)vmb.cbMinimumPool) + { + DynamicPool dynamicPool = ((DynamicPoolSet)this.m_alDynamicSets[index]).AllocateDynamicPool(vmb.sizeDynamicPoolPxl, 8, vmb.ThresholdHeightPxl); + num += dynamicPool.TotalSize.Width * dynamicPool.TotalSize.Height * SurfaceFormatInfo.GetBitsPerPixel(dynamicPool.Format) / 8; + index = (index + 1) % this.m_alDynamicSets.Count; + } + this.m_sizeThresholdPxl = new Size(vmb.sizeDynamicPoolPxl.Width, vmb.ThresholdHeightPxl); } - else + + public Size EstimatedMaxPerformantResolution => this.m_vmbStartup.sizeLargeBuffersPxl; + + public Size MaximumSmallPoolBlockSize => this.m_sizeThresholdPxl; + + public Surface RequestSurface( + ISurfaceContentOwner surfaceOwner, + SurfaceFormat nFormat, + Size sizeContentPxl, + Size sizeGutter) { - sizeRequestPxl = new Size(sizeContentPxl.Height, sizeContentPxl.Width); - fRotated = true; - sizeGutter = new Size(sizeGutter.Height, sizeGutter.Width); + Debug2.Validate(surfaceOwner != null, typeof(ArgumentNullException), "Must provide valid surface owner"); + Debug2.Validate(this.m_device.IsSurfaceFormatSupported(nFormat), typeof(ArgumentException), "Surface format is not supported"); + Debug2.Validate(sizeContentPxl.Width > 0 && sizeContentPxl.Height > 0, typeof(ArgumentOutOfRangeException), "Must provide positive area for surface"); + bool flag1 = false; + bool flag2 = false; + Surface surface = (Surface)null; + DynamicPoolSet dynamicPoolSet = (DynamicPoolSet)null; + for (int index = 0; index < this.m_alDynamicSets.Count; ++index) + { + dynamicPoolSet = (DynamicPoolSet)this.m_alDynamicSets[index]; + if (dynamicPoolSet.Format == nFormat) + { + flag1 = true; + break; + } + } + if (flag1) + { + Size sizeRequestPxl; + bool fRotated; + if (sizeContentPxl.Width >= sizeContentPxl.Height) + { + sizeRequestPxl = sizeContentPxl; + fRotated = false; + } + else + { + sizeRequestPxl = new Size(sizeContentPxl.Height, sizeContentPxl.Width); + fRotated = true; + sizeGutter = new Size(sizeGutter.Height, sizeGutter.Width); + } + sizeRequestPxl.Width += sizeGutter.Width * 2; + sizeRequestPxl.Height += sizeGutter.Height * 2; + if (sizeRequestPxl.Width <= this.m_sizeThresholdPxl.Width && sizeRequestPxl.Height <= this.m_sizeThresholdPxl.Height) + { + surface = dynamicPoolSet.RequestSurface(surfaceOwner, sizeRequestPxl, sizeContentPxl, sizeGutter, fRotated, PoolAllocMethod.Available, PoolAllocMethod.ScavengeDead) ?? dynamicPoolSet.RequestSurface(surfaceOwner, sizeRequestPxl, sizeContentPxl, sizeGutter, fRotated, PoolAllocMethod.CompactDead, PoolAllocMethod.CompactAll); + if (surface != null) + ; + } + } + else + { + int num = this.m_fAllowDynamicPool ? 1 : 0; + } + if (surface == null) + { + this.CollectLargeSurfaces(); + flag2 = true; + surface = new Surface(new SurfacePool(this.m_device, sizeContentPxl, nFormat) + { + DestroyWhenEmpty = true + }, surfaceOwner, sizeContentPxl); + surface.RegisterUsage((object)this); + } + if (flag2) + this.m_listLargeSurfaces.AddLast(new LinkedListNode(surface)); + return surface; } - sizeRequestPxl.Width += sizeGutter.Width * 2; - sizeRequestPxl.Height += sizeGutter.Height * 2; - if (sizeRequestPxl.Width <= this.m_sizeThresholdPxl.Width && sizeRequestPxl.Height <= this.m_sizeThresholdPxl.Height) + + public Surface RequestNamedSurface( + ISurfaceContentOwner surfaceOwner, + Size sizeContentPxl, + int nPoolID) { - surface = dynamicPoolSet.RequestSurface(surfaceOwner, sizeRequestPxl, sizeContentPxl, sizeGutter, fRotated, PoolAllocMethod.Available, PoolAllocMethod.ScavengeDead) ?? dynamicPoolSet.RequestSurface(surfaceOwner, sizeRequestPxl, sizeContentPxl, sizeGutter, fRotated, PoolAllocMethod.CompactDead, PoolAllocMethod.CompactAll); - if (surface != null) - ; + Debug2.Validate(surfaceOwner != null, typeof(ArgumentNullException), "Must provide valid surface owner"); + Debug2.Validate(sizeContentPxl.Width > 0 && sizeContentPxl.Height > 0, typeof(ArgumentOutOfRangeException), "Must provide positive area for surface"); + Debug2.Validate(nPoolID >= 0, typeof(ArgumentException), "Must have valid ID or 0"); + SurfacePool dictNamedPool = this.m_dictNamedPools[nPoolID]; + Debug2.Validate(dictNamedPool != null, typeof(ArgumentException), "Must have previously allocated pool"); + dictNamedPool.DisposeAllSurfaces(); + return new Surface(dictNamedPool, surfaceOwner, sizeContentPxl); } - } - else - { - int num = this.m_fAllowDynamicPool ? 1 : 0; - } - if (surface == null) - { - this.CollectLargeSurfaces(); - flag2 = true; - surface = new Surface(new SurfacePool(this.m_device, sizeContentPxl, nFormat) + + public void AllocateNamedSurface(int nPoolID, SurfaceFormat nFormat, Size sizeStoragePxl) { - DestroyWhenEmpty = true - }, surfaceOwner, sizeContentPxl); - surface.RegisterUsage((object) this); - } - if (flag2) - this.m_listLargeSurfaces.AddLast(new LinkedListNode(surface)); - return surface; - } - - public Surface RequestNamedSurface( - ISurfaceContentOwner surfaceOwner, - Size sizeContentPxl, - int nPoolID) - { - Debug2.Validate(surfaceOwner != null, typeof (ArgumentNullException), "Must provide valid surface owner"); - Debug2.Validate(sizeContentPxl.Width > 0 && sizeContentPxl.Height > 0, typeof (ArgumentOutOfRangeException), "Must provide positive area for surface"); - Debug2.Validate(nPoolID >= 0, typeof (ArgumentException), "Must have valid ID or 0"); - SurfacePool dictNamedPool = this.m_dictNamedPools[nPoolID]; - Debug2.Validate(dictNamedPool != null, typeof (ArgumentException), "Must have previously allocated pool"); - dictNamedPool.DisposeAllSurfaces(); - return new Surface(dictNamedPool, surfaceOwner, sizeContentPxl); - } - - public void AllocateNamedSurface(int nPoolID, SurfaceFormat nFormat, Size sizeStoragePxl) - { - Debug2.Validate(nPoolID > 0, typeof (ArgumentException), "Must have valid ID"); - Debug2.Validate(this.m_device.IsSurfaceFormatSupported(nFormat), typeof (ArgumentException), "Surface format is not supported"); - Debug2.Validate(sizeStoragePxl.Width > 0 && sizeStoragePxl.Height > 0, typeof (ArgumentException), "Must have valid surface size"); - Debug2.Validate(this.m_dictNamedPools[nPoolID] == null, (Type) null, "SurfacePool must not already be allocated"); - SurfacePool surfacePool = new SurfacePool(this.m_device, sizeStoragePxl, nFormat); - try - { - surfacePool.DestroyWhenEmpty = false; - this.m_dictNamedPools[nPoolID] = surfacePool; - surfacePool = (SurfacePool) null; - } - finally - { - surfacePool?.Dispose(); - } - } - - public void FreeNamedSurface(int nPoolID) - { - Debug2.Validate(nPoolID > 0, (Type) null, "Must have valid ID"); - SurfacePool dictNamedPool = this.m_dictNamedPools[nPoolID]; - Debug2.Validate(dictNamedPool != null, (Type) null, "Must have previously allocated pool"); - this.m_dictNamedPools.Remove(nPoolID); - dictNamedPool.Dispose(); - } - - public void CollectDeadSurfaces() - { - foreach (DynamicPoolSet alDynamicSet in this.m_alDynamicSets) - { - foreach (DynamicPool pool in alDynamicSet.Pools) - pool.CollectDeadSurfaces(); - } - this.CollectLargeSurfaces(); - } - - private void CollectLargeSurfaces() - { - LinkedListNode next; - for (LinkedListNode node = this.m_listLargeSurfaces.First; node != null; node = next) - { - next = node.Next; - Surface surface = node.Value; - if (!surface.InUse) - { - surface.UnregisterUsage((object) this); - this.m_listLargeSurfaces.Remove(node); + Debug2.Validate(nPoolID > 0, typeof(ArgumentException), "Must have valid ID"); + Debug2.Validate(this.m_device.IsSurfaceFormatSupported(nFormat), typeof(ArgumentException), "Surface format is not supported"); + Debug2.Validate(sizeStoragePxl.Width > 0 && sizeStoragePxl.Height > 0, typeof(ArgumentException), "Must have valid surface size"); + Debug2.Validate(this.m_dictNamedPools[nPoolID] == null, (Type)null, "SurfacePool must not already be allocated"); + SurfacePool surfacePool = new SurfacePool(this.m_device, sizeStoragePxl, nFormat); + try + { + surfacePool.DestroyWhenEmpty = false; + this.m_dictNamedPools[nPoolID] = surfacePool; + surfacePool = (SurfacePool)null; + } + finally + { + surfacePool?.Dispose(); + } } - } - } - public struct VideoMemoryBreakdown - { - public Size sizeBuffersPxl; - public uint cbVideo; - public Size sizeBackgroundPxl; - public Size sizeDynamicPoolPxl; - public Size sizeLargeBuffersPxl; - public uint cbMinimumPool; + public void FreeNamedSurface(int nPoolID) + { + Debug2.Validate(nPoolID > 0, (Type)null, "Must have valid ID"); + SurfacePool dictNamedPool = this.m_dictNamedPools[nPoolID]; + Debug2.Validate(dictNamedPool != null, (Type)null, "Must have previously allocated pool"); + this.m_dictNamedPools.Remove(nPoolID); + dictNamedPool.Dispose(); + } - public int ThresholdHeightPxl => Math.Max(Math.Min(this.sizeDynamicPoolPxl.Height, 350), this.sizeDynamicPoolPxl.Height * 350 / 2048); + public void CollectDeadSurfaces() + { + foreach (DynamicPoolSet alDynamicSet in this.m_alDynamicSets) + { + foreach (DynamicPool pool in alDynamicSet.Pools) + pool.CollectDeadSurfaces(); + } + this.CollectLargeSurfaces(); + } + + private void CollectLargeSurfaces() + { + LinkedListNode next; + for (LinkedListNode node = this.m_listLargeSurfaces.First; node != null; node = next) + { + next = node.Next; + Surface surface = node.Value; + if (!surface.InUse) + { + surface.UnregisterUsage((object)this); + this.m_listLargeSurfaces.Remove(node); + } + } + } + + public struct VideoMemoryBreakdown + { + public Size sizeBuffersPxl; + public uint cbVideo; + public Size sizeBackgroundPxl; + public Size sizeDynamicPoolPxl; + public Size sizeLargeBuffersPxl; + public uint cbMinimumPool; + + public int ThresholdHeightPxl => Math.Max(Math.Min(this.sizeDynamicPoolPxl.Height, 350), this.sizeDynamicPoolPxl.Height * 350 / 2048); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfacePool.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfacePool.cs index f9ce7dd..77726ab 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfacePool.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfacePool.cs @@ -13,209 +13,209 @@ using System.Collections; namespace Microsoft.Iris.Render.Graphics { - internal class SurfacePool : RenderObject, IRenderHandleOwner - { - private GraphicsDevice m_device; - private RenderSession m_session; - private ObjectTracker m_trackerSurfaces; - protected RemoteSurfacePool m_remotePool; - private Size m_sizeStoragePxl; - private bool m_fDestroyWhenEmpty; - private SurfaceFormat m_nFormat; - private SurfacePoolAllocationResult m_nStorage; - private bool m_fPrimaryOwner; - private Effect m_effect; - - internal SurfacePool(GraphicsDevice device, SurfaceFormat nFormat, RENDERHANDLE rhExternal) => this.CommonCreate(device, nFormat, rhExternal); - - internal SurfacePool(GraphicsDevice device, Size sizeStoragePxl, SurfaceFormat nFormat) + internal class SurfacePool : RenderObject, IRenderHandleOwner { - Debug2.Validate(sizeStoragePxl.Width > 0 && sizeStoragePxl.Height > 0, typeof (ArgumentException), "Must have positive area"); - this.CommonCreate(device, nFormat, RENDERHANDLE.NULL); - this.m_sizeStoragePxl = sizeStoragePxl; - this.m_nStorage = SurfacePoolAllocationResult.NotAllocated; - this.Allocate(); - } + private GraphicsDevice m_device; + private RenderSession m_session; + private ObjectTracker m_trackerSurfaces; + protected RemoteSurfacePool m_remotePool; + private Size m_sizeStoragePxl; + private bool m_fDestroyWhenEmpty; + private SurfaceFormat m_nFormat; + private SurfacePoolAllocationResult m_nStorage; + private bool m_fPrimaryOwner; + private Effect m_effect; - private void CommonCreate( - GraphicsDevice device, - SurfaceFormat nFormat, - RENDERHANDLE rhExternal) - { - Debug2.Validate(nFormat != SurfaceFormat.None, typeof (ArgumentException), nameof (nFormat)); - Debug2.Validate(device != null, typeof (ArgumentNullException), "Creating a SurfacePool requires a GraphicsDevice"); - this.m_device = device; - this.m_session = device.Session; - Debug2.Validate(this.m_session != null, typeof (InvalidOperationException), "Creating a SurfacePool requires a RenderSession"); - this.m_session.AssertOwningThread(); - this.m_remotePool = (RemoteSurfacePool) null; - this.m_sizeStoragePxl = new Size(); - this.m_nFormat = nFormat; - RENDERHANDLE handle = rhExternal; - if (handle == RENDERHANDLE.NULL) - { - handle = this.m_session.RenderingPort.AllocHandle((IRenderHandleOwner) this); - this.m_fPrimaryOwner = true; - } - try - { - this.CreateRemoteSurfacePool(handle, this.m_fPrimaryOwner); - } - finally - { - if (this.m_remotePool == null) + internal SurfacePool(GraphicsDevice device, SurfaceFormat nFormat, RENDERHANDLE rhExternal) => this.CommonCreate(device, nFormat, rhExternal); + + internal SurfacePool(GraphicsDevice device, Size sizeStoragePxl, SurfaceFormat nFormat) { - GC.SuppressFinalize((object) this); - if (this.m_fPrimaryOwner) - this.m_session.RenderingPort.FreeHandle(handle); + Debug2.Validate(sizeStoragePxl.Width > 0 && sizeStoragePxl.Height > 0, typeof(ArgumentException), "Must have positive area"); + this.CommonCreate(device, nFormat, RENDERHANDLE.NULL); + this.m_sizeStoragePxl = sizeStoragePxl; + this.m_nStorage = SurfacePoolAllocationResult.NotAllocated; + this.Allocate(); } - } - this.m_trackerSurfaces = new ObjectTracker(this.m_session, (object) this); - if (this.m_fPrimaryOwner) - return; - this.m_nStorage = SurfacePoolAllocationResult.Immoveable; - } - protected virtual void CreateRemoteSurfacePool(RENDERHANDLE handle, bool fPrimaryOwner) - { - if (fPrimaryOwner) - { - this.m_device.CreateSurfacePool(this, handle, this.Format); - this.m_remotePool = RemoteSurfacePool.CreateFromHandle(this.m_session.RenderingPort, handle); - } - else - this.m_remotePool = RemoteSurfacePool.CreateFromExternalHandle(this.m_session.RenderingPort, handle, (IRenderHandleOwner) this); - } - - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + private void CommonCreate( + GraphicsDevice device, + SurfaceFormat nFormat, + RENDERHANDLE rhExternal) { - if (this.m_effect != null) - this.m_effect.UnregisterUsage((object) this); - this.DisposeAllSurfaces(); - this.m_trackerSurfaces.Dispose(); - this.m_remotePool.Dispose(); - this.m_device.OnSurfacePoolDispose(); + Debug2.Validate(nFormat != SurfaceFormat.None, typeof(ArgumentException), nameof(nFormat)); + Debug2.Validate(device != null, typeof(ArgumentNullException), "Creating a SurfacePool requires a GraphicsDevice"); + this.m_device = device; + this.m_session = device.Session; + Debug2.Validate(this.m_session != null, typeof(InvalidOperationException), "Creating a SurfacePool requires a RenderSession"); + this.m_session.AssertOwningThread(); + this.m_remotePool = (RemoteSurfacePool)null; + this.m_sizeStoragePxl = new Size(); + this.m_nFormat = nFormat; + RENDERHANDLE handle = rhExternal; + if (handle == RENDERHANDLE.NULL) + { + handle = this.m_session.RenderingPort.AllocHandle((IRenderHandleOwner)this); + this.m_fPrimaryOwner = true; + } + try + { + this.CreateRemoteSurfacePool(handle, this.m_fPrimaryOwner); + } + finally + { + if (this.m_remotePool == null) + { + GC.SuppressFinalize((object)this); + if (this.m_fPrimaryOwner) + this.m_session.RenderingPort.FreeHandle(handle); + } + } + this.m_trackerSurfaces = new ObjectTracker(this.m_session, (object)this); + if (this.m_fPrimaryOwner) + return; + this.m_nStorage = SurfacePoolAllocationResult.Immoveable; + } + + protected virtual void CreateRemoteSurfacePool(RENDERHANDLE handle, bool fPrimaryOwner) + { + if (fPrimaryOwner) + { + this.m_device.CreateSurfacePool(this, handle, this.Format); + this.m_remotePool = RemoteSurfacePool.CreateFromHandle(this.m_session.RenderingPort, handle); + } + else + this.m_remotePool = RemoteSurfacePool.CreateFromExternalHandle(this.m_session.RenderingPort, handle, (IRenderHandleOwner)this); + } + + protected override void Dispose(bool fInDispose) + { + try + { + if (fInDispose) + { + if (this.m_effect != null) + this.m_effect.UnregisterUsage((object)this); + this.DisposeAllSurfaces(); + this.m_trackerSurfaces.Dispose(); + this.m_remotePool.Dispose(); + this.m_device.OnSurfacePoolDispose(); + } + this.m_effect = (Effect)null; + this.m_remotePool = (RemoteSurfacePool)null; + this.m_trackerSurfaces = (ObjectTracker)null; + this.m_device = (GraphicsDevice)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remotePool.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remotePool = (RemoteSurfacePool)null; + + public Size StorageSize => this.m_sizeStoragePxl; + + public SurfaceFormat Format => this.m_nFormat; + + internal RemoteSurfacePool RemoteStub => this.m_remotePool; + + protected RenderSession Session => this.m_session; + + internal GraphicsDevice Device => this.m_device; + + internal bool DestroyWhenEmpty + { + get => this.m_fDestroyWhenEmpty; + set => this.m_fDestroyWhenEmpty = value; + } + + internal IList AllSurfaces + { + get + { + IList list = (IList)null; + if (this.m_trackerSurfaces != null) + list = (IList)this.m_trackerSurfaces.LiveObjects; + return list; + } + } + + internal SurfacePoolAllocationResult StorageState => this.m_nStorage; + + public Effect Effect + { + get => this.m_effect; + set + { + Effect effect = value; + if (this.m_effect == effect) + return; + if (this.m_effect != null) + this.m_effect.UnregisterUsage((object)this); + this.m_effect = effect; + if (this.m_effect != null) + this.m_effect.RegisterUsage((object)this); + this.m_remotePool.SendSetEffect(this.m_effect == null ? (RemoteEffect)null : this.m_effect.RemoteStub); + } + } + + internal int CreateSurface(Surface spNew, RENDERHANDLE handle) + { + this.m_remotePool.SendCreateSurface(handle); + return this.AttachSurface(spNew); + } + + internal int AttachSurface(Surface spNew) => this.m_trackerSurfaces.AddObject((object)spNew); + + internal void DisposeAllSurfaces() + { + if (this.m_trackerSurfaces == null) + return; + ArrayList liveObjects = this.m_trackerSurfaces.LiveObjects; + for (int index = 0; index < liveObjects.Count; ++index) + ((SharedRenderObject)liveObjects[index]).UnregisterUsage((object)this); + } + + internal void NotifyDisposeSurface(int nID) + { + if (this.m_trackerSurfaces == null) + return; + this.m_trackerSurfaces.RemoveObject(nID); + if (!this.m_fDestroyWhenEmpty || !this.m_trackerSurfaces.IsEmpty) + return; + this.Dispose(); + } + + internal void Restore() + { + if (this.m_remotePool == null || !this.m_remotePool.IsValid) + return; + if (!this.m_sizeStoragePxl.IsZero) + this.Allocate(); + ArrayList liveObjects = this.m_trackerSurfaces.LiveObjects; + for (int index = 0; index < liveObjects.Count; ++index) + ((Surface)liveObjects[index]).RestoreContent(); + } + + internal static void RemapSurface(Surface surCur, SurfacePool poolNew) + { + SurfacePool surfacePool = surCur.SurfacePool; + if (poolNew == surfacePool) + return; + int surfacePoolInstanceId = surCur.SurfacePoolInstanceID; + surfacePool.NotifyDisposeSurface(surfacePoolInstanceId); + int nNewInstanceID = poolNew.m_trackerSurfaces.AddObject((object)surCur); + surCur.NotifyNewPool(poolNew, nNewInstanceID); + } + + internal void NotifyAllocation(SurfacePoolAllocationResult nResult) => this.m_nStorage = nResult; + + private void Allocate() + { + this.m_remotePool.SendAllocate(this.m_sizeStoragePxl); + this.m_nStorage = SurfacePoolAllocationResult.Requested; } - this.m_effect = (Effect) null; - this.m_remotePool = (RemoteSurfacePool) null; - this.m_trackerSurfaces = (ObjectTracker) null; - this.m_device = (GraphicsDevice) null; - } - finally - { - base.Dispose(fInDispose); - } } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remotePool.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remotePool = (RemoteSurfacePool) null; - - public Size StorageSize => this.m_sizeStoragePxl; - - public SurfaceFormat Format => this.m_nFormat; - - internal RemoteSurfacePool RemoteStub => this.m_remotePool; - - protected RenderSession Session => this.m_session; - - internal GraphicsDevice Device => this.m_device; - - internal bool DestroyWhenEmpty - { - get => this.m_fDestroyWhenEmpty; - set => this.m_fDestroyWhenEmpty = value; - } - - internal IList AllSurfaces - { - get - { - IList list = (IList) null; - if (this.m_trackerSurfaces != null) - list = (IList) this.m_trackerSurfaces.LiveObjects; - return list; - } - } - - internal SurfacePoolAllocationResult StorageState => this.m_nStorage; - - public Effect Effect - { - get => this.m_effect; - set - { - Effect effect = value; - if (this.m_effect == effect) - return; - if (this.m_effect != null) - this.m_effect.UnregisterUsage((object) this); - this.m_effect = effect; - if (this.m_effect != null) - this.m_effect.RegisterUsage((object) this); - this.m_remotePool.SendSetEffect(this.m_effect == null ? (RemoteEffect) null : this.m_effect.RemoteStub); - } - } - - internal int CreateSurface(Surface spNew, RENDERHANDLE handle) - { - this.m_remotePool.SendCreateSurface(handle); - return this.AttachSurface(spNew); - } - - internal int AttachSurface(Surface spNew) => this.m_trackerSurfaces.AddObject((object) spNew); - - internal void DisposeAllSurfaces() - { - if (this.m_trackerSurfaces == null) - return; - ArrayList liveObjects = this.m_trackerSurfaces.LiveObjects; - for (int index = 0; index < liveObjects.Count; ++index) - ((SharedRenderObject) liveObjects[index]).UnregisterUsage((object) this); - } - - internal void NotifyDisposeSurface(int nID) - { - if (this.m_trackerSurfaces == null) - return; - this.m_trackerSurfaces.RemoveObject(nID); - if (!this.m_fDestroyWhenEmpty || !this.m_trackerSurfaces.IsEmpty) - return; - this.Dispose(); - } - - internal void Restore() - { - if (this.m_remotePool == null || !this.m_remotePool.IsValid) - return; - if (!this.m_sizeStoragePxl.IsZero) - this.Allocate(); - ArrayList liveObjects = this.m_trackerSurfaces.LiveObjects; - for (int index = 0; index < liveObjects.Count; ++index) - ((Surface) liveObjects[index]).RestoreContent(); - } - - internal static void RemapSurface(Surface surCur, SurfacePool poolNew) - { - SurfacePool surfacePool = surCur.SurfacePool; - if (poolNew == surfacePool) - return; - int surfacePoolInstanceId = surCur.SurfacePoolInstanceID; - surfacePool.NotifyDisposeSurface(surfacePoolInstanceId); - int nNewInstanceID = poolNew.m_trackerSurfaces.AddObject((object) surCur); - surCur.NotifyNewPool(poolNew, nNewInstanceID); - } - - internal void NotifyAllocation(SurfacePoolAllocationResult nResult) => this.m_nStorage = nResult; - - private void Allocate() - { - this.m_remotePool.SendAllocate(this.m_sizeStoragePxl); - this.m_nStorage = SurfacePoolAllocationResult.Requested; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfacePoolAllocationResult.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfacePoolAllocationResult.cs index af0779d..a4d5451 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfacePoolAllocationResult.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/SurfacePoolAllocationResult.cs @@ -6,11 +6,11 @@ namespace Microsoft.Iris.Render.Graphics { - internal enum SurfacePoolAllocationResult - { - NotAllocated, - Requested, - Immoveable, - NotEnoughVideoMemory, - } + internal enum SurfacePoolAllocationResult + { + NotAllocated, + Requested, + Immoveable, + NotEnoughVideoMemory, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TextureVariableInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TextureVariableInfo.cs index 033a4b8..b3606c2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TextureVariableInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TextureVariableInfo.cs @@ -6,14 +6,14 @@ namespace Microsoft.Iris.Render.Graphics { - internal class TextureVariableInfo : VariableInfo - { - internal string SamplerName; - internal string MinFilter; - internal string MagFilter; - internal int CoordinateMapID; - internal int ImageIndexID; + internal class TextureVariableInfo : VariableInfo + { + internal string SamplerName; + internal string MinFilter; + internal string MagFilter; + internal int CoordinateMapID; + internal int ImageIndexID; - public TextureVariableInfo() => this.IsDynamic = true; - } + public TextureVariableInfo() => this.IsDynamic = true; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNode.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNode.cs index 466008c..f1d7ea2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNode.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNode.cs @@ -10,262 +10,262 @@ using System.Diagnostics; namespace Microsoft.Iris.Render.Graphics { - internal abstract class TreeNode : CachedRenderObject - { - private static int s_idObject; - private ITreeOwner m_treeOwner; - private int m_idObject; - private TreeNode m_nodeParent; - private TreeNode m_nodeFirstChild; - private TreeNode m_nodeNext; - private TreeNode m_nodePrevious; - public static int s_DEBUG_nTotalNodes; - - internal TreeNode(ITreeOwner iTreeOwner) + internal abstract class TreeNode : CachedRenderObject { - Debug2.Validate(iTreeOwner != null, typeof (ArgumentNullException), "Must have a valid ITreeOwner when creating a TreeNode"); - this.m_treeOwner = iTreeOwner; - } + private static int s_idObject; + private ITreeOwner m_treeOwner; + private int m_idObject; + private TreeNode m_nodeParent; + private TreeNode m_nodeFirstChild; + private TreeNode m_nodeNext; + private TreeNode m_nodePrevious; + public static int s_DEBUG_nTotalNodes; - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + internal TreeNode(ITreeOwner iTreeOwner) { - this.ChangeParent((TreeNode) null); - this.RemoveAllChildren(); + Debug2.Validate(iTreeOwner != null, typeof(ArgumentNullException), "Must have a valid ITreeOwner when creating a TreeNode"); + this.m_treeOwner = iTreeOwner; } - this.m_treeOwner = (ITreeOwner) null; - } - finally - { - base.Dispose(fInDispose); - } - } - private ITreeOwner Tree => this.m_treeOwner; - - internal bool HasChildren => this.m_nodeFirstChild != null; - - internal bool IsRoot => this.m_treeOwner.Root == this; - - internal TreeNode Parent => this.m_nodeParent; - - internal TreeNode NextSibling => this.m_nodeNext; - - internal TreeNode PreviousSibling => this.m_nodePrevious; - - internal TreeNode FirstSibling => this.m_nodeParent == null ? this : this.m_nodeParent.m_nodeFirstChild; - - internal TreeNode LastSibling - { - get - { - TreeNode treeNode = this; - while (treeNode.m_nodeNext != null) - treeNode = treeNode.m_nodeNext; - return treeNode; - } - } - - internal TreeNode FirstChild => this.m_nodeFirstChild; - - internal TreeNode LastChild => this.m_nodeFirstChild != null ? this.m_nodeFirstChild.LastSibling : (TreeNode) null; - - internal TreeNodeCollection Children => new TreeNodeCollection(this); - - internal AncestorEnumerator Ancestors => new AncestorEnumerator(this); - - internal bool HasDescendant(TreeNode nodeOther) - { - for (; nodeOther != null; nodeOther = nodeOther.m_nodeParent) - { - if (nodeOther == this) - return true; - } - return false; - } - - public int ChildCount - { - get - { - int num = 0; - for (TreeNode treeNode = this.m_nodeFirstChild; treeNode != null; treeNode = treeNode.m_nodeNext) - ++num; - return num; - } - } - - internal virtual void RemoveAllChildren() - { - while (this.m_nodeFirstChild != null) - this.m_nodeFirstChild.ChangeParent((TreeNode) null); - } - - internal void ChangeParent(TreeNode nodeNewParent) => this.ChangeParent(nodeNewParent, (TreeNode) null, TreeNode.LinkType.First); - - internal void ChangeParent(TreeNode nodeNewParent, TreeNode nodeSibling, TreeNode.LinkType lt) - { - if (this.m_nodeParent == nodeNewParent) - return; - TreeNode nodeParent = this.m_nodeParent; - if (this.m_nodeParent != null) - TreeNode.DoUnlink(this); - if (nodeNewParent != null) - TreeNode.DoLink(nodeNewParent, this, nodeSibling, lt); - if (nodeParent == null && nodeNewParent != null) - { - this.RegisterUsage((object) this); - } - else - { - if (nodeParent == null || nodeNewParent != null) - return; - this.UnregisterUsage((object) this); - } - } - - private static void DoLink( - TreeNode nodeParent, - TreeNode nodeChange, - TreeNode nodeSibling, - TreeNode.LinkType lt) - { - nodeChange.m_nodeParent = nodeParent; - TreeNode nodeFirstChild = nodeParent.m_nodeFirstChild; - if (nodeFirstChild == null) - { - nodeParent.m_nodeFirstChild = nodeChange; - } - else - { - switch (lt) + protected override void Dispose(bool fInDispose) { - case TreeNode.LinkType.Before: - nodeChange.m_nodeNext = nodeSibling; - nodeChange.m_nodePrevious = nodeSibling.m_nodePrevious; - nodeSibling.m_nodePrevious = nodeChange; - if (nodeChange.m_nodePrevious != null) + try { - nodeChange.m_nodePrevious.m_nodeNext = nodeChange; - break; + if (fInDispose) + { + this.ChangeParent((TreeNode)null); + this.RemoveAllChildren(); + } + this.m_treeOwner = (ITreeOwner)null; + } + finally + { + base.Dispose(fInDispose); } - nodeParent.m_nodeFirstChild = nodeChange; - break; - case TreeNode.LinkType.Behind: - nodeChange.m_nodePrevious = nodeSibling; - nodeChange.m_nodeNext = nodeSibling.m_nodeNext; - nodeSibling.m_nodeNext = nodeChange; - if (nodeChange.m_nodeNext == null) - break; - nodeChange.m_nodeNext.m_nodePrevious = nodeChange; - break; - case TreeNode.LinkType.First: - nodeParent.m_nodeFirstChild = nodeChange; - nodeChange.m_nodeNext = nodeFirstChild; - if (nodeFirstChild == null) - break; - nodeFirstChild.m_nodePrevious = nodeChange; - break; - case TreeNode.LinkType.Last: - TreeNode lastSibling = nodeFirstChild.LastSibling; - lastSibling.m_nodeNext = nodeChange; - nodeChange.m_nodePrevious = lastSibling; - break; } - } - } - private static void DoUnlink(TreeNode nodeChange) - { - if (nodeChange.m_nodeParent.m_nodeFirstChild == nodeChange) - nodeChange.m_nodeParent.m_nodeFirstChild = nodeChange.m_nodeNext; - if (nodeChange.m_nodeNext != null) - nodeChange.m_nodeNext.m_nodePrevious = nodeChange.m_nodePrevious; - if (nodeChange.m_nodePrevious != null) - nodeChange.m_nodePrevious.m_nodeNext = nodeChange.m_nodeNext; - nodeChange.m_nodeParent = (TreeNode) null; - nodeChange.m_nodeNext = (TreeNode) null; - nodeChange.m_nodePrevious = (TreeNode) null; - } + private ITreeOwner Tree => this.m_treeOwner; - internal int InstanceID - { - get - { - if (this.m_idObject == 0) - this.SetInstanceID(TreeNode.GenerateInstanceID()); - return this.m_idObject; - } - } + internal bool HasChildren => this.m_nodeFirstChild != null; - private static int GenerateInstanceID() => ++TreeNode.s_idObject; + internal bool IsRoot => this.m_treeOwner.Root == this; - private void SetInstanceID(int idObject) => this.m_idObject = idObject; + internal TreeNode Parent => this.m_nodeParent; - public override int GetHashCode() => this.InstanceID; + internal TreeNode NextSibling => this.m_nodeNext; - public override bool Equals(object oRHS) => object.ReferenceEquals((object) this, oRHS); + internal TreeNode PreviousSibling => this.m_nodePrevious; - public bool TestNodes( - TreeNode.NodeTest test, - TreeNode.NodeRelation nScope, - bool fParentChainsMustGoToRoot) - { - if ((nScope & TreeNode.NodeRelation.FullChain) == TreeNode.NodeRelation.None || (nScope & TreeNode.NodeRelation.Self) != TreeNode.NodeRelation.None && !test(this)) - return false; - if ((nScope & TreeNode.NodeRelation.Parents) != TreeNode.NodeRelation.None) - { - TreeNode node = this; - do + internal TreeNode FirstSibling => this.m_nodeParent == null ? this : this.m_nodeParent.m_nodeFirstChild; + + internal TreeNode LastSibling { - TreeNode parent = node.Parent; - if (parent != null) - node = parent; - else - goto label_7; + get + { + TreeNode treeNode = this; + while (treeNode.m_nodeNext != null) + treeNode = treeNode.m_nodeNext; + return treeNode; + } } - while (test(node)); - return false; -label_7: - if (fParentChainsMustGoToRoot && node != this.m_treeOwner.Root) - return false; - } - return true; + + internal TreeNode FirstChild => this.m_nodeFirstChild; + + internal TreeNode LastChild => this.m_nodeFirstChild != null ? this.m_nodeFirstChild.LastSibling : (TreeNode)null; + + internal TreeNodeCollection Children => new TreeNodeCollection(this); + + internal AncestorEnumerator Ancestors => new AncestorEnumerator(this); + + internal bool HasDescendant(TreeNode nodeOther) + { + for (; nodeOther != null; nodeOther = nodeOther.m_nodeParent) + { + if (nodeOther == this) + return true; + } + return false; + } + + public int ChildCount + { + get + { + int num = 0; + for (TreeNode treeNode = this.m_nodeFirstChild; treeNode != null; treeNode = treeNode.m_nodeNext) + ++num; + return num; + } + } + + internal virtual void RemoveAllChildren() + { + while (this.m_nodeFirstChild != null) + this.m_nodeFirstChild.ChangeParent((TreeNode)null); + } + + internal void ChangeParent(TreeNode nodeNewParent) => this.ChangeParent(nodeNewParent, (TreeNode)null, TreeNode.LinkType.First); + + internal void ChangeParent(TreeNode nodeNewParent, TreeNode nodeSibling, TreeNode.LinkType lt) + { + if (this.m_nodeParent == nodeNewParent) + return; + TreeNode nodeParent = this.m_nodeParent; + if (this.m_nodeParent != null) + TreeNode.DoUnlink(this); + if (nodeNewParent != null) + TreeNode.DoLink(nodeNewParent, this, nodeSibling, lt); + if (nodeParent == null && nodeNewParent != null) + { + this.RegisterUsage((object)this); + } + else + { + if (nodeParent == null || nodeNewParent != null) + return; + this.UnregisterUsage((object)this); + } + } + + private static void DoLink( + TreeNode nodeParent, + TreeNode nodeChange, + TreeNode nodeSibling, + TreeNode.LinkType lt) + { + nodeChange.m_nodeParent = nodeParent; + TreeNode nodeFirstChild = nodeParent.m_nodeFirstChild; + if (nodeFirstChild == null) + { + nodeParent.m_nodeFirstChild = nodeChange; + } + else + { + switch (lt) + { + case TreeNode.LinkType.Before: + nodeChange.m_nodeNext = nodeSibling; + nodeChange.m_nodePrevious = nodeSibling.m_nodePrevious; + nodeSibling.m_nodePrevious = nodeChange; + if (nodeChange.m_nodePrevious != null) + { + nodeChange.m_nodePrevious.m_nodeNext = nodeChange; + break; + } + nodeParent.m_nodeFirstChild = nodeChange; + break; + case TreeNode.LinkType.Behind: + nodeChange.m_nodePrevious = nodeSibling; + nodeChange.m_nodeNext = nodeSibling.m_nodeNext; + nodeSibling.m_nodeNext = nodeChange; + if (nodeChange.m_nodeNext == null) + break; + nodeChange.m_nodeNext.m_nodePrevious = nodeChange; + break; + case TreeNode.LinkType.First: + nodeParent.m_nodeFirstChild = nodeChange; + nodeChange.m_nodeNext = nodeFirstChild; + if (nodeFirstChild == null) + break; + nodeFirstChild.m_nodePrevious = nodeChange; + break; + case TreeNode.LinkType.Last: + TreeNode lastSibling = nodeFirstChild.LastSibling; + lastSibling.m_nodeNext = nodeChange; + nodeChange.m_nodePrevious = lastSibling; + break; + } + } + } + + private static void DoUnlink(TreeNode nodeChange) + { + if (nodeChange.m_nodeParent.m_nodeFirstChild == nodeChange) + nodeChange.m_nodeParent.m_nodeFirstChild = nodeChange.m_nodeNext; + if (nodeChange.m_nodeNext != null) + nodeChange.m_nodeNext.m_nodePrevious = nodeChange.m_nodePrevious; + if (nodeChange.m_nodePrevious != null) + nodeChange.m_nodePrevious.m_nodeNext = nodeChange.m_nodeNext; + nodeChange.m_nodeParent = (TreeNode)null; + nodeChange.m_nodeNext = (TreeNode)null; + nodeChange.m_nodePrevious = (TreeNode)null; + } + + internal int InstanceID + { + get + { + if (this.m_idObject == 0) + this.SetInstanceID(TreeNode.GenerateInstanceID()); + return this.m_idObject; + } + } + + private static int GenerateInstanceID() => ++TreeNode.s_idObject; + + private void SetInstanceID(int idObject) => this.m_idObject = idObject; + + public override int GetHashCode() => this.InstanceID; + + public override bool Equals(object oRHS) => object.ReferenceEquals((object)this, oRHS); + + public bool TestNodes( + TreeNode.NodeTest test, + TreeNode.NodeRelation nScope, + bool fParentChainsMustGoToRoot) + { + if ((nScope & TreeNode.NodeRelation.FullChain) == TreeNode.NodeRelation.None || (nScope & TreeNode.NodeRelation.Self) != TreeNode.NodeRelation.None && !test(this)) + return false; + if ((nScope & TreeNode.NodeRelation.Parents) != TreeNode.NodeRelation.None) + { + TreeNode node = this; + do + { + TreeNode parent = node.Parent; + if (parent != null) + node = parent; + else + goto label_7; + } + while (test(node)); + return false; + label_7: + if (fParentChainsMustGoToRoot && node != this.m_treeOwner.Root) + return false; + } + return true; + } + + internal int DEBUG_CurrentGeneration => 0; + + [Conditional("DEBUG")] + internal void DEBUG_CheckGeneration(int idxIntendedGeneration) + { + } + + [Conditional("DEBUG")] + internal void DEBUG_IncTotalNodes() => ++TreeNode.s_DEBUG_nTotalNodes; + + [Conditional("DEBUG")] + internal void DEBUG_DecTotalNodes() => --TreeNode.s_DEBUG_nTotalNodes; + + internal enum LinkType + { + Before = 1, + Behind = 2, + First = 3, + Last = 4, + } + + [Flags] + public enum NodeRelation + { + None = 0, + Self = 1, + Parents = 2, + FullChain = Parents | Self, // 0x00000003 + } + + public delegate bool NodeTest(TreeNode node); } - - internal int DEBUG_CurrentGeneration => 0; - - [Conditional("DEBUG")] - internal void DEBUG_CheckGeneration(int idxIntendedGeneration) - { - } - - [Conditional("DEBUG")] - internal void DEBUG_IncTotalNodes() => ++TreeNode.s_DEBUG_nTotalNodes; - - [Conditional("DEBUG")] - internal void DEBUG_DecTotalNodes() => --TreeNode.s_DEBUG_nTotalNodes; - - internal enum LinkType - { - Before = 1, - Behind = 2, - First = 3, - Last = 4, - } - - [Flags] - public enum NodeRelation - { - None = 0, - Self = 1, - Parents = 2, - FullChain = Parents | Self, // 0x00000003 - } - - public delegate bool NodeTest(TreeNode node); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNodeCollection.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNodeCollection.cs index 74486d7..2fdc6bd 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNodeCollection.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNodeCollection.cs @@ -10,139 +10,139 @@ using System.Collections; namespace Microsoft.Iris.Render.Graphics { - internal struct TreeNodeCollection : IList, ICollection, IEnumerable - { - private TreeNode m_nodeSubject; - - internal TreeNodeCollection(TreeNode nodeSubject) => this.m_nodeSubject = nodeSubject; - - public int Count => this.m_nodeSubject.ChildCount; - - bool ICollection.IsSynchronized => false; - - object ICollection.SyncRoot => throw new InvalidOperationException("This collection may only be used on the correct thread"); - - bool IList.IsFixedSize => false; - - bool IList.IsReadOnly => false; - - object IList.this[int index] + internal struct TreeNodeCollection : IList, ICollection, IEnumerable { - get => (object) this[index]; - set => Debug2.Validate(false, typeof (InvalidOperationException), "Use Add() and Remove() to modify collection"); - } + private TreeNode m_nodeSubject; - public TreeNode this[int idxChild] - { - get - { - Debug2.Validate(idxChild >= 0, typeof (ArgumentOutOfRangeException), "Must have a valid index"); - int num = 0; - foreach (TreeNode treeNode in this) + internal TreeNodeCollection(TreeNode nodeSubject) => this.m_nodeSubject = nodeSubject; + + public int Count => this.m_nodeSubject.ChildCount; + + bool ICollection.IsSynchronized => false; + + object ICollection.SyncRoot => throw new InvalidOperationException("This collection may only be used on the correct thread"); + + bool IList.IsFixedSize => false; + + bool IList.IsReadOnly => false; + + object IList.this[int index] { - if (idxChild == num) - return treeNode; - ++num; + get => (object)this[index]; + set => Debug2.Validate(false, typeof(InvalidOperationException), "Use Add() and Remove() to modify collection"); + } + + public TreeNode this[int idxChild] + { + get + { + Debug2.Validate(idxChild >= 0, typeof(ArgumentOutOfRangeException), "Must have a valid index"); + int num = 0; + foreach (TreeNode treeNode in this) + { + if (idxChild == num) + return treeNode; + ++num; + } + Debug2.Validate(false, typeof(ArgumentOutOfRangeException), "Must have a valid index"); + return (TreeNode)null; + } + set => Debug2.Validate(false, typeof(InvalidOperationException), "Use Add() and Remove() to modify collection"); + } + + IEnumerator IEnumerable.GetEnumerator() => (IEnumerator)this.GetEnumerator(); + + public TreeNodeEnumerator GetEnumerator() => new TreeNodeEnumerator(this.m_nodeSubject); + + void ICollection.CopyTo(Array arDest, int idxDest) + { + TreeNodeCollection.PromptCompatibleArray(arDest, idxDest, typeof(TreeNode), this.m_nodeSubject.ChildCount); + foreach (TreeNode treeNode in this) + arDest.SetValue((object)treeNode, idxDest++); + } + + public void CopyTo(TreeNode[] arDest, int idxDest) => ((ICollection)this).CopyTo((Array)arDest, idxDest); + + int IList.Add(object value) + { + this.Add((TreeNode)value); + return this.m_nodeSubject.ChildCount - 1; + } + + public void Add(TreeNode nodeChild) + { + Debug2.Validate(nodeChild != null, typeof(ArgumentNullException), "Must have a valid child"); + Debug2.Validate(nodeChild.Parent == null, typeof(ArgumentException), "Child must not already be parented"); + nodeChild.ChangeParent(this.m_nodeSubject, (TreeNode)null, TreeNode.LinkType.Last); + } + + public void Clear() => this.m_nodeSubject.RemoveAllChildren(); + + bool IList.Contains(object nodeChild) => this.Contains((TreeNode)nodeChild); + + public bool Contains(TreeNode nodeChild) + { + Debug2.Validate(nodeChild != null, typeof(ArgumentNullException), "Must have a valid child"); + return nodeChild.Parent == this.m_nodeSubject; + } + + int IList.IndexOf(object nodeChild) => this.IndexOf((TreeNode)nodeChild); + + public int IndexOf(TreeNode nodeChild) + { + Debug2.Validate(nodeChild != null, typeof(ArgumentNullException), "Must have a valid child"); + if (nodeChild.Parent != this.m_nodeSubject) + return -1; + int num = 0; + foreach (TreeNode treeNode in this) + { + if (nodeChild == treeNode) + return num; + ++num; + } + return -1; + } + + void IList.Insert(int idxInsertAt, object nodeChild) => this.Insert(idxInsertAt, (TreeNode)nodeChild); + + public void Insert(int idxInsertAt, TreeNode nodeChild) + { + Debug2.Validate(nodeChild != null, typeof(ArgumentNullException), "Must have a valid child"); + Debug2.Validate(nodeChild.Parent == null, typeof(ArgumentException), "Child must not already be parented"); + TreeNode nodeSibling = (TreeNode)null; + TreeNode.LinkType lt = TreeNode.LinkType.Last; + if (idxInsertAt < this.Count) + { + nodeSibling = this[idxInsertAt]; + lt = TreeNode.LinkType.Before; + } + nodeChild.ChangeParent(this.m_nodeSubject, nodeSibling, lt); + } + + void IList.Remove(object nodeChild) => this.Remove((TreeNode)nodeChild); + + public void Remove(TreeNode nodeChild) + { + Debug2.Validate(nodeChild != null, typeof(ArgumentNullException), "must pass a valid TreeNode"); + nodeChild.ChangeParent((TreeNode)null); + } + + public void RemoveAt(int idxRemoveAt) => this[idxRemoveAt].ChangeParent((TreeNode)null); + + public static void PromptCompatibleArray( + Array array, + int indexStart, + Type typeObject, + int numItems) + { + Debug2.Validate(array != null, typeof(ArgumentNullException), "Must have valid array"); + Debug2.Validate(typeObject != null, typeof(ArgumentNullException), "Must have valid Type"); + Debug2.Validate(array.Rank == 1, typeof(RankException), "Array must have rank=1"); + Debug2.Validate(indexStart < array.Length || numItems == 0, typeof(ArgumentException), "Must have valid index"); + Debug2.Validate(indexStart >= 0, typeof(ArgumentOutOfRangeException), "Must have valid index"); + Debug2.Validate(indexStart + numItems <= array.Length, typeof(ArgumentOutOfRangeException), "Must have sufficient room in array"); + Type elementType = array.GetType().GetElementType(); + Debug2.Validate(typeObject == elementType || typeObject.IsSubclassOf(elementType), typeof(ArrayTypeMismatchException), "Must be a compatible array type"); } - Debug2.Validate(false, typeof (ArgumentOutOfRangeException), "Must have a valid index"); - return (TreeNode) null; - } - set => Debug2.Validate(false, typeof (InvalidOperationException), "Use Add() and Remove() to modify collection"); } - - IEnumerator IEnumerable.GetEnumerator() => (IEnumerator) this.GetEnumerator(); - - public TreeNodeEnumerator GetEnumerator() => new TreeNodeEnumerator(this.m_nodeSubject); - - void ICollection.CopyTo(Array arDest, int idxDest) - { - TreeNodeCollection.PromptCompatibleArray(arDest, idxDest, typeof (TreeNode), this.m_nodeSubject.ChildCount); - foreach (TreeNode treeNode in this) - arDest.SetValue((object) treeNode, idxDest++); - } - - public void CopyTo(TreeNode[] arDest, int idxDest) => ((ICollection) this).CopyTo((Array) arDest, idxDest); - - int IList.Add(object value) - { - this.Add((TreeNode) value); - return this.m_nodeSubject.ChildCount - 1; - } - - public void Add(TreeNode nodeChild) - { - Debug2.Validate(nodeChild != null, typeof (ArgumentNullException), "Must have a valid child"); - Debug2.Validate(nodeChild.Parent == null, typeof (ArgumentException), "Child must not already be parented"); - nodeChild.ChangeParent(this.m_nodeSubject, (TreeNode) null, TreeNode.LinkType.Last); - } - - public void Clear() => this.m_nodeSubject.RemoveAllChildren(); - - bool IList.Contains(object nodeChild) => this.Contains((TreeNode) nodeChild); - - public bool Contains(TreeNode nodeChild) - { - Debug2.Validate(nodeChild != null, typeof (ArgumentNullException), "Must have a valid child"); - return nodeChild.Parent == this.m_nodeSubject; - } - - int IList.IndexOf(object nodeChild) => this.IndexOf((TreeNode) nodeChild); - - public int IndexOf(TreeNode nodeChild) - { - Debug2.Validate(nodeChild != null, typeof (ArgumentNullException), "Must have a valid child"); - if (nodeChild.Parent != this.m_nodeSubject) - return -1; - int num = 0; - foreach (TreeNode treeNode in this) - { - if (nodeChild == treeNode) - return num; - ++num; - } - return -1; - } - - void IList.Insert(int idxInsertAt, object nodeChild) => this.Insert(idxInsertAt, (TreeNode) nodeChild); - - public void Insert(int idxInsertAt, TreeNode nodeChild) - { - Debug2.Validate(nodeChild != null, typeof (ArgumentNullException), "Must have a valid child"); - Debug2.Validate(nodeChild.Parent == null, typeof (ArgumentException), "Child must not already be parented"); - TreeNode nodeSibling = (TreeNode) null; - TreeNode.LinkType lt = TreeNode.LinkType.Last; - if (idxInsertAt < this.Count) - { - nodeSibling = this[idxInsertAt]; - lt = TreeNode.LinkType.Before; - } - nodeChild.ChangeParent(this.m_nodeSubject, nodeSibling, lt); - } - - void IList.Remove(object nodeChild) => this.Remove((TreeNode) nodeChild); - - public void Remove(TreeNode nodeChild) - { - Debug2.Validate(nodeChild != null, typeof (ArgumentNullException), "must pass a valid TreeNode"); - nodeChild.ChangeParent((TreeNode) null); - } - - public void RemoveAt(int idxRemoveAt) => this[idxRemoveAt].ChangeParent((TreeNode) null); - - public static void PromptCompatibleArray( - Array array, - int indexStart, - Type typeObject, - int numItems) - { - Debug2.Validate(array != null, typeof (ArgumentNullException), "Must have valid array"); - Debug2.Validate(typeObject != null, typeof (ArgumentNullException), "Must have valid Type"); - Debug2.Validate(array.Rank == 1, typeof (RankException), "Array must have rank=1"); - Debug2.Validate(indexStart < array.Length || numItems == 0, typeof (ArgumentException), "Must have valid index"); - Debug2.Validate(indexStart >= 0, typeof (ArgumentOutOfRangeException), "Must have valid index"); - Debug2.Validate(indexStart + numItems <= array.Length, typeof (ArgumentOutOfRangeException), "Must have sufficient room in array"); - Type elementType = array.GetType().GetElementType(); - Debug2.Validate(typeObject == elementType || typeObject.IsSubclassOf(elementType), typeof (ArrayTypeMismatchException), "Must be a compatible array type"); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNodeEnumerator.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNodeEnumerator.cs index e714a01..d141a40 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNodeEnumerator.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/TreeNodeEnumerator.cs @@ -8,36 +8,36 @@ using System.Collections; namespace Microsoft.Iris.Render.Graphics { - internal struct TreeNodeEnumerator : IEnumerator - { - private TreeNode m_nodeParent; - private TreeNode m_nodeCurrent; - private TreeNode m_nodeNext; - - internal TreeNodeEnumerator(TreeNode nodeParent) + internal struct TreeNodeEnumerator : IEnumerator { - this.m_nodeParent = nodeParent; - this.m_nodeCurrent = (TreeNode) null; - this.m_nodeNext = nodeParent.FirstChild; + private TreeNode m_nodeParent; + private TreeNode m_nodeCurrent; + private TreeNode m_nodeNext; + + internal TreeNodeEnumerator(TreeNode nodeParent) + { + this.m_nodeParent = nodeParent; + this.m_nodeCurrent = (TreeNode)null; + this.m_nodeNext = nodeParent.FirstChild; + } + + object IEnumerator.Current => (object)this.m_nodeCurrent; + + public TreeNode Current => this.m_nodeCurrent; + + public void Reset() + { + this.m_nodeCurrent = (TreeNode)null; + this.m_nodeNext = this.m_nodeParent.FirstChild; + } + + public bool MoveNext() + { + this.m_nodeCurrent = this.m_nodeNext; + if (this.m_nodeNext == null) + return false; + this.m_nodeNext = this.m_nodeNext.NextSibling; + return true; + } } - - object IEnumerator.Current => (object) this.m_nodeCurrent; - - public TreeNode Current => this.m_nodeCurrent; - - public void Reset() - { - this.m_nodeCurrent = (TreeNode) null; - this.m_nodeNext = this.m_nodeParent.FirstChild; - } - - public bool MoveNext() - { - this.m_nodeCurrent = this.m_nodeNext; - if (this.m_nodeNext == null) - return false; - this.m_nodeNext = this.m_nodeNext.NextSibling; - return true; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VariableInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VariableInfo.cs index dbf741f..b72713d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VariableInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VariableInfo.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render.Graphics { - internal class VariableInfo - { - internal int ID; - internal bool IsDynamic; - internal Dx9VariableType Type; - internal string Name; - internal object DefaultValue; - } + internal class VariableInfo + { + internal int ID; + internal bool IsDynamic; + internal Dx9VariableType Type; + internal string Name; + internal object DefaultValue; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VariableScope.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VariableScope.cs index 5834877..a93b37f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VariableScope.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VariableScope.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render.Graphics { - internal enum VariableScope : byte - { - Global = 1, - Local = 2, - Const = 3, - } + internal enum VariableScope : byte + { + Global = 1, + Local = 2, + Const = 3, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VideoPool.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VideoPool.cs index af342aa..d15ebfc 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VideoPool.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VideoPool.cs @@ -10,62 +10,62 @@ using Microsoft.Iris.Render.Protocols.Splash.Rendering; namespace Microsoft.Iris.Render.Graphics { - internal sealed class VideoPool : SurfacePool, IVideoPoolCallback - { - private RemoteVideoPool m_remoteVideoPool; - private IVideoPoolNotification m_imgOwner; - private float m_flContentOverscan; - private Size m_sizeTargetPxl; - - internal VideoPool(GraphicsDevice device, IVideoPoolNotification imgOwner) - : base(device, SurfaceFormat.External, RENDERHANDLE.NULL) - => this.m_imgOwner = imgOwner; - - protected override void CreateRemoteSurfacePool(RENDERHANDLE rhHandle, bool fPrimaryOwner) + internal sealed class VideoPool : SurfacePool, IVideoPoolCallback { - if (fPrimaryOwner) - { - this.Device.CreateVideoPool(this, rhHandle); - this.m_remoteVideoPool = RemoteVideoPool.CreateFromHandle(this.Session.RenderingPort, rhHandle); - } - else - this.m_remoteVideoPool = RemoteVideoPool.CreateFromExternalHandle(this.Session.RenderingPort, rhHandle, (IRenderHandleOwner) this); - this.m_remotePool = (RemoteSurfacePool) this.m_remoteVideoPool; + private RemoteVideoPool m_remoteVideoPool; + private IVideoPoolNotification m_imgOwner; + private float m_flContentOverscan; + private Size m_sizeTargetPxl; + + internal VideoPool(GraphicsDevice device, IVideoPoolNotification imgOwner) + : base(device, SurfaceFormat.External, RENDERHANDLE.NULL) + => this.m_imgOwner = imgOwner; + + protected override void CreateRemoteSurfacePool(RENDERHANDLE rhHandle, bool fPrimaryOwner) + { + if (fPrimaryOwner) + { + this.Device.CreateVideoPool(this, rhHandle); + this.m_remoteVideoPool = RemoteVideoPool.CreateFromHandle(this.Session.RenderingPort, rhHandle); + } + else + this.m_remoteVideoPool = RemoteVideoPool.CreateFromExternalHandle(this.Session.RenderingPort, rhHandle, (IRenderHandleOwner)this); + this.m_remotePool = (RemoteSurfacePool)this.m_remoteVideoPool; + } + + internal RemoteVideoPool RemoteVideoStub => this.m_remoteVideoPool; + + internal float ContentOverscan + { + get => this.m_flContentOverscan; + set + { + if (Math2.WithinEpsilon(this.m_flContentOverscan, value)) + return; + this.m_flContentOverscan = value; + this.m_remoteVideoPool.SendSetContentOverscan(value); + } + } + + internal void NotifyVideoModeChanged(Size sizeTargetPxl) + { + if (!(this.m_sizeTargetPxl != sizeTargetPxl)) + return; + this.m_sizeTargetPxl = sizeTargetPxl; + this.m_remoteVideoPool.SendNotifyVideoSizeChanged(sizeTargetPxl); + } + + void IVideoPoolCallback.OnInputChanged( + RENDERHANDLE target, + Size sizeTargetPxl, + Size sizeAspectRatio, + uint nFrameRateNumerator, + uint nFrameRateDenominator, + SurfaceFormat nFormat) + { + this.m_imgOwner.NotifySourceChanged(sizeTargetPxl, sizeAspectRatio); + } + + void IVideoPoolCallback.OnInvalidate(RENDERHANDLE target) => this.m_imgOwner.InvalidateClients(); } - - internal RemoteVideoPool RemoteVideoStub => this.m_remoteVideoPool; - - internal float ContentOverscan - { - get => this.m_flContentOverscan; - set - { - if (Math2.WithinEpsilon(this.m_flContentOverscan, value)) - return; - this.m_flContentOverscan = value; - this.m_remoteVideoPool.SendSetContentOverscan(value); - } - } - - internal void NotifyVideoModeChanged(Size sizeTargetPxl) - { - if (!(this.m_sizeTargetPxl != sizeTargetPxl)) - return; - this.m_sizeTargetPxl = sizeTargetPxl; - this.m_remoteVideoPool.SendNotifyVideoSizeChanged(sizeTargetPxl); - } - - void IVideoPoolCallback.OnInputChanged( - RENDERHANDLE target, - Size sizeTargetPxl, - Size sizeAspectRatio, - uint nFrameRateNumerator, - uint nFrameRateDenominator, - SurfaceFormat nFormat) - { - this.m_imgOwner.NotifySourceChanged(sizeTargetPxl, sizeAspectRatio); - } - - void IVideoPoolCallback.OnInvalidate(RENDERHANDLE target) => this.m_imgOwner.InvalidateClients(); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VideoZoomMode.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VideoZoomMode.cs index 52a1b8b..2302290 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VideoZoomMode.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VideoZoomMode.cs @@ -6,11 +6,11 @@ namespace Microsoft.Iris.Render.Graphics { - internal enum VideoZoomMode - { - Normal, - Zoomed, - Stretched, - NonLinear, - } + internal enum VideoZoomMode + { + Normal, + Zoomed, + Stretched, + NonLinear, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Visual.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Visual.cs index dfd6d08..b5e52c6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Visual.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Visual.cs @@ -15,577 +15,577 @@ using System.Collections.Specialized; namespace Microsoft.Iris.Render.Graphics { - internal abstract class Visual : - TreeNode, - IVisual, - IAnimatableObject, - IAnimatable, - ISharedRenderObject, - IRenderHandleOwner, - IRawInputSite - { - private const uint k_DebugBitShift = 5; - private static ColorF s_colorTransparent = ColorF.FromArgb(0U); - private static ColorF s_colorWhite = new ColorF(1f, 1f, 1f, 1f); - public static readonly string PositionProperty = nameof (Position); - public static readonly string AlphaProperty = nameof (Alpha); - public static readonly string OrientationProperty = "Orientation"; - public static readonly string RotationProperty = nameof (Rotation); - public static readonly string ScaleProperty = nameof (Scale); - public static readonly string SizeProperty = nameof (Size); - protected RenderWindow m_window; - protected RemoteVisual m_remoteVisual; - private Vector3 m_vecPosition; - private Vector2 m_vecSize; - private BitVector32 m_bvDataBits; - private static BitVector32.Section s_bvsMouse = BitVector32.CreateSection((short) 15); - private static BitVector32.Section s_bvsDebug = BitVector32.CreateSection((short) 3, Visual.s_bvsMouse); - private static BitVector32.Section s_bvsValid = BitVector32.CreateSection((short) 1, Visual.s_bvsDebug); - private static BitVector32.Section s_bvsVisible = BitVector32.CreateSection((short) 1, Visual.s_bvsValid); - private static BitVector32.Section s_bvsAlpha; - private static BitVector32.Section s_bvsCenterPointScale; - private static BitVector32.Section s_bvsColor; - private static BitVector32.Section s_bvsCoordmap; - private static BitVector32.Section s_bvsGradient; - private static BitVector32.Section s_bvsLayer; - private static BitVector32.Section s_bvsRotation; - private static BitVector32.Section s_bvsScale; - private static BitVector32.Section s_bvsFlush = BitVector32.CreateSection((short) 1, Visual.s_bvsVisible); - private static BitVector32.Section s_bvsRelativeSize; - private static BitVector32.Section s_bvsCamera; - private static BitVector32.Section s_bvsNineGrid; - private static BitVector32.Section[] s_sectionPropIDMap; - private object m_objOwnerData; - - static Visual() + internal abstract class Visual : + TreeNode, + IVisual, + IAnimatableObject, + IAnimatable, + ISharedRenderObject, + IRenderHandleOwner, + IRawInputSite { - Visual.s_bvsAlpha = BitVector32.CreateSection((short) 1, Visual.s_bvsFlush); - Visual.s_bvsCenterPointScale = BitVector32.CreateSection((short) 1, Visual.s_bvsAlpha); - Visual.s_bvsColor = BitVector32.CreateSection((short) 1, Visual.s_bvsCenterPointScale); - Visual.s_bvsCoordmap = BitVector32.CreateSection((short) 1, Visual.s_bvsColor); - Visual.s_bvsGradient = BitVector32.CreateSection((short) 1, Visual.s_bvsCoordmap); - Visual.s_bvsLayer = BitVector32.CreateSection((short) 1, Visual.s_bvsGradient); - Visual.s_bvsRotation = BitVector32.CreateSection((short) 1, Visual.s_bvsLayer); - Visual.s_bvsScale = BitVector32.CreateSection((short) 1, Visual.s_bvsRotation); - Visual.s_bvsRelativeSize = BitVector32.CreateSection((short) 1, Visual.s_bvsScale); - Visual.s_bvsCamera = BitVector32.CreateSection((short) 1, Visual.s_bvsRelativeSize); - Visual.s_bvsNineGrid = BitVector32.CreateSection((short) 1, Visual.s_bvsCamera); - Visual.s_sectionPropIDMap = new BitVector32.Section[10]; - Visual.s_sectionPropIDMap[0] = Visual.s_bvsAlpha; - Visual.s_sectionPropIDMap[1] = Visual.s_bvsScale; - Visual.s_sectionPropIDMap[2] = Visual.s_bvsRotation; - Visual.s_sectionPropIDMap[3] = Visual.s_bvsCenterPointScale; - Visual.s_sectionPropIDMap[4] = Visual.s_bvsLayer; - Visual.s_sectionPropIDMap[5] = Visual.s_bvsColor; - Visual.s_sectionPropIDMap[6] = Visual.s_bvsCoordmap; - Visual.s_sectionPropIDMap[7] = Visual.s_bvsGradient; - Visual.s_sectionPropIDMap[8] = Visual.s_bvsCamera; - Visual.s_sectionPropIDMap[9] = Visual.s_bvsNineGrid; - } + private const uint k_DebugBitShift = 5; + private static ColorF s_colorTransparent = ColorF.FromArgb(0U); + private static ColorF s_colorWhite = new ColorF(1f, 1f, 1f, 1f); + public static readonly string PositionProperty = nameof(Position); + public static readonly string AlphaProperty = nameof(Alpha); + public static readonly string OrientationProperty = "Orientation"; + public static readonly string RotationProperty = nameof(Rotation); + public static readonly string ScaleProperty = nameof(Scale); + public static readonly string SizeProperty = nameof(Size); + protected RenderWindow m_window; + protected RemoteVisual m_remoteVisual; + private Vector3 m_vecPosition; + private Vector2 m_vecSize; + private BitVector32 m_bvDataBits; + private static BitVector32.Section s_bvsMouse = BitVector32.CreateSection((short)15); + private static BitVector32.Section s_bvsDebug = BitVector32.CreateSection((short)3, Visual.s_bvsMouse); + private static BitVector32.Section s_bvsValid = BitVector32.CreateSection((short)1, Visual.s_bvsDebug); + private static BitVector32.Section s_bvsVisible = BitVector32.CreateSection((short)1, Visual.s_bvsValid); + private static BitVector32.Section s_bvsAlpha; + private static BitVector32.Section s_bvsCenterPointScale; + private static BitVector32.Section s_bvsColor; + private static BitVector32.Section s_bvsCoordmap; + private static BitVector32.Section s_bvsGradient; + private static BitVector32.Section s_bvsLayer; + private static BitVector32.Section s_bvsRotation; + private static BitVector32.Section s_bvsScale; + private static BitVector32.Section s_bvsFlush = BitVector32.CreateSection((short)1, Visual.s_bvsVisible); + private static BitVector32.Section s_bvsRelativeSize; + private static BitVector32.Section s_bvsCamera; + private static BitVector32.Section s_bvsNineGrid; + private static BitVector32.Section[] s_sectionPropIDMap; + private object m_objOwnerData; - internal Visual(RenderSession session, RenderWindow window, object objOwnerData) - : base((ITreeOwner) window) - { - Debug2.Validate(session != null, typeof (ArgumentNullException), "Must have valid session"); - Debug2.Validate(window != null, typeof (ArgumentNullException), "Must have valid render window"); - session.AssertOwningThread(); - this.m_window = window; - this.m_objOwnerData = objOwnerData; - this.m_vecPosition = Vector3.Zero; - this.m_vecSize = Vector2.Zero; - this.FlushValues = true; - this.SetValid(true); - this.SetVisible(true); - } - - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + static Visual() { - this.SetValid(false); - this.RemoveAllGradients(); - this.PropertyManager.RemoveAlphaProp(this); - this.PropertyManager.RemoveCenterPointScaleProp(this); - this.PropertyManager.RemoveLayerProp(this); - this.PropertyManager.RemoveRotationProp(this); - this.PropertyManager.RemoveScaleProp(this); - if (this.m_remoteVisual != null) - this.m_remoteVisual.Dispose(); + Visual.s_bvsAlpha = BitVector32.CreateSection((short)1, Visual.s_bvsFlush); + Visual.s_bvsCenterPointScale = BitVector32.CreateSection((short)1, Visual.s_bvsAlpha); + Visual.s_bvsColor = BitVector32.CreateSection((short)1, Visual.s_bvsCenterPointScale); + Visual.s_bvsCoordmap = BitVector32.CreateSection((short)1, Visual.s_bvsColor); + Visual.s_bvsGradient = BitVector32.CreateSection((short)1, Visual.s_bvsCoordmap); + Visual.s_bvsLayer = BitVector32.CreateSection((short)1, Visual.s_bvsGradient); + Visual.s_bvsRotation = BitVector32.CreateSection((short)1, Visual.s_bvsLayer); + Visual.s_bvsScale = BitVector32.CreateSection((short)1, Visual.s_bvsRotation); + Visual.s_bvsRelativeSize = BitVector32.CreateSection((short)1, Visual.s_bvsScale); + Visual.s_bvsCamera = BitVector32.CreateSection((short)1, Visual.s_bvsRelativeSize); + Visual.s_bvsNineGrid = BitVector32.CreateSection((short)1, Visual.s_bvsCamera); + Visual.s_sectionPropIDMap = new BitVector32.Section[10]; + Visual.s_sectionPropIDMap[0] = Visual.s_bvsAlpha; + Visual.s_sectionPropIDMap[1] = Visual.s_bvsScale; + Visual.s_sectionPropIDMap[2] = Visual.s_bvsRotation; + Visual.s_sectionPropIDMap[3] = Visual.s_bvsCenterPointScale; + Visual.s_sectionPropIDMap[4] = Visual.s_bvsLayer; + Visual.s_sectionPropIDMap[5] = Visual.s_bvsColor; + Visual.s_sectionPropIDMap[6] = Visual.s_bvsCoordmap; + Visual.s_sectionPropIDMap[7] = Visual.s_bvsGradient; + Visual.s_sectionPropIDMap[8] = Visual.s_bvsCamera; + Visual.s_sectionPropIDMap[9] = Visual.s_bvsNineGrid; } - this.m_remoteVisual = (RemoteVisual) null; - this.m_objOwnerData = (object) null; - } - finally - { - base.Dispose(fInDispose); - } - } - MouseOptions IVisual.MouseOptions - { - get => this.MouseOptions; - set => this.MouseOptions = value; - } - - IVisualContainer IVisual.Parent => this.Parent as IVisualContainer; - - string IVisual.DebugID - { - get => this.DebugDescription; - set - { - } - } - - ColorF IVisual.DebugColor - { - get => this.DEBUG_OutlineColor; - set => this.DEBUG_OutlineColor = value; - } - - void IVisual.CopyFrom(IVisual visualSource) - { - Visual visual = (Visual) visualSource; - this.Position = visual.Position; - this.Size = visual.Size; - this.Scale = visual.Scale; - this.Rotation = visual.Rotation; - this.Alpha = visual.Alpha; - this.CenterPointScale = visual.CenterPointScale; - this.Layer = visual.Layer; - this.MouseOptions = visual.MouseOptions; - } - - void IVisual.Remove() => this.RemoveFromTree(); - - protected void AddGradient(Gradient gradient) - { - Vector result; - if (this.IsDynamicValueSet(Visual.PropId.Gradients)) - { - this.PropertyManager.GetGradientProp(this, out result); - } - else - { - result = new Vector(); - this.PropertyManager.SetGradientProp(this, result); - } - gradient.RegisterUsage((object) this); - result.Add(gradient); - this.m_remoteVisual.SendAddGradient(gradient.RemoteGradient); - } - - protected void RemoveAllGradients() - { - if (!this.IsDynamicValueSet(Visual.PropId.Gradients)) - return; - Vector result; - this.PropertyManager.GetGradientProp(this, out result); - this.PropertyManager.RemoveGradientProp(this); - foreach (SharedRenderObject sharedRenderObject in result) - sharedRenderObject.UnregisterUsage((object) this); - result.Clear(); - this.m_remoteVisual.SendClearGradients(); - } - - 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); - this.ChangeParent((TreeNode) visualParent); - } - - internal override void RemoveAllChildren() - { - for (Visual firstChild = (Visual) this.FirstChild; firstChild != null; firstChild = (Visual) this.FirstChild) - firstChild.ChangeParent((Visual) null, (Visual) null, VisualOrder.First); - base.RemoveAllChildren(); - } - - protected void RemoveFromTree() - { - this.RemoveAllChildren(); - this.ChangeParent((Visual) null, (Visual) null, VisualOrder.First); - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteVisual.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteVisual = (RemoteVisual) null; - - internal RemoteVisual RemoteStub => this.m_remoteVisual; - - public object OwnerData - { - get => this.m_objOwnerData; - set => this.m_objOwnerData = value; - } - - protected Vector3 Position - { - get => this.m_vecPosition; - set => this.SetPosition(value, false); - } - - protected void SetPosition(Vector3 value, bool force) - { - if (!(this.m_vecPosition != value) && !force) - return; - this.m_vecPosition = value; - if (!this.FlushValues) - return; - this.m_remoteVisual.SendSetPosition(this.m_vecPosition); - } - - internal Vector2 Size - { - get => this.m_vecSize; - set => this.SetSize(value, false); - } - - internal void SetSize(Vector2 value, bool force) - { - Debug2.Validate((double) value.X >= 0.0 && (double) value.Y >= 0.0, typeof (ArgumentOutOfRangeException), "Negative size not allowed"); - if (!(this.m_vecSize != value) && !force) - return; - this.m_vecSize = value; - if (!this.FlushValues) - return; - this.m_remoteVisual.SendSetSize(this.m_vecSize); - } - - protected float Alpha - { - get - { - float result = 1f; - if (this.IsDynamicValueSet(Visual.PropId.Alpha)) + internal Visual(RenderSession session, RenderWindow window, object objOwnerData) + : base((ITreeOwner)window) { - this.PropertyManager.GetAlphaProp(this, out result); - Debug2.Validate(!Math2.WithinEpsilon(result, 1f), typeof (InvalidOperationException), "expected non-opaque alpha if HasAlpha flag was set"); + Debug2.Validate(session != null, typeof(ArgumentNullException), "Must have valid session"); + Debug2.Validate(window != null, typeof(ArgumentNullException), "Must have valid render window"); + session.AssertOwningThread(); + this.m_window = window; + this.m_objOwnerData = objOwnerData; + this.m_vecPosition = Vector3.Zero; + this.m_vecSize = Vector2.Zero; + this.FlushValues = true; + this.SetValid(true); + this.SetVisible(true); } - return result; - } - set => this.SetAlpha(value, false); - } - protected void SetAlpha(float value, bool force) - { - if ((double) this.Alpha == (double) value && !force) - return; - Debug2.Validate((double) value >= 0.0 && (double) value <= 1.0, typeof (ArgumentOutOfRangeException), "Alpha value must be within 0-1 range (incl)"); - this.PropertyManager.SetAlphaProp(this, value); - if (!this.FlushValues) - return; - this.m_remoteVisual.SendSetAlpha(value); - } - - protected Vector3 Scale - { - get - { - Vector3 result = Vector3.UnitVector; - if (this.IsDynamicValueSet(Visual.PropId.Scale)) + protected override void Dispose(bool fInDispose) { - this.PropertyManager.GetScaleProp(this, out result); - Debug2.Validate(result != Vector3.UnitVector, typeof (InvalidOperationException), "expected non-unit scale if HasScale flag was set"); + try + { + if (fInDispose) + { + this.SetValid(false); + this.RemoveAllGradients(); + this.PropertyManager.RemoveAlphaProp(this); + this.PropertyManager.RemoveCenterPointScaleProp(this); + this.PropertyManager.RemoveLayerProp(this); + this.PropertyManager.RemoveRotationProp(this); + this.PropertyManager.RemoveScaleProp(this); + if (this.m_remoteVisual != null) + this.m_remoteVisual.Dispose(); + } + this.m_remoteVisual = (RemoteVisual)null; + this.m_objOwnerData = (object)null; + } + finally + { + base.Dispose(fInDispose); + } } - return result; - } - set => this.SetScale(value, false); - } - protected void SetScale(Vector3 value, bool force) - { - if (!(this.Scale != value) && !force) - return; - this.PropertyManager.SetScaleProp(this, value); - if (!this.FlushValues) - return; - this.m_remoteVisual.SendSetScale(value); - } - - protected AxisAngle Rotation - { - get - { - AxisAngle result = AxisAngle.Identity; - if (this.IsDynamicValueSet(Visual.PropId.Rotation)) + MouseOptions IVisual.MouseOptions { - this.PropertyManager.GetRotationProp(this, out result); - Debug2.Validate(result != AxisAngle.Identity, typeof (InvalidOperationException), "expected non-null rotation data if HasRotation flag was set"); + get => this.MouseOptions; + set => this.MouseOptions = value; } - return result; - } - set => this.SetRotation(value, false); - } - protected void SetRotation(AxisAngle value, bool force) - { - if (!(this.Rotation != value) && !force) - return; - this.PropertyManager.SetRotationProp(this, value); - AxisAngle aaRotation = value; - if (this.m_window.IsRightToLeft && (double) aaRotation.Axis.Y <= 0.0 && (double) aaRotation.Axis.X <= 0.0) - aaRotation.Angle = -aaRotation.Angle; - if (!this.FlushValues) - return; - this.m_remoteVisual.SendSetRotation(aaRotation); - } + IVisualContainer IVisual.Parent => this.Parent as IVisualContainer; - protected Vector3 CenterPointScale - { - get - { - Vector3 result = Vector3.Zero; - if (this.IsDynamicValueSet(Visual.PropId.CenterPointScale)) + string IVisual.DebugID { - this.PropertyManager.GetCenterPointScaleProp(this, out result); - Debug2.Validate(result != Vector3.Zero, typeof (InvalidOperationException), "expected non-unit scale if HasCenterPointScale flag was set"); + get => this.DebugDescription; + set + { + } } - return result; - } - set - { - if (this.m_window.IsRightToLeft) - value.X = 1f - value.X; - if (!(this.CenterPointScale != value)) - return; - this.PropertyManager.SetCenterPointScaleProp(this, value); - if (!this.FlushValues) - return; - this.m_remoteVisual.SendSetCenterPointScale(value); - } - } - protected uint Layer - { - get - { - uint result = 0; - if (this.IsDynamicValueSet(Visual.PropId.Layer)) + ColorF IVisual.DebugColor { - this.PropertyManager.GetLayerProp(this, out result); - Debug2.Validate(result != 0U, typeof (InvalidOperationException), "expected non-zero layer if HasLayer flag was set"); + get => this.DEBUG_OutlineColor; + set => this.DEBUG_OutlineColor = value; } - return result; - } - set - { - if ((int) this.Layer == (int) value) - return; - this.PropertyManager.SetLayerProp(this, value); - if (!this.FlushValues) - return; - this.m_remoteVisual.SendSetLayer(value); - } - } - protected bool Visible - { - get => this.GetVisible(); - set - { - if (this.Visible == value) - return; - this.SetVisible(value); - if (!this.FlushValues) - return; - this.m_remoteVisual.SendSetVisible(value); - } - } - - protected bool RelativeSize - { - get => this.m_bvDataBits[Visual.s_bvsRelativeSize] != 0; - set - { - int num = value ? 1 : 0; - if (this.m_bvDataBits[Visual.s_bvsRelativeSize] == num) - return; - this.m_bvDataBits[Visual.s_bvsRelativeSize] = num; - this.m_remoteVisual.SendSetRelativeSize(value); - } - } - - internal bool IsValid => this.GetValid(); - - public MouseOptions MouseOptions - { - get => (MouseOptions) this.m_bvDataBits[Visual.s_bvsMouse]; - set - { - Debug2.Validate((value & ~MouseOptions.ValidMask) == MouseOptions.None, typeof (ArgumentException), "Expected valid mouse bits"); - uint nMask = (uint) this.m_bvDataBits[Visual.s_bvsMouse] ^ (uint) (short) value; - if (nMask != 0U && this.FlushValues) - this.m_remoteVisual.SendChangeDataBits((uint) value, nMask); - this.m_bvDataBits[Visual.s_bvsMouse] = (int) (short) value; - } - } - - internal Visual.DebugBits DebugOptions - { - get => (Visual.DebugBits) this.m_bvDataBits[Visual.s_bvsDebug]; - set - { - Debug2.Validate((value & ~Visual.DebugBits.Dump) == Visual.DebugBits.None, typeof (ArgumentException), "Expected valid debug bits"); - Debug2.Validate((uint) value < (uint) byte.MaxValue, typeof (ArgumentException), "Expected valid debug bits"); - uint nMask = (uint) ((Visual.DebugBits) this.m_bvDataBits[Visual.s_bvsDebug] ^ value); - if (nMask != 0U) + void IVisual.CopyFrom(IVisual visualSource) { - uint nValue = (uint) value << 5; - if (this.m_remoteVisual.IsValid) - this.m_remoteVisual.SendChangeDataBits(nValue, nMask); + Visual visual = (Visual)visualSource; + this.Position = visual.Position; + this.Size = visual.Size; + this.Scale = visual.Scale; + this.Rotation = visual.Rotation; + this.Alpha = visual.Alpha; + this.CenterPointScale = visual.CenterPointScale; + this.Layer = visual.Layer; + this.MouseOptions = visual.MouseOptions; + } + + void IVisual.Remove() => this.RemoveFromTree(); + + protected void AddGradient(Gradient gradient) + { + Vector result; + if (this.IsDynamicValueSet(Visual.PropId.Gradients)) + { + this.PropertyManager.GetGradientProp(this, out result); + } + else + { + result = new Vector(); + this.PropertyManager.SetGradientProp(this, result); + } + gradient.RegisterUsage((object)this); + result.Add(gradient); + this.m_remoteVisual.SendAddGradient(gradient.RemoteGradient); + } + + protected void RemoveAllGradients() + { + if (!this.IsDynamicValueSet(Visual.PropId.Gradients)) + return; + Vector result; + this.PropertyManager.GetGradientProp(this, out result); + this.PropertyManager.RemoveGradientProp(this); + foreach (SharedRenderObject sharedRenderObject in result) + sharedRenderObject.UnregisterUsage((object)this); + result.Clear(); + this.m_remoteVisual.SendClearGradients(); + } + + 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); + this.ChangeParent((TreeNode)visualParent); + } + + internal override void RemoveAllChildren() + { + for (Visual firstChild = (Visual)this.FirstChild; firstChild != null; firstChild = (Visual)this.FirstChild) + firstChild.ChangeParent((Visual)null, (Visual)null, VisualOrder.First); + base.RemoveAllChildren(); + } + + protected void RemoveFromTree() + { + this.RemoveAllChildren(); + this.ChangeParent((Visual)null, (Visual)null, VisualOrder.First); + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteVisual.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteVisual = (RemoteVisual)null; + + internal RemoteVisual RemoteStub => this.m_remoteVisual; + + public object OwnerData + { + get => this.m_objOwnerData; + set => this.m_objOwnerData = value; + } + + protected Vector3 Position + { + get => this.m_vecPosition; + set => this.SetPosition(value, false); + } + + protected void SetPosition(Vector3 value, bool force) + { + if (!(this.m_vecPosition != value) && !force) + return; + this.m_vecPosition = value; + if (!this.FlushValues) + return; + this.m_remoteVisual.SendSetPosition(this.m_vecPosition); + } + + internal Vector2 Size + { + get => this.m_vecSize; + set => this.SetSize(value, false); + } + + internal void SetSize(Vector2 value, bool force) + { + Debug2.Validate((double)value.X >= 0.0 && (double)value.Y >= 0.0, typeof(ArgumentOutOfRangeException), "Negative size not allowed"); + if (!(this.m_vecSize != value) && !force) + return; + this.m_vecSize = value; + if (!this.FlushValues) + return; + this.m_remoteVisual.SendSetSize(this.m_vecSize); + } + + protected float Alpha + { + get + { + float result = 1f; + if (this.IsDynamicValueSet(Visual.PropId.Alpha)) + { + this.PropertyManager.GetAlphaProp(this, out result); + Debug2.Validate(!Math2.WithinEpsilon(result, 1f), typeof(InvalidOperationException), "expected non-opaque alpha if HasAlpha flag was set"); + } + return result; + } + set => this.SetAlpha(value, false); + } + + protected void SetAlpha(float value, bool force) + { + if ((double)this.Alpha == (double)value && !force) + return; + Debug2.Validate((double)value >= 0.0 && (double)value <= 1.0, typeof(ArgumentOutOfRangeException), "Alpha value must be within 0-1 range (incl)"); + this.PropertyManager.SetAlphaProp(this, value); + if (!this.FlushValues) + return; + this.m_remoteVisual.SendSetAlpha(value); + } + + protected Vector3 Scale + { + get + { + Vector3 result = Vector3.UnitVector; + if (this.IsDynamicValueSet(Visual.PropId.Scale)) + { + this.PropertyManager.GetScaleProp(this, out result); + Debug2.Validate(result != Vector3.UnitVector, typeof(InvalidOperationException), "expected non-unit scale if HasScale flag was set"); + } + return result; + } + set => this.SetScale(value, false); + } + + protected void SetScale(Vector3 value, bool force) + { + if (!(this.Scale != value) && !force) + return; + this.PropertyManager.SetScaleProp(this, value); + if (!this.FlushValues) + return; + this.m_remoteVisual.SendSetScale(value); + } + + protected AxisAngle Rotation + { + get + { + AxisAngle result = AxisAngle.Identity; + if (this.IsDynamicValueSet(Visual.PropId.Rotation)) + { + this.PropertyManager.GetRotationProp(this, out result); + Debug2.Validate(result != AxisAngle.Identity, typeof(InvalidOperationException), "expected non-null rotation data if HasRotation flag was set"); + } + return result; + } + set => this.SetRotation(value, false); + } + + protected void SetRotation(AxisAngle value, bool force) + { + if (!(this.Rotation != value) && !force) + return; + this.PropertyManager.SetRotationProp(this, value); + AxisAngle aaRotation = value; + if (this.m_window.IsRightToLeft && (double)aaRotation.Axis.Y <= 0.0 && (double)aaRotation.Axis.X <= 0.0) + aaRotation.Angle = -aaRotation.Angle; + if (!this.FlushValues) + return; + this.m_remoteVisual.SendSetRotation(aaRotation); + } + + protected Vector3 CenterPointScale + { + get + { + Vector3 result = Vector3.Zero; + if (this.IsDynamicValueSet(Visual.PropId.CenterPointScale)) + { + this.PropertyManager.GetCenterPointScaleProp(this, out result); + Debug2.Validate(result != Vector3.Zero, typeof(InvalidOperationException), "expected non-unit scale if HasCenterPointScale flag was set"); + } + return result; + } + set + { + if (this.m_window.IsRightToLeft) + value.X = 1f - value.X; + if (!(this.CenterPointScale != value)) + return; + this.PropertyManager.SetCenterPointScaleProp(this, value); + if (!this.FlushValues) + return; + this.m_remoteVisual.SendSetCenterPointScale(value); + } + } + + protected uint Layer + { + get + { + uint result = 0; + if (this.IsDynamicValueSet(Visual.PropId.Layer)) + { + this.PropertyManager.GetLayerProp(this, out result); + Debug2.Validate(result != 0U, typeof(InvalidOperationException), "expected non-zero layer if HasLayer flag was set"); + } + return result; + } + set + { + if ((int)this.Layer == (int)value) + return; + this.PropertyManager.SetLayerProp(this, value); + if (!this.FlushValues) + return; + this.m_remoteVisual.SendSetLayer(value); + } + } + + protected bool Visible + { + get => this.GetVisible(); + set + { + if (this.Visible == value) + return; + this.SetVisible(value); + if (!this.FlushValues) + return; + this.m_remoteVisual.SendSetVisible(value); + } + } + + protected bool RelativeSize + { + get => this.m_bvDataBits[Visual.s_bvsRelativeSize] != 0; + set + { + int num = value ? 1 : 0; + if (this.m_bvDataBits[Visual.s_bvsRelativeSize] == num) + return; + this.m_bvDataBits[Visual.s_bvsRelativeSize] = num; + this.m_remoteVisual.SendSetRelativeSize(value); + } + } + + internal bool IsValid => this.GetValid(); + + public MouseOptions MouseOptions + { + get => (MouseOptions)this.m_bvDataBits[Visual.s_bvsMouse]; + set + { + Debug2.Validate((value & ~MouseOptions.ValidMask) == MouseOptions.None, typeof(ArgumentException), "Expected valid mouse bits"); + uint nMask = (uint)this.m_bvDataBits[Visual.s_bvsMouse] ^ (uint)(short)value; + if (nMask != 0U && this.FlushValues) + this.m_remoteVisual.SendChangeDataBits((uint)value, nMask); + this.m_bvDataBits[Visual.s_bvsMouse] = (int)(short)value; + } + } + + internal Visual.DebugBits DebugOptions + { + get => (Visual.DebugBits)this.m_bvDataBits[Visual.s_bvsDebug]; + set + { + Debug2.Validate((value & ~Visual.DebugBits.Dump) == Visual.DebugBits.None, typeof(ArgumentException), "Expected valid debug bits"); + Debug2.Validate((uint)value < (uint)byte.MaxValue, typeof(ArgumentException), "Expected valid debug bits"); + uint nMask = (uint)((Visual.DebugBits)this.m_bvDataBits[Visual.s_bvsDebug] ^ value); + if (nMask != 0U) + { + uint nValue = (uint)value << 5; + if (this.m_remoteVisual.IsValid) + this.m_remoteVisual.SendChangeDataBits(nValue, nMask); + } + this.m_bvDataBits[Visual.s_bvsDebug] = (int)value; + } + } + + protected VisualPropertyManager PropertyManager => this.m_window.Session.VisualPropertyManager; + + internal ColorF DEBUG_OutlineColor + { + get => Visual.s_colorTransparent; + set + { + } + } + + private bool GetValid() => this.m_bvDataBits[Visual.s_bvsValid] != 0; + + private void SetValid(bool fValid) => this.m_bvDataBits[Visual.s_bvsValid] = fValid ? 1 : 0; + + private bool GetVisible() => this.m_bvDataBits[Visual.s_bvsVisible] != 0; + + private void SetVisible(bool fVisible) => this.m_bvDataBits[Visual.s_bvsVisible] = fVisible ? 1 : 0; + + internal bool IsDynamicValueSet(Visual.PropId propid) + { + Debug2.Validate(propid < Visual.PropId.MaxDynamicProp, typeof(InvalidOperationException), "Cannot call dynvalue on this propid"); + return this.m_bvDataBits[Visual.s_sectionPropIDMap[(int)propid]] != 0; + } + + internal void SetDynamicValueSet(Visual.PropId propid, bool fValue) + { + Debug2.Validate(propid < Visual.PropId.MaxDynamicProp, typeof(InvalidOperationException), "Cannot call dynvalue on this propid"); + this.m_bvDataBits[Visual.s_sectionPropIDMap[(int)propid]] = fValue ? 1 : 0; + } + + internal bool IsPropFlagSet(Visual.PropId propid) + { + Debug2.Validate(propid >= Visual.PropId.MaxDynamicProp && propid < Visual.PropId.MaxFlagProp, typeof(InvalidOperationException), "Cannot call IsPropFlagSet on this propid"); + return this.m_bvDataBits[Visual.s_sectionPropIDMap[(int)propid]] != 0; + } + + internal void SetPropFlag(Visual.PropId propid, bool fValue) + { + Debug2.Validate(propid >= Visual.PropId.MaxDynamicProp && propid < Visual.PropId.MaxFlagProp, typeof(InvalidOperationException), "Cannot call SetPropFlag on this propid"); + this.m_bvDataBits[Visual.s_sectionPropIDMap[(int)propid]] = fValue ? 1 : 0; + } + + internal override void Reset() + { + this.RemoveFromTree(); + this.RemoveAllGradients(); + bool flushValues = this.FlushValues; + this.FlushValues = false; + this.Position = Vector3.Zero; + this.Scale = Vector3.UnitVector; + this.Size = Vector2.Zero; + this.Layer = 0U; + this.Alpha = 1f; + this.Rotation = AxisAngle.Identity; + this.Visible = true; + this.CenterPointScale = Vector3.Zero; + this.OwnerData = (object)null; + this.MouseOptions = MouseOptions.None; + this.FlushValues = flushValues; + this.m_remoteVisual.SendReset(); + } + + private bool FlushValues + { + get => this.m_bvDataBits[Visual.s_bvsFlush] != 0; + set => this.m_bvDataBits[Visual.s_bvsFlush] = value ? 1 : 0; + } + + RENDERHANDLE IAnimatableObject.GetObjectId() => ((IRenderHandleOwner)this).RenderHandle; + + uint IAnimatableObject.GetPropertyId(string propertyName) + { + if (propertyName == Visual.PositionProperty) + return 1; + if (propertyName == Visual.AlphaProperty) + return 2; + if (propertyName == Visual.RotationProperty || propertyName == Visual.OrientationProperty) + return 3; + if (propertyName == Visual.ScaleProperty) + return 4; + if (propertyName == Visual.SizeProperty) + return 5; + Debug2.Validate(false, typeof(ArgumentException), "Unsupported property"); + return 0; + } + + AnimationInputType IAnimatableObject.GetPropertyType( + string propertyName) + { + if (propertyName == Visual.PositionProperty) + return AnimationInputType.Vector3; + if (propertyName == Visual.AlphaProperty) + return AnimationInputType.Float; + if (propertyName == Visual.RotationProperty) + return AnimationInputType.Vector4; + if (propertyName == Visual.OrientationProperty) + return AnimationInputType.Quaternion; + if (propertyName == Visual.ScaleProperty) + return AnimationInputType.Vector3; + if (propertyName == Visual.SizeProperty) + return AnimationInputType.Vector2; + Debug2.Validate(false, typeof(ArgumentException), "Unsupported property"); + return AnimationInputType.Float; + } + + public override int GetHashCode() => this.m_remoteVisual.GetHashCode(); + + public override bool Equals(object oRHS) => base.Equals(oRHS); + + [System.Flags] + internal enum DebugBits + { + MarkForOutline = 1, + IgnoreOutlineAll = 2, + Dump = IgnoreOutlineAll | MarkForOutline, // 0x00000003 + None = 0, + ValidMask = Dump, // 0x00000003 + } + + internal enum PropId + { + Alpha = 0, + Scale = 1, + Rotation = 2, + CenterPointScale = 3, + Layer = 4, + OutlineColor = 5, + CoordMap = 6, + Gradients = 7, + Camera = 8, + MaxDynamicProp = 9, + NineGrid = 9, + MaxFlagProp = 10, // 0x0000000A + } + + private enum AnimatableProperties : uint + { + Position = 1, + Alpha = 2, + Rotation = 3, + Scale = 4, + Size = 5, } - this.m_bvDataBits[Visual.s_bvsDebug] = (int) value; - } } - - protected VisualPropertyManager PropertyManager => this.m_window.Session.VisualPropertyManager; - - internal ColorF DEBUG_OutlineColor - { - get => Visual.s_colorTransparent; - set - { - } - } - - private bool GetValid() => this.m_bvDataBits[Visual.s_bvsValid] != 0; - - private void SetValid(bool fValid) => this.m_bvDataBits[Visual.s_bvsValid] = fValid ? 1 : 0; - - private bool GetVisible() => this.m_bvDataBits[Visual.s_bvsVisible] != 0; - - private void SetVisible(bool fVisible) => this.m_bvDataBits[Visual.s_bvsVisible] = fVisible ? 1 : 0; - - internal bool IsDynamicValueSet(Visual.PropId propid) - { - Debug2.Validate(propid < Visual.PropId.MaxDynamicProp, typeof (InvalidOperationException), "Cannot call dynvalue on this propid"); - return this.m_bvDataBits[Visual.s_sectionPropIDMap[(int) propid]] != 0; - } - - internal void SetDynamicValueSet(Visual.PropId propid, bool fValue) - { - Debug2.Validate(propid < Visual.PropId.MaxDynamicProp, typeof (InvalidOperationException), "Cannot call dynvalue on this propid"); - this.m_bvDataBits[Visual.s_sectionPropIDMap[(int) propid]] = fValue ? 1 : 0; - } - - internal bool IsPropFlagSet(Visual.PropId propid) - { - Debug2.Validate(propid >= Visual.PropId.MaxDynamicProp && propid < Visual.PropId.MaxFlagProp, typeof (InvalidOperationException), "Cannot call IsPropFlagSet on this propid"); - return this.m_bvDataBits[Visual.s_sectionPropIDMap[(int) propid]] != 0; - } - - internal void SetPropFlag(Visual.PropId propid, bool fValue) - { - Debug2.Validate(propid >= Visual.PropId.MaxDynamicProp && propid < Visual.PropId.MaxFlagProp, typeof (InvalidOperationException), "Cannot call SetPropFlag on this propid"); - this.m_bvDataBits[Visual.s_sectionPropIDMap[(int) propid]] = fValue ? 1 : 0; - } - - internal override void Reset() - { - this.RemoveFromTree(); - this.RemoveAllGradients(); - bool flushValues = this.FlushValues; - this.FlushValues = false; - this.Position = Vector3.Zero; - this.Scale = Vector3.UnitVector; - this.Size = Vector2.Zero; - this.Layer = 0U; - this.Alpha = 1f; - this.Rotation = AxisAngle.Identity; - this.Visible = true; - this.CenterPointScale = Vector3.Zero; - this.OwnerData = (object) null; - this.MouseOptions = MouseOptions.None; - this.FlushValues = flushValues; - this.m_remoteVisual.SendReset(); - } - - private bool FlushValues - { - get => this.m_bvDataBits[Visual.s_bvsFlush] != 0; - set => this.m_bvDataBits[Visual.s_bvsFlush] = value ? 1 : 0; - } - - RENDERHANDLE IAnimatableObject.GetObjectId() => ((IRenderHandleOwner) this).RenderHandle; - - uint IAnimatableObject.GetPropertyId(string propertyName) - { - if (propertyName == Visual.PositionProperty) - return 1; - if (propertyName == Visual.AlphaProperty) - return 2; - if (propertyName == Visual.RotationProperty || propertyName == Visual.OrientationProperty) - return 3; - if (propertyName == Visual.ScaleProperty) - return 4; - if (propertyName == Visual.SizeProperty) - return 5; - Debug2.Validate(false, typeof (ArgumentException), "Unsupported property"); - return 0; - } - - AnimationInputType IAnimatableObject.GetPropertyType( - string propertyName) - { - if (propertyName == Visual.PositionProperty) - return AnimationInputType.Vector3; - if (propertyName == Visual.AlphaProperty) - return AnimationInputType.Float; - if (propertyName == Visual.RotationProperty) - return AnimationInputType.Vector4; - if (propertyName == Visual.OrientationProperty) - return AnimationInputType.Quaternion; - if (propertyName == Visual.ScaleProperty) - return AnimationInputType.Vector3; - if (propertyName == Visual.SizeProperty) - return AnimationInputType.Vector2; - Debug2.Validate(false, typeof (ArgumentException), "Unsupported property"); - return AnimationInputType.Float; - } - - public override int GetHashCode() => this.m_remoteVisual.GetHashCode(); - - public override bool Equals(object oRHS) => base.Equals(oRHS); - - [System.Flags] - internal enum DebugBits - { - MarkForOutline = 1, - IgnoreOutlineAll = 2, - Dump = IgnoreOutlineAll | MarkForOutline, // 0x00000003 - None = 0, - ValidMask = Dump, // 0x00000003 - } - - internal enum PropId - { - Alpha = 0, - Scale = 1, - Rotation = 2, - CenterPointScale = 3, - Layer = 4, - OutlineColor = 5, - CoordMap = 6, - Gradients = 7, - Camera = 8, - MaxDynamicProp = 9, - NineGrid = 9, - MaxFlagProp = 10, // 0x0000000A - } - - private enum AnimatableProperties : uint - { - Position = 1, - Alpha = 2, - Rotation = 3, - Scale = 4, - Size = 5, - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualContainer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualContainer.cs index c7a84c1..58adc63 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualContainer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualContainer.cs @@ -12,152 +12,152 @@ using System; namespace Microsoft.Iris.Render.Graphics { - internal class VisualContainer : - Visual, - IVisualContainer, - IVisual, - IRawInputSite, - IAnimatable, - ISharedRenderObject - { - private bool m_fIsRoot; - - internal VisualContainer( - bool isRoot, - RenderSession session, - RenderWindow window, - object objOwnerData, - out RemoteVisual remoteVisual) - : base(session, window, objOwnerData) + internal class VisualContainer : + Visual, + IVisualContainer, + IVisual, + IRawInputSite, + IAnimatable, + ISharedRenderObject { - 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 = (RemoteVisual) session.BuildRemoteVisualContainer((Visual) this); - this.m_remoteVisual.SendSetVisible(true); - remoteVisual = this.m_remoteVisual; + private bool m_fIsRoot; + + internal VisualContainer( + bool isRoot, + RenderSession session, + RenderWindow 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 = (RemoteVisual)session.BuildRemoteVisualContainer((Visual)this); + this.m_remoteVisual.SendSetVisible(true); + remoteVisual = this.m_remoteVisual; + } + + protected override void Dispose(bool fInDispose) + { + try + { + if (!fInDispose) + return; + this.RemoveAllChildren(); + if (!this.IsDynamicValueSet(Visual.PropId.Camera)) + return; + this.PropertyManager.RemoveCameraProp((Visual)this); + } + finally + { + base.Dispose(fInDispose); + } + } + + private void SetCamera(ICamera camera) + { + this.PropertyManager.SetCameraProp((Visual)this, (Camera)camera); + RemoteVisualContainer remoteVisual = (RemoteVisualContainer)this.m_remoteVisual; + if (camera != null) + remoteVisual.SendSetCamera(((Camera)camera).RemoteStub); + else + remoteVisual.SendSetCamera((RemoteCamera)null); + } + + bool IVisualContainer.IsRoot => this.m_fIsRoot; + + Vector3 IVisualContainer.Position + { + get => this.Position; + set => this.Position = value; + } + + void IVisualContainer.SetPosition(Vector3 value, bool force) => this.SetPosition(value, force); + + Vector2 IVisualContainer.Size + { + get => this.Size; + set => this.Size = value; + } + + void IVisualContainer.SetSize(Vector2 value, bool force) => this.SetSize(value, force); + + bool IVisualContainer.Visible + { + get => this.Visible; + set => this.Visible = value; + } + + Vector3 IVisualContainer.Scale + { + get => this.Scale; + set => this.Scale = value; + } + + void IVisualContainer.SetScale(Vector3 value, bool force) => this.SetScale(value, force); + + AxisAngle IVisualContainer.Rotation + { + get => this.Rotation; + set => this.Rotation = value; + } + + void IVisualContainer.SetRotation(AxisAngle value, bool force) => this.SetRotation(value, force); + + float IVisualContainer.Alpha + { + get => this.Alpha; + set => this.Alpha = value; + } + + void IVisualContainer.SetAlpha(float value, bool force) => this.SetAlpha(value, force); + + Vector3 IVisualContainer.CenterPoint + { + get => this.CenterPointScale; + set => this.CenterPointScale = value; + } + + int IVisualContainer.ChildCount => this.ChildCount; + + uint IVisualContainer.Layer + { + get => this.Layer; + set => this.Layer = value; + } + + ICamera IVisualContainer.Camera + { + get + { + Camera result = (Camera)null; + if (this.IsDynamicValueSet(Visual.PropId.Camera)) + this.PropertyManager.GetCameraProp((Visual)this, out result); + return (ICamera)result; + } + set => this.SetCamera(value); + } + + void IVisualContainer.AddGradient(IGradient gradient) => this.AddGradient((Gradient)gradient); + + void IVisualContainer.RemoveAllGradients() => this.RemoveAllGradients(); + + void IVisualContainer.AddChild( + IVisual vChild, + IVisual vSibling, + VisualOrder nOrder) + { + Visual visual = (Visual)vChild; + Visual visualSibling = (Visual)null; + if (vSibling != null) + visualSibling = (Visual)vSibling; + visual.ChangeParent((Visual)this, visualSibling, nOrder); + } + + void IVisualContainer.RemoveChild(IVisual vChild) => ((Visual)vChild).ChangeParent((Visual)null, (Visual)null, VisualOrder.First); + + void IVisualContainer.RemoveAllChildren() => this.RemoveAllChildren(); } - - protected override void Dispose(bool fInDispose) - { - try - { - if (!fInDispose) - return; - this.RemoveAllChildren(); - if (!this.IsDynamicValueSet(Visual.PropId.Camera)) - return; - this.PropertyManager.RemoveCameraProp((Visual) this); - } - finally - { - base.Dispose(fInDispose); - } - } - - private void SetCamera(ICamera camera) - { - this.PropertyManager.SetCameraProp((Visual) this, (Camera) camera); - RemoteVisualContainer remoteVisual = (RemoteVisualContainer) this.m_remoteVisual; - if (camera != null) - remoteVisual.SendSetCamera(((Camera) camera).RemoteStub); - else - remoteVisual.SendSetCamera((RemoteCamera) null); - } - - bool IVisualContainer.IsRoot => this.m_fIsRoot; - - Vector3 IVisualContainer.Position - { - get => this.Position; - set => this.Position = value; - } - - void IVisualContainer.SetPosition(Vector3 value, bool force) => this.SetPosition(value, force); - - Vector2 IVisualContainer.Size - { - get => this.Size; - set => this.Size = value; - } - - void IVisualContainer.SetSize(Vector2 value, bool force) => this.SetSize(value, force); - - bool IVisualContainer.Visible - { - get => this.Visible; - set => this.Visible = value; - } - - Vector3 IVisualContainer.Scale - { - get => this.Scale; - set => this.Scale = value; - } - - void IVisualContainer.SetScale(Vector3 value, bool force) => this.SetScale(value, force); - - AxisAngle IVisualContainer.Rotation - { - get => this.Rotation; - set => this.Rotation = value; - } - - void IVisualContainer.SetRotation(AxisAngle value, bool force) => this.SetRotation(value, force); - - float IVisualContainer.Alpha - { - get => this.Alpha; - set => this.Alpha = value; - } - - void IVisualContainer.SetAlpha(float value, bool force) => this.SetAlpha(value, force); - - Vector3 IVisualContainer.CenterPoint - { - get => this.CenterPointScale; - set => this.CenterPointScale = value; - } - - int IVisualContainer.ChildCount => this.ChildCount; - - uint IVisualContainer.Layer - { - get => this.Layer; - set => this.Layer = value; - } - - ICamera IVisualContainer.Camera - { - get - { - Camera result = (Camera) null; - if (this.IsDynamicValueSet(Visual.PropId.Camera)) - this.PropertyManager.GetCameraProp((Visual) this, out result); - return (ICamera) result; - } - set => this.SetCamera(value); - } - - void IVisualContainer.AddGradient(IGradient gradient) => this.AddGradient((Gradient) gradient); - - void IVisualContainer.RemoveAllGradients() => this.RemoveAllGradients(); - - void IVisualContainer.AddChild( - IVisual vChild, - IVisual vSibling, - VisualOrder nOrder) - { - Visual visual = (Visual) vChild; - Visual visualSibling = (Visual) null; - if (vSibling != null) - visualSibling = (Visual) vSibling; - visual.ChangeParent((Visual) this, visualSibling, nOrder); - } - - void IVisualContainer.RemoveChild(IVisual vChild) => ((Visual) vChild).ChangeParent((Visual) null, (Visual) null, VisualOrder.First); - - void IVisualContainer.RemoveAllChildren() => this.RemoveAllChildren(); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualPropertyManager.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualPropertyManager.cs index 466a3fe..ed8f8ab 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualPropertyManager.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualPropertyManager.cs @@ -11,236 +11,236 @@ using System.Collections; namespace Microsoft.Iris.Render.Graphics { - internal class VisualPropertyManager : IDisposable - { - private SmartMap m_scaleProp; - private SmartMap m_centerPointScaleProp; - private SmartMap m_layerProp; - private SmartMap m_coordMapProp; - private SmartMap m_alphaProp; - private SmartMap m_rotationProp; - private SmartMap> m_gradientProp; - private SmartMap m_cameraProp; - - public VisualPropertyManager() + internal class VisualPropertyManager : IDisposable { - this.m_alphaProp = new SmartMap(); - this.m_coordMapProp = new SmartMap(); - this.m_gradientProp = new SmartMap>(); - this.m_layerProp = new SmartMap(); - this.m_rotationProp = new SmartMap(); - this.m_scaleProp = new SmartMap(); - this.m_centerPointScaleProp = new SmartMap(); - this.m_cameraProp = new SmartMap(); - } + private SmartMap m_scaleProp; + private SmartMap m_centerPointScaleProp; + private SmartMap m_layerProp; + private SmartMap m_coordMapProp; + private SmartMap m_alphaProp; + private SmartMap m_rotationProp; + private SmartMap> m_gradientProp; + private SmartMap m_cameraProp; - public void Dispose() - { - Debug2.Validate(this.m_alphaProp.IsEmpty, typeof (InvalidOperationException), "empty"); - Debug2.Validate(this.m_coordMapProp.IsEmpty, typeof (InvalidOperationException), "empty"); - Debug2.Validate(this.m_gradientProp.IsEmpty, typeof (InvalidOperationException), "empty"); - Debug2.Validate(this.m_layerProp.IsEmpty, typeof (InvalidOperationException), "empty"); - Debug2.Validate(this.m_rotationProp.IsEmpty, typeof (InvalidOperationException), "empty"); - Debug2.Validate(this.m_scaleProp.IsEmpty, typeof (InvalidOperationException), "empty"); - Debug2.Validate(this.m_centerPointScaleProp.IsEmpty, typeof (InvalidOperationException), "empty"); - Debug2.Validate(this.m_cameraProp.IsEmpty, typeof (InvalidOperationException), "empty"); - } + public VisualPropertyManager() + { + this.m_alphaProp = new SmartMap(); + this.m_coordMapProp = new SmartMap(); + this.m_gradientProp = new SmartMap>(); + this.m_layerProp = new SmartMap(); + this.m_rotationProp = new SmartMap(); + this.m_scaleProp = new SmartMap(); + this.m_centerPointScaleProp = new SmartMap(); + this.m_cameraProp = new SmartMap(); + } - public bool GetScaleProp(Visual key, out Vector3 result) - { - bool condition = this.m_scaleProp.TryGetValue((uint) key.GetHashCode(), out result); - Debug2.Validate(condition, typeof (InvalidOperationException), "should have scale"); - return condition; - } + public void Dispose() + { + Debug2.Validate(this.m_alphaProp.IsEmpty, typeof(InvalidOperationException), "empty"); + Debug2.Validate(this.m_coordMapProp.IsEmpty, typeof(InvalidOperationException), "empty"); + Debug2.Validate(this.m_gradientProp.IsEmpty, typeof(InvalidOperationException), "empty"); + Debug2.Validate(this.m_layerProp.IsEmpty, typeof(InvalidOperationException), "empty"); + Debug2.Validate(this.m_rotationProp.IsEmpty, typeof(InvalidOperationException), "empty"); + Debug2.Validate(this.m_scaleProp.IsEmpty, typeof(InvalidOperationException), "empty"); + Debug2.Validate(this.m_centerPointScaleProp.IsEmpty, typeof(InvalidOperationException), "empty"); + Debug2.Validate(this.m_cameraProp.IsEmpty, typeof(InvalidOperationException), "empty"); + } - public void SetScaleProp(Visual key, Vector3 oValue) - { - if (oValue != Vector3.UnitVector) - { - this.m_scaleProp.SetValue((uint) key.GetHashCode(), oValue); - key.SetDynamicValueSet(Visual.PropId.Scale, true); - } - else - { - if (!key.IsDynamicValueSet(Visual.PropId.Scale)) - return; - this.RemoveScaleProp(key); - } - } + public bool GetScaleProp(Visual key, out Vector3 result) + { + bool condition = this.m_scaleProp.TryGetValue((uint)key.GetHashCode(), out result); + Debug2.Validate(condition, typeof(InvalidOperationException), "should have scale"); + return condition; + } - public void RemoveScaleProp(Visual key) - { - this.m_scaleProp.Remove((uint) key.GetHashCode()); - key.SetDynamicValueSet(Visual.PropId.Scale, false); - } + public void SetScaleProp(Visual key, Vector3 oValue) + { + if (oValue != Vector3.UnitVector) + { + this.m_scaleProp.SetValue((uint)key.GetHashCode(), oValue); + key.SetDynamicValueSet(Visual.PropId.Scale, true); + } + else + { + if (!key.IsDynamicValueSet(Visual.PropId.Scale)) + return; + this.RemoveScaleProp(key); + } + } - public bool GetAlphaProp(Visual key, out float result) - { - bool condition = this.m_alphaProp.TryGetValue((uint) key.GetHashCode(), out result); - Debug2.Validate(condition, typeof (InvalidOperationException), "should have alpha"); - return condition; - } + public void RemoveScaleProp(Visual key) + { + this.m_scaleProp.Remove((uint)key.GetHashCode()); + key.SetDynamicValueSet(Visual.PropId.Scale, false); + } - public void SetAlphaProp(Visual key, float oValue) - { - if (!Math2.WithinEpsilon(oValue, 1f)) - { - this.m_alphaProp.SetValue((uint) key.GetHashCode(), oValue); - key.SetDynamicValueSet(Visual.PropId.Alpha, true); - } - else - { - if (!key.IsDynamicValueSet(Visual.PropId.Alpha)) - return; - this.RemoveAlphaProp(key); - } - } + public bool GetAlphaProp(Visual key, out float result) + { + bool condition = this.m_alphaProp.TryGetValue((uint)key.GetHashCode(), out result); + Debug2.Validate(condition, typeof(InvalidOperationException), "should have alpha"); + return condition; + } - public void RemoveAlphaProp(Visual key) - { - this.m_alphaProp.Remove((uint) key.GetHashCode()); - key.SetDynamicValueSet(Visual.PropId.Alpha, false); - } + public void SetAlphaProp(Visual key, float oValue) + { + if (!Math2.WithinEpsilon(oValue, 1f)) + { + this.m_alphaProp.SetValue((uint)key.GetHashCode(), oValue); + key.SetDynamicValueSet(Visual.PropId.Alpha, true); + } + else + { + if (!key.IsDynamicValueSet(Visual.PropId.Alpha)) + return; + this.RemoveAlphaProp(key); + } + } - public bool GetRotationProp(Visual key, out AxisAngle result) - { - bool condition = this.m_rotationProp.TryGetValue((uint) key.GetHashCode(), out result); - Debug2.Validate(condition, typeof (InvalidOperationException), "should have rotation"); - return condition; - } + public void RemoveAlphaProp(Visual key) + { + this.m_alphaProp.Remove((uint)key.GetHashCode()); + key.SetDynamicValueSet(Visual.PropId.Alpha, false); + } - public void SetRotationProp(Visual key, AxisAngle oValue) - { - if (oValue != AxisAngle.Identity) - { - this.m_rotationProp.SetValue((uint) key.GetHashCode(), oValue); - key.SetDynamicValueSet(Visual.PropId.Rotation, true); - } - else - { - if (!key.IsDynamicValueSet(Visual.PropId.Rotation)) - return; - this.RemoveRotationProp(key); - } - } + public bool GetRotationProp(Visual key, out AxisAngle result) + { + bool condition = this.m_rotationProp.TryGetValue((uint)key.GetHashCode(), out result); + Debug2.Validate(condition, typeof(InvalidOperationException), "should have rotation"); + return condition; + } - public void RemoveRotationProp(Visual key) - { - this.m_rotationProp.Remove((uint) key.GetHashCode()); - key.SetDynamicValueSet(Visual.PropId.Rotation, false); - } + public void SetRotationProp(Visual key, AxisAngle oValue) + { + if (oValue != AxisAngle.Identity) + { + this.m_rotationProp.SetValue((uint)key.GetHashCode(), oValue); + key.SetDynamicValueSet(Visual.PropId.Rotation, true); + } + else + { + if (!key.IsDynamicValueSet(Visual.PropId.Rotation)) + return; + this.RemoveRotationProp(key); + } + } - public bool GetCenterPointScaleProp(Visual key, out Vector3 result) - { - bool condition = this.m_centerPointScaleProp.TryGetValue((uint) key.GetHashCode(), out result); - Debug2.Validate(condition, typeof (InvalidOperationException), "should have center point scale"); - return condition; - } + public void RemoveRotationProp(Visual key) + { + this.m_rotationProp.Remove((uint)key.GetHashCode()); + key.SetDynamicValueSet(Visual.PropId.Rotation, false); + } - public void SetCenterPointScaleProp(Visual key, Vector3 oValue) - { - if (oValue != Vector3.Zero) - { - this.m_centerPointScaleProp.SetValue((uint) key.GetHashCode(), oValue); - key.SetDynamicValueSet(Visual.PropId.CenterPointScale, true); - } - else - { - if (!key.IsDynamicValueSet(Visual.PropId.CenterPointScale)) - return; - this.RemoveCenterPointScaleProp(key); - } - } + public bool GetCenterPointScaleProp(Visual key, out Vector3 result) + { + bool condition = this.m_centerPointScaleProp.TryGetValue((uint)key.GetHashCode(), out result); + Debug2.Validate(condition, typeof(InvalidOperationException), "should have center point scale"); + return condition; + } - public void RemoveCenterPointScaleProp(Visual key) - { - this.m_centerPointScaleProp.Remove((uint) key.GetHashCode()); - key.SetDynamicValueSet(Visual.PropId.CenterPointScale, false); - } + public void SetCenterPointScaleProp(Visual key, Vector3 oValue) + { + if (oValue != Vector3.Zero) + { + this.m_centerPointScaleProp.SetValue((uint)key.GetHashCode(), oValue); + key.SetDynamicValueSet(Visual.PropId.CenterPointScale, true); + } + else + { + if (!key.IsDynamicValueSet(Visual.PropId.CenterPointScale)) + return; + this.RemoveCenterPointScaleProp(key); + } + } - public bool GetLayerProp(Visual key, out uint result) - { - bool condition = this.m_layerProp.TryGetValue((uint) key.GetHashCode(), out result); - Debug2.Validate(condition, typeof (InvalidOperationException), "should have layer"); - return condition; - } + public void RemoveCenterPointScaleProp(Visual key) + { + this.m_centerPointScaleProp.Remove((uint)key.GetHashCode()); + key.SetDynamicValueSet(Visual.PropId.CenterPointScale, false); + } - public void SetLayerProp(Visual key, uint oValue) - { - if (oValue != 0U) - { - this.m_layerProp.SetValue((uint) key.GetHashCode(), oValue); - key.SetDynamicValueSet(Visual.PropId.Layer, true); - } - else - { - if (!key.IsDynamicValueSet(Visual.PropId.Layer)) - return; - this.RemoveLayerProp(key); - } - } + public bool GetLayerProp(Visual key, out uint result) + { + bool condition = this.m_layerProp.TryGetValue((uint)key.GetHashCode(), out result); + Debug2.Validate(condition, typeof(InvalidOperationException), "should have layer"); + return condition; + } - public void RemoveLayerProp(Visual key) - { - this.m_layerProp.Remove((uint) key.GetHashCode()); - key.SetDynamicValueSet(Visual.PropId.Layer, false); - } + public void SetLayerProp(Visual key, uint oValue) + { + if (oValue != 0U) + { + this.m_layerProp.SetValue((uint)key.GetHashCode(), oValue); + key.SetDynamicValueSet(Visual.PropId.Layer, true); + } + else + { + if (!key.IsDynamicValueSet(Visual.PropId.Layer)) + return; + this.RemoveLayerProp(key); + } + } - public bool GetGradientProp(Visual key, out Vector result) - { - bool condition = this.m_gradientProp.TryGetValue((uint) key.GetHashCode(), out result); - Debug2.Validate(condition, typeof (InvalidOperationException), "should have gradient"); - return condition; - } + public void RemoveLayerProp(Visual key) + { + this.m_layerProp.Remove((uint)key.GetHashCode()); + key.SetDynamicValueSet(Visual.PropId.Layer, false); + } - public void SetGradientProp(Visual key, Vector oValue) - { - this.m_gradientProp.SetValue((uint) key.GetHashCode(), oValue); - key.SetDynamicValueSet(Visual.PropId.Gradients, true); - } + public bool GetGradientProp(Visual key, out Vector result) + { + bool condition = this.m_gradientProp.TryGetValue((uint)key.GetHashCode(), out result); + Debug2.Validate(condition, typeof(InvalidOperationException), "should have gradient"); + return condition; + } - public void RemoveGradientProp(Visual key) - { - this.m_gradientProp.Remove((uint) key.GetHashCode()); - key.SetDynamicValueSet(Visual.PropId.Gradients, false); - } + public void SetGradientProp(Visual key, Vector oValue) + { + this.m_gradientProp.SetValue((uint)key.GetHashCode(), oValue); + key.SetDynamicValueSet(Visual.PropId.Gradients, true); + } - public bool GetCameraProp(Visual key, out Camera result) - { - bool condition = this.m_cameraProp.TryGetValue((uint) key.GetHashCode(), out result); - Debug2.Validate(condition, typeof (InvalidOperationException), "should have Camera"); - return condition; - } + public void RemoveGradientProp(Visual key) + { + this.m_gradientProp.Remove((uint)key.GetHashCode()); + key.SetDynamicValueSet(Visual.PropId.Gradients, false); + } - public void SetCameraProp(Visual key, Camera oValue) - { - this.m_cameraProp.SetValue((uint) key.GetHashCode(), oValue); - key.SetDynamicValueSet(Visual.PropId.Camera, true); - } + public bool GetCameraProp(Visual key, out Camera result) + { + bool condition = this.m_cameraProp.TryGetValue((uint)key.GetHashCode(), out result); + Debug2.Validate(condition, typeof(InvalidOperationException), "should have Camera"); + return condition; + } - public void RemoveCameraProp(Visual key) - { - this.m_cameraProp.Remove((uint) key.GetHashCode()); - key.SetDynamicValueSet(Visual.PropId.Camera, false); - } + public void SetCameraProp(Visual key, Camera oValue) + { + this.m_cameraProp.SetValue((uint)key.GetHashCode(), oValue); + key.SetDynamicValueSet(Visual.PropId.Camera, true); + } - public bool GetCoordmapProp(Visual key, out ArrayList result) - { - bool condition = this.m_coordMapProp.TryGetValue((uint) key.GetHashCode(), out result); - Debug2.Validate(condition, typeof (InvalidOperationException), "should have coordmap"); - return condition; - } + public void RemoveCameraProp(Visual key) + { + this.m_cameraProp.Remove((uint)key.GetHashCode()); + key.SetDynamicValueSet(Visual.PropId.Camera, false); + } - public void SetCoordmapProp(Visual key, ArrayList oValue) - { - this.m_coordMapProp.SetValue((uint) key.GetHashCode(), oValue); - key.SetDynamicValueSet(Visual.PropId.CoordMap, true); - } + public bool GetCoordmapProp(Visual key, out ArrayList result) + { + bool condition = this.m_coordMapProp.TryGetValue((uint)key.GetHashCode(), out result); + Debug2.Validate(condition, typeof(InvalidOperationException), "should have coordmap"); + return condition; + } - public void RemoveCoordmapProp(Visual key) - { - this.m_coordMapProp.Remove((uint) key.GetHashCode()); - key.SetDynamicValueSet(Visual.PropId.CoordMap, false); + public void SetCoordmapProp(Visual key, ArrayList oValue) + { + this.m_coordMapProp.SetValue((uint)key.GetHashCode(), oValue); + key.SetDynamicValueSet(Visual.PropId.CoordMap, true); + } + + public void RemoveCoordmapProp(Visual key) + { + this.m_coordMapProp.Remove((uint)key.GetHashCode()); + key.SetDynamicValueSet(Visual.PropId.CoordMap, false); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/GraphicsDeviceType.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/GraphicsDeviceType.cs index 8c651a4..5178bfa 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/GraphicsDeviceType.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/GraphicsDeviceType.cs @@ -6,11 +6,11 @@ namespace Microsoft.Iris.Render { - public enum GraphicsDeviceType - { - None, - Gdi, - Direct3D9, - XeDirectX9, - } + public enum GraphicsDeviceType + { + None, + Gdi, + Direct3D9, + XeDirectX9, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/GraphicsRenderingQuality.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/GraphicsRenderingQuality.cs index ff94276..bd1fbde 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/GraphicsRenderingQuality.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/GraphicsRenderingQuality.cs @@ -6,9 +6,9 @@ namespace Microsoft.Iris.Render { - public enum GraphicsRenderingQuality - { - MinQuality, - MaxQuality, - } + public enum GraphicsRenderingQuality + { + MinQuality, + MaxQuality, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/HSLElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/HSLElement.cs index ddd5d66..d7b14a7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/HSLElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/HSLElement.cs @@ -10,72 +10,72 @@ using System; namespace Microsoft.Iris.Render { - internal class HSLElement : EffectOperation - { - internal const string HuePropertyName = "Hue"; - internal const string SaturationPropertyName = "Saturation"; - internal const string LightnessPropertyName = "Lightness"; - private float m_flHue; - private byte m_nHueID; - private float m_flSaturation; - private byte m_nSaturationID; - private float m_flLightness; - private byte m_nLightnessID; - - public HSLElement(string stName, float flHue, float flSaturation, float flLightness) - : this() + internal class HSLElement : EffectOperation { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate((double) flHue >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Hue is >= 0"); - Debug2.Validate((double) flSaturation >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Saturation is >= 0"); - Debug2.Validate((double) flLightness >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Lightness is >= 0"); - this.m_flHue = flHue; - this.m_flSaturation = flSaturation; - this.m_flLightness = flLightness; - this.m_stName = stName; + internal const string HuePropertyName = "Hue"; + internal const string SaturationPropertyName = "Saturation"; + internal const string LightnessPropertyName = "Lightness"; + private float m_flHue; + private byte m_nHueID; + private float m_flSaturation; + private byte m_nSaturationID; + private float m_flLightness; + private byte m_nLightnessID; + + public HSLElement(string stName, float flHue, float flSaturation, float flLightness) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate((double)flHue >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Hue is >= 0"); + Debug2.Validate((double)flSaturation >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Saturation is >= 0"); + Debug2.Validate((double)flLightness >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Lightness is >= 0"); + this.m_flHue = flHue; + this.m_flSaturation = flSaturation; + this.m_flLightness = flLightness; + this.m_stName = stName; + } + + public HSLElement() => this.m_typeOperation = EffectOperationType.HSL; + + public float Hue + { + get => this.m_flHue; + set => this.m_flHue = value; + } + + internal byte HueID => this.m_nHueID; + + public float Saturation + { + get => this.m_flSaturation; + set => this.m_flSaturation = value; + } + + internal byte SaturationID => this.m_nSaturationID; + + public float Lightness + { + get => this.m_flLightness; + set => this.m_flLightness = value; + } + + internal byte LightnessID => this.m_nLightnessID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Hue", (byte)8, ref this.m_nHueID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Saturation", (byte)8, ref this.m_nSaturationID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Lightness", (byte)8, ref this.m_nLightnessID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("Hue", EffectPropertyType.Float, (object)this.m_flHue, this.m_nHueID, dictProperties) && this.GenerateProperty("Saturation", EffectPropertyType.Float, (object)this.m_flSaturation, this.m_nSaturationID, dictProperties) && this.GenerateProperty("Lightness", EffectPropertyType.Float, (object)this.m_flLightness, this.m_nLightnessID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Hue", this.HueID, this.Hue, cacheKey); + this.GeneratePropertyCacheKey("Saturation", this.SaturationID, this.Saturation, cacheKey); + this.GeneratePropertyCacheKey("Lightness", this.LightnessID, this.Lightness, cacheKey); + } } - - public HSLElement() => this.m_typeOperation = EffectOperationType.HSL; - - public float Hue - { - get => this.m_flHue; - set => this.m_flHue = value; - } - - internal byte HueID => this.m_nHueID; - - public float Saturation - { - get => this.m_flSaturation; - set => this.m_flSaturation = value; - } - - internal byte SaturationID => this.m_nSaturationID; - - public float Lightness - { - get => this.m_flLightness; - set => this.m_flLightness = value; - } - - internal byte LightnessID => this.m_nLightnessID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Hue", (byte) 8, ref this.m_nHueID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Saturation", (byte) 8, ref this.m_nSaturationID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Lightness", (byte) 8, ref this.m_nLightnessID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("Hue", EffectPropertyType.Float, (object) this.m_flHue, this.m_nHueID, dictProperties) && this.GenerateProperty("Saturation", EffectPropertyType.Float, (object) this.m_flSaturation, this.m_nSaturationID, dictProperties) && this.GenerateProperty("Lightness", EffectPropertyType.Float, (object) this.m_flLightness, this.m_nLightnessID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Hue", this.HueID, this.Hue, cacheKey); - this.GeneratePropertyCacheKey("Saturation", this.SaturationID, this.Saturation, cacheKey); - this.GeneratePropertyCacheKey("Lightness", this.LightnessID, this.Lightness, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/HSVElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/HSVElement.cs index c39b73e..3194d91 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/HSVElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/HSVElement.cs @@ -10,72 +10,72 @@ using System; namespace Microsoft.Iris.Render { - internal class HSVElement : EffectOperation - { - internal const string HuePropertyName = "Hue"; - internal const string SaturationPropertyName = "Saturation"; - internal const string ValuePropertyName = "Value"; - private float m_flHue; - private byte m_nHueID; - private float m_flSaturation; - private byte m_nSaturationID; - private float m_flValue; - private byte m_nValueID; - - public HSVElement(string stName, float flHue, float flSaturation, float flValue) - : this() + internal class HSVElement : EffectOperation { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate((double) flHue >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Hue is >= 0"); - Debug2.Validate((double) flSaturation >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Saturation is >= 0"); - Debug2.Validate((double) flValue >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Value is >= 0"); - this.m_flHue = flHue; - this.m_flSaturation = flSaturation; - this.m_flValue = flValue; - this.m_stName = stName; + internal const string HuePropertyName = "Hue"; + internal const string SaturationPropertyName = "Saturation"; + internal const string ValuePropertyName = "Value"; + private float m_flHue; + private byte m_nHueID; + private float m_flSaturation; + private byte m_nSaturationID; + private float m_flValue; + private byte m_nValueID; + + public HSVElement(string stName, float flHue, float flSaturation, float flValue) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate((double)flHue >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Hue is >= 0"); + Debug2.Validate((double)flSaturation >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Saturation is >= 0"); + Debug2.Validate((double)flValue >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Value is >= 0"); + this.m_flHue = flHue; + this.m_flSaturation = flSaturation; + this.m_flValue = flValue; + this.m_stName = stName; + } + + public HSVElement() => this.m_typeOperation = EffectOperationType.HSV; + + public float Hue + { + get => this.m_flHue; + set => this.m_flHue = value; + } + + internal byte HueID => this.m_nHueID; + + public float Saturation + { + get => this.m_flSaturation; + set => this.m_flSaturation = value; + } + + internal byte SaturationID => this.m_nSaturationID; + + public float Value + { + get => this.m_flValue; + set => this.m_flValue = value; + } + + internal byte ValueID => this.m_nValueID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Hue", (byte)8, ref this.m_nHueID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Saturation", (byte)8, ref this.m_nSaturationID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Value", (byte)8, ref this.m_nValueID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("Hue", EffectPropertyType.Float, (object)this.m_flHue, this.m_nHueID, dictProperties) && this.GenerateProperty("Saturation", EffectPropertyType.Float, (object)this.m_flSaturation, this.m_nSaturationID, dictProperties) && this.GenerateProperty("Value", EffectPropertyType.Float, (object)this.m_flValue, this.m_nValueID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Hue", this.HueID, this.Hue, cacheKey); + this.GeneratePropertyCacheKey("Saturation", this.SaturationID, this.Saturation, cacheKey); + this.GeneratePropertyCacheKey("Value", this.ValueID, this.Value, cacheKey); + } } - - public HSVElement() => this.m_typeOperation = EffectOperationType.HSV; - - public float Hue - { - get => this.m_flHue; - set => this.m_flHue = value; - } - - internal byte HueID => this.m_nHueID; - - public float Saturation - { - get => this.m_flSaturation; - set => this.m_flSaturation = value; - } - - internal byte SaturationID => this.m_nSaturationID; - - public float Value - { - get => this.m_flValue; - set => this.m_flValue = value; - } - - internal byte ValueID => this.m_nValueID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Hue", (byte) 8, ref this.m_nHueID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Saturation", (byte) 8, ref this.m_nSaturationID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Value", (byte) 8, ref this.m_nValueID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("Hue", EffectPropertyType.Float, (object) this.m_flHue, this.m_nHueID, dictProperties) && this.GenerateProperty("Saturation", EffectPropertyType.Float, (object) this.m_flSaturation, this.m_nSaturationID, dictProperties) && this.GenerateProperty("Value", EffectPropertyType.Float, (object) this.m_flValue, this.m_nValueID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Hue", this.HueID, this.Hue, cacheKey); - this.GeneratePropertyCacheKey("Saturation", this.SaturationID, this.Saturation, cacheKey); - this.GeneratePropertyCacheKey("Value", this.ValueID, this.Value, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/HWND.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/HWND.cs index 84f8b80..6d207f7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/HWND.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/HWND.cs @@ -8,51 +8,51 @@ using System; namespace Microsoft.Iris.Render { - [Serializable] - public struct HWND - { - public IntPtr h; - - public HWND(IntPtr hwnd) => this.h = hwnd; - - public static HWND NULL => new HWND() + [Serializable] + public struct HWND { - h = IntPtr.Zero - }; + public IntPtr h; - public static HWND HWND_TOP => new HWND() - { - h = new IntPtr(0) - }; + public HWND(IntPtr hwnd) => this.h = hwnd; - public static HWND HWND_BOTTOM => new HWND() - { - h = new IntPtr(1) - }; + public static HWND NULL => new HWND() + { + h = IntPtr.Zero + }; - public static HWND HWND_TOPMOST => new HWND() - { - h = new IntPtr(-1) - }; + public static HWND HWND_TOP => new HWND() + { + h = new IntPtr(0) + }; - public static HWND HWND_NOTOPMOST => new HWND() - { - h = new IntPtr(-2) - }; + public static HWND HWND_BOTTOM => new HWND() + { + h = new IntPtr(1) + }; - public static HWND HWND_MESSAGE => new HWND() - { - h = new IntPtr(-3) - }; + public static HWND HWND_TOPMOST => new HWND() + { + h = new IntPtr(-1) + }; - public static bool operator ==(HWND hl, HWND hr) => hl.h == hr.h; + public static HWND HWND_NOTOPMOST => new HWND() + { + h = new IntPtr(-2) + }; - public static bool operator !=(HWND hl, HWND hr) => hl.h != hr.h; + public static HWND HWND_MESSAGE => new HWND() + { + h = new IntPtr(-3) + }; - public override bool Equals(object oCompare) => this.h == (IntPtr) oCompare; + public static bool operator ==(HWND hl, HWND hr) => hl.h == hr.h; - public override int GetHashCode() => (int) this.h.ToInt64(); + public static bool operator !=(HWND hl, HWND hr) => hl.h != hr.h; - public override string ToString() => base.ToString(); - } + public override bool Equals(object oCompare) => this.h == (IntPtr)oCompare; + + public override int GetHashCode() => (int)this.h.ToInt64(); + + public override string ToString() => base.ToString(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IActivatable.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IActivatable.cs index 6e61b49..106cac9 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IActivatable.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IActivatable.cs @@ -6,7 +6,7 @@ namespace Microsoft.Iris.Render { - public interface IActivatable - { - } + public interface IActivatable + { + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimatable.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimatable.cs index 8a83d7a..44f9c7f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimatable.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimatable.cs @@ -6,7 +6,7 @@ namespace Microsoft.Iris.Render { - public interface IAnimatable : ISharedRenderObject - { - } + public interface IAnimatable : ISharedRenderObject + { + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimation.cs index d271611..064dbe2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimation.cs @@ -6,28 +6,28 @@ namespace Microsoft.Iris.Render { - public interface IAnimation : ISharedRenderObject - { - int RepeatCount { get; set; } + public interface IAnimation : ISharedRenderObject + { + int RepeatCount { get; set; } - bool IsPlaying { get; } + bool IsPlaying { get; } - bool IsActive { get; } + bool IsActive { get; } - bool AutoReset { get; set; } + bool AutoReset { get; set; } - AnimationResetBehavior ResetBehavior { get; set; } + AnimationResetBehavior ResetBehavior { get; set; } - void Play(); + void Play(); - void Pause(); + void Pause(); - void Reset(); + void Reset(); - void InstantAdvance(float advanceTime); + void InstantAdvance(float advanceTime); - void InstantFinish(); + void InstantFinish(); - event AsyncNotifyHandler AsyncNotifyEvent; - } + event AsyncNotifyHandler AsyncNotifyEvent; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationGroup.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationGroup.cs index 6d7f172..802262b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationGroup.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationGroup.cs @@ -6,7 +6,7 @@ namespace Microsoft.Iris.Render { - public interface IAnimationGroup : IAnimation, ISharedRenderObject - { - } + public interface IAnimationGroup : IAnimation, ISharedRenderObject + { + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationInputProvider.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationInputProvider.cs index 59a7c4a..0d69352 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationInputProvider.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationInputProvider.cs @@ -6,26 +6,26 @@ namespace Microsoft.Iris.Render { - public interface IAnimationInputProvider : IAnimatable, ISharedRenderObject - { - void PublishFloat(string propertyName, float value); + public interface IAnimationInputProvider : IAnimatable, ISharedRenderObject + { + void PublishFloat(string propertyName, float value); - void PublishVector2(string propertyName, Vector2 value); + void PublishVector2(string propertyName, Vector2 value); - void PublishVector3(string propertyName, Vector3 value); + void PublishVector3(string propertyName, Vector3 value); - void PublishVector4(string propertyName, Vector4 value); + void PublishVector4(string propertyName, Vector4 value); - void PublishQuaternion(string propertyName, Quaternion value); + void PublishQuaternion(string propertyName, Quaternion value); - void RevokeFloat(string propertyName); + void RevokeFloat(string propertyName); - void RevokeVector2(string propertyName); + void RevokeVector2(string propertyName); - void RevokeVector3(string propertyName); + void RevokeVector3(string propertyName); - void RevokeVector4(string propertyName); + void RevokeVector4(string propertyName); - void RevokeQuaternion(string propertyName); - } + void RevokeQuaternion(string propertyName); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationPropertyMap.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationPropertyMap.cs index 6a59a08..673793f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationPropertyMap.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationPropertyMap.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render { - public interface IAnimationPropertyMap - { - uint GetPropertyId(string propertyName); + public interface IAnimationPropertyMap + { + uint GetPropertyId(string propertyName); - AnimationInputType GetPropertyType(string propertyName); - } + AnimationInputType GetPropertyType(string propertyName); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationSystem.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationSystem.cs index 5d69e44..078219e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationSystem.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IAnimationSystem.cs @@ -6,30 +6,30 @@ namespace Microsoft.Iris.Render { - public interface IAnimationSystem - { - int UpdatesPerSecond { get; set; } + public interface IAnimationSystem + { + int UpdatesPerSecond { get; set; } - float SpeedAdjustment { get; set; } + float SpeedAdjustment { get; set; } - bool BackCompat { set; } + bool BackCompat { set; } - IKeyframeAnimation CreateKeyframeAnimation( - object objUser, - AnimationInput initialValue); + IKeyframeAnimation CreateKeyframeAnimation( + object objUser, + AnimationInput initialValue); - IAnimationGroup CreateAnimationGroup(object objUser); + IAnimationGroup CreateAnimationGroup(object objUser); - IExternalAnimationInput CreateExternalAnimationInput( - object objUser, - IAnimationPropertyMap propertyMap); + IExternalAnimationInput CreateExternalAnimationInput( + object objUser, + IAnimationPropertyMap propertyMap); - void PulseTimeAdvance(int nAdvanceMs); + void PulseTimeAdvance(int nAdvanceMs); - void PauseAnimations(); + void PauseAnimations(); - void StepAnimations(int nAdvanceMs); + void StepAnimations(int nAdvanceMs); - void ResumeAnimations(); - } + void ResumeAnimations(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ICamera.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ICamera.cs index 1efd000..852f442 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ICamera.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ICamera.cs @@ -6,16 +6,16 @@ namespace Microsoft.Iris.Render { - public interface ICamera : IAnimatable, ISharedRenderObject - { - Vector3 Eye { get; set; } + public interface ICamera : IAnimatable, ISharedRenderObject + { + Vector3 Eye { get; set; } - Vector3 At { get; set; } + Vector3 At { get; set; } - Vector3 Up { get; set; } + Vector3 Up { get; set; } - float Zn { get; set; } + float Zn { get; set; } - bool Perspective { get; set; } - } + bool Perspective { get; set; } + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDebug.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDebug.cs index 03e61ce..47e77ce 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDebug.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDebug.cs @@ -8,24 +8,24 @@ using System; namespace Microsoft.Iris.Render { - public interface IDebug : IDisposable - { - void Enter(string context); + public interface IDebug : IDisposable + { + void Enter(string context); - void Leave(string context); + void Leave(string context); - void Assert(bool condition, string message); + void Assert(bool condition, string message); - void Throw(bool condition, string message); + void Throw(bool condition, string message); - void Write(DebugCategory category, int verbosityLevel, string message); + void Write(DebugCategory category, int verbosityLevel, string message); - void WriteLine(DebugCategory category, int verbosityLevel, string message); + void WriteLine(DebugCategory category, int verbosityLevel, string message); - void Indent(DebugCategory category, int verbosityLevel); + void Indent(DebugCategory category, int verbosityLevel); - void Unindent(DebugCategory category, int verbosityLevel); + void Unindent(DebugCategory category, int verbosityLevel); - bool IsCategoryEnabled(DebugCategory category, int verbosityLevel); - } + bool IsCategoryEnabled(DebugCategory category, int verbosityLevel); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDeferredInvokeItem.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDeferredInvokeItem.cs index 4899b2c..92ef022 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDeferredInvokeItem.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDeferredInvokeItem.cs @@ -6,8 +6,8 @@ namespace Microsoft.Iris.Render { - public interface IDeferredInvokeItem - { - void Dispatch(); - } + public interface IDeferredInvokeItem + { + void Dispatch(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDisplay.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDisplay.cs index e7543c4..2be03d0 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDisplay.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDisplay.cs @@ -6,41 +6,41 @@ namespace Microsoft.Iris.Render { - public interface IDisplay - { - string DeviceName { get; } + public interface IDisplay + { + string DeviceName { get; } - Rectangle ScreenArea { get; } + Rectangle ScreenArea { get; } - Rectangle WorkArea { get; } + Rectangle WorkArea { get; } - bool IsPrimary { get; } + bool IsPrimary { get; } - TvFormat TvFormat { get; } + TvFormat TvFormat { get; } - bool TvMode { get; } + bool TvMode { get; } - Size LogicalFullScreenResolution { get; } + Size LogicalFullScreenResolution { get; } - DisplayMode[] SupportedModes { get; } + DisplayMode[] SupportedModes { get; } - DisplayMode[] ExtraModes { get; } + DisplayMode[] ExtraModes { get; } - DisplayMode[] AllModes { get; } + DisplayMode[] AllModes { get; } - DisplayMode CurrentMode { get; } + DisplayMode CurrentMode { get; } - DisplayMode DesktopMode { get; } + DisplayMode DesktopMode { get; } - string MonitorPnP { get; } + string MonitorPnP { get; } - bool ValidateDisplayMode( - DisplayMode modeDesired, - DisplayModeFlags nCheck, - bool fAllowAllModes, - out DisplayMode modeComplete, - out DisplayModeFlags nCompleteCheck); + bool ValidateDisplayMode( + DisplayMode modeDesired, + DisplayModeFlags nCheck, + bool fAllowAllModes, + out DisplayMode modeComplete, + out DisplayModeFlags nCompleteCheck); - bool ChangeFullScreenResolution(DisplayMode modeChanges, DisplayModeFlags nValid); - } + bool ChangeFullScreenResolution(DisplayMode modeChanges, DisplayModeFlags nValid); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDisplayManager.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDisplayManager.cs index 49cd5de..7bb62b9 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDisplayManager.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IDisplayManager.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render { - public interface IDisplayManager - { - IDisplay PrimaryDisplay { get; } + public interface IDisplayManager + { + IDisplay PrimaryDisplay { get; } - DisplayMode[] ExtraModes { get; set; } + DisplayMode[] ExtraModes { get; set; } - IDisplay DisplayFromDeviceName(string stDeviceName); - } + IDisplay DisplayFromDeviceName(string stDeviceName); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IEffect.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IEffect.cs index 418c47a..b0b0204 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IEffect.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IEffect.cs @@ -6,28 +6,28 @@ namespace Microsoft.Iris.Render { - public interface IEffect : IAnimatable, ISharedRenderObject - { - void SetProperty(string stPropertyName, int nValue); + public interface IEffect : IAnimatable, ISharedRenderObject + { + void SetProperty(string stPropertyName, int nValue); - void SetProperty(string stPropertyName, float flValue); + void SetProperty(string stPropertyName, float flValue); - void SetProperty(string stPropertyName, Vector2 vValue); + void SetProperty(string stPropertyName, Vector2 vValue); - void SetProperty(string stPropertyName, Vector3 vValue); + void SetProperty(string stPropertyName, Vector3 vValue); - void SetProperty(string stPropertyName, Vector4 vValue); + void SetProperty(string stPropertyName, Vector4 vValue); - void SetProperty(string stPropertyName, ColorF colorValue); + void SetProperty(string stPropertyName, ColorF colorValue); - void SetProperty(string stPropertyName, IImage imgValue); + void SetProperty(string stPropertyName, IImage imgValue); - void SetProperty(string stPropertyName, IImage[] imgValue); + void SetProperty(string stPropertyName, IImage[] imgValue); - void SetProperty(string stPropertyName, IVideoStream streamValue); + void SetProperty(string stPropertyName, IVideoStream streamValue); - string Name { get; } + string Name { get; } - IEffectTemplate Template { get; } - } + IEffectTemplate Template { get; } + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IEffectTemplate.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IEffectTemplate.cs index e85fca5..77ff52c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IEffectTemplate.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IEffectTemplate.cs @@ -6,16 +6,16 @@ namespace Microsoft.Iris.Render { - public interface IEffectTemplate : ISharedRenderObject - { - void AddEffectProperty(string stPath); + public interface IEffectTemplate : ISharedRenderObject + { + void AddEffectProperty(string stPath); - bool Build(EffectInput input); + bool Build(EffectInput input); - IEffect CreateInstance(object objUser); + IEffect CreateInstance(object objUser); - bool IsBuilt { get; } + bool IsBuilt { get; } - string Name { get; } - } + string Name { get; } + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IExternalAnimationInput.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IExternalAnimationInput.cs index abab44d..3cf7b07 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IExternalAnimationInput.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IExternalAnimationInput.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render { - public interface IExternalAnimationInput : IAnimatable, ISharedRenderObject - { - uint UniqueId { get; } + public interface IExternalAnimationInput : IAnimatable, ISharedRenderObject + { + uint UniqueId { get; } - IAnimationInputProvider CreateProvider(object objUser); - } + IAnimationInputProvider CreateProvider(object objUser); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IGradient.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IGradient.cs index 3ff3376..5c5a285 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IGradient.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IGradient.cs @@ -6,16 +6,16 @@ namespace Microsoft.Iris.Render { - public interface IGradient : ISharedRenderObject - { - Orientation Orientation { get; set; } + public interface IGradient : ISharedRenderObject + { + Orientation Orientation { get; set; } - ColorF ColorMask { get; set; } + ColorF ColorMask { get; set; } - float Offset { get; set; } + float Offset { get; set; } - void AddValue(float flPosition, float flValue, RelativeSpace rsSpace); + void AddValue(float flPosition, float flValue, RelativeSpace rsSpace); - void Clear(); - } + void Clear(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IGraphicsDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IGraphicsDevice.cs index 78d7350..5729b58 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IGraphicsDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IGraphicsDevice.cs @@ -6,24 +6,24 @@ namespace Microsoft.Iris.Render { - public interface IGraphicsDevice - { - GraphicsDeviceType DeviceType { get; } + public interface IGraphicsDevice + { + GraphicsDeviceType DeviceType { get; } - Size MaximumImageSize { get; } + Size MaximumImageSize { get; } - bool IsVideoComposited { get; } + bool IsVideoComposited { get; } - GraphicsRenderingQuality RenderingQuality { get; } + GraphicsRenderingQuality RenderingQuality { get; } - void RenderNowIfPossible(); + void RenderNowIfPossible(); - void BeginCaptureBackBuffer(string stFileName); + void BeginCaptureBackBuffer(string stFileName); - void EndCaptureBackBuffer(); + void EndCaptureBackBuffer(); - void TriggerDeviceReset(); + void TriggerDeviceReset(); - event BackBufferCapturedHandler BackBufferCapturedEvent; - } + event BackBufferCapturedHandler BackBufferCapturedEvent; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IHwndHostWindow.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IHwndHostWindow.cs index f521f9a..2681124 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IHwndHostWindow.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IHwndHostWindow.cs @@ -8,18 +8,18 @@ using System; namespace Microsoft.Iris.Render { - public interface IHwndHostWindow : IDisposable - { - ColorF BackgroundColor { get; set; } + public interface IHwndHostWindow : IDisposable + { + ColorF BackgroundColor { get; set; } - Point ClientPosition { get; set; } + Point ClientPosition { get; set; } - IntPtr Hwnd { get; } + IntPtr Hwnd { get; } - bool Visible { get; set; } + bool Visible { get; set; } - Size WindowSize { get; set; } + Size WindowSize { get; set; } - event EventHandler OnHandleChanged; - } + event EventHandler OnHandleChanged; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IImage.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IImage.cs index 443d514..920bfbc 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IImage.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IImage.cs @@ -8,14 +8,14 @@ using System; namespace Microsoft.Iris.Render { - public interface IImage : ISharedRenderObject - { - Size Size { get; } + public interface IImage : ISharedRenderObject + { + Size Size { get; } - ImageFormat Format { get; } + ImageFormat Format { get; } - string Identifier { get; } + string Identifier { get; } - bool LoadContent(ImageFormat format, Size size, int Stride, IntPtr Data); - } + bool LoadContent(ImageFormat format, Size size, int Stride, IntPtr Data); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IInputSystem.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IInputSystem.cs index 7d493a6..ef2ef9d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IInputSystem.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IInputSystem.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render { - public interface IInputSystem - { - void RegisterRawInputCallbacks(IRawInputCallbacks handlers); + public interface IInputSystem + { + void RegisterRawInputCallbacks(IRawInputCallbacks handlers); - void UnregisterRawInputCallbacks(); - } + void UnregisterRawInputCallbacks(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IKeyframeAnimation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IKeyframeAnimation.cs index 72adc8f..ca99211 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IKeyframeAnimation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IKeyframeAnimation.cs @@ -6,45 +6,45 @@ namespace Microsoft.Iris.Render { - public interface IKeyframeAnimation : IAnimation, ISharedRenderObject, IActivatable - { - int KeyframeCount { get; } + public interface IKeyframeAnimation : IAnimation, ISharedRenderObject, IActivatable + { + int KeyframeCount { get; } - AnimationInput InitialValue { get; } + AnimationInput InitialValue { get; } - AnimationInput Reference { get; set; } + AnimationInput Reference { get; set; } - AnimationInput Scale { get; set; } + AnimationInput Scale { get; set; } - AnimationInputType Type { get; } + AnimationInputType Type { get; } - void AddKeyframe(AnimationKeyframe keyframe); + void AddKeyframe(AnimationKeyframe keyframe); - AnimationKeyframe GetKeyframe(int keyframeIndex); + AnimationKeyframe GetKeyframe(int keyframeIndex); - void SetKeyframe(int keyframeIndex, AnimationKeyframe keyframe); + void SetKeyframe(int keyframeIndex, AnimationKeyframe keyframe); - void AddTarget(IAnimatable targetObject, string targetProperty); + void AddTarget(IAnimatable targetObject, string targetProperty); - void AddTarget(IAnimatable targetObject, string targetProperty, string targetPropertyMask); + void AddTarget(IAnimatable targetObject, string targetProperty, string targetPropertyMask); - void RemoveTarget(IAnimatable targetObject, string targetProperty, string targetPropertyMask); + void RemoveTarget(IAnimatable targetObject, string targetProperty, string targetPropertyMask); - void RemoveAllTargets(); + void RemoveAllTargets(); - void AddStageEvent(AnimationStage animationStage, AnimationEvent animationEvent); + void AddStageEvent(AnimationStage animationStage, AnimationEvent animationEvent); - void AddTimeEvent(float absoluteTime, AnimationEvent animationEvent); + void AddTimeEvent(float absoluteTime, AnimationEvent animationEvent); - void AddProgressEvent(float progress, AnimationEvent animationEvent); + void AddProgressEvent(float progress, AnimationEvent animationEvent); - void AddValueEvent( - ValueEventCondition condition, - AnimationInput reference, - AnimationEvent animationEvent); + void AddValueEvent( + ValueEventCondition condition, + AnimationInput reference, + AnimationEvent animationEvent); - void RemoveEvent(AnimationEvent animationEvent); + void RemoveEvent(AnimationEvent animationEvent); - void RemoveAllEvents(); - } + void RemoveAllEvents(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRawInputCallbacks.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRawInputCallbacks.cs index c0c5c62..98ed1e7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRawInputCallbacks.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRawInputCallbacks.cs @@ -8,18 +8,18 @@ using Microsoft.Iris.Input; namespace Microsoft.Iris.Render { - public interface IRawInputCallbacks - { - InputHandlerFlags InputHandlerMask { get; } + public interface IRawInputCallbacks + { + InputHandlerFlags InputHandlerMask { get; } - void HandleRawKeyboardInput(uint messageID, InputModifiers modifiers, ref RawKeyboardData args); + void HandleRawKeyboardInput(uint messageID, InputModifiers modifiers, ref RawKeyboardData args); - void HandleRawMouseInput(uint messageID, InputModifiers modifiers, ref RawMouseData args); + void HandleRawMouseInput(uint messageID, InputModifiers modifiers, ref RawMouseData args); - void HandleRawHidInput(ref RawHidData args); + void HandleRawHidInput(ref RawHidData args); - void HandleRawDragInput(uint messageID, InputModifiers modifiers, ref RawDragData args); + void HandleRawDragInput(uint messageID, InputModifiers modifiers, ref RawDragData args); - void HandleAppCommand(ref RawHidData args); - } + void HandleAppCommand(ref RawHidData args); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderEngine.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderEngine.cs index 9f2280c..a852567 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderEngine.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderEngine.cs @@ -8,29 +8,29 @@ using System; namespace Microsoft.Iris.Render { - public interface IRenderEngine : IRenderObject, IDisposable - { - void Initialize( - GraphicsDeviceType typeGraphics, - GraphicsRenderingQuality renderingQuality, - SoundDeviceType typeSound); + public interface IRenderEngine : IRenderObject, IDisposable + { + void Initialize( + GraphicsDeviceType typeGraphics, + GraphicsRenderingQuality renderingQuality, + SoundDeviceType typeSound); - IRenderSession Session { get; } + IRenderSession Session { get; } - IRenderWindow Window { get; } + IRenderWindow Window { get; } - IDisplayManager DisplayManager { get; } + IDisplayManager DisplayManager { get; } - bool ProcessNativeEvents(); + bool ProcessNativeEvents(); - void WaitForWork(uint nTimeoutInMsecs); + void WaitForWork(uint nTimeoutInMsecs); - void InterThreadWake(); + void InterThreadWake(); - void FlushBatch(); + void FlushBatch(); - bool IsGraphicsDeviceAvailable(GraphicsDeviceType type, bool fFilterRecommended); + bool IsGraphicsDeviceAvailable(GraphicsDeviceType type, bool fFilterRecommended); - bool IsSoundDeviceAvailable(SoundDeviceType type); - } + bool IsSoundDeviceAvailable(SoundDeviceType type); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderHost.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderHost.cs index 7825b74..8f6844e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderHost.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderHost.cs @@ -8,8 +8,8 @@ using System; namespace Microsoft.Iris.Render { - public interface IRenderHost - { - void DeferredInvoke(DeferredInvokePriority priority, IDeferredInvokeItem item, TimeSpan delay); - } + public interface IRenderHost + { + void DeferredInvoke(DeferredInvokePriority priority, IDeferredInvokeItem item, TimeSpan delay); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderObject.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderObject.cs index c7d74de..bb412f4 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderObject.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderObject.cs @@ -8,7 +8,7 @@ using System; namespace Microsoft.Iris.Render { - public interface IRenderObject : IDisposable - { - } + public interface IRenderObject : IDisposable + { + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderSession.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderSession.cs index fd26a59..b1e8b58 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderSession.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderSession.cs @@ -8,28 +8,28 @@ using System; namespace Microsoft.Iris.Render { - public interface IRenderSession : IRenderObject, IDisposable - { - IAnimationSystem AnimationSystem { get; } + public interface IRenderSession : IRenderObject, IDisposable + { + IAnimationSystem AnimationSystem { get; } - IInputSystem InputSystem { get; } + IInputSystem InputSystem { get; } - IGraphicsDevice GraphicsDevice { get; } + IGraphicsDevice GraphicsDevice { get; } - ISoundDevice SoundDevice { get; } + ISoundDevice SoundDevice { get; } - IEffectTemplate CreateEffectTemplate(object objUser, string stName); + IEffectTemplate CreateEffectTemplate(object objUser, string stName); - IVideoStream CreateVideoStream(object objUser); + IVideoStream CreateVideoStream(object objUser); - IVisualContainer CreateVisualContainer(object objUser, object objOwnerData); + IVisualContainer CreateVisualContainer(object objUser, object objOwnerData); - ICamera CreateCamera(object objUser); + ICamera CreateCamera(object objUser); - IGradient CreateGradient(object objUser); + IGradient CreateGradient(object objUser); - ISprite CreateSprite(object objUser, object objOwnerData); + ISprite CreateSprite(object objUser, object objOwnerData); - IImage CreateImage(object objUser, string identifier, ContentNotifyHandler handler); - } + IImage CreateImage(object objUser, string identifier, ContentNotifyHandler handler); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderWindow.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderWindow.cs index f2ecdf8..7edef93 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderWindow.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IRenderWindow.cs @@ -8,132 +8,132 @@ using Microsoft.Iris.Input; namespace Microsoft.Iris.Render { - public interface IRenderWindow - { - int Left { get; } + public interface IRenderWindow + { + int Left { get; } - int Top { get; } + int Top { get; } - int Right { get; } + int Right { get; } - int Bottom { get; } + int Bottom { get; } - int Width { get; } + int Width { get; } - int Height { get; } + int Height { get; } - HWND WindowHandle { get; } + HWND WindowHandle { get; } - Size ClientSize { get; set; } + Size ClientSize { get; set; } - Size InitialClientSize { get; set; } + Size InitialClientSize { get; set; } - FormPlacement InitialPlacement { set; } + FormPlacement InitialPlacement { set; } - FormPlacement FinalPlacement { get; } + FormPlacement FinalPlacement { get; } - int MinResizeWidth { get; set; } + int MinResizeWidth { get; set; } - int MaxResizeWidth { get; set; } + int MaxResizeWidth { get; set; } - Point Position { get; set; } + Point Position { get; set; } - string Text { get; set; } + string Text { get; set; } - Cursor Cursor { get; set; } + Cursor Cursor { get; set; } - Cursor IdleCursor { get; set; } + Cursor IdleCursor { get; set; } - bool Visible { get; set; } + bool Visible { get; set; } - bool IsLoaded { get; } + bool IsLoaded { get; } - ColorF BackgroundColor { get; set; } + ColorF BackgroundColor { get; set; } - bool EnableExternalDragDrop { get; set; } + bool EnableExternalDragDrop { get; set; } - bool IsDragInProgress { get; set; } + bool IsDragInProgress { get; set; } - IDisplay CurrentDisplay { get; set; } + IDisplay CurrentDisplay { get; set; } - bool FullScreenExclusive { get; set; } + bool FullScreenExclusive { get; set; } - bool ActivationState { get; } + bool ActivationState { get; } - WindowState WindowState { get; set; } + WindowState WindowState { get; set; } - FormStyleInfo Styles { get; set; } + FormStyleInfo Styles { get; set; } - HWND AppNotifyWindow { set; } + HWND AppNotifyWindow { set; } - IVisualContainer VisualRoot { get; } + IVisualContainer VisualRoot { get; } - void Initialize(); + void Initialize(); - void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions); + void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions); - void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges); + void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges); - void SetWindowOptions(WindowOptions options, bool enable); + void SetWindowOptions(WindowOptions options, bool enable); - void SetMouseIdleOptions(Size sizeMouseIdleTolerance, uint nMouseIdleDelay); + void SetMouseIdleOptions(Size sizeMouseIdleTolerance, uint nMouseIdleDelay); - void SetCapture(IRawInputSite captureSite, bool state); + void SetCapture(IRawInputSite captureSite, bool state); - void SetDragDropResult(uint nDragOverResult, uint nDragDropResult); + void SetDragDropResult(uint nDragOverResult, uint nDragDropResult); - void ClientToScreen(ref Point point); + void ClientToScreen(ref Point point); - void ScreenToClient(ref Point point); + void ScreenToClient(ref Point point); - void ForceMouseIdle(bool fIdle); + void ForceMouseIdle(bool fIdle); - void LockMouseActive(bool fActive); + void LockMouseActive(bool fActive); - void RefreshHitTarget(); + void RefreshHitTarget(); - void TakeFocus(); + void TakeFocus(); - void TakeForeground(bool fForce); + void TakeForeground(bool fForce); - void BringToTop(); + void BringToTop(); - void Restore(); + void Restore(); - void TemporarilyExitExclusiveMode(); + void TemporarilyExitExclusiveMode(); - void Close(FormCloseReason fcrCloseReason); + void Close(FormCloseReason fcrCloseReason); - IHwndHostWindow CreateHwndHostWindow(); + IHwndHostWindow CreateHwndHostWindow(); - event LocationChangedHandler LocationChangedEvent; + event LocationChangedHandler LocationChangedEvent; - event SizeChangedHandler SizeChangedEvent; + event SizeChangedHandler SizeChangedEvent; - event MonitorChangedHandler MonitorChangedEvent; + event MonitorChangedHandler MonitorChangedEvent; - event WindowStateChangedHandler WindowStateChangedEvent; + event WindowStateChangedHandler WindowStateChangedEvent; - event SysCommandHandler SysCommandEvent; + event SysCommandHandler SysCommandEvent; - event MouseIdleHandler MouseIdleEvent; + event MouseIdleHandler MouseIdleEvent; - event ShowHandler ShowEvent; + event ShowHandler ShowEvent; - event ActivationChangeHandler ActivationChangeEvent; + event ActivationChangeHandler ActivationChangeEvent; - event SessionActivateHandler SessionActivateEvent; + event SessionActivateHandler SessionActivateEvent; - event SessionConnectHandler SessionConnectEvent; + event SessionConnectHandler SessionConnectEvent; - event SetFocusHandler SetFocusEvent; + event SetFocusHandler SetFocusEvent; - event LoadHandler LoadEvent; + event LoadHandler LoadEvent; - event CloseHandler CloseEvent; + event CloseHandler CloseEvent; - event CloseRequestHandler CloseRequestEvent; + event CloseRequestHandler CloseRequestEvent; - event ForwardMessageHandler ForwardMessageEvent; - } + event ForwardMessageHandler ForwardMessageEvent; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISharedRenderObject.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISharedRenderObject.cs index bb96f21..c89520d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISharedRenderObject.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISharedRenderObject.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render { - public interface ISharedRenderObject - { - int UsageCount { get; } + public interface ISharedRenderObject + { + int UsageCount { get; } - void RegisterUsage(object user); + void RegisterUsage(object user); - void UnregisterUsage(object user); - } + void UnregisterUsage(object user); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISound.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISound.cs index 71573a5..a8ef9ec 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISound.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISound.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render { - public interface ISound : ISharedRenderObject, IActivatable - { - void Play(); + public interface ISound : ISharedRenderObject, IActivatable + { + void Play(); - void Stop(); - } + void Stop(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundBuffer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundBuffer.cs index 0dcc2e0..66af289 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundBuffer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundBuffer.cs @@ -6,8 +6,8 @@ namespace Microsoft.Iris.Render { - public interface ISoundBuffer : ISharedRenderObject - { - ISound CreateSound(object objUser); - } + public interface ISoundBuffer : ISharedRenderObject + { + ISound CreateSound(object objUser); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundData.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundData.cs index 4c38bc0..aecf98f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundData.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundData.cs @@ -8,20 +8,20 @@ using System; namespace Microsoft.Iris.Render { - public interface ISoundData - { - SoundDataFormat Format { get; } + public interface ISoundData + { + SoundDataFormat Format { get; } - uint ChannelCount { get; } + uint ChannelCount { get; } - uint SampleRate { get; } + uint SampleRate { get; } - uint SampleSize { get; } + uint SampleSize { get; } - uint SampleCount { get; } + uint SampleCount { get; } - IntPtr AcquireContent(); + IntPtr AcquireContent(); - void ReleaseContent(); - } + void ReleaseContent(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundDevice.cs index 96b82d7..ac59700 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISoundDevice.cs @@ -6,14 +6,14 @@ namespace Microsoft.Iris.Render { - public interface ISoundDevice - { - SoundDeviceType DeviceType { get; } + public interface ISoundDevice + { + SoundDeviceType DeviceType { get; } - bool Mute { get; set; } + bool Mute { get; set; } - float Volume { get; set; } + float Volume { get; set; } - ISoundBuffer CreateSoundBuffer(object objUser, ISoundData soundData); - } + ISoundBuffer CreateSoundBuffer(object objUser, ISoundData soundData); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISprite.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISprite.cs index cf02b7f..4fa61ca 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISprite.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ISprite.cs @@ -8,34 +8,34 @@ using Microsoft.Iris.Input; namespace Microsoft.Iris.Render { - public interface ISprite : IVisual, IRawInputSite, IAnimatable, ISharedRenderObject - { - Vector3 Position { get; set; } + public interface ISprite : IVisual, IRawInputSite, IAnimatable, ISharedRenderObject + { + Vector3 Position { get; set; } - Vector2 Size { get; set; } + Vector2 Size { get; set; } - bool Visible { get; set; } + bool Visible { get; set; } - Vector3 Scale { get; set; } + Vector3 Scale { get; set; } - AxisAngle Rotation { get; set; } + AxisAngle Rotation { get; set; } - float Alpha { get; set; } + float Alpha { get; set; } - Vector3 CenterPoint { get; set; } + Vector3 CenterPoint { get; set; } - uint Layer { get; set; } + uint Layer { get; set; } - IEffect Effect { get; set; } + IEffect Effect { get; set; } - bool RelativeSize { get; set; } + bool RelativeSize { get; set; } - void AddGradient(IGradient gradient); + void AddGradient(IGradient gradient); - void RemoveAllGradients(); + void RemoveAllGradients(); - void SetCoordMap(int idxLayer, CoordMap coordMap); + void SetCoordMap(int idxLayer, CoordMap coordMap); - void SetNineGrid(int left, int top, int right, int bottom); - } + void SetNineGrid(int left, int top, int right, int bottom); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVideoStream.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVideoStream.cs index 9d924cf..0d278e1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVideoStream.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVideoStream.cs @@ -6,20 +6,20 @@ namespace Microsoft.Iris.Render { - public interface IVideoStream : ISharedRenderObject - { - int StreamID { get; } + public interface IVideoStream : ISharedRenderObject + { + int StreamID { get; } - float ContentOverscan { get; set; } + float ContentOverscan { get; set; } - int ContentAspectWidth { get; } + int ContentAspectWidth { get; } - int ContentAspectHeight { get; } + int ContentAspectHeight { get; } - int ContentHeight { get; } + int ContentHeight { get; } - int ContentWidth { get; } + int ContentWidth { get; } - event InvalidateContentHandler InvalidateContentEvent; - } + event InvalidateContentHandler InvalidateContentEvent; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVisual.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVisual.cs index 928b363..ba46d51 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVisual.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVisual.cs @@ -8,18 +8,18 @@ using Microsoft.Iris.Input; namespace Microsoft.Iris.Render { - public interface IVisual : IRawInputSite, IAnimatable, ISharedRenderObject - { - MouseOptions MouseOptions { get; set; } + public interface IVisual : IRawInputSite, IAnimatable, ISharedRenderObject + { + MouseOptions MouseOptions { get; set; } - IVisualContainer Parent { get; } + IVisualContainer Parent { get; } - string DebugID { get; set; } + string DebugID { get; set; } - ColorF DebugColor { get; set; } + ColorF DebugColor { get; set; } - void Remove(); + void Remove(); - void CopyFrom(IVisual visualSource); - } + void CopyFrom(IVisual visualSource); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVisualContainer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVisualContainer.cs index 798f7c8..f8bf749 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVisualContainer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IVisualContainer.cs @@ -8,48 +8,48 @@ using Microsoft.Iris.Input; namespace Microsoft.Iris.Render { - public interface IVisualContainer : IVisual, IRawInputSite, IAnimatable, ISharedRenderObject - { - bool IsRoot { get; } + public interface IVisualContainer : IVisual, IRawInputSite, IAnimatable, ISharedRenderObject + { + bool IsRoot { get; } - Vector3 Position { get; set; } + Vector3 Position { get; set; } - Vector2 Size { get; set; } + Vector2 Size { get; set; } - bool Visible { get; set; } + bool Visible { get; set; } - Vector3 Scale { get; set; } + Vector3 Scale { get; set; } - AxisAngle Rotation { get; set; } + AxisAngle Rotation { get; set; } - float Alpha { get; set; } + float Alpha { get; set; } - Vector3 CenterPoint { get; set; } + Vector3 CenterPoint { get; set; } - uint Layer { get; set; } + uint Layer { get; set; } - int ChildCount { get; } + int ChildCount { get; } - ICamera Camera { get; set; } + ICamera Camera { get; set; } - void SetPosition(Vector3 value, bool force); + void SetPosition(Vector3 value, bool force); - void SetSize(Vector2 value, bool force); + void SetSize(Vector2 value, bool force); - void SetScale(Vector3 value, bool force); + void SetScale(Vector3 value, bool force); - void SetRotation(AxisAngle value, bool force); + void SetRotation(AxisAngle value, bool force); - void SetAlpha(float value, bool force); + void SetAlpha(float value, bool force); - void AddGradient(IGradient gradient); + void AddGradient(IGradient gradient); - void RemoveAllGradients(); + void RemoveAllGradients(); - void AddChild(IVisual vChild, IVisual vSibling, VisualOrder nOrder); + void AddChild(IVisual vChild, IVisual vSibling, VisualOrder nOrder); - void RemoveChild(IVisual vChild); + void RemoveChild(IVisual vChild); - void RemoveAllChildren(); - } + void RemoveAllChildren(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IconFlags.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IconFlags.cs index 802e42d..7ccac21 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IconFlags.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IconFlags.cs @@ -8,11 +8,11 @@ using System; namespace Microsoft.Iris.Render { - [Flags] - public enum IconFlags - { - Small = 1, - Large = 2, - All = Large | Small, // 0x00000003 - } + [Flags] + public enum IconFlags + { + Small = 1, + Large = 2, + All = Large | Small, // 0x00000003 + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ImageElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ImageElement.cs index 53f26af..0e2bd31 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ImageElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ImageElement.cs @@ -10,67 +10,67 @@ using System; namespace Microsoft.Iris.Render { - public class ImageElement : EffectInput - { - internal const string ImagePropertyName = "Image"; - internal const string UVOffsetPropertyName = "UVOffset"; - private IImage m_image; - private byte m_nImageID; - private Vector2 m_UVOffset; - private byte m_nUVOffsetID; - - public ImageElement(string stName, IImage imgSource) - : this() + public class ImageElement : EffectInput { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - this.m_stName = stName; - this.m_image = imgSource; + internal const string ImagePropertyName = "Image"; + internal const string UVOffsetPropertyName = "UVOffset"; + private IImage m_image; + private byte m_nImageID; + private Vector2 m_UVOffset; + private byte m_nUVOffsetID; + + public ImageElement(string stName, IImage imgSource) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + this.m_stName = stName; + this.m_image = imgSource; + } + + public ImageElement() + { + this.m_stName = nameof(Image); + this.m_typeInput = EffectInputType.Image; + } + + public IImage Image + { + get => this.m_image; + set => this.m_image = value; + } + + internal byte ImageID => this.m_nImageID; + + public Vector2 UVOffset + { + get => this.m_UVOffset; + set => this.m_UVOffset = value; + } + + internal byte UVOffsetID => this.m_nUVOffsetID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + int num = base.PreProcessProperties(dictionary, ref nNextUniqueID); + this.AddEffectProperty(dictionary, "Image"); + this.m_nImageID = nNextUniqueID++; + return num + this.PreProcessProperty(dictionary, "UVOffset", (byte)12, ref this.m_nUVOffsetID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) + { + if (!this.GenerateProperty("Image", EffectPropertyType.Image, (object)this.m_image, this.m_nImageID, dictProperties)) + return false; + dictProperties[this.GeneratePropertyPath("Image")].IsDynamic = true; + return this.GenerateProperty("UVOffset", EffectPropertyType.Vector2, (object)this.m_UVOffset, this.m_nUVOffsetID, dictProperties); + } + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("UVOffset", this.UVOffsetID, this.UVOffset, cacheKey); + } } - - public ImageElement() - { - this.m_stName = nameof (Image); - this.m_typeInput = EffectInputType.Image; - } - - public IImage Image - { - get => this.m_image; - set => this.m_image = value; - } - - internal byte ImageID => this.m_nImageID; - - public Vector2 UVOffset - { - get => this.m_UVOffset; - set => this.m_UVOffset = value; - } - - internal byte UVOffsetID => this.m_nUVOffsetID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - int num = base.PreProcessProperties(dictionary, ref nNextUniqueID); - this.AddEffectProperty(dictionary, "Image"); - this.m_nImageID = nNextUniqueID++; - return num + this.PreProcessProperty(dictionary, "UVOffset", (byte) 12, ref this.m_nUVOffsetID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) - { - if (!this.GenerateProperty("Image", EffectPropertyType.Image, (object) this.m_image, this.m_nImageID, dictProperties)) - return false; - dictProperties[this.GeneratePropertyPath("Image")].IsDynamic = true; - return this.GenerateProperty("UVOffset", EffectPropertyType.Vector2, (object) this.m_UVOffset, this.m_nUVOffsetID, dictProperties); - } - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("UVOffset", this.UVOffsetID, this.UVOffset, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ImageFormat.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ImageFormat.cs index c6b80e2..2d939bd 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ImageFormat.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ImageFormat.cs @@ -6,11 +6,11 @@ namespace Microsoft.Iris.Render { - public enum ImageFormat - { - None, - A8R8G8B8, - X8R8G8B8, - A8, - } + public enum ImageFormat + { + None, + A8R8G8B8, + X8R8G8B8, + A8, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Inset.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Inset.cs index 8a5b6e5..8f60440 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Inset.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Inset.cs @@ -6,96 +6,96 @@ namespace Microsoft.Iris.Render { - public struct Inset - { - private int _left; - private int _top; - private int _right; - private int _bottom; - public static readonly Inset Zero = new Inset(0, 0, 0, 0); - - public Inset(int left, int top, int right, int bottom) + public struct Inset { - this._left = left; - this._top = top; - this._right = right; - this._bottom = bottom; + private int _left; + private int _top; + private int _right; + private int _bottom; + public static readonly Inset Zero = new Inset(0, 0, 0, 0); + + public Inset(int left, int top, int right, int bottom) + { + this._left = left; + this._top = top; + this._right = right; + this._bottom = bottom; + } + + internal Inset(Point topLeft, Point rightBottom) + { + this._left = topLeft.X; + this._top = topLeft.Y; + this._right = rightBottom.X; + this._bottom = rightBottom.Y; + } + + public int Left + { + get => this._left; + set => this._left = value; + } + + public int Top + { + get => this._top; + set => this._top = value; + } + + public int Right + { + get => this._right; + set => this._right = value; + } + + public int Bottom + { + get => this._bottom; + set => this._bottom = value; + } + + public static Inset operator +(Inset left, Inset right) => new Inset(left.Left + right.Left, left.Top + right.Top, left.Right + right.Right, left.Bottom + right.Bottom); + + public static Inset Add(Inset left, Inset right) => left + right; + + public static Inset operator -(Inset left, Inset right) => new Inset(left.Left - right.Left, left.Top - right.Top, left.Right - right.Right, left.Bottom - right.Bottom); + + public static Inset operator -(Inset left) => new Inset(-left.Left, -left.Top, -left.Right, -left.Bottom); + + public static Inset Subtract(Inset left, Inset right) => left - right; + + public override bool Equals(object obj) => obj is Inset inset && this == inset; + + public static bool operator ==(Inset left, Inset right) => left.Left == right.Left && left.Top == right.Top && left.Right == right.Right && left.Bottom == right.Bottom; + + public static bool operator !=(Inset left, Inset right) => !(left == right); + + public override int GetHashCode() => this.Left ^ (this.Top << 13 | (int)((uint)this.Top >> 19)) ^ (this.Right << 26 | (int)((uint)this.Right >> 6)) ^ (this.Bottom << 7 | (int)((uint)this.Bottom >> 25)); + + public override string ToString() => base.ToString(); + + internal Point TopLeft + { + get => new Point(this.Left, this.Top); + set + { + this.Left = value.X; + this.Top = value.Y; + } + } + + internal Point BottomRight + { + get => new Point(this.Right, this.Bottom); + set + { + this.Right = value.X; + this.Bottom = value.Y; + } + } + + public Size Size => new Size(this.Left + this.Right, this.Top + this.Bottom); + + public Rectangle ToRect => new Rectangle(this.Left, this.Right, this.Top, this.Bottom); } - - internal Inset(Point topLeft, Point rightBottom) - { - this._left = topLeft.X; - this._top = topLeft.Y; - this._right = rightBottom.X; - this._bottom = rightBottom.Y; - } - - public int Left - { - get => this._left; - set => this._left = value; - } - - public int Top - { - get => this._top; - set => this._top = value; - } - - public int Right - { - get => this._right; - set => this._right = value; - } - - public int Bottom - { - get => this._bottom; - set => this._bottom = value; - } - - public static Inset operator +(Inset left, Inset right) => new Inset(left.Left + right.Left, left.Top + right.Top, left.Right + right.Right, left.Bottom + right.Bottom); - - public static Inset Add(Inset left, Inset right) => left + right; - - public static Inset operator -(Inset left, Inset right) => new Inset(left.Left - right.Left, left.Top - right.Top, left.Right - right.Right, left.Bottom - right.Bottom); - - public static Inset operator -(Inset left) => new Inset(-left.Left, -left.Top, -left.Right, -left.Bottom); - - public static Inset Subtract(Inset left, Inset right) => left - right; - - public override bool Equals(object obj) => obj is Inset inset && this == inset; - - public static bool operator ==(Inset left, Inset right) => left.Left == right.Left && left.Top == right.Top && left.Right == right.Right && left.Bottom == right.Bottom; - - public static bool operator !=(Inset left, Inset right) => !(left == right); - - public override int GetHashCode() => this.Left ^ (this.Top << 13 | (int) ((uint) this.Top >> 19)) ^ (this.Right << 26 | (int) ((uint) this.Right >> 6)) ^ (this.Bottom << 7 | (int) ((uint) this.Bottom >> 25)); - - public override string ToString() => base.ToString(); - - internal Point TopLeft - { - get => new Point(this.Left, this.Top); - set - { - this.Left = value.X; - this.Top = value.Y; - } - } - - internal Point BottomRight - { - get => new Point(this.Right, this.Bottom); - set - { - this.Right = value.X; - this.Bottom = value.Y; - } - } - - public Size Size => new Size(this.Left + this.Right, this.Top + this.Bottom); - - public Rectangle ToRect => new Rectangle(this.Left, this.Right, this.Top, this.Bottom); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Bits.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Bits.cs index 77cf8cd..4ca329b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Bits.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Bits.cs @@ -10,68 +10,68 @@ using System.Diagnostics; namespace Microsoft.Iris.Render.Internal { - internal static class Bits - { - public static bool TestFlag(int nValue, int nMask) => (nValue & nMask) != 0; - - public static bool TestFlag(uint nValue, uint nMask) => ((int) nValue & (int) nMask) != 0; - - public static bool TestAnyFlags(int nValue, int nMask) => (nValue & nMask) != 0; - - public static bool TestAnyFlags(uint nValue, uint nMask) => ((int) nValue & (int) nMask) != 0; - - public static bool TestAllFlags(int nValue, int nMask) => (nValue & nMask) == nMask; - - public static bool TestAllFlags(uint nValue, uint nMask) => ((int) nValue & (int) nMask) == (int) nMask; - - public static void SetFlag(ref int nValue, int nMask) => nValue |= nMask; - - public static void SetFlag(ref uint nValue, uint nMask) => nValue |= nMask; - - public static void ClearFlag(ref int nValue, int nMask) => nValue &= ~nMask; - - public static void ClearFlag(ref uint nValue, uint nMask) => nValue &= ~nMask; - - public static void ChangeFlags(ref int nValue, int nNewValue, int nMask) => nValue = nNewValue & nMask | nValue & ~nMask; - - public static void ChangeFlags(ref uint nValue, uint nNewValue, uint nMask) => nValue = (uint) ((int) nNewValue & (int) nMask | (int) nValue & ~(int) nMask); - - public static void ChangeFlag(ref int nValue, bool fFlag, int nMask) + internal static class Bits { - int num = fFlag ? nMask : 0; - nValue = num & nMask | nValue & ~nMask; + public static bool TestFlag(int nValue, int nMask) => (nValue & nMask) != 0; + + public static bool TestFlag(uint nValue, uint nMask) => ((int)nValue & (int)nMask) != 0; + + public static bool TestAnyFlags(int nValue, int nMask) => (nValue & nMask) != 0; + + public static bool TestAnyFlags(uint nValue, uint nMask) => ((int)nValue & (int)nMask) != 0; + + public static bool TestAllFlags(int nValue, int nMask) => (nValue & nMask) == nMask; + + public static bool TestAllFlags(uint nValue, uint nMask) => ((int)nValue & (int)nMask) == (int)nMask; + + public static void SetFlag(ref int nValue, int nMask) => nValue |= nMask; + + public static void SetFlag(ref uint nValue, uint nMask) => nValue |= nMask; + + public static void ClearFlag(ref int nValue, int nMask) => nValue &= ~nMask; + + public static void ClearFlag(ref uint nValue, uint nMask) => nValue &= ~nMask; + + public static void ChangeFlags(ref int nValue, int nNewValue, int nMask) => nValue = nNewValue & nMask | nValue & ~nMask; + + public static void ChangeFlags(ref uint nValue, uint nNewValue, uint nMask) => nValue = (uint)((int)nNewValue & (int)nMask | (int)nValue & ~(int)nMask); + + public static void ChangeFlag(ref int nValue, bool fFlag, int nMask) + { + int num = fFlag ? nMask : 0; + nValue = num & nMask | nValue & ~nMask; + } + + public static void ChangeFlag(ref uint nValue, bool fFlag, uint nMask) + { + uint num = fFlag ? nMask : 0U; + nValue = (uint)((int)num & (int)nMask | (int)nValue & ~(int)nMask); + } + + public static void FlipFlags(ref int nValue, int nMask) => nValue ^= nMask; + + public static void FlipFlags(ref uint nValue, uint nMask) => nValue ^= nMask; + + public static int ExtractFlags(int nValue, int nMask) => nValue & nMask; + + public static int ExtractFlags(int nValue, int nMask, int cShiftBits) => (nValue & nMask) >> cShiftBits; + + public static uint ExtractFlags(uint nValue, uint nMask) => nValue & nMask; + + public static uint ExtractFlags(uint nValue, uint nMask, int cShiftBits) => (nValue & nMask) >> cShiftBits; + + [Conditional("DEBUG")] + public static void AssertFlags(int nTestFlags, int nValidFlags) + { + } + + [Conditional("DEBUG")] + public static void AssertFlags(uint nTestFlags, uint nValidFlags) + { + } + + public static void PromptFlags(int nTestFlags, int nValidFlags) => Debug2.Validate((nTestFlags & nValidFlags) == nTestFlags, typeof(ArgumentException), "Ensure valid flags"); + + public static void PromptFlags(uint nTestFlags, uint nValidFlags) => Debug2.Validate(((int)nTestFlags & (int)nValidFlags) == (int)nTestFlags, typeof(ArgumentException), "Ensure valid flags"); } - - public static void ChangeFlag(ref uint nValue, bool fFlag, uint nMask) - { - uint num = fFlag ? nMask : 0U; - nValue = (uint) ((int) num & (int) nMask | (int) nValue & ~(int) nMask); - } - - public static void FlipFlags(ref int nValue, int nMask) => nValue ^= nMask; - - public static void FlipFlags(ref uint nValue, uint nMask) => nValue ^= nMask; - - public static int ExtractFlags(int nValue, int nMask) => nValue & nMask; - - public static int ExtractFlags(int nValue, int nMask, int cShiftBits) => (nValue & nMask) >> cShiftBits; - - public static uint ExtractFlags(uint nValue, uint nMask) => nValue & nMask; - - public static uint ExtractFlags(uint nValue, uint nMask, int cShiftBits) => (nValue & nMask) >> cShiftBits; - - [Conditional("DEBUG")] - public static void AssertFlags(int nTestFlags, int nValidFlags) - { - } - - [Conditional("DEBUG")] - public static void AssertFlags(uint nTestFlags, uint nValidFlags) - { - } - - public static void PromptFlags(int nTestFlags, int nValidFlags) => Debug2.Validate((nTestFlags & nValidFlags) == nTestFlags, typeof (ArgumentException), "Ensure valid flags"); - - public static void PromptFlags(uint nTestFlags, uint nValidFlags) => Debug2.Validate(((int) nTestFlags & (int) nValidFlags) == (int) nTestFlags, typeof (ArgumentException), "Ensure valid flags"); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Display.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Display.cs index 082f5f3..383dbf4 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Display.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Display.cs @@ -10,281 +10,281 @@ using System.Collections.Generic; namespace Microsoft.Iris.Render.Internal { - internal class Display : IDisplay - { - private string m_stDeviceName; - private Rectangle m_rcMonitor; - private Rectangle m_rcWork; - private bool m_fPrimaryMonitor; - private DisplayManager m_owner; - private RenderEngine m_engine; - private uint m_nDisplayId; - private TvFormat m_nTvFormat; - private string m_stMonitorPnP; - private DisplayMode m_modeDesktop; - private DisplayMode m_modeCurrent; - private DisplayModeFlags m_nCurrentValid; - private DisplayMode[] m_arSupportedModes; - private DisplayMode[] m_arExtraModes; - private DisplayMode[] m_arAllModes; - - internal Display( - DisplayManager owner, - RenderEngine engine, - string stDeviceName, - uint nDisplayID) + internal class Display : IDisplay { - this.m_stDeviceName = stDeviceName; - this.m_owner = owner; - this.m_engine = engine; - this.m_nDisplayId = nDisplayID; - this.m_arSupportedModes = DisplayMode.EmptyModes; - this.m_arExtraModes = DisplayMode.EmptyModes; - this.m_arAllModes = DisplayMode.EmptyModes; - this.m_modeCurrent = new DisplayMode(); - this.m_nCurrentValid = (DisplayModeFlags) 0; + private string m_stDeviceName; + private Rectangle m_rcMonitor; + private Rectangle m_rcWork; + private bool m_fPrimaryMonitor; + private DisplayManager m_owner; + private RenderEngine m_engine; + private uint m_nDisplayId; + private TvFormat m_nTvFormat; + private string m_stMonitorPnP; + private DisplayMode m_modeDesktop; + private DisplayMode m_modeCurrent; + private DisplayModeFlags m_nCurrentValid; + private DisplayMode[] m_arSupportedModes; + private DisplayMode[] m_arExtraModes; + private DisplayMode[] m_arAllModes; + + internal Display( + DisplayManager owner, + RenderEngine engine, + string stDeviceName, + uint nDisplayID) + { + this.m_stDeviceName = stDeviceName; + this.m_owner = owner; + this.m_engine = engine; + this.m_nDisplayId = nDisplayID; + this.m_arSupportedModes = DisplayMode.EmptyModes; + this.m_arExtraModes = DisplayMode.EmptyModes; + this.m_arAllModes = DisplayMode.EmptyModes; + this.m_modeCurrent = new DisplayMode(); + this.m_nCurrentValid = (DisplayModeFlags)0; + } + + public string DeviceName => this.m_stDeviceName; + + public Rectangle ScreenArea => this.m_rcMonitor; + + public Rectangle WorkArea => this.m_rcWork; + + public bool IsPrimary => this.m_fPrimaryMonitor; + + public TvFormat TvFormat => this.m_nTvFormat; + + public bool TvMode => this.m_modeCurrent.fTvMode; + + public Size LogicalFullScreenResolution => this.m_modeCurrent.sizeLogicalPxl.IsZero ? (this.m_modeCurrent.sizePhysicalPxl.IsZero ? this.m_rcMonitor.Size : this.m_modeCurrent.sizePhysicalPxl) : this.m_modeCurrent.sizeLogicalPxl; + + internal uint UniqueId => this.m_nDisplayId; + + public DisplayMode[] SupportedModes => this.m_arSupportedModes; + + public DisplayMode[] ExtraModes => this.m_arExtraModes; + + public DisplayMode[] AllModes => this.m_arAllModes; + + public DisplayMode CurrentMode => this.m_modeCurrent; + + public DisplayMode DesktopMode => this.m_modeDesktop; + + public string MonitorPnP => this.m_stMonitorPnP; + + public bool ValidateDisplayMode( + DisplayMode modeDesired, + DisplayModeFlags nCheck, + bool fAllowAllModes, + out DisplayMode modeComplete, + out DisplayModeFlags nCompleteCheck) + { + if (fAllowAllModes) + { + if (this.m_arAllModes == null || this.m_arAllModes.Length == 0) + { + modeComplete = modeDesired; + nCompleteCheck = nCheck; + return false; + } + } + else if (this.m_arSupportedModes == null || this.m_arSupportedModes.Length == 0) + { + modeComplete = modeDesired; + nCompleteCheck = nCheck; + return false; + } + this.CompleteDisplayMode(ref modeDesired, ref nCheck); + modeComplete = this.m_modeCurrent; + nCompleteCheck = this.m_nCurrentValid; + DisplayMode[] array = fAllowAllModes ? this.m_arAllModes : this.m_arExtraModes; + DisplayMode.RenderModeComparer renderModeComparer = new DisplayMode.RenderModeComparer(); + if (Array.BinarySearch(array, modeDesired, (IComparer)renderModeComparer) >= 0) + { + modeComplete = modeDesired; + nCompleteCheck = DisplayModeFlags.Size | DisplayModeFlags.Format | DisplayModeFlags.RefreshRate; + } + else + { + modeComplete = this.m_modeDesktop; + int num = Display.ComputeRank(this.m_modeDesktop, modeDesired, nCheck); + nCompleteCheck = DisplayModeFlags.Size | DisplayModeFlags.Format | DisplayModeFlags.RefreshRate; + foreach (DisplayMode arSupportedMode in this.m_arSupportedModes) + { + int rank = Display.ComputeRank(arSupportedMode, modeDesired, nCheck); + if (rank >= num) + { + modeComplete = arSupportedMode; + num = rank; + nCompleteCheck = DisplayModeFlags.Size | DisplayModeFlags.Format | DisplayModeFlags.RefreshRate; + } + } + if (modeDesired.sizeLogicalPxl.Width > 0 && modeDesired.sizeLogicalPxl.Height > 0) + { + modeComplete.sizeLogicalPxl.Width = modeComplete.sizePhysicalPxl.Width; + modeComplete.sizeLogicalPxl.Height = modeComplete.sizePhysicalPxl.Width * modeDesired.sizeLogicalPxl.Height / modeDesired.sizeLogicalPxl.Width; + } + else + modeComplete.sizeLogicalPxl = modeComplete.sizePhysicalPxl; + } + if (Bits.TestFlag((int)nCheck, 8)) + { + modeComplete.fTvMode = modeDesired.fTvMode; + nCompleteCheck |= DisplayModeFlags.TvMode; + } + return true; + } + + public bool ChangeFullScreenResolution(DisplayMode modeChanges, DisplayModeFlags nValid) + { + bool flag = false; + Debug2.Validate(modeChanges.sizePhysicalPxl.Width == 0 && modeChanges.sizePhysicalPxl.Height == 0 || modeChanges.sizePhysicalPxl.Width > 0 && modeChanges.sizePhysicalPxl.Height > 0, typeof(ArgumentException), (object)"Must specify physical 0 x 0 or a positive size", (object)typeof(ArgumentOutOfRangeException)); + Debug2.Validate(modeChanges.sizeLogicalPxl.Width == 0 && modeChanges.sizeLogicalPxl.Height == 0 || modeChanges.sizeLogicalPxl.Width > 0 && modeChanges.sizeLogicalPxl.Height > 0, typeof(ArgumentException), (object)"Must specify logical 0 x 0 or a positive size", (object)typeof(ArgumentOutOfRangeException)); + Debug2.Validate(modeChanges.nRefreshRate >= 0 && modeChanges.nRefreshRate < 1000, typeof(ArgumentException), "Must have valid refresh rate"); + DisplayMode modeCurrent = this.m_modeCurrent; + this.m_modeCurrent.ChangeFrom(modeChanges, nValid); + this.m_nCurrentValid |= nValid; + if (this.m_modeCurrent != modeCurrent) + { + this.m_owner.RemoteStub.SendChangeFullScreenMode(this.m_nDisplayId, new RenderDisplayMode() + { + sizePhysicalPxl = this.m_modeCurrent.sizePhysicalPxl, + sizeLogicalPxl = this.m_modeCurrent.sizeLogicalPxl, + nFormat = this.m_modeCurrent.nFormat, + nRefreshRate = this.m_modeCurrent.nRefreshRate, + Interlaced = this.m_modeCurrent.fInterlaced + }, this.m_modeCurrent.fTvMode); + flag = true; + this.m_engine.Window.NotifyDisplayReconfigured(); + } + return flag; + } + + private static int ComputeRank( + DisplayMode modeValid, + DisplayMode modeDesired, + DisplayModeFlags nCheck) + { + int num1 = 0; + if (Bits.TestFlag((int)nCheck, 2)) + { + if (modeValid.nFormat == modeDesired.nFormat) + { + num1 += 4000; + } + else + { + int num2 = SurfaceFormatInfo.GetBitsPerPixel(modeValid.nFormat); + int num3 = SurfaceFormatInfo.GetBitsPerPixel(modeDesired.nFormat); + if (num2 == 24) + num2 = 32; + if (num3 == 24) + num3 = 32; + if (num2 == num3) + num1 += 3500; + } + } + if (Bits.TestFlag((int)nCheck, 1) && !modeValid.sizePhysicalPxl.IsZero) + { + Size size = new Size(modeDesired.sizePhysicalPxl.Width - modeValid.sizePhysicalPxl.Width, modeDesired.sizePhysicalPxl.Height - modeValid.sizePhysicalPxl.Height); + if (modeValid.sizePhysicalPxl.Width < 640 && modeValid.sizePhysicalPxl.Height < 480 || size.Width >= 0 && size.Height >= 0) + { + float flValue1 = Math.Abs((float)size.Width / (float)modeValid.sizePhysicalPxl.Width); + float flValue2 = Math.Abs((float)size.Height / (float)modeValid.sizePhysicalPxl.Height); + int num2 = 2000 - (int)(1000.0 * (double)Math2.Clamp(flValue1, 0.0f, 1f) + 1000.0 * (double)Math2.Clamp(flValue2, 0.0f, 1f)); + if (num2 < 0) + num2 = 0; + num1 += num2; + } + } + if (Bits.TestFlag((int)nCheck, 4) && modeValid.fInterlaced == modeDesired.fInterlaced) + { + int num2 = Math.Abs(modeDesired.nRefreshRate - modeValid.nRefreshRate); + if (num2 >= 15) + return -1; + int num3 = 1000 * (15 - num2) / 15; + num1 += num3; + } + return num1; + } + + private void CompleteDisplayMode(ref DisplayMode modeDesired, ref DisplayModeFlags nCheck) + { + if (!Bits.TestFlag((int)nCheck, 1)) + { + if (Bits.TestFlag((int)this.m_nCurrentValid, 1) && !this.m_modeCurrent.sizePhysicalPxl.IsZero) + { + modeDesired.sizePhysicalPxl = this.m_modeCurrent.sizePhysicalPxl; + modeDesired.sizeLogicalPxl = this.m_modeCurrent.sizeLogicalPxl; + nCheck |= DisplayModeFlags.Size; + } + else + { + modeDesired.sizePhysicalPxl.Width = this.m_rcMonitor.Width; + modeDesired.sizePhysicalPxl.Height = this.m_rcMonitor.Height; + modeDesired.sizeLogicalPxl.Width = this.m_rcMonitor.Width; + modeDesired.sizeLogicalPxl.Height = this.m_rcMonitor.Height; + nCheck |= DisplayModeFlags.Size; + } + } + if (!Bits.TestFlag((int)nCheck, 2) && Bits.TestFlag((int)this.m_nCurrentValid, 2)) + { + modeDesired.nFormat = this.m_modeCurrent.nFormat; + nCheck |= DisplayModeFlags.Format; + } + if (!Bits.TestFlag((int)nCheck, 4)) + { + if (Bits.TestFlag((int)this.m_nCurrentValid, 4) && this.m_modeCurrent.nRefreshRate > 0) + { + modeDesired.nRefreshRate = this.m_modeCurrent.nRefreshRate; + modeDesired.fInterlaced = this.m_modeCurrent.fInterlaced; + nCheck |= DisplayModeFlags.RefreshRate; + } + else + { + modeDesired.nRefreshRate = 60; + modeDesired.fInterlaced = false; + nCheck |= DisplayModeFlags.RefreshRate; + } + } + if (Bits.TestFlag((int)nCheck, 8) || !Bits.TestFlag((int)this.m_nCurrentValid, 8)) + return; + modeDesired.fTvMode = this.m_modeCurrent.fTvMode; + nCheck |= DisplayModeFlags.TvMode; + } + + internal void UpdateMonitorInfo( + Rectangle rcMonitor, + Rectangle rcWork, + bool fPrimary, + TvFormat nTvFormat, + string stMonitorPnP, + DisplayMode modeDesktop) + { + this.m_rcMonitor = rcMonitor; + this.m_rcWork = rcWork; + this.m_fPrimaryMonitor = fPrimary; + this.m_nTvFormat = nTvFormat; + this.m_modeDesktop = modeDesktop; + this.m_stMonitorPnP = stMonitorPnP; + } + + internal void UpdateDisplayModes( + DisplayMode[] arNewSupportedModes, + DisplayMode[] arNewExtraModes, + DisplayMode[] arNewAllModes) + { + this.m_arSupportedModes = arNewSupportedModes; + if (this.m_arSupportedModes == null) + this.m_arSupportedModes = DisplayMode.EmptyModes; + this.m_arExtraModes = arNewExtraModes; + if (this.m_arExtraModes == null) + this.m_arExtraModes = DisplayMode.EmptyModes; + this.m_arAllModes = arNewAllModes; + if (this.m_arAllModes != null) + return; + this.m_arAllModes = DisplayMode.EmptyModes; + } } - - public string DeviceName => this.m_stDeviceName; - - public Rectangle ScreenArea => this.m_rcMonitor; - - public Rectangle WorkArea => this.m_rcWork; - - public bool IsPrimary => this.m_fPrimaryMonitor; - - public TvFormat TvFormat => this.m_nTvFormat; - - public bool TvMode => this.m_modeCurrent.fTvMode; - - public Size LogicalFullScreenResolution => this.m_modeCurrent.sizeLogicalPxl.IsZero ? (this.m_modeCurrent.sizePhysicalPxl.IsZero ? this.m_rcMonitor.Size : this.m_modeCurrent.sizePhysicalPxl) : this.m_modeCurrent.sizeLogicalPxl; - - internal uint UniqueId => this.m_nDisplayId; - - public DisplayMode[] SupportedModes => this.m_arSupportedModes; - - public DisplayMode[] ExtraModes => this.m_arExtraModes; - - public DisplayMode[] AllModes => this.m_arAllModes; - - public DisplayMode CurrentMode => this.m_modeCurrent; - - public DisplayMode DesktopMode => this.m_modeDesktop; - - public string MonitorPnP => this.m_stMonitorPnP; - - public bool ValidateDisplayMode( - DisplayMode modeDesired, - DisplayModeFlags nCheck, - bool fAllowAllModes, - out DisplayMode modeComplete, - out DisplayModeFlags nCompleteCheck) - { - if (fAllowAllModes) - { - if (this.m_arAllModes == null || this.m_arAllModes.Length == 0) - { - modeComplete = modeDesired; - nCompleteCheck = nCheck; - return false; - } - } - else if (this.m_arSupportedModes == null || this.m_arSupportedModes.Length == 0) - { - modeComplete = modeDesired; - nCompleteCheck = nCheck; - return false; - } - this.CompleteDisplayMode(ref modeDesired, ref nCheck); - modeComplete = this.m_modeCurrent; - nCompleteCheck = this.m_nCurrentValid; - DisplayMode[] array = fAllowAllModes ? this.m_arAllModes : this.m_arExtraModes; - DisplayMode.RenderModeComparer renderModeComparer = new DisplayMode.RenderModeComparer(); - if (Array.BinarySearch(array, modeDesired, (IComparer) renderModeComparer) >= 0) - { - modeComplete = modeDesired; - nCompleteCheck = DisplayModeFlags.Size | DisplayModeFlags.Format | DisplayModeFlags.RefreshRate; - } - else - { - modeComplete = this.m_modeDesktop; - int num = Display.ComputeRank(this.m_modeDesktop, modeDesired, nCheck); - nCompleteCheck = DisplayModeFlags.Size | DisplayModeFlags.Format | DisplayModeFlags.RefreshRate; - foreach (DisplayMode arSupportedMode in this.m_arSupportedModes) - { - int rank = Display.ComputeRank(arSupportedMode, modeDesired, nCheck); - if (rank >= num) - { - modeComplete = arSupportedMode; - num = rank; - nCompleteCheck = DisplayModeFlags.Size | DisplayModeFlags.Format | DisplayModeFlags.RefreshRate; - } - } - if (modeDesired.sizeLogicalPxl.Width > 0 && modeDesired.sizeLogicalPxl.Height > 0) - { - modeComplete.sizeLogicalPxl.Width = modeComplete.sizePhysicalPxl.Width; - modeComplete.sizeLogicalPxl.Height = modeComplete.sizePhysicalPxl.Width * modeDesired.sizeLogicalPxl.Height / modeDesired.sizeLogicalPxl.Width; - } - else - modeComplete.sizeLogicalPxl = modeComplete.sizePhysicalPxl; - } - if (Bits.TestFlag((int) nCheck, 8)) - { - modeComplete.fTvMode = modeDesired.fTvMode; - nCompleteCheck |= DisplayModeFlags.TvMode; - } - return true; - } - - public bool ChangeFullScreenResolution(DisplayMode modeChanges, DisplayModeFlags nValid) - { - bool flag = false; - Debug2.Validate(modeChanges.sizePhysicalPxl.Width == 0 && modeChanges.sizePhysicalPxl.Height == 0 || modeChanges.sizePhysicalPxl.Width > 0 && modeChanges.sizePhysicalPxl.Height > 0, typeof (ArgumentException), (object) "Must specify physical 0 x 0 or a positive size", (object) typeof (ArgumentOutOfRangeException)); - Debug2.Validate(modeChanges.sizeLogicalPxl.Width == 0 && modeChanges.sizeLogicalPxl.Height == 0 || modeChanges.sizeLogicalPxl.Width > 0 && modeChanges.sizeLogicalPxl.Height > 0, typeof (ArgumentException), (object) "Must specify logical 0 x 0 or a positive size", (object) typeof (ArgumentOutOfRangeException)); - Debug2.Validate(modeChanges.nRefreshRate >= 0 && modeChanges.nRefreshRate < 1000, typeof (ArgumentException), "Must have valid refresh rate"); - DisplayMode modeCurrent = this.m_modeCurrent; - this.m_modeCurrent.ChangeFrom(modeChanges, nValid); - this.m_nCurrentValid |= nValid; - if (this.m_modeCurrent != modeCurrent) - { - this.m_owner.RemoteStub.SendChangeFullScreenMode(this.m_nDisplayId, new RenderDisplayMode() - { - sizePhysicalPxl = this.m_modeCurrent.sizePhysicalPxl, - sizeLogicalPxl = this.m_modeCurrent.sizeLogicalPxl, - nFormat = this.m_modeCurrent.nFormat, - nRefreshRate = this.m_modeCurrent.nRefreshRate, - Interlaced = this.m_modeCurrent.fInterlaced - }, this.m_modeCurrent.fTvMode); - flag = true; - this.m_engine.Window.NotifyDisplayReconfigured(); - } - return flag; - } - - private static int ComputeRank( - DisplayMode modeValid, - DisplayMode modeDesired, - DisplayModeFlags nCheck) - { - int num1 = 0; - if (Bits.TestFlag((int) nCheck, 2)) - { - if (modeValid.nFormat == modeDesired.nFormat) - { - num1 += 4000; - } - else - { - int num2 = SurfaceFormatInfo.GetBitsPerPixel(modeValid.nFormat); - int num3 = SurfaceFormatInfo.GetBitsPerPixel(modeDesired.nFormat); - if (num2 == 24) - num2 = 32; - if (num3 == 24) - num3 = 32; - if (num2 == num3) - num1 += 3500; - } - } - if (Bits.TestFlag((int) nCheck, 1) && !modeValid.sizePhysicalPxl.IsZero) - { - Size size = new Size(modeDesired.sizePhysicalPxl.Width - modeValid.sizePhysicalPxl.Width, modeDesired.sizePhysicalPxl.Height - modeValid.sizePhysicalPxl.Height); - if (modeValid.sizePhysicalPxl.Width < 640 && modeValid.sizePhysicalPxl.Height < 480 || size.Width >= 0 && size.Height >= 0) - { - float flValue1 = Math.Abs((float) size.Width / (float) modeValid.sizePhysicalPxl.Width); - float flValue2 = Math.Abs((float) size.Height / (float) modeValid.sizePhysicalPxl.Height); - int num2 = 2000 - (int) (1000.0 * (double) Math2.Clamp(flValue1, 0.0f, 1f) + 1000.0 * (double) Math2.Clamp(flValue2, 0.0f, 1f)); - if (num2 < 0) - num2 = 0; - num1 += num2; - } - } - if (Bits.TestFlag((int) nCheck, 4) && modeValid.fInterlaced == modeDesired.fInterlaced) - { - int num2 = Math.Abs(modeDesired.nRefreshRate - modeValid.nRefreshRate); - if (num2 >= 15) - return -1; - int num3 = 1000 * (15 - num2) / 15; - num1 += num3; - } - return num1; - } - - private void CompleteDisplayMode(ref DisplayMode modeDesired, ref DisplayModeFlags nCheck) - { - if (!Bits.TestFlag((int) nCheck, 1)) - { - if (Bits.TestFlag((int) this.m_nCurrentValid, 1) && !this.m_modeCurrent.sizePhysicalPxl.IsZero) - { - modeDesired.sizePhysicalPxl = this.m_modeCurrent.sizePhysicalPxl; - modeDesired.sizeLogicalPxl = this.m_modeCurrent.sizeLogicalPxl; - nCheck |= DisplayModeFlags.Size; - } - else - { - modeDesired.sizePhysicalPxl.Width = this.m_rcMonitor.Width; - modeDesired.sizePhysicalPxl.Height = this.m_rcMonitor.Height; - modeDesired.sizeLogicalPxl.Width = this.m_rcMonitor.Width; - modeDesired.sizeLogicalPxl.Height = this.m_rcMonitor.Height; - nCheck |= DisplayModeFlags.Size; - } - } - if (!Bits.TestFlag((int) nCheck, 2) && Bits.TestFlag((int) this.m_nCurrentValid, 2)) - { - modeDesired.nFormat = this.m_modeCurrent.nFormat; - nCheck |= DisplayModeFlags.Format; - } - if (!Bits.TestFlag((int) nCheck, 4)) - { - if (Bits.TestFlag((int) this.m_nCurrentValid, 4) && this.m_modeCurrent.nRefreshRate > 0) - { - modeDesired.nRefreshRate = this.m_modeCurrent.nRefreshRate; - modeDesired.fInterlaced = this.m_modeCurrent.fInterlaced; - nCheck |= DisplayModeFlags.RefreshRate; - } - else - { - modeDesired.nRefreshRate = 60; - modeDesired.fInterlaced = false; - nCheck |= DisplayModeFlags.RefreshRate; - } - } - if (Bits.TestFlag((int) nCheck, 8) || !Bits.TestFlag((int) this.m_nCurrentValid, 8)) - return; - modeDesired.fTvMode = this.m_modeCurrent.fTvMode; - nCheck |= DisplayModeFlags.TvMode; - } - - internal void UpdateMonitorInfo( - Rectangle rcMonitor, - Rectangle rcWork, - bool fPrimary, - TvFormat nTvFormat, - string stMonitorPnP, - DisplayMode modeDesktop) - { - this.m_rcMonitor = rcMonitor; - this.m_rcWork = rcWork; - this.m_fPrimaryMonitor = fPrimary; - this.m_nTvFormat = nTvFormat; - this.m_modeDesktop = modeDesktop; - this.m_stMonitorPnP = stMonitorPnP; - } - - internal void UpdateDisplayModes( - DisplayMode[] arNewSupportedModes, - DisplayMode[] arNewExtraModes, - DisplayMode[] arNewAllModes) - { - this.m_arSupportedModes = arNewSupportedModes; - if (this.m_arSupportedModes == null) - this.m_arSupportedModes = DisplayMode.EmptyModes; - this.m_arExtraModes = arNewExtraModes; - if (this.m_arExtraModes == null) - this.m_arExtraModes = DisplayMode.EmptyModes; - this.m_arAllModes = arNewAllModes; - if (this.m_arAllModes != null) - return; - this.m_arAllModes = DisplayMode.EmptyModes; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/DisplayManager.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/DisplayManager.cs index 6e49b61..c5e2f1b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/DisplayManager.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/DisplayManager.cs @@ -14,326 +14,326 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Internal { - internal class DisplayManager : - RenderObject, - IDisplayManager, - IDesktopManagerCallback, - IRenderHandleOwner, - IEnumerable - { - private const uint MONITORINFOF_PRIMARY = 1; - private static ushort[] s_ByteOrder_MonitorInfoCallbackMsg; - private RenderSession m_session; - private RenderEngine m_engine; - private RemoteDesktopManager m_remoteManager; - private DisplayMode[] m_arExtraModes; - private DisplayManager.DisplayInfo m_info; - private DisplayManager.DisplayInfo m_infoRebuilding; - private Display m_dispRebuildLastAdded; - private ArrayList m_alRebuildSupportedModes; - private ArrayList m_alRebuildAllModes; - private bool m_fPendingChangeNotification; - - private DisplayManager(RenderSession session, RenderEngine engine, bool fEnumDisplayModes) + internal class DisplayManager : + RenderObject, + IDisplayManager, + IDesktopManagerCallback, + IRenderHandleOwner, + IEnumerable { - this.m_session = session; - this.m_engine = engine; - this.m_info = new DisplayManager.DisplayInfo(); - this.m_arExtraModes = DisplayMode.EmptyModes; - this.m_remoteManager = this.m_session.BuildRemoteDesktopManager(this, fEnumDisplayModes); - this.m_remoteManager.SendRebuildMonitorCache(); - } + private const uint MONITORINFOF_PRIMARY = 1; + private static ushort[] s_ByteOrder_MonitorInfoCallbackMsg; + private RenderSession m_session; + private RenderEngine m_engine; + private RemoteDesktopManager m_remoteManager; + private DisplayMode[] m_arExtraModes; + private DisplayManager.DisplayInfo m_info; + private DisplayManager.DisplayInfo m_infoRebuilding; + private Display m_dispRebuildLastAdded; + private ArrayList m_alRebuildSupportedModes; + private ArrayList m_alRebuildAllModes; + private bool m_fPendingChangeNotification; - internal static DisplayManager CreateDisplayManager( - RenderSession session, - RenderEngine engine, - bool fEnumDisplayModes) - { - return new DisplayManager(session, engine, fEnumDisplayModes); - } - - protected override void Dispose(bool fInDispose) - { - if (fInDispose && this.m_remoteManager != null) - this.m_remoteManager.Dispose(); - this.m_remoteManager = (RemoteDesktopManager) null; - base.Dispose(fInDispose); - } - - public IDisplay PrimaryDisplay => (IDisplay) this.m_info.primaryDisplay; - - public DisplayMode[] ExtraModes - { - get => this.m_arExtraModes; - set - { - if (value == null) - value = DisplayMode.EmptyModes; - this.m_arExtraModes = value; - } - } - - internal RemoteDesktopManager RemoteStub => this.m_remoteManager; - - public IDisplay DisplayFromDeviceName(string stDeviceName) => (IDisplay) this.DisplayFromName(stDeviceName); - - private Display DisplayFromName(string stDeviceName) - { - Display display1 = (Display) null; - if (!string.IsNullOrEmpty(stDeviceName)) - { - foreach (Display display2 in this.m_info.displays) + private DisplayManager(RenderSession session, RenderEngine engine, bool fEnumDisplayModes) { - if (string.Compare(display2.DeviceName, stDeviceName, StringComparison.OrdinalIgnoreCase) == 0) - { - display1 = display2; - break; - } + this.m_session = session; + this.m_engine = engine; + this.m_info = new DisplayManager.DisplayInfo(); + this.m_arExtraModes = DisplayMode.EmptyModes; + this.m_remoteManager = this.m_session.BuildRemoteDesktopManager(this, fEnumDisplayModes); + this.m_remoteManager.SendRebuildMonitorCache(); } - } - return display1; - } - internal Display DisplayFromUniqueId(uint idDisplay) - { - foreach (Display display in this.m_info.displays) - { - if ((int) idDisplay == (int) display.UniqueId) - return display; - } - return (Display) null; - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteManager.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteManager = (RemoteDesktopManager) null; - - void IDesktopManagerCallback.OnBeginEnumMonitorInfo(RENDERHANDLE target) - { - this.m_infoRebuilding = new DisplayManager.DisplayInfo(); - this.m_dispRebuildLastAdded = (Display) null; - this.m_alRebuildSupportedModes = new ArrayList(); - this.m_alRebuildAllModes = new ArrayList(); - } - - void IDesktopManagerCallback.OnEndEnumMonitorInfo(RENDERHANDLE target) - { - foreach (Display display in this.m_infoRebuilding.displays) - { - if (display.IsPrimary) - this.m_infoRebuilding.primaryDisplay = display; - } - this.m_info = this.m_infoRebuilding; - this.m_infoRebuilding = (DisplayManager.DisplayInfo) null; - this.m_dispRebuildLastAdded = (Display) null; - this.m_alRebuildSupportedModes = (ArrayList) null; - this.m_alRebuildAllModes = (ArrayList) null; - if (this.DisplayChange == null || this.m_fPendingChangeNotification) - return; - this.m_session.DeferredInvoke((Delegate) new DeferredHandler(this.DeliverDisplayChangeNotification), (object) null, DeferredInvokePriority.Normal); - this.m_fPendingChangeNotification = true; - } - - unsafe void IDesktopManagerCallback.OnMonitorInfo( - RENDERHANDLE target, - Message* pmsgRaw) - { - if (this.m_session.IsForeignByteOrderOnWindowing) - MarshalHelper.SwapByteOrder((byte*) pmsgRaw, ref DisplayManager.s_ByteOrder_MonitorInfoCallbackMsg, typeof (DisplayManager.MonitorInfoCallbackMsg), 0, 0); - Display display = this.ConvertMonitorInfo((DisplayManager.MonitorInfoCallbackMsg*) pmsgRaw); - this.m_dispRebuildLastAdded = display; - this.m_alRebuildSupportedModes.Clear(); - this.m_alRebuildAllModes.Clear(); - this.m_infoRebuilding.displays.Add((object) display); - } - - void IDesktopManagerCallback.OnBeginDisplayModes(RENDERHANDLE target) - { - } - - void IDesktopManagerCallback.OnDisplayMode( - RENDERHANDLE target, - RenderDisplayMode rmodeAdd, - bool fSupported) - { - DisplayMode displayMode = new DisplayMode(); - displayMode.sizePhysicalPxl = rmodeAdd.sizePhysicalPxl; - displayMode.sizeLogicalPxl = rmodeAdd.sizeLogicalPxl; - displayMode.nFormat = rmodeAdd.nFormat; - displayMode.nRefreshRate = rmodeAdd.nRefreshRate; - displayMode.fInterlaced = rmodeAdd.Interlaced; - displayMode.fTvMode = false; - if (fSupported) - this.m_alRebuildSupportedModes.Add((object) displayMode); - else - this.m_alRebuildAllModes.Add((object) displayMode); - } - - void IDesktopManagerCallback.OnEndDisplayModes(RENDERHANDLE target) - { - DisplayMode[] arSupportedModes; - DisplayMode[] arExtraModes; - DisplayMode[] arAllModes; - this.BuildModeLists(out arSupportedModes, out arExtraModes, out arAllModes); - if (arSupportedModes.Length <= 0) - return; - this.m_dispRebuildLastAdded.UpdateDisplayModes(arSupportedModes, arExtraModes, arAllModes); - } - - public IEnumerator GetEnumerator() => this.m_info != null ? this.m_info.displays.GetEnumerator() : new Display[0].GetEnumerator(); - - public event EventHandler DisplayChange; - - private void DeliverDisplayChangeNotification(object param) - { - if (!this.m_fPendingChangeNotification) - return; - this.m_fPendingChangeNotification = false; - if (this.DisplayChange == null) - return; - this.DisplayChange((object) this, EventArgs.Empty); - } - - private unsafe Display ConvertMonitorInfo(DisplayManager.MonitorInfoCallbackMsg* pmsg) - { - string stringUni1 = Marshal.PtrToStringUni(new IntPtr((void*) &pmsg->pad_szDevice1)); - Display display = (Display) null; - if (this.m_info != null) - display = this.DisplayFromName(stringUni1); - if (display == null) - display = new Display(this, this.m_engine, stringUni1, pmsg->idDisplay); - Rectangle rcMonitor = new Rectangle(pmsg->rcMonLeft, pmsg->rcMonTop, pmsg->rcMonRight - pmsg->rcMonLeft, pmsg->rcMonBottom - pmsg->rcMonTop); - Rectangle rcWork = new Rectangle(pmsg->rcWrkLeft, pmsg->rcWrkTop, pmsg->rcWrkRight - pmsg->rcWrkLeft, pmsg->rcWrkBottom - pmsg->rcWrkTop); - bool fPrimary = ((int) pmsg->dwFlags & 1) != 0; - TvFormat nTvFormat = (TvFormat) pmsg->nTvFormat; - DisplayMode modeDesktop = new DisplayMode(); - modeDesktop.sizePhysicalPxl.Width = pmsg->sizeScreenWidth; - modeDesktop.sizePhysicalPxl.Height = pmsg->sizeScreenHeight; - modeDesktop.sizeLogicalPxl.Width = pmsg->sizeScreenWidth; - modeDesktop.sizeLogicalPxl.Height = pmsg->sizeScreenHeight; - modeDesktop.nFormat = (SurfaceFormat) pmsg->nFormat; - modeDesktop.nRefreshRate = pmsg->nRefreshRate; - modeDesktop.fInterlaced = pmsg->fInterlaced != 0U; - modeDesktop.fTvMode = false; - string stringUni2 = Marshal.PtrToStringUni(new IntPtr((void*) &pmsg->pad_szMonitorPnP1)); - display.UpdateMonitorInfo(rcMonitor, rcWork, fPrimary, nTvFormat, stringUni2, modeDesktop); - return display; - } - - private void BuildModeLists( - out DisplayMode[] arSupportedModes, - out DisplayMode[] arExtraModes, - out DisplayMode[] arAllModes) - { - DisplayMode.RenderModeComparer renderModeComparer = new DisplayMode.RenderModeComparer(); - arSupportedModes = (DisplayMode[]) this.m_alRebuildSupportedModes.ToArray(typeof (DisplayMode)); - Array.Sort(arSupportedModes, (IComparer) renderModeComparer); - arAllModes = (DisplayMode[]) this.m_alRebuildAllModes.ToArray(typeof (DisplayMode)); - Array.Sort(arAllModes, (IComparer) renderModeComparer); - Vector vector = new Vector(); - int length = this.m_arExtraModes.Length; - List[] intListArray = new List[length]; - for (int index = 0; index < length; ++index) - intListArray[index] = new List(); - for (int index1 = 0; index1 < this.m_alRebuildAllModes.Count; ++index1) - { - DisplayMode alRebuildAllMode = (DisplayMode) this.m_alRebuildAllModes[index1]; - if (Array.BinarySearch(arSupportedModes, alRebuildAllMode, (IComparer) renderModeComparer) < 0) + internal static DisplayManager CreateDisplayManager( + RenderSession session, + RenderEngine engine, + bool fEnumDisplayModes) { - for (int index2 = 0; index2 < this.m_arExtraModes.Length; ++index2) - { - DisplayMode arExtraMode = this.m_arExtraModes[index2]; - if (DisplayMode.CompareRenderModes(alRebuildAllMode, arExtraMode) == 0) + return new DisplayManager(session, engine, fEnumDisplayModes); + } + + protected override void Dispose(bool fInDispose) + { + if (fInDispose && this.m_remoteManager != null) + this.m_remoteManager.Dispose(); + this.m_remoteManager = (RemoteDesktopManager)null; + base.Dispose(fInDispose); + } + + public IDisplay PrimaryDisplay => (IDisplay)this.m_info.primaryDisplay; + + public DisplayMode[] ExtraModes + { + get => this.m_arExtraModes; + set { - vector.Add(alRebuildAllMode); - intListArray[index2] = (List) null; + if (value == null) + value = DisplayMode.EmptyModes; + this.m_arExtraModes = value; } - else if (DisplayMode.CompareSimilarModes(alRebuildAllMode, arExtraMode) == 0) - intListArray[index2]?.Add(index1); - } } - } - foreach (List intList in intListArray) - { - if (intList != null) + + internal RemoteDesktopManager RemoteStub => this.m_remoteManager; + + public IDisplay DisplayFromDeviceName(string stDeviceName) => (IDisplay)this.DisplayFromName(stDeviceName); + + private Display DisplayFromName(string stDeviceName) { - foreach (int index in intList) - vector.Add((DisplayMode) this.m_alRebuildAllModes[index]); + Display display1 = (Display)null; + if (!string.IsNullOrEmpty(stDeviceName)) + { + foreach (Display display2 in this.m_info.displays) + { + if (string.Compare(display2.DeviceName, stDeviceName, StringComparison.OrdinalIgnoreCase) == 0) + { + display1 = display2; + break; + } + } + } + return display1; } - } - arExtraModes = vector.ToArray(); - Array.Sort(arExtraModes, (IComparer) renderModeComparer); - } - private class DisplayInfo - { - public Display primaryDisplay; - public ArrayList displays = new ArrayList(); - } + internal Display DisplayFromUniqueId(uint idDisplay) + { + foreach (Display display in this.m_info.displays) + { + if ((int)idDisplay == (int)display.UniqueId) + return display; + } + return (Display)null; + } - [ComVisible(false)] - private struct MonitorInfoCallbackMsg - { - public uint cbSize; - public int nMsg; - public RENDERHANDLE idObjectSubject; - public uint idDisplay; - public uint nTvFormat; - public int sizeScreenWidth; - public int sizeScreenHeight; - public uint nFormat; - public int nRefreshRate; - public uint fInterlaced; - public uint cbMiSize; - public int rcMonLeft; - public int rcMonTop; - public int rcMonRight; - public int rcMonBottom; - public int rcWrkLeft; - public int rcWrkTop; - public int rcWrkRight; - public int rcWrkBottom; - public uint dwFlags; - public long pad_szDevice1; - public long pad_szDevice2; - public long pad_szDevice3; - public long pad_szDevice4; - public long pad_szDevice5; - public long pad_szDevice6; - public long pad_szDevice7; - public long pad_szDevice8; - public long pad_szMonitorPnP1; - public long pad_szMonitorPnP2; - public long pad_szMonitorPnP3; - public long pad_szMonitorPnP4; - public long pad_szMonitorPnP5; - public long pad_szMonitorPnP6; - public long pad_szMonitorPnP7; - public long pad_szMonitorPnP8; - public long pad_szMonitorPnP9; - public long pad_szMonitorPnP10; - public long pad_szMonitorPnP11; - public long pad_szMonitorPnP12; - public long pad_szMonitorPnP13; - public long pad_szMonitorPnP14; - public long pad_szMonitorPnP15; - public long pad_szMonitorPnP16; - public long pad_szMonitorPnP17; - public long pad_szMonitorPnP18; - public long pad_szMonitorPnP19; - public long pad_szMonitorPnP20; - public long pad_szMonitorPnP21; - public long pad_szMonitorPnP22; - public long pad_szMonitorPnP23; - public long pad_szMonitorPnP24; - public long pad_szMonitorPnP25; - public long pad_szMonitorPnP26; - public long pad_szMonitorPnP27; - public long pad_szMonitorPnP28; - public long pad_szMonitorPnP29; - public long pad_szMonitorPnP30; - public long pad_szMonitorPnP31; - public long pad_szMonitorPnP32; + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteManager.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteManager = (RemoteDesktopManager)null; + + void IDesktopManagerCallback.OnBeginEnumMonitorInfo(RENDERHANDLE target) + { + this.m_infoRebuilding = new DisplayManager.DisplayInfo(); + this.m_dispRebuildLastAdded = (Display)null; + this.m_alRebuildSupportedModes = new ArrayList(); + this.m_alRebuildAllModes = new ArrayList(); + } + + void IDesktopManagerCallback.OnEndEnumMonitorInfo(RENDERHANDLE target) + { + foreach (Display display in this.m_infoRebuilding.displays) + { + if (display.IsPrimary) + this.m_infoRebuilding.primaryDisplay = display; + } + this.m_info = this.m_infoRebuilding; + this.m_infoRebuilding = (DisplayManager.DisplayInfo)null; + this.m_dispRebuildLastAdded = (Display)null; + this.m_alRebuildSupportedModes = (ArrayList)null; + this.m_alRebuildAllModes = (ArrayList)null; + if (this.DisplayChange == null || this.m_fPendingChangeNotification) + return; + this.m_session.DeferredInvoke((Delegate)new DeferredHandler(this.DeliverDisplayChangeNotification), (object)null, DeferredInvokePriority.Normal); + this.m_fPendingChangeNotification = true; + } + + unsafe void IDesktopManagerCallback.OnMonitorInfo( + RENDERHANDLE target, + Message* pmsgRaw) + { + if (this.m_session.IsForeignByteOrderOnWindowing) + MarshalHelper.SwapByteOrder((byte*)pmsgRaw, ref DisplayManager.s_ByteOrder_MonitorInfoCallbackMsg, typeof(DisplayManager.MonitorInfoCallbackMsg), 0, 0); + Display display = this.ConvertMonitorInfo((DisplayManager.MonitorInfoCallbackMsg*)pmsgRaw); + this.m_dispRebuildLastAdded = display; + this.m_alRebuildSupportedModes.Clear(); + this.m_alRebuildAllModes.Clear(); + this.m_infoRebuilding.displays.Add((object)display); + } + + void IDesktopManagerCallback.OnBeginDisplayModes(RENDERHANDLE target) + { + } + + void IDesktopManagerCallback.OnDisplayMode( + RENDERHANDLE target, + RenderDisplayMode rmodeAdd, + bool fSupported) + { + DisplayMode displayMode = new DisplayMode(); + displayMode.sizePhysicalPxl = rmodeAdd.sizePhysicalPxl; + displayMode.sizeLogicalPxl = rmodeAdd.sizeLogicalPxl; + displayMode.nFormat = rmodeAdd.nFormat; + displayMode.nRefreshRate = rmodeAdd.nRefreshRate; + displayMode.fInterlaced = rmodeAdd.Interlaced; + displayMode.fTvMode = false; + if (fSupported) + this.m_alRebuildSupportedModes.Add((object)displayMode); + else + this.m_alRebuildAllModes.Add((object)displayMode); + } + + void IDesktopManagerCallback.OnEndDisplayModes(RENDERHANDLE target) + { + DisplayMode[] arSupportedModes; + DisplayMode[] arExtraModes; + DisplayMode[] arAllModes; + this.BuildModeLists(out arSupportedModes, out arExtraModes, out arAllModes); + if (arSupportedModes.Length <= 0) + return; + this.m_dispRebuildLastAdded.UpdateDisplayModes(arSupportedModes, arExtraModes, arAllModes); + } + + public IEnumerator GetEnumerator() => this.m_info != null ? this.m_info.displays.GetEnumerator() : new Display[0].GetEnumerator(); + + public event EventHandler DisplayChange; + + private void DeliverDisplayChangeNotification(object param) + { + if (!this.m_fPendingChangeNotification) + return; + this.m_fPendingChangeNotification = false; + if (this.DisplayChange == null) + return; + this.DisplayChange((object)this, EventArgs.Empty); + } + + private unsafe Display ConvertMonitorInfo(DisplayManager.MonitorInfoCallbackMsg* pmsg) + { + string stringUni1 = Marshal.PtrToStringUni(new IntPtr((void*)&pmsg->pad_szDevice1)); + Display display = (Display)null; + if (this.m_info != null) + display = this.DisplayFromName(stringUni1); + if (display == null) + display = new Display(this, this.m_engine, stringUni1, pmsg->idDisplay); + Rectangle rcMonitor = new Rectangle(pmsg->rcMonLeft, pmsg->rcMonTop, pmsg->rcMonRight - pmsg->rcMonLeft, pmsg->rcMonBottom - pmsg->rcMonTop); + Rectangle rcWork = new Rectangle(pmsg->rcWrkLeft, pmsg->rcWrkTop, pmsg->rcWrkRight - pmsg->rcWrkLeft, pmsg->rcWrkBottom - pmsg->rcWrkTop); + bool fPrimary = ((int)pmsg->dwFlags & 1) != 0; + TvFormat nTvFormat = (TvFormat)pmsg->nTvFormat; + DisplayMode modeDesktop = new DisplayMode(); + modeDesktop.sizePhysicalPxl.Width = pmsg->sizeScreenWidth; + modeDesktop.sizePhysicalPxl.Height = pmsg->sizeScreenHeight; + modeDesktop.sizeLogicalPxl.Width = pmsg->sizeScreenWidth; + modeDesktop.sizeLogicalPxl.Height = pmsg->sizeScreenHeight; + modeDesktop.nFormat = (SurfaceFormat)pmsg->nFormat; + modeDesktop.nRefreshRate = pmsg->nRefreshRate; + modeDesktop.fInterlaced = pmsg->fInterlaced != 0U; + modeDesktop.fTvMode = false; + string stringUni2 = Marshal.PtrToStringUni(new IntPtr((void*)&pmsg->pad_szMonitorPnP1)); + display.UpdateMonitorInfo(rcMonitor, rcWork, fPrimary, nTvFormat, stringUni2, modeDesktop); + return display; + } + + private void BuildModeLists( + out DisplayMode[] arSupportedModes, + out DisplayMode[] arExtraModes, + out DisplayMode[] arAllModes) + { + DisplayMode.RenderModeComparer renderModeComparer = new DisplayMode.RenderModeComparer(); + arSupportedModes = (DisplayMode[])this.m_alRebuildSupportedModes.ToArray(typeof(DisplayMode)); + Array.Sort(arSupportedModes, (IComparer)renderModeComparer); + arAllModes = (DisplayMode[])this.m_alRebuildAllModes.ToArray(typeof(DisplayMode)); + Array.Sort(arAllModes, (IComparer)renderModeComparer); + Vector vector = new Vector(); + int length = this.m_arExtraModes.Length; + List[] intListArray = new List[length]; + for (int index = 0; index < length; ++index) + intListArray[index] = new List(); + for (int index1 = 0; index1 < this.m_alRebuildAllModes.Count; ++index1) + { + DisplayMode alRebuildAllMode = (DisplayMode)this.m_alRebuildAllModes[index1]; + if (Array.BinarySearch(arSupportedModes, alRebuildAllMode, (IComparer)renderModeComparer) < 0) + { + for (int index2 = 0; index2 < this.m_arExtraModes.Length; ++index2) + { + DisplayMode arExtraMode = this.m_arExtraModes[index2]; + if (DisplayMode.CompareRenderModes(alRebuildAllMode, arExtraMode) == 0) + { + vector.Add(alRebuildAllMode); + intListArray[index2] = (List)null; + } + else if (DisplayMode.CompareSimilarModes(alRebuildAllMode, arExtraMode) == 0) + intListArray[index2]?.Add(index1); + } + } + } + foreach (List intList in intListArray) + { + if (intList != null) + { + foreach (int index in intList) + vector.Add((DisplayMode)this.m_alRebuildAllModes[index]); + } + } + arExtraModes = vector.ToArray(); + Array.Sort(arExtraModes, (IComparer)renderModeComparer); + } + + private class DisplayInfo + { + public Display primaryDisplay; + public ArrayList displays = new ArrayList(); + } + + [ComVisible(false)] + private struct MonitorInfoCallbackMsg + { + public uint cbSize; + public int nMsg; + public RENDERHANDLE idObjectSubject; + public uint idDisplay; + public uint nTvFormat; + public int sizeScreenWidth; + public int sizeScreenHeight; + public uint nFormat; + public int nRefreshRate; + public uint fInterlaced; + public uint cbMiSize; + public int rcMonLeft; + public int rcMonTop; + public int rcMonRight; + public int rcMonBottom; + public int rcWrkLeft; + public int rcWrkTop; + public int rcWrkRight; + public int rcWrkBottom; + public uint dwFlags; + public long pad_szDevice1; + public long pad_szDevice2; + public long pad_szDevice3; + public long pad_szDevice4; + public long pad_szDevice5; + public long pad_szDevice6; + public long pad_szDevice7; + public long pad_szDevice8; + public long pad_szMonitorPnP1; + public long pad_szMonitorPnP2; + public long pad_szMonitorPnP3; + public long pad_szMonitorPnP4; + public long pad_szMonitorPnP5; + public long pad_szMonitorPnP6; + public long pad_szMonitorPnP7; + public long pad_szMonitorPnP8; + public long pad_szMonitorPnP9; + public long pad_szMonitorPnP10; + public long pad_szMonitorPnP11; + public long pad_szMonitorPnP12; + public long pad_szMonitorPnP13; + public long pad_szMonitorPnP14; + public long pad_szMonitorPnP15; + public long pad_szMonitorPnP16; + public long pad_szMonitorPnP17; + public long pad_szMonitorPnP18; + public long pad_szMonitorPnP19; + public long pad_szMonitorPnP20; + public long pad_szMonitorPnP21; + public long pad_szMonitorPnP22; + public long pad_szMonitorPnP23; + public long pad_szMonitorPnP24; + public long pad_szMonitorPnP25; + public long pad_szMonitorPnP26; + public long pad_szMonitorPnP27; + public long pad_szMonitorPnP28; + public long pad_szMonitorPnP29; + public long pad_szMonitorPnP30; + public long pad_szMonitorPnP31; + public long pad_szMonitorPnP32; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/EventCookie.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/EventCookie.cs index 6c9525c..53965f7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/EventCookie.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/EventCookie.cs @@ -6,38 +6,38 @@ namespace Microsoft.Iris.Render.Internal { - internal struct EventCookie - { - public static readonly EventCookie NULL = new EventCookie(); - private uint m_value; - - private EventCookie(uint value) => this.m_value = value; - - public static bool operator ==(EventCookie hl, EventCookie hr) => (int) hl.m_value == (int) hr.m_value; - - public static bool operator !=(EventCookie hl, EventCookie hr) => (int) hl.m_value != (int) hr.m_value; - - public override bool Equals(object oCompare) + internal struct EventCookie { - switch (oCompare) - { - case uint num: -label_3: - return (int) this.m_value == (int) num; - case EventCookie eventCookie: - num = eventCookie.m_value; - goto label_3; - default: - return false; - } + public static readonly EventCookie NULL = new EventCookie(); + private uint m_value; + + private EventCookie(uint value) => this.m_value = value; + + public static bool operator ==(EventCookie hl, EventCookie hr) => (int)hl.m_value == (int)hr.m_value; + + public static bool operator !=(EventCookie hl, EventCookie hr) => (int)hl.m_value != (int)hr.m_value; + + public override bool Equals(object oCompare) + { + switch (oCompare) + { + case uint num: + label_3: + return (int)this.m_value == (int)num; + case EventCookie eventCookie: + num = eventCookie.m_value; + goto label_3; + default: + return false; + } + } + + public override int GetHashCode() => (int)this.m_value; + + internal static EventCookie FromUInt32(uint value) => new EventCookie(value); + + internal static uint ToUInt32(EventCookie handle) => handle.m_value; + + public static EventCookie ReserveSlot() => EventCookie.FromUInt32(KeyAllocator.ReserveSlot()); } - - public override int GetHashCode() => (int) this.m_value; - - internal static EventCookie FromUInt32(uint value) => new EventCookie(value); - - internal static uint ToUInt32(EventCookie handle) => handle.m_value; - - public static EventCookie ReserveSlot() => EventCookie.FromUInt32(KeyAllocator.ReserveSlot()); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/FormApi.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/FormApi.cs index 8512b09..72a3b54 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/FormApi.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/FormApi.cs @@ -8,14 +8,14 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Internal { - internal static class FormApi - { - private const string s_stEhRenderDll = "UIXRender.dll"; + internal static class FormApi + { + private const string s_stEhRenderDll = "UIXRender.dll"; - [DllImport("UIXRender.dll")] - public static extern HRESULT SpGdiplusInit(); + [DllImport("UIXRender.dll")] + public static extern HRESULT SpGdiplusInit(); - [DllImport("UIXRender.dll")] - public static extern HRESULT SpGdiplusUninit(); - } + [DllImport("UIXRender.dll")] + public static extern HRESULT SpGdiplusUninit(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/GraphicsCaps.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/GraphicsCaps.cs index a112bc7..a5d61d5 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/GraphicsCaps.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/GraphicsCaps.cs @@ -9,19 +9,19 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Internal { - [ComVisible(false)] - [Serializable] - internal struct GraphicsCaps - { - internal uint DeviceType; - internal int MaxSimultaneousTextures; - internal int MaxTextureWidth; - internal int MaxTextureHeight; - internal ulong DedicatedVideoMemory; - internal ulong TotalVideoMemory; - internal uint PixelShaderProfile; - internal uint VertexShaderProfile; - internal int DriverWarning; - internal int AvailableRenderTargets; - } + [ComVisible(false)] + [Serializable] + internal struct GraphicsCaps + { + internal uint DeviceType; + internal int MaxSimultaneousTextures; + internal int MaxTextureWidth; + internal int MaxTextureHeight; + internal ulong DedicatedVideoMemory; + internal ulong TotalVideoMemory; + internal uint PixelShaderProfile; + internal uint VertexShaderProfile; + internal int DriverWarning; + internal int AvailableRenderTargets; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HRESULT.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HRESULT.cs index 992f6c6..7c7077e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HRESULT.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HRESULT.cs @@ -8,31 +8,31 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Internal { - internal struct HRESULT - { - public int hr; - - public HRESULT(int hr) => this.hr = hr; - - public static bool operator ==(HRESULT hrA, HRESULT hrB) => hrA.hr == hrB.hr; - - public static bool operator !=(HRESULT hrA, HRESULT hrB) => hrA.hr != hrB.hr; - - public override bool Equals(object oCompare) => oCompare is HRESULT hresult && this.hr == hresult.hr; - - public override int GetHashCode() => this.hr; - - public bool IsError() => this.hr < 0; - - public bool IsSuccess() => this.hr >= 0; - - public void HandleError() + internal struct HRESULT { - if (!this.IsError()) - return; - Marshal.ThrowExceptionForHR(this.hr); - } + public int hr; - public int Int => this.hr; - } + public HRESULT(int hr) => this.hr = hr; + + public static bool operator ==(HRESULT hrA, HRESULT hrB) => hrA.hr == hrB.hr; + + public static bool operator !=(HRESULT hrA, HRESULT hrB) => hrA.hr != hrB.hr; + + public override bool Equals(object oCompare) => oCompare is HRESULT hresult && this.hr == hresult.hr; + + public override int GetHashCode() => this.hr; + + public bool IsError() => this.hr < 0; + + public bool IsSuccess() => this.hr >= 0; + + public void HandleError() + { + if (!this.IsError()) + return; + Marshal.ThrowExceptionForHR(this.hr); + } + + public int Int => this.hr; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HwndHostWindow.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HwndHostWindow.cs index 7dc67dd..b7b502f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HwndHostWindow.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/HwndHostWindow.cs @@ -11,106 +11,106 @@ using System; namespace Microsoft.Iris.Render.Internal { - internal sealed class HwndHostWindow : - RenderObject, - IHwndHostWindow, - IDisposable, - IHwndHostWindowCallback, - IRenderHandleOwner - { - private RemoteHwndHostWindow m_remoteWindow; - private ColorF m_clrBackground; - private HWND m_hwnd; - private Point m_ptClientPosition; - private Size m_sizeWindow; - private bool m_fVisible; - private EventHandler m_eventHandleChanged; - - public HwndHostWindow(RenderWindow winParent) + internal sealed class HwndHostWindow : + RenderObject, + IHwndHostWindow, + IDisposable, + IHwndHostWindowCallback, + IRenderHandleOwner { - ProtocolSplashDesktopNt ntDesktopProtocol = winParent.Session.NtDesktopProtocol; - this.m_remoteWindow = ntDesktopProtocol.BuildRemoteHwndHostWindow((IRenderHandleOwner) this, winParent.RemoteStub, ntDesktopProtocol.LocalHwndHostWindowCallbackHandle); - this.m_clrBackground = new ColorF((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); + private RemoteHwndHostWindow m_remoteWindow; + private ColorF m_clrBackground; + private HWND m_hwnd; + private Point m_ptClientPosition; + private Size m_sizeWindow; + private bool m_fVisible; + private EventHandler m_eventHandleChanged; + + public HwndHostWindow(RenderWindow winParent) + { + ProtocolSplashDesktopNt ntDesktopProtocol = winParent.Session.NtDesktopProtocol; + this.m_remoteWindow = ntDesktopProtocol.BuildRemoteHwndHostWindow((IRenderHandleOwner)this, winParent.RemoteStub, ntDesktopProtocol.LocalHwndHostWindowCallbackHandle); + this.m_clrBackground = new ColorF((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue); + } + + protected override void Dispose(bool fInDispose) + { + if (fInDispose && this.m_remoteWindow != null) + { + this.m_remoteWindow.Dispose(); + this.m_remoteWindow = (RemoteHwndHostWindow)null; + } + base.Dispose(fInDispose); + } + + ColorF IHwndHostWindow.BackgroundColor + { + get => this.m_clrBackground; + set + { + if (!(this.m_clrBackground != value)) + return; + this.m_clrBackground = value; + this.m_remoteWindow.SendSetBackgroundColor(value); + } + } + + Point IHwndHostWindow.ClientPosition + { + get => this.m_ptClientPosition; + set + { + if (!(this.m_ptClientPosition != value)) + return; + this.m_ptClientPosition = value; + this.m_remoteWindow.SendSetPosition(value); + } + } + + IntPtr IHwndHostWindow.Hwnd => this.m_hwnd.h; + + bool IHwndHostWindow.Visible + { + get => this.m_fVisible; + set + { + if (this.m_fVisible == value) + return; + this.m_fVisible = value; + this.m_remoteWindow.SendSetVisible(value); + } + } + + Size IHwndHostWindow.WindowSize + { + get => this.m_sizeWindow; + set + { + if (!(this.m_sizeWindow != value)) + return; + this.m_sizeWindow = value; + this.m_remoteWindow.SendSetSize(value); + } + } + + event EventHandler IHwndHostWindow.OnHandleChanged + { + add => this.m_eventHandleChanged += value; + remove => this.m_eventHandleChanged -= value; + } + + void IHwndHostWindowCallback.OnHandleChanged( + RENDERHANDLE target, + HWND hWnd) + { + this.m_hwnd = hWnd; + if (this.m_eventHandleChanged == null) + return; + this.m_eventHandleChanged((object)this, EventArgs.Empty); + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteWindow.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteWindow = (RemoteHwndHostWindow)null; } - - protected override void Dispose(bool fInDispose) - { - if (fInDispose && this.m_remoteWindow != null) - { - this.m_remoteWindow.Dispose(); - this.m_remoteWindow = (RemoteHwndHostWindow) null; - } - base.Dispose(fInDispose); - } - - ColorF IHwndHostWindow.BackgroundColor - { - get => this.m_clrBackground; - set - { - if (!(this.m_clrBackground != value)) - return; - this.m_clrBackground = value; - this.m_remoteWindow.SendSetBackgroundColor(value); - } - } - - Point IHwndHostWindow.ClientPosition - { - get => this.m_ptClientPosition; - set - { - if (!(this.m_ptClientPosition != value)) - return; - this.m_ptClientPosition = value; - this.m_remoteWindow.SendSetPosition(value); - } - } - - IntPtr IHwndHostWindow.Hwnd => this.m_hwnd.h; - - bool IHwndHostWindow.Visible - { - get => this.m_fVisible; - set - { - if (this.m_fVisible == value) - return; - this.m_fVisible = value; - this.m_remoteWindow.SendSetVisible(value); - } - } - - Size IHwndHostWindow.WindowSize - { - get => this.m_sizeWindow; - set - { - if (!(this.m_sizeWindow != value)) - return; - this.m_sizeWindow = value; - this.m_remoteWindow.SendSetSize(value); - } - } - - event EventHandler IHwndHostWindow.OnHandleChanged - { - add => this.m_eventHandleChanged += value; - remove => this.m_eventHandleChanged -= value; - } - - void IHwndHostWindowCallback.OnHandleChanged( - RENDERHANDLE target, - HWND hWnd) - { - this.m_hwnd = hWnd; - if (this.m_eventHandleChanged == null) - return; - this.m_eventHandleChanged((object) this, EventArgs.Empty); - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteWindow.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteWindow = (RemoteHwndHostWindow) null; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/InputSystem.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/InputSystem.cs index 05eb399..da522aa 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/InputSystem.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/InputSystem.cs @@ -12,235 +12,235 @@ using System; namespace Microsoft.Iris.Render.Internal { - internal sealed class InputSystem : RenderObject, IRenderHandleOwner, IInputSystem, IInputCallback - { - private const uint NG_KEYBOARD = 1; - private const uint NG_HIDCOMMAND = 2; - private const uint NG_APPCOMMAND = 3; - private const uint NG_WINDOWINPUT = 4; - private const uint NG_DRAGINPUT = 5; - private static ushort[] s_ByteOrder_KeyboardCommandMessage; - private static ushort[] s_ByteOrder_RemoteCallbackMessage; - private static ushort[] s_ByteOrder_HIDCommandMessage; - private static ushort[] s_ByteOrder_AppCommandMessage; - private static ushort[] s_ByteOrder_WindowInputCallbackMessage; - private static ushort[] s_ByteOrder_DragInputCallbackMessage; - private RenderSession m_session; - private RemoteInputRouter m_remoteInputRouter; - private IRawInputCallbacks m_inputHandlers; - private InputHandlerFlags m_maskInputHandlers; - - internal InputSystem(RenderSession session, RenderWindow window) + internal sealed class InputSystem : RenderObject, IRenderHandleOwner, IInputSystem, IInputCallback { - this.m_session = session; - this.Initialize(window); + private const uint NG_KEYBOARD = 1; + private const uint NG_HIDCOMMAND = 2; + private const uint NG_APPCOMMAND = 3; + private const uint NG_WINDOWINPUT = 4; + private const uint NG_DRAGINPUT = 5; + private static ushort[] s_ByteOrder_KeyboardCommandMessage; + private static ushort[] s_ByteOrder_RemoteCallbackMessage; + private static ushort[] s_ByteOrder_HIDCommandMessage; + private static ushort[] s_ByteOrder_AppCommandMessage; + private static ushort[] s_ByteOrder_WindowInputCallbackMessage; + private static ushort[] s_ByteOrder_DragInputCallbackMessage; + private RenderSession m_session; + private RemoteInputRouter m_remoteInputRouter; + private IRawInputCallbacks m_inputHandlers; + private InputHandlerFlags m_maskInputHandlers; + + internal InputSystem(RenderSession session, RenderWindow window) + { + this.m_session = session; + this.Initialize(window); + } + + internal void Initialize(RenderWindow window) => this.m_remoteInputRouter = this.m_session.BuildRemoteInputRouter(this, window); + + protected override void Dispose(bool fInDispose) + { + try + { + if (fInDispose && this.m_remoteInputRouter != null) + this.m_remoteInputRouter.Dispose(); + this.m_remoteInputRouter = (RemoteInputRouter)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteInputRouter.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteInputRouter = (RemoteInputRouter)null; + + unsafe void IInputCallback.OnInput(RENDERHANDLE target, Message* inputInfoPtr) + { + InputSystem.RemoteCallbackMessage* remoteCallbackMessagePtr = (InputSystem.RemoteCallbackMessage*)inputInfoPtr; + if (this.m_session.IsForeignByteOrderOnWindowing) + MarshalHelper.SwapByteOrder((byte*)remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_RemoteCallbackMessage, typeof(InputSystem.RemoteCallbackMessage), 0, 0); + switch (remoteCallbackMessagePtr->ownerMessage) + { + case 1: + if (this.m_session.IsForeignByteOrderOnWindowing) + MarshalHelper.SwapByteOrder((byte*)remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_KeyboardCommandMessage, typeof(InputSystem.KeyboardCommandMessage), sizeof(InputSystem.RemoteCallbackMessage), 0); + this.HandleKeyboardInput((InputSystem.KeyboardCommandMessage*)remoteCallbackMessagePtr); + break; + case 2: + if (this.m_session.IsForeignByteOrderOnWindowing) + MarshalHelper.SwapByteOrder((byte*)remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_HIDCommandMessage, typeof(InputSystem.HIDCommandMessage), sizeof(InputSystem.RemoteCallbackMessage), 0); + this.HandleHIDCommandInput((InputSystem.HIDCommandMessage*)remoteCallbackMessagePtr); + break; + case 3: + if (this.m_session.IsForeignByteOrderOnWindowing) + MarshalHelper.SwapByteOrder((byte*)remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_AppCommandMessage, typeof(InputSystem.AppCommandMessage), sizeof(InputSystem.RemoteCallbackMessage), 0); + this.HandleAppCommandInput((InputSystem.AppCommandMessage*)remoteCallbackMessagePtr); + break; + case 4: + if (this.m_session.IsForeignByteOrderOnWindowing) + MarshalHelper.SwapByteOrder((byte*)remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_WindowInputCallbackMessage, typeof(InputSystem.WindowInputCallbackMessage), sizeof(InputSystem.RemoteCallbackMessage), 0); + this.HandleWindowInput((InputSystem.WindowInputCallbackMessage*)remoteCallbackMessagePtr); + break; + case 5: + if (this.m_session.IsForeignByteOrderOnWindowing) + MarshalHelper.SwapByteOrder((byte*)remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_DragInputCallbackMessage, typeof(InputSystem.DragInputCallbackMessage), sizeof(InputSystem.RemoteCallbackMessage), 0); + this.HandleDragInput((InputSystem.DragInputCallbackMessage*)remoteCallbackMessagePtr); + break; + default: + Debug2.Throw(false, "unexpected input type in IInputCallback.OnInput"); + break; + } + } + + public void RegisterRawInputCallbacks(IRawInputCallbacks handlers) + { + Debug2.Validate(handlers != null, typeof(ArgumentException), "must provide valid IRawInputCallbacks callback interface"); + Debug2.Validate(this.m_inputHandlers == null, typeof(InvalidOperationException), "Not allowed to register twice on one session"); + this.m_inputHandlers = handlers; + this.m_maskInputHandlers = this.m_inputHandlers.InputHandlerMask; + Debug2.Validate(this.m_maskInputHandlers != InputHandlerFlags.None, typeof(ArgumentException), "must register interest for at least one input type"); + } + + public void UnregisterRawInputCallbacks() + { + this.m_inputHandlers = (IRawInputCallbacks)null; + this.m_maskInputHandlers = InputHandlerFlags.None; + } + + private unsafe void HandleKeyboardInput(InputSystem.KeyboardCommandMessage* pmsg) + { + if (!this.IsRegisteredForInputType(InputHandlerFlags.Keyboard)) + return; + RawKeyboardData args = new RawKeyboardData((Keys)(ushort)pmsg->vk, pmsg->ScanCode, (uint)pmsg->repCount, pmsg->flags, pmsg->IsRemote != 0 ? InputDeviceType.Other : InputDeviceType.Keyboard); + this.m_inputHandlers.HandleRawKeyboardInput(pmsg->uiMsg, (InputModifiers)pmsg->stateValue, ref args); + } + + private unsafe void HandleHIDCommandInput(InputSystem.HIDCommandMessage* pmsg) + { + if (!this.IsRegisteredForInputType(InputHandlerFlags.Hid)) + return; + RawHidData args = new RawHidData(pmsg->usage, pmsg->usagePage, pmsg->wValue != 0U ? KeyAction.Down : KeyAction.Up, pmsg->IsRemote != 0 ? InputDeviceType.Other : InputDeviceType.Keyboard); + this.m_inputHandlers.HandleRawHidInput(ref args); + } + + private unsafe void HandleAppCommandInput(InputSystem.AppCommandMessage* pmsg) + { + if (!this.IsRegisteredForInputType(InputHandlerFlags.AppCommand)) + return; + RawHidData args1 = new RawHidData(pmsg->AppCommand, 0U, KeyAction.Down, InputDeviceType.Other); + this.m_inputHandlers.HandleAppCommand(ref args1); + RawHidData args2 = new RawHidData(pmsg->AppCommand, 0U, KeyAction.Up, InputDeviceType.Other); + this.m_inputHandlers.HandleAppCommand(ref args2); + } + + private unsafe void HandleWindowInput(InputSystem.WindowInputCallbackMessage* msg) + { + if (!this.IsRegisteredForInputType(InputHandlerFlags.Mouse)) + return; + RawMouseData args = new RawMouseData(this.m_session.TryGetHandleOwner(msg->subjectValue), this.m_session.TryGetHandleOwner(msg->naturalValue), msg->positionXOffset, msg->positionYOffset, msg->naturalXOffset, msg->naturalYOffset, msg->physicalXOffset, msg->physicalYOffset, msg->screenXOffset, msg->screenYOffset, (MouseButtons)msg->buttonFlag, (int)msg->wheelDelta); + this.m_inputHandlers.HandleRawMouseInput(msg->messageValue, (InputModifiers)msg->modifiersValue, ref args); + } + + private unsafe void HandleDragInput(InputSystem.DragInputCallbackMessage* msg) + { + if (!this.IsRegisteredForInputType(InputHandlerFlags.Drag)) + return; + RawDragData args = new RawDragData(this.m_session.TryGetHandleOwner(msg->subjectValue), msg->positionXOffset, msg->positionYOffset, msg->pDataStream); + this.m_inputHandlers.HandleRawDragInput(msg->messageValue, (InputModifiers)msg->dragModifiers, ref args); + } + + private bool IsRegisteredForInputType(InputHandlerFlags flag) => this.m_inputHandlers != null && (this.m_maskInputHandlers & flag) == flag; + + protected override void Invariant() => Debug2.Validate(this.m_session != null, typeof(InvalidOperationException), this.GetType().ToString()); + + private struct RemoteCallbackMessage + { + public uint sizeCount; + public int msgValue; + public uint objectSubjectID; + public uint ownerCookie; + public uint ownerMessage; + } + + private struct KeyboardCommandMessage + { + public uint sizeCount; + public int msgValue; + public uint objectSubjectID; + public uint ownerHandle; + public uint codeValue; + public int IsRemote; + public int ScanCode; + public int vk; + public uint uiMsg; + public int repCount; + public uint stateValue; + public ushort flags; + } + + private struct HIDCommandMessage + { + public uint sizeCount; + public int msgValue; + public uint objectSubjectID; + public uint ownerHandle; + public uint codeValue; + public int IsRemote; + public uint usagePage; + public uint usage; + public uint wValue; + } + + private struct AppCommandMessage + { + public uint sizeCount; + public int msgValue; + public uint objectSubjectID; + public uint ownerHandle; + public uint codeValue; + public uint AppCommand; + public uint deviceValue; + public uint keysValue; + } + + private struct WindowInputCallbackMessage + { + public uint sizeCount; + public int msgValue; + public uint objectSubjectID; + public uint ownerCookie; + public uint ownerMessage; + public uint messageValue; + public uint subjectValue; + public int positionXOffset; + public int positionYOffset; + public uint naturalValue; + public int naturalXOffset; + public int naturalYOffset; + public int physicalXOffset; + public int physicalYOffset; + public int screenXOffset; + public int screenYOffset; + public uint modifiersValue; + public uint buttonFlag; + public short wheelDelta; + } + + private struct DragInputCallbackMessage + { + public uint sizeCount; + public int msgValue; + public uint objectSubjectID; + public uint ownerCookie; + public uint ownerMessage; + public uint messageValue; + public uint subjectValue; + public uint dragModifiers; + public int positionXOffset; + public int positionYOffset; + public IntPtr pDataStream; + } } - - internal void Initialize(RenderWindow window) => this.m_remoteInputRouter = this.m_session.BuildRemoteInputRouter(this, window); - - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose && this.m_remoteInputRouter != null) - this.m_remoteInputRouter.Dispose(); - this.m_remoteInputRouter = (RemoteInputRouter) null; - } - finally - { - base.Dispose(fInDispose); - } - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteInputRouter.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteInputRouter = (RemoteInputRouter) null; - - unsafe void IInputCallback.OnInput(RENDERHANDLE target, Message* inputInfoPtr) - { - InputSystem.RemoteCallbackMessage* remoteCallbackMessagePtr = (InputSystem.RemoteCallbackMessage*) inputInfoPtr; - if (this.m_session.IsForeignByteOrderOnWindowing) - MarshalHelper.SwapByteOrder((byte*) remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_RemoteCallbackMessage, typeof (InputSystem.RemoteCallbackMessage), 0, 0); - switch (remoteCallbackMessagePtr->ownerMessage) - { - case 1: - if (this.m_session.IsForeignByteOrderOnWindowing) - MarshalHelper.SwapByteOrder((byte*) remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_KeyboardCommandMessage, typeof (InputSystem.KeyboardCommandMessage), sizeof (InputSystem.RemoteCallbackMessage), 0); - this.HandleKeyboardInput((InputSystem.KeyboardCommandMessage*) remoteCallbackMessagePtr); - break; - case 2: - if (this.m_session.IsForeignByteOrderOnWindowing) - MarshalHelper.SwapByteOrder((byte*) remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_HIDCommandMessage, typeof (InputSystem.HIDCommandMessage), sizeof (InputSystem.RemoteCallbackMessage), 0); - this.HandleHIDCommandInput((InputSystem.HIDCommandMessage*) remoteCallbackMessagePtr); - break; - case 3: - if (this.m_session.IsForeignByteOrderOnWindowing) - MarshalHelper.SwapByteOrder((byte*) remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_AppCommandMessage, typeof (InputSystem.AppCommandMessage), sizeof (InputSystem.RemoteCallbackMessage), 0); - this.HandleAppCommandInput((InputSystem.AppCommandMessage*) remoteCallbackMessagePtr); - break; - case 4: - if (this.m_session.IsForeignByteOrderOnWindowing) - MarshalHelper.SwapByteOrder((byte*) remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_WindowInputCallbackMessage, typeof (InputSystem.WindowInputCallbackMessage), sizeof (InputSystem.RemoteCallbackMessage), 0); - this.HandleWindowInput((InputSystem.WindowInputCallbackMessage*) remoteCallbackMessagePtr); - break; - case 5: - if (this.m_session.IsForeignByteOrderOnWindowing) - MarshalHelper.SwapByteOrder((byte*) remoteCallbackMessagePtr, ref InputSystem.s_ByteOrder_DragInputCallbackMessage, typeof (InputSystem.DragInputCallbackMessage), sizeof (InputSystem.RemoteCallbackMessage), 0); - this.HandleDragInput((InputSystem.DragInputCallbackMessage*) remoteCallbackMessagePtr); - break; - default: - Debug2.Throw(false, "unexpected input type in IInputCallback.OnInput"); - break; - } - } - - public void RegisterRawInputCallbacks(IRawInputCallbacks handlers) - { - Debug2.Validate(handlers != null, typeof (ArgumentException), "must provide valid IRawInputCallbacks callback interface"); - Debug2.Validate(this.m_inputHandlers == null, typeof (InvalidOperationException), "Not allowed to register twice on one session"); - this.m_inputHandlers = handlers; - this.m_maskInputHandlers = this.m_inputHandlers.InputHandlerMask; - Debug2.Validate(this.m_maskInputHandlers != InputHandlerFlags.None, typeof (ArgumentException), "must register interest for at least one input type"); - } - - public void UnregisterRawInputCallbacks() - { - this.m_inputHandlers = (IRawInputCallbacks) null; - this.m_maskInputHandlers = InputHandlerFlags.None; - } - - private unsafe void HandleKeyboardInput(InputSystem.KeyboardCommandMessage* pmsg) - { - if (!this.IsRegisteredForInputType(InputHandlerFlags.Keyboard)) - return; - RawKeyboardData args = new RawKeyboardData((Keys) (ushort) pmsg->vk, pmsg->ScanCode, (uint) pmsg->repCount, pmsg->flags, pmsg->IsRemote != 0 ? InputDeviceType.Other : InputDeviceType.Keyboard); - this.m_inputHandlers.HandleRawKeyboardInput(pmsg->uiMsg, (InputModifiers) pmsg->stateValue, ref args); - } - - private unsafe void HandleHIDCommandInput(InputSystem.HIDCommandMessage* pmsg) - { - if (!this.IsRegisteredForInputType(InputHandlerFlags.Hid)) - return; - RawHidData args = new RawHidData(pmsg->usage, pmsg->usagePage, pmsg->wValue != 0U ? KeyAction.Down : KeyAction.Up, pmsg->IsRemote != 0 ? InputDeviceType.Other : InputDeviceType.Keyboard); - this.m_inputHandlers.HandleRawHidInput(ref args); - } - - private unsafe void HandleAppCommandInput(InputSystem.AppCommandMessage* pmsg) - { - if (!this.IsRegisteredForInputType(InputHandlerFlags.AppCommand)) - return; - RawHidData args1 = new RawHidData(pmsg->AppCommand, 0U, KeyAction.Down, InputDeviceType.Other); - this.m_inputHandlers.HandleAppCommand(ref args1); - RawHidData args2 = new RawHidData(pmsg->AppCommand, 0U, KeyAction.Up, InputDeviceType.Other); - this.m_inputHandlers.HandleAppCommand(ref args2); - } - - private unsafe void HandleWindowInput(InputSystem.WindowInputCallbackMessage* msg) - { - if (!this.IsRegisteredForInputType(InputHandlerFlags.Mouse)) - return; - RawMouseData args = new RawMouseData(this.m_session.TryGetHandleOwner(msg->subjectValue), this.m_session.TryGetHandleOwner(msg->naturalValue), msg->positionXOffset, msg->positionYOffset, msg->naturalXOffset, msg->naturalYOffset, msg->physicalXOffset, msg->physicalYOffset, msg->screenXOffset, msg->screenYOffset, (MouseButtons) msg->buttonFlag, (int) msg->wheelDelta); - this.m_inputHandlers.HandleRawMouseInput(msg->messageValue, (InputModifiers) msg->modifiersValue, ref args); - } - - private unsafe void HandleDragInput(InputSystem.DragInputCallbackMessage* msg) - { - if (!this.IsRegisteredForInputType(InputHandlerFlags.Drag)) - return; - RawDragData args = new RawDragData(this.m_session.TryGetHandleOwner(msg->subjectValue), msg->positionXOffset, msg->positionYOffset, msg->pDataStream); - this.m_inputHandlers.HandleRawDragInput(msg->messageValue, (InputModifiers) msg->dragModifiers, ref args); - } - - private bool IsRegisteredForInputType(InputHandlerFlags flag) => this.m_inputHandlers != null && (this.m_maskInputHandlers & flag) == flag; - - protected override void Invariant() => Debug2.Validate(this.m_session != null, typeof (InvalidOperationException), this.GetType().ToString()); - - private struct RemoteCallbackMessage - { - public uint sizeCount; - public int msgValue; - public uint objectSubjectID; - public uint ownerCookie; - public uint ownerMessage; - } - - private struct KeyboardCommandMessage - { - public uint sizeCount; - public int msgValue; - public uint objectSubjectID; - public uint ownerHandle; - public uint codeValue; - public int IsRemote; - public int ScanCode; - public int vk; - public uint uiMsg; - public int repCount; - public uint stateValue; - public ushort flags; - } - - private struct HIDCommandMessage - { - public uint sizeCount; - public int msgValue; - public uint objectSubjectID; - public uint ownerHandle; - public uint codeValue; - public int IsRemote; - public uint usagePage; - public uint usage; - public uint wValue; - } - - private struct AppCommandMessage - { - public uint sizeCount; - public int msgValue; - public uint objectSubjectID; - public uint ownerHandle; - public uint codeValue; - public uint AppCommand; - public uint deviceValue; - public uint keysValue; - } - - private struct WindowInputCallbackMessage - { - public uint sizeCount; - public int msgValue; - public uint objectSubjectID; - public uint ownerCookie; - public uint ownerMessage; - public uint messageValue; - public uint subjectValue; - public int positionXOffset; - public int positionYOffset; - public uint naturalValue; - public int naturalXOffset; - public int naturalYOffset; - public int physicalXOffset; - public int physicalYOffset; - public int screenXOffset; - public int screenYOffset; - public uint modifiersValue; - public uint buttonFlag; - public short wheelDelta; - } - - private struct DragInputCallbackMessage - { - public uint sizeCount; - public int msgValue; - public uint objectSubjectID; - public uint ownerCookie; - public uint ownerMessage; - public uint messageValue; - public uint subjectValue; - public uint dragModifiers; - public int positionXOffset; - public int positionYOffset; - public IntPtr pDataStream; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/KeyAllocator.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/KeyAllocator.cs index 0cfb22b..36c47d1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/KeyAllocator.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/KeyAllocator.cs @@ -8,10 +8,10 @@ using System.Threading; namespace Microsoft.Iris.Render.Internal { - internal class KeyAllocator - { - private static int s_idxKeyGen; + internal class KeyAllocator + { + private static int s_idxKeyGen; - internal static uint ReserveSlot() => (uint) Interlocked.Increment(ref KeyAllocator.s_idxKeyGen); - } + internal static uint ReserveSlot() => (uint)Interlocked.Increment(ref KeyAllocator.s_idxKeyGen); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Math2.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Math2.cs index f2b0524..1156e4e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Math2.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Math2.cs @@ -6,38 +6,38 @@ namespace Microsoft.Iris.Render.Internal { - internal class Math2 - { - public static int FindPowerOf2(int nValue) => Math2.FindPowerOf2(nValue, 1); - - public static int FindPowerOf2(int nValue, int nStart) + internal class Math2 { - int num = nStart; - while (num < nValue) - num *= 2; - return num; - } + public static int FindPowerOf2(int nValue) => Math2.FindPowerOf2(nValue, 1); - public static int RoundUp(float flValue) => (int) ((double) flValue + 0.5); + public static int FindPowerOf2(int nValue, int nStart) + { + int num = nStart; + while (num < nValue) + num *= 2; + return num; + } - public static int Clamp(int nValue, int nMin, int nMax) - { - if (nValue < nMin) - return nMin; - return nValue > nMax ? nMax : nValue; - } + public static int RoundUp(float flValue) => (int)((double)flValue + 0.5); - public static float Clamp(float flValue, float flMin, float flMax) - { - if ((double) flValue < (double) flMin) - return flMin; - return (double) flValue > (double) flMax ? flMax : flValue; - } + public static int Clamp(int nValue, int nMin, int nMax) + { + if (nValue < nMin) + return nMin; + return nValue > nMax ? nMax : nValue; + } - public static bool WithinEpsilon(float flValue1, float flValue2) - { - float num = flValue1 - flValue2; - return -9.99999974737875E-06 <= (double) num && (double) num <= 9.99999974737875E-06; + public static float Clamp(float flValue, float flMin, float flMax) + { + if ((double)flValue < (double)flMin) + return flMin; + return (double)flValue > (double)flMax ? flMax : flValue; + } + + public static bool WithinEpsilon(float flValue1, float flValue2) + { + float num = flValue1 - flValue2; + return -9.99999974737875E-06 <= (double)num && (double)num <= 9.99999974737875E-06; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/ObjectTracker.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/ObjectTracker.cs index e7e5b6e..4172a42 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/ObjectTracker.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/ObjectTracker.cs @@ -10,91 +10,91 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Internal { - internal sealed class ObjectTracker : TrackerBase - { - private ObjectTracker.ThreadMode m_nMode; - private int m_idxNextIdentity; - private GCHandle m_hndOwner; - - public ObjectTracker(RenderSession session, object objOwner) - : this(session, ObjectTracker.ThreadMode.Private, objOwner) + internal sealed class ObjectTracker : TrackerBase { + private ObjectTracker.ThreadMode m_nMode; + private int m_idxNextIdentity; + private GCHandle m_hndOwner; + + public ObjectTracker(RenderSession session, object objOwner) + : this(session, ObjectTracker.ThreadMode.Private, objOwner) + { + } + + public ObjectTracker(RenderSession session, ObjectTracker.ThreadMode nMode, object objOwner) + { + Debug2.Validate(session != null || nMode != ObjectTracker.ThreadMode.Private, typeof(ArgumentException), "must specify a session for private trackers"); + Debug2.Validate(objOwner != null || nMode == ObjectTracker.ThreadMode.Master, typeof(ArgumentException), "must specify an owner (except mater tracker)"); + if (nMode == ObjectTracker.ThreadMode.Private) + ObjectTrackerGroup.RegisterChildTracker(this); + this.m_nMode = nMode; + this.m_idxNextIdentity = 1; + this.m_hndOwner = GCHandle.Alloc(objOwner, GCHandleType.Weak); + } + + protected override void Dispose(bool fInDispose) + { + base.Dispose(fInDispose); + if (this.m_hndOwner.IsAllocated) + { + this.m_hndOwner.Free(); + this.m_hndOwner = new GCHandle(); + } + int num = fInDispose ? 1 : 0; + } + + public object Owner + { + get + { + object obj = (object)null; + if (this.m_hndOwner.IsAllocated) + obj = this.m_hndOwner.Target; + return obj; + } + } + + public int AddObject(object o) + { + int num; + lock (this) + { + num = this.m_idxNextIdentity++; + this.AddObject((object)num, o); + } + return num; + } + + public void RemoveObject(int nIdentity) => this.RemoveKey((object)nIdentity); + + public object Find(int nIdentity) => this.Find((object)nIdentity); + + protected override void SetupObjectTable() + { + lock (this) + base.SetupObjectTable(); + } + + private void DoCleanup() + { + if (this.Owner == null) + this.Dispose(); + else + this.RemoveDeadObjects(); + } + + private void CleanupTimer(object sender, EventArgs args) + { + this.DoCleanup(); + foreach (ObjectTracker liveObject in this.LiveObjects) + liveObject.DoCleanup(); + } + + public enum ThreadMode + { + Private, + Shared, + Master, + } } - - public ObjectTracker(RenderSession session, ObjectTracker.ThreadMode nMode, object objOwner) - { - Debug2.Validate(session != null || nMode != ObjectTracker.ThreadMode.Private, typeof (ArgumentException), "must specify a session for private trackers"); - Debug2.Validate(objOwner != null || nMode == ObjectTracker.ThreadMode.Master, typeof (ArgumentException), "must specify an owner (except mater tracker)"); - if (nMode == ObjectTracker.ThreadMode.Private) - ObjectTrackerGroup.RegisterChildTracker(this); - this.m_nMode = nMode; - this.m_idxNextIdentity = 1; - this.m_hndOwner = GCHandle.Alloc(objOwner, GCHandleType.Weak); - } - - protected override void Dispose(bool fInDispose) - { - base.Dispose(fInDispose); - if (this.m_hndOwner.IsAllocated) - { - this.m_hndOwner.Free(); - this.m_hndOwner = new GCHandle(); - } - int num = fInDispose ? 1 : 0; - } - - public object Owner - { - get - { - object obj = (object) null; - if (this.m_hndOwner.IsAllocated) - obj = this.m_hndOwner.Target; - return obj; - } - } - - public int AddObject(object o) - { - int num; - lock (this) - { - num = this.m_idxNextIdentity++; - this.AddObject((object) num, o); - } - return num; - } - - public void RemoveObject(int nIdentity) => this.RemoveKey((object) nIdentity); - - public object Find(int nIdentity) => this.Find((object) nIdentity); - - protected override void SetupObjectTable() - { - lock (this) - base.SetupObjectTable(); - } - - private void DoCleanup() - { - if (this.Owner == null) - this.Dispose(); - else - this.RemoveDeadObjects(); - } - - private void CleanupTimer(object sender, EventArgs args) - { - this.DoCleanup(); - foreach (ObjectTracker liveObject in this.LiveObjects) - liveObject.DoCleanup(); - } - - public enum ThreadMode - { - Private, - Shared, - Master, - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/ObjectTrackerGroup.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/ObjectTrackerGroup.cs index bea810b..13b6b03 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/ObjectTrackerGroup.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/ObjectTrackerGroup.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render.Internal { - internal static class ObjectTrackerGroup - { - private static ObjectTracker s_objectTrackerGroup = new ObjectTracker((RenderSession) null, ObjectTracker.ThreadMode.Master, (object) null); + internal static class ObjectTrackerGroup + { + private static ObjectTracker s_objectTrackerGroup = new ObjectTracker((RenderSession)null, ObjectTracker.ThreadMode.Master, (object)null); - internal static void RegisterChildTracker(ObjectTracker trackerToAdd) => ObjectTrackerGroup.s_objectTrackerGroup.AddObject((object) trackerToAdd); - } + internal static void RegisterChildTracker(ObjectTracker trackerToAdd) => ObjectTrackerGroup.s_objectTrackerGroup.AddObject((object)trackerToAdd); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderCaps.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderCaps.cs index 7f5cbb8..1ee5022 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderCaps.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderCaps.cs @@ -11,85 +11,85 @@ using System; namespace Microsoft.Iris.Render.Internal { - internal class RenderCaps : RenderObject, IRenderHandleOwner, IRenderCapsCallback - { - private RemoteRenderCaps m_remoteObject; - private Vector m_graphicsCapsList; - private Vector m_soundCapsList; - private bool m_hasValidCaps; - private bool m_capsPending; - private uint m_currentRequestId; - - internal RenderCaps(RenderSession ownerSession) + internal class RenderCaps : RenderObject, IRenderHandleOwner, IRenderCapsCallback { - this.m_hasValidCaps = false; - this.m_capsPending = false; - this.m_currentRequestId = 0U; - this.m_graphicsCapsList = new Vector(); - this.m_soundCapsList = new Vector(); - this.m_remoteObject = ownerSession.RenderingProtocol.BuildRemoteRenderCaps((IRenderHandleOwner) this, ownerSession.RenderingProtocol.LocalRenderCapsCallbackHandle); + private RemoteRenderCaps m_remoteObject; + private Vector m_graphicsCapsList; + private Vector m_soundCapsList; + private bool m_hasValidCaps; + private bool m_capsPending; + private uint m_currentRequestId; + + internal RenderCaps(RenderSession ownerSession) + { + this.m_hasValidCaps = false; + this.m_capsPending = false; + this.m_currentRequestId = 0U; + this.m_graphicsCapsList = new Vector(); + this.m_soundCapsList = new Vector(); + this.m_remoteObject = ownerSession.RenderingProtocol.BuildRemoteRenderCaps((IRenderHandleOwner)this, ownerSession.RenderingProtocol.LocalRenderCapsCallbackHandle); + } + + internal bool HasValidCaps => this.m_hasValidCaps; + + internal Vector Graphics => this.m_graphicsCapsList; + + internal Vector Sound => this.m_soundCapsList; + + internal void RequestCaps() + { + if (this.m_capsPending) + return; + ++this.m_currentRequestId; + this.m_remoteObject.SendCheckCaps(this.m_currentRequestId); + this.m_capsPending = true; + } + + internal event EventHandler CapsAvailable; + + protected void NotifyCapsAvailable() + { + if (this.CapsAvailable == null) + return; + this.CapsAvailable((object)this, EventArgs.Empty); + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteRenderCaps)null; + + void IRenderCapsCallback.OnBeginCapsCheck(RENDERHANDLE target, uint cookie) + { + this.m_graphicsCapsList.Clear(); + this.m_soundCapsList.Clear(); + this.m_hasValidCaps = false; + } + + void IRenderCapsCallback.OnEndCapsCheck(RENDERHANDLE target, uint cookie) + { + this.m_hasValidCaps = true; + this.m_capsPending = false; + this.NotifyCapsAvailable(); + } + + void IRenderCapsCallback.OnGraphicsCaps( + RENDERHANDLE target, + uint cookie, + GraphicsCaps caps) + { + if ((int)this.m_currentRequestId != (int)cookie) + return; + this.m_graphicsCapsList.Add(caps); + } + + void IRenderCapsCallback.OnSoundCaps( + RENDERHANDLE target, + uint cookie, + SoundCaps caps) + { + if ((int)this.m_currentRequestId != (int)cookie) + return; + this.m_soundCapsList.Add(caps); + } } - - internal bool HasValidCaps => this.m_hasValidCaps; - - internal Vector Graphics => this.m_graphicsCapsList; - - internal Vector Sound => this.m_soundCapsList; - - internal void RequestCaps() - { - if (this.m_capsPending) - return; - ++this.m_currentRequestId; - this.m_remoteObject.SendCheckCaps(this.m_currentRequestId); - this.m_capsPending = true; - } - - internal event EventHandler CapsAvailable; - - protected void NotifyCapsAvailable() - { - if (this.CapsAvailable == null) - return; - this.CapsAvailable((object) this, EventArgs.Empty); - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteRenderCaps) null; - - void IRenderCapsCallback.OnBeginCapsCheck(RENDERHANDLE target, uint cookie) - { - this.m_graphicsCapsList.Clear(); - this.m_soundCapsList.Clear(); - this.m_hasValidCaps = false; - } - - void IRenderCapsCallback.OnEndCapsCheck(RENDERHANDLE target, uint cookie) - { - this.m_hasValidCaps = true; - this.m_capsPending = false; - this.NotifyCapsAvailable(); - } - - void IRenderCapsCallback.OnGraphicsCaps( - RENDERHANDLE target, - uint cookie, - GraphicsCaps caps) - { - if ((int) this.m_currentRequestId != (int) cookie) - return; - this.m_graphicsCapsList.Add(caps); - } - - void IRenderCapsCallback.OnSoundCaps( - RENDERHANDLE target, - uint cookie, - SoundCaps caps) - { - if ((int) this.m_currentRequestId != (int) cookie) - return; - this.m_soundCapsList.Add(caps); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderDisplayMode.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderDisplayMode.cs index 823a52d..badbafb 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderDisplayMode.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderDisplayMode.cs @@ -8,30 +8,30 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Internal { - [ComVisible(false)] - internal struct RenderDisplayMode - { - public Size sizePhysicalPxl; - public Size sizeLogicalPxl; - public SurfaceFormat nFormat; - public int nRefreshRate; - private RenderDisplayMode.Flags m_nFlags; - - public bool Interlaced + [ComVisible(false)] + internal struct RenderDisplayMode { - get => Bits.TestFlag((uint) this.m_nFlags, 1U); - set - { - uint nFlags = (uint) this.m_nFlags; - Bits.ChangeFlag(ref nFlags, value, 1U); - this.m_nFlags = (RenderDisplayMode.Flags) nFlags; - } - } + public Size sizePhysicalPxl; + public Size sizeLogicalPxl; + public SurfaceFormat nFormat; + public int nRefreshRate; + private RenderDisplayMode.Flags m_nFlags; - [System.Flags] - public enum Flags : uint - { - Interlaced = 1, + public bool Interlaced + { + get => Bits.TestFlag((uint)this.m_nFlags, 1U); + set + { + uint nFlags = (uint)this.m_nFlags; + Bits.ChangeFlag(ref nFlags, value, 1U); + this.m_nFlags = (RenderDisplayMode.Flags)nFlags; + } + } + + [System.Flags] + public enum Flags : uint + { + Interlaced = 1, + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs index 8762913..d749039 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs @@ -12,256 +12,256 @@ using System.Collections; namespace Microsoft.Iris.Render.Internal { - internal class RenderEngine : RenderObject, IRenderEngine, IRenderObject, IDisposable - { - private static BitArray s_contexts; - private static uint s_contextIdSeed = 1; - private static uint s_maxContextId = 254; - private IrisEngineInfo m_engineInfo; - private RenderToken m_primaryToken; - private MessagingSession m_messagingSession; - private RenderSession m_renderSession; - private RenderCaps m_renderCaps; - private GraphicsDeviceType m_typeGraphics; - private SoundDeviceType m_typeSound; - private RenderWindow m_renderWindow; - private DisplayManager m_displayManager; - private InputSystem m_inputSystem; - private SoundDevice m_soundDevice; - private ContextID m_localContextId; - private ContextID m_engineContextId; - - static RenderEngine() => RenderEngine.s_contexts = new BitArray((int) RenderEngine.s_maxContextId + 1); - - internal RenderEngine(IrisEngineInfo engineInfo, IRenderHost renderHost) + internal class RenderEngine : RenderObject, IRenderEngine, IRenderObject, IDisposable { - Debug2.Validate(engineInfo != null, typeof (ArgumentNullException), nameof (engineInfo)); - Debug2.Validate(renderHost != null, typeof (ArgumentNullException), nameof (renderHost)); - this.m_engineInfo = engineInfo; - this.m_engineContextId = RenderEngine.AllocateContextId(); - this.m_localContextId = RenderEngine.AllocateContextId(); - this.m_primaryToken = new RenderToken((EngineInfo) engineInfo, this.m_localContextId, this.m_engineContextId, RENDERGROUP.NULL); - this.m_messagingSession = new MessagingSession(renderHost, this.m_primaryToken); - this.m_messagingSession.Connect(); - this.m_renderSession = new RenderSession(this); - this.m_renderCaps = new RenderCaps(this.m_renderSession); - this.m_renderCaps.RequestCaps(); - this.m_messagingSession.FlushBatch(); - while (!this.m_renderCaps.HasValidCaps) - MessagingSession.DoEvents(50U); - } + private static BitArray s_contexts; + private static uint s_contextIdSeed = 1; + private static uint s_maxContextId = 254; + private IrisEngineInfo m_engineInfo; + private RenderToken m_primaryToken; + private MessagingSession m_messagingSession; + private RenderSession m_renderSession; + private RenderCaps m_renderCaps; + private GraphicsDeviceType m_typeGraphics; + private SoundDeviceType m_typeSound; + private RenderWindow m_renderWindow; + private DisplayManager m_displayManager; + private InputSystem m_inputSystem; + private SoundDevice m_soundDevice; + private ContextID m_localContextId; + private ContextID m_engineContextId; - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + static RenderEngine() => RenderEngine.s_contexts = new BitArray((int)RenderEngine.s_maxContextId + 1); + + internal RenderEngine(IrisEngineInfo engineInfo, IRenderHost renderHost) { - this.m_renderSession.ReleaseSharedResources(); - if (this.m_renderWindow != null) - this.m_renderWindow.WindowCreatedEvent -= new EventHandler(this.OnRenderWindowCreated); - if (this.m_soundDevice != null) - this.m_soundDevice.Dispose(); - if (this.m_renderWindow != null) - this.m_renderWindow.Dispose(); - if (this.m_inputSystem != null) - this.m_inputSystem.Dispose(); - if (this.m_displayManager != null) - this.m_displayManager.Dispose(); - if (this.m_renderSession != null) - this.m_renderSession.Dispose(); - if (this.m_messagingSession != null) - { - if (this.m_messagingSession.IsConnected) - this.m_messagingSession.Disconnect(); - this.m_messagingSession.Dispose(); - } - RenderEngine.FreeContextId(this.m_localContextId); - RenderEngine.FreeContextId(this.m_engineContextId); + Debug2.Validate(engineInfo != null, typeof(ArgumentNullException), nameof(engineInfo)); + Debug2.Validate(renderHost != null, typeof(ArgumentNullException), nameof(renderHost)); + this.m_engineInfo = engineInfo; + this.m_engineContextId = RenderEngine.AllocateContextId(); + this.m_localContextId = RenderEngine.AllocateContextId(); + this.m_primaryToken = new RenderToken((EngineInfo)engineInfo, this.m_localContextId, this.m_engineContextId, RENDERGROUP.NULL); + this.m_messagingSession = new MessagingSession(renderHost, this.m_primaryToken); + this.m_messagingSession.Connect(); + this.m_renderSession = new RenderSession(this); + this.m_renderCaps = new RenderCaps(this.m_renderSession); + this.m_renderCaps.RequestCaps(); + this.m_messagingSession.FlushBatch(); + while (!this.m_renderCaps.HasValidCaps) + MessagingSession.DoEvents(50U); } - this.m_soundDevice = (SoundDevice) null; - this.m_displayManager = (DisplayManager) null; - this.m_renderWindow = (RenderWindow) null; - this.m_renderSession = (RenderSession) null; - this.m_messagingSession = (MessagingSession) null; - } - finally - { - base.Dispose(fInDispose); - } - } - void IRenderEngine.Initialize( - GraphicsDeviceType typeGraphics, - GraphicsRenderingQuality renderingQuality, - SoundDeviceType typeSound) - { - Debug2.Validate(this.m_messagingSession.IsConnected, typeof (InvalidOperationException), "Must be connected before attempting to initialize"); - Debug2.Validate(this.m_renderSession != null, typeof (ArgumentNullException), "Session must exist before calling Initialize"); - Debug2.Validate(this.IsGraphicsDeviceAvailable(typeGraphics, false), typeof (InvalidOperationException), "Graphics device type not available"); - Debug2.Validate(this.IsSoundDeviceAvailable(typeSound), typeof (InvalidOperationException), "Sound device type not available"); - this.m_renderSession.AssertOwningThread(); - this.m_typeGraphics = typeGraphics; - this.m_typeSound = typeSound; - this.m_displayManager = DisplayManager.CreateDisplayManager(this.m_renderSession, this, false); - this.m_renderWindow = new RenderWindow(this.m_renderSession, this.m_displayManager, typeGraphics, renderingQuality); - this.m_renderWindow.WindowCreatedEvent += new EventHandler(this.OnRenderWindowCreated); - this.m_renderSession.Initialize(); - this.m_inputSystem = new InputSystem(this.m_renderSession, this.m_renderWindow); - } - - private MessagingSession MessagingSession => this.m_messagingSession; - - IRenderSession IRenderEngine.Session => (IRenderSession) this.m_renderSession; - - internal RenderSession Session => this.m_renderSession; - - IRenderWindow IRenderEngine.Window => (IRenderWindow) this.m_renderWindow; - - internal RenderWindow Window => this.m_renderWindow; - - IDisplayManager IRenderEngine.DisplayManager => (IDisplayManager) this.m_displayManager; - - public DisplayManager DisplayManager => this.m_displayManager; - - public InputSystem InputSystem => this.m_inputSystem; - - internal SoundDevice SoundDevice => this.m_soundDevice; - - internal Vector GraphicsCaps => this.m_renderCaps.Graphics; - - internal Vector SoundCaps => this.m_renderCaps.Sound; - - private void DoEvents(uint nTimeoutInMsecs) - { - this.m_messagingSession.AssertOwningThread(); - MessagingSession.DoEvents(nTimeoutInMsecs); - } - - bool IRenderEngine.ProcessNativeEvents() - { - this.m_renderSession.AssertOwningThread(); - Win32Api.MSG msg; - EngineApi.WorkResult nResult; - EngineApi.SpPeekMessage(out msg, HWND.NULL, 0U, 0U, 1U, out nResult); - if (!Bits.TestFlag((uint) nResult, 2U)) - return Bits.TestFlag((uint) nResult, 1U); - if (this.m_renderWindow != null) - this.m_renderWindow.ForwardWindowMessage(ref msg); - Win32Api.TranslateMessage(ref msg); - Win32Api.DispatchMessage(ref msg); - return true; - } - - void IRenderEngine.WaitForWork(uint nTimeoutInMsecs) - { - this.m_renderSession.AssertOwningThread(); - EngineApi.SpWaitMessage(nTimeoutInMsecs, IntPtr.Zero); - } - - void IRenderEngine.InterThreadWake() => EngineApi.SpInvoke(this.m_localContextId, IntPtr.Zero, IntPtr.Zero, false); - - void IRenderEngine.FlushBatch() - { - this.m_renderSession.AssertOwningThread(); - this.m_messagingSession.FlushBatch(); - } - - bool IRenderEngine.IsGraphicsDeviceAvailable( - GraphicsDeviceType type, - bool fFilterRecommended) - { - Debug2.Validate(this.m_renderCaps != null, typeof (ArgumentNullException), "RenderCaps must be initialized prior to calling"); - this.m_renderSession.AssertOwningThread(); - return this.IsGraphicsDeviceAvailable(type, fFilterRecommended); - } - - private bool IsGraphicsDeviceAvailable(GraphicsDeviceType type, bool fFilterRecommended) - { - foreach (Microsoft.Iris.Render.Internal.GraphicsCaps graphic in this.m_renderCaps.Graphics) - { - if ((GraphicsDeviceType) graphic.DeviceType == type) - return !fFilterRecommended || graphic.DriverWarning == 0; - } - return false; - } - - bool IRenderEngine.IsSoundDeviceAvailable(SoundDeviceType type) - { - Debug2.Validate(this.m_renderCaps != null, typeof (ArgumentNullException), "RenderCaps must be initialized prior to calling"); - this.m_renderSession.AssertOwningThread(); - return this.IsSoundDeviceAvailable(type); - } - - private bool IsSoundDeviceAvailable(SoundDeviceType type) - { - if (type == SoundDeviceType.None) - return true; - foreach (Microsoft.Iris.Render.Internal.SoundCaps soundCaps in this.m_renderCaps.Sound) - { - if ((SoundDeviceType) soundCaps.DeviceType == type) - return true; - } - return false; - } - - private void OnRenderWindowCreated(object sender, EventArgs args) - { - SoundDevice soundDevice = (SoundDevice) null; - switch (this.m_typeSound) - { - case SoundDeviceType.None: - this.m_soundDevice = soundDevice; - break; - case SoundDeviceType.DirectSound8: - soundDevice = (SoundDevice) new Ds8SoundDevice(this.m_renderSession, (IRenderWindow) this.m_renderWindow); - goto case SoundDeviceType.None; - case SoundDeviceType.WaveAudio: - case SoundDeviceType.XAudio: - Debug2.Validate(false, typeof (NotImplementedException), "{0} is not yet supported"); - goto case SoundDeviceType.None; - default: - Debug2.Validate(false, typeof (ArgumentException), "typeSound"); - goto case SoundDeviceType.None; - } - } - - internal static ContextID AllocateContextId() - { - uint num1 = 0; - lock (RenderEngine.s_contexts) - { - for (int index = 0; (long) index < (long) RenderEngine.s_maxContextId; ++index) + protected override void Dispose(bool fInDispose) { - uint num2 = RenderEngine.s_contextIdSeed++; - if (RenderEngine.s_contextIdSeed > RenderEngine.s_maxContextId) - RenderEngine.s_contextIdSeed = 1U; - if (!RenderEngine.s_contexts[(int) num2]) - { - num1 = num2; - RenderEngine.s_contexts[(int) num1] = true; - break; - } + try + { + if (fInDispose) + { + this.m_renderSession.ReleaseSharedResources(); + if (this.m_renderWindow != null) + this.m_renderWindow.WindowCreatedEvent -= new EventHandler(this.OnRenderWindowCreated); + if (this.m_soundDevice != null) + this.m_soundDevice.Dispose(); + if (this.m_renderWindow != null) + this.m_renderWindow.Dispose(); + if (this.m_inputSystem != null) + this.m_inputSystem.Dispose(); + if (this.m_displayManager != null) + this.m_displayManager.Dispose(); + if (this.m_renderSession != null) + this.m_renderSession.Dispose(); + if (this.m_messagingSession != null) + { + if (this.m_messagingSession.IsConnected) + this.m_messagingSession.Disconnect(); + this.m_messagingSession.Dispose(); + } + RenderEngine.FreeContextId(this.m_localContextId); + RenderEngine.FreeContextId(this.m_engineContextId); + } + this.m_soundDevice = (SoundDevice)null; + this.m_displayManager = (DisplayManager)null; + this.m_renderWindow = (RenderWindow)null; + this.m_renderSession = (RenderSession)null; + this.m_messagingSession = (MessagingSession)null; + } + finally + { + base.Dispose(fInDispose); + } } - } - Debug2.Validate(num1 != 0U, typeof (InvalidOperationException), "Failed to allocate a context ID"); - return ContextID.FromUInt32(num1); - } - private static void FreeContextId(ContextID contextId) - { - uint uint32 = ContextID.ToUInt32(contextId); - Debug2.Validate(RenderEngine.s_contexts[(int) uint32], typeof (InvalidOperationException), "ContextID is not in use"); - lock (RenderEngine.s_contexts) - RenderEngine.s_contexts[(int) uint32] = false; - } + void IRenderEngine.Initialize( + GraphicsDeviceType typeGraphics, + GraphicsRenderingQuality renderingQuality, + SoundDeviceType typeSound) + { + Debug2.Validate(this.m_messagingSession.IsConnected, typeof(InvalidOperationException), "Must be connected before attempting to initialize"); + Debug2.Validate(this.m_renderSession != null, typeof(ArgumentNullException), "Session must exist before calling Initialize"); + Debug2.Validate(this.IsGraphicsDeviceAvailable(typeGraphics, false), typeof(InvalidOperationException), "Graphics device type not available"); + Debug2.Validate(this.IsSoundDeviceAvailable(typeSound), typeof(InvalidOperationException), "Sound device type not available"); + this.m_renderSession.AssertOwningThread(); + this.m_typeGraphics = typeGraphics; + this.m_typeSound = typeSound; + this.m_displayManager = DisplayManager.CreateDisplayManager(this.m_renderSession, this, false); + this.m_renderWindow = new RenderWindow(this.m_renderSession, this.m_displayManager, typeGraphics, renderingQuality); + this.m_renderWindow.WindowCreatedEvent += new EventHandler(this.OnRenderWindowCreated); + this.m_renderSession.Initialize(); + this.m_inputSystem = new InputSystem(this.m_renderSession, this.m_renderWindow); + } - protected override void Invariant() - { - Debug2.Validate(this.m_localContextId != ContextID.NULL, typeof (InvalidOperationException), "local ContextId should not be NULL while running"); - Debug2.Validate(this.m_engineContextId != ContextID.NULL, typeof (InvalidOperationException), "engine ContextId should not be NULL while running"); - Debug2.Validate(this.MessagingSession != null, typeof (InvalidOperationException), "MessagingSession should not be null while running"); - Debug2.Validate(this.MessagingSession.IsConnected, typeof (InvalidOperationException), "MessagingSession should be connected while running"); + private MessagingSession MessagingSession => this.m_messagingSession; + + IRenderSession IRenderEngine.Session => (IRenderSession)this.m_renderSession; + + internal RenderSession Session => this.m_renderSession; + + IRenderWindow IRenderEngine.Window => (IRenderWindow)this.m_renderWindow; + + internal RenderWindow Window => this.m_renderWindow; + + IDisplayManager IRenderEngine.DisplayManager => (IDisplayManager)this.m_displayManager; + + public DisplayManager DisplayManager => this.m_displayManager; + + public InputSystem InputSystem => this.m_inputSystem; + + internal SoundDevice SoundDevice => this.m_soundDevice; + + internal Vector GraphicsCaps => this.m_renderCaps.Graphics; + + internal Vector SoundCaps => this.m_renderCaps.Sound; + + private void DoEvents(uint nTimeoutInMsecs) + { + this.m_messagingSession.AssertOwningThread(); + MessagingSession.DoEvents(nTimeoutInMsecs); + } + + bool IRenderEngine.ProcessNativeEvents() + { + this.m_renderSession.AssertOwningThread(); + Win32Api.MSG msg; + EngineApi.WorkResult nResult; + EngineApi.SpPeekMessage(out msg, HWND.NULL, 0U, 0U, 1U, out nResult); + if (!Bits.TestFlag((uint)nResult, 2U)) + return Bits.TestFlag((uint)nResult, 1U); + if (this.m_renderWindow != null) + this.m_renderWindow.ForwardWindowMessage(ref msg); + Win32Api.TranslateMessage(ref msg); + Win32Api.DispatchMessage(ref msg); + return true; + } + + void IRenderEngine.WaitForWork(uint nTimeoutInMsecs) + { + this.m_renderSession.AssertOwningThread(); + EngineApi.SpWaitMessage(nTimeoutInMsecs, IntPtr.Zero); + } + + void IRenderEngine.InterThreadWake() => EngineApi.SpInvoke(this.m_localContextId, IntPtr.Zero, IntPtr.Zero, false); + + void IRenderEngine.FlushBatch() + { + this.m_renderSession.AssertOwningThread(); + this.m_messagingSession.FlushBatch(); + } + + bool IRenderEngine.IsGraphicsDeviceAvailable( + GraphicsDeviceType type, + bool fFilterRecommended) + { + Debug2.Validate(this.m_renderCaps != null, typeof(ArgumentNullException), "RenderCaps must be initialized prior to calling"); + this.m_renderSession.AssertOwningThread(); + return this.IsGraphicsDeviceAvailable(type, fFilterRecommended); + } + + private bool IsGraphicsDeviceAvailable(GraphicsDeviceType type, bool fFilterRecommended) + { + foreach (Microsoft.Iris.Render.Internal.GraphicsCaps graphic in this.m_renderCaps.Graphics) + { + if ((GraphicsDeviceType)graphic.DeviceType == type) + return !fFilterRecommended || graphic.DriverWarning == 0; + } + return false; + } + + bool IRenderEngine.IsSoundDeviceAvailable(SoundDeviceType type) + { + Debug2.Validate(this.m_renderCaps != null, typeof(ArgumentNullException), "RenderCaps must be initialized prior to calling"); + this.m_renderSession.AssertOwningThread(); + return this.IsSoundDeviceAvailable(type); + } + + private bool IsSoundDeviceAvailable(SoundDeviceType type) + { + if (type == SoundDeviceType.None) + return true; + foreach (Microsoft.Iris.Render.Internal.SoundCaps soundCaps in this.m_renderCaps.Sound) + { + if ((SoundDeviceType)soundCaps.DeviceType == type) + return true; + } + return false; + } + + private void OnRenderWindowCreated(object sender, EventArgs args) + { + SoundDevice soundDevice = (SoundDevice)null; + switch (this.m_typeSound) + { + case SoundDeviceType.None: + this.m_soundDevice = soundDevice; + break; + case SoundDeviceType.DirectSound8: + soundDevice = (SoundDevice)new Ds8SoundDevice(this.m_renderSession, (IRenderWindow)this.m_renderWindow); + goto case SoundDeviceType.None; + case SoundDeviceType.WaveAudio: + case SoundDeviceType.XAudio: + Debug2.Validate(false, typeof(NotImplementedException), "{0} is not yet supported"); + goto case SoundDeviceType.None; + default: + Debug2.Validate(false, typeof(ArgumentException), "typeSound"); + goto case SoundDeviceType.None; + } + } + + internal static ContextID AllocateContextId() + { + uint num1 = 0; + lock (RenderEngine.s_contexts) + { + for (int index = 0; (long)index < (long)RenderEngine.s_maxContextId; ++index) + { + uint num2 = RenderEngine.s_contextIdSeed++; + if (RenderEngine.s_contextIdSeed > RenderEngine.s_maxContextId) + RenderEngine.s_contextIdSeed = 1U; + if (!RenderEngine.s_contexts[(int)num2]) + { + num1 = num2; + RenderEngine.s_contexts[(int)num1] = true; + break; + } + } + } + Debug2.Validate(num1 != 0U, typeof(InvalidOperationException), "Failed to allocate a context ID"); + return ContextID.FromUInt32(num1); + } + + private static void FreeContextId(ContextID contextId) + { + uint uint32 = ContextID.ToUInt32(contextId); + Debug2.Validate(RenderEngine.s_contexts[(int)uint32], typeof(InvalidOperationException), "ContextID is not in use"); + lock (RenderEngine.s_contexts) + RenderEngine.s_contexts[(int)uint32] = false; + } + + protected override void Invariant() + { + Debug2.Validate(this.m_localContextId != ContextID.NULL, typeof(InvalidOperationException), "local ContextId should not be NULL while running"); + Debug2.Validate(this.m_engineContextId != ContextID.NULL, typeof(InvalidOperationException), "engine ContextId should not be NULL while running"); + Debug2.Validate(this.MessagingSession != null, typeof(InvalidOperationException), "MessagingSession should not be null while running"); + Debug2.Validate(this.MessagingSession.IsConnected, typeof(InvalidOperationException), "MessagingSession should be connected while running"); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs index b3c949a..6f8e623 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs @@ -18,354 +18,354 @@ using System; namespace Microsoft.Iris.Render.Internal { - internal class RenderSession : RenderObject, IRenderSession, IRenderObject, IDisposable - { - private RenderEngine m_renderEngine; - private MessagingSession m_owningSession; - private VisualPropertyManager m_visPropManager; - private ProtocolSplashDesktop m_protocolDesktop; - private ProtocolSplashDesktopNt m_protocolDesktopNt; - private ProtocolSplashRendering m_protocolRendering; - private ProtocolSplashRenderingNt m_protocolRenderingNt; - private ProtocolSplashRendering m_protocolRenderingLocal; - private AnimationSystem m_animationSystem; - private ObjectCacheManager m_cacheManager; - private Microsoft.Iris.Render.Common.ObjectCache m_cacheSprite; - private Microsoft.Iris.Render.Common.ObjectCache m_cacheContainer; - - internal RenderSession(RenderEngine renderEngine) + internal class RenderSession : RenderObject, IRenderSession, IRenderObject, IDisposable { - Debug2.Validate(renderEngine != null, typeof (ArgumentNullException), nameof (renderEngine)); - this.RegisterOwningThread(); - this.m_protocolRendering = ProtocolSplashRendering.Bind(this.Messaging.RenderingPort); - this.m_protocolDesktop = ProtocolSplashDesktop.Bind(this.Messaging.WindowingPort); - this.m_protocolRenderingNt = ProtocolSplashRenderingNt.Bind(this.Messaging.RenderingPort); - this.m_protocolDesktopNt = ProtocolSplashDesktopNt.Bind(this.Messaging.WindowingPort); - if (this.Messaging.WindowingPort != this.Messaging.RenderingPort) - this.m_protocolRenderingLocal = ProtocolSplashRendering.Bind(this.Messaging.WindowingPort); - this.m_renderEngine = renderEngine; - this.m_visPropManager = new VisualPropertyManager(); - this.m_cacheManager = (ObjectCacheManager) null; + private RenderEngine m_renderEngine; + private MessagingSession m_owningSession; + private VisualPropertyManager m_visPropManager; + private ProtocolSplashDesktop m_protocolDesktop; + private ProtocolSplashDesktopNt m_protocolDesktopNt; + private ProtocolSplashRendering m_protocolRendering; + private ProtocolSplashRenderingNt m_protocolRenderingNt; + private ProtocolSplashRendering m_protocolRenderingLocal; + private AnimationSystem m_animationSystem; + private ObjectCacheManager m_cacheManager; + private Microsoft.Iris.Render.Common.ObjectCache m_cacheSprite; + private Microsoft.Iris.Render.Common.ObjectCache m_cacheContainer; + + internal RenderSession(RenderEngine renderEngine) + { + Debug2.Validate(renderEngine != null, typeof(ArgumentNullException), nameof(renderEngine)); + this.RegisterOwningThread(); + this.m_protocolRendering = ProtocolSplashRendering.Bind(this.Messaging.RenderingPort); + this.m_protocolDesktop = ProtocolSplashDesktop.Bind(this.Messaging.WindowingPort); + this.m_protocolRenderingNt = ProtocolSplashRenderingNt.Bind(this.Messaging.RenderingPort); + this.m_protocolDesktopNt = ProtocolSplashDesktopNt.Bind(this.Messaging.WindowingPort); + if (this.Messaging.WindowingPort != this.Messaging.RenderingPort) + this.m_protocolRenderingLocal = ProtocolSplashRendering.Bind(this.Messaging.WindowingPort); + this.m_renderEngine = renderEngine; + this.m_visPropManager = new VisualPropertyManager(); + this.m_cacheManager = (ObjectCacheManager)null; + } + + internal void Initialize() => this.m_animationSystem = new AnimationSystem(this); + + protected override void Dispose(bool fInDispose) + { + try + { + if (fInDispose && this.m_animationSystem != null) + this.m_animationSystem.UnregisterUsage((object)this); + this.UnregisterOwningThread(); + this.m_animationSystem = (AnimationSystem)null; + this.m_visPropManager.Dispose(); + } + finally + { + base.Dispose(fInDispose); + } + } + + IGraphicsDevice IRenderSession.GraphicsDevice => (IGraphicsDevice)this.m_renderEngine.Window.GraphicsDevice; + + ISoundDevice IRenderSession.SoundDevice => (ISoundDevice)this.m_renderEngine.SoundDevice; + + internal SoundDevice SoundDevice => this.m_renderEngine.SoundDevice; + + IAnimationSystem IRenderSession.AnimationSystem => (IAnimationSystem)this.m_animationSystem; + + IInputSystem IRenderSession.InputSystem => (IInputSystem)this.m_renderEngine.InputSystem; + + internal MessagingSession Messaging => this.m_owningSession; + + internal RenderPort RenderingPort => this.m_owningSession.RenderingPort; + + internal RenderPort WindowingPort => this.m_owningSession.WindowingPort; + + internal ProtocolSplashDesktop DesktopProtocol => this.m_protocolDesktop; + + internal ProtocolSplashDesktopNt NtDesktopProtocol => this.m_protocolDesktopNt; + + internal ProtocolSplashRendering RenderingProtocol => this.m_protocolRendering; + + internal ProtocolSplashRenderingNt NtRenderingProtocol => this.m_protocolRenderingNt; + + internal ProtocolSplashRendering LocalRenderingProtocol => this.m_protocolRenderingLocal; + + internal bool IsValid => this.m_owningSession.IsConnected; + + internal bool IsForeignByteOrderOnWindowing => this.WindowingPort.ForeignByteOrder; + + internal VisualPropertyManager VisualPropertyManager => this.m_visPropManager; + + internal ObjectCacheManager CacheManager => this.m_cacheManager; + + public IEffectTemplate CreateEffectTemplate(object objUser, string stName) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + EffectTemplate effectTemplate = this.m_renderEngine.Window.GraphicsDevice.CreateEffectTemplate(stName); + effectTemplate.RegisterUsage(objUser); + return (IEffectTemplate)effectTemplate; + } + + public IVideoStream CreateVideoStream(object objUser) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + VideoStream videoStream = new VideoStream(this, this.m_renderEngine.Window.GraphicsDevice); + videoStream.RegisterUsage(objUser); + return (IVideoStream)videoStream; + } + + public IVisualContainer CreateVisualContainer( + object objUser, + object objOwnerData) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + VisualContainer visualContainer = (VisualContainer)null; + if (this.m_cacheContainer != null) + { + visualContainer = (VisualContainer)this.m_cacheContainer.Remove(objUser); + if (visualContainer != null) + visualContainer.OwnerData = objOwnerData; + } + if (visualContainer == null) + { + RemoteVisual remoteVisual; + visualContainer = new VisualContainer(false, this, this.m_renderEngine.Window, objOwnerData, out remoteVisual); + visualContainer.RegisterUsage(objUser); + visualContainer.Cache = this.m_cacheContainer; + } + return (IVisualContainer)visualContainer; + } + + public ICamera CreateCamera(object objUser) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + Camera camera = new Camera(this); + camera.RegisterUsage(objUser); + return (ICamera)camera; + } + + public IGradient CreateGradient(object objUser) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + Gradient gradient = new Gradient(this, this.m_renderEngine.Window.GraphicsDevice.RemoteDevice); + gradient.RegisterUsage(objUser); + return (IGradient)gradient; + } + + public ISprite CreateSprite(object objUser, object objOwnerData) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + Sprite sprite = (Sprite)null; + if (this.m_cacheSprite != null) + { + sprite = (Sprite)this.m_cacheSprite.Remove(objUser); + if (sprite != null) + sprite.OwnerData = objOwnerData; + } + if (sprite == null) + { + sprite = new Sprite(this, this.m_renderEngine.Window, objOwnerData); + sprite.RegisterUsage(objUser); + sprite.Cache = this.m_cacheSprite; + } + return (ISprite)sprite; + } + + public IImage CreateImage( + object objUser, + string identifier, + ContentNotifyHandler handler) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + Debug2.Validate(handler != null, typeof(InvalidOperationException), "Invalid handler"); + Image image = this.m_renderEngine.Window.GraphicsDevice.CreateImage(identifier, handler); + image.RegisterUsage(objUser); + return (IImage)image; + } + + internal GraphicsCaps GetGraphicsCaps(GraphicsDeviceType type) + { + foreach (GraphicsCaps graphicsCap in this.m_renderEngine.GraphicsCaps) + { + if ((GraphicsDeviceType)graphicsCap.DeviceType == type) + return graphicsCap; + } + return new GraphicsCaps(); + } + + private void RegisterOwningThread() => this.m_owningSession = MessagingSession.Current; + + private void UnregisterOwningThread() => this.m_owningSession = (MessagingSession)null; + + internal void AssertOwningThread() + { + } + + internal bool IsOwningThread() => this.m_owningSession == MessagingSession.Current; + + public void DeferredInvoke(Delegate method, object args, DeferredInvokePriority priority) + { + if (this.m_owningSession == null) + return; + this.m_owningSession.DeferredInvoke(method, args, priority, TimeSpan.FromMilliseconds(0.0)); + } + + public void DeferredInvoke( + SharedRenderObject owner, + Delegate method, + object args, + DeferredInvokePriority priority) + { + if (this.m_owningSession == null) + return; + this.m_owningSession.DeferredInvoke(owner, method, args, priority, TimeSpan.FromMilliseconds(0.0)); + } + + internal void DeferredInvoke( + Delegate method, + object args, + DeferredInvokePriority priority, + TimeSpan delay) + { + if (this.m_owningSession == null) + return; + this.m_owningSession.DeferredInvoke(method, args, priority, delay); + } + + internal void ReleaseSharedResources() + { + if (this.m_cacheSprite != null) + { + this.m_cacheManager.UnregisterCache(this.m_cacheSprite); + this.m_cacheSprite.Dispose(); + this.m_cacheSprite = (Microsoft.Iris.Render.Common.ObjectCache)null; + } + if (this.m_cacheContainer == null) + return; + this.m_cacheManager.UnregisterCache(this.m_cacheContainer); + this.m_cacheContainer.Dispose(); + this.m_cacheContainer = (Microsoft.Iris.Render.Common.ObjectCache)null; + } + + internal RENDERHANDLE AllocateRenderHandle(IRenderHandleOwner owner) => this.RenderingPort.AllocHandle(owner); + + internal void FreeRenderHandle(RENDERHANDLE handle) => this.RenderingPort.FreeHandle(handle); + + internal IVisual TryGetHandleOwner(uint dwHandleData) => this.WindowingPort.TryGetHandleOwner(RENDERHANDLE.FromUInt32(dwHandleData)) as IVisual; + + public RemoteDesktopManager BuildRemoteDesktopManager( + DisplayManager owner, + bool fEnumDisplayModes) + { + Debug2.Validate(this.IsOwningThread(), typeof(InvalidOperationException), "Must be called on the session's owning client thread"); + return this.NtDesktopProtocol.BuildRemoteDesktopManager((IRenderHandleOwner)owner, this.NtDesktopProtocol.LocalDesktopManagerCallbackHandle, fEnumDisplayModes); + } + + internal RemoteFormWindow BuildRemoteFormWindow( + RenderWindow window, + DisplayManager displayManager) + { + Debug2.Validate(this.IsOwningThread(), typeof(InvalidOperationException), "Must be called on the session's owning client thread"); + return this.NtDesktopProtocol.BuildRemoteFormWindow((IRenderHandleOwner)window, displayManager.RemoteStub, this.DesktopProtocol.LocalFormWindowCallbackHandle); + } + + internal RemoteInputRouter BuildRemoteInputRouter( + InputSystem inputSystem, + RenderWindow window) + { + Debug2.Validate(this.IsOwningThread(), typeof(InvalidOperationException), "Must be called on the session's owning client thread"); + RemoteInputRouter remoteInputRouter = this.DesktopProtocol.BuildRemoteInputRouter((IRenderHandleOwner)inputSystem, this.DesktopProtocol.LocalInputCallbackHandle); + remoteInputRouter?.SendRegisterWithInputSource(this.WindowingPort.DefaultGroupID, ((IRenderHandleOwner)window).RenderHandle); + return remoteInputRouter; + } + + internal RemoteNtDevice BuildRemoteNtDevice(NtGraphicsDevice device) => this.NtRenderingProtocol.BuildRemoteNtDevice((IRenderHandleOwner)device, this.RenderingProtocol.LocalDeviceCallbackHandle); + + internal RemoteGdiDevice BuildRemoteGdiDevice(GdiGraphicsDevice device) => this.NtRenderingProtocol.BuildRemoteGdiDevice((IRenderHandleOwner)device, this.RenderingProtocol.LocalDeviceCallbackHandle); + + internal RemoteNullDevice BuildRemoteNullDevice( + NullGraphicsDevice device, + bool fUseSplitWindowingPort) + { + return fUseSplitWindowingPort ? this.LocalRenderingProtocol.BuildRemoteNullDevice((IRenderHandleOwner)device, this.LocalRenderingProtocol.LocalDeviceCallbackHandle) : this.RenderingProtocol.BuildRemoteNullDevice((IRenderHandleOwner)device, this.RenderingProtocol.LocalDeviceCallbackHandle); + } + + internal unsafe DataBuffer BuildDataBuffer(IntPtr pData, uint cbSize) => new DataBuffer(this.RenderingPort, pData.ToPointer(), cbSize); + + internal void LoadSurface(DataBuffer buffer, Surface surface, ImageHeader header) => RemoteRasterizer.SendLoadRawImage(this.RenderingProtocol, surface.RemoteStub, buffer.RemoteStub, header); + + internal RemoteDx9EffectResource BuildRemoteDx9EffectResource( + Dx9EffectResource effectResource, + Dx9GraphicsDevice dx9Device, + DataBuffer dataBuffer) + { + return this.RenderingProtocol.BuildRemoteDx9EffectResource((IRenderHandleOwner)effectResource, dx9Device.RemoteDevice, dataBuffer.RemoteStub); + } + + internal RemoteDx9Effect BuildRemoteDx9Effect(Dx9Effect effect) => RemoteDx9Effect.Create(this.RenderingProtocol, (IRenderHandleOwner)effect); + + internal RemoteGdiEffect BuildRemoteGdiEffect(GdiEffect effect) => RemoteGdiEffect.Create(this.NtRenderingProtocol, (IRenderHandleOwner)effect); + + internal RemoteCamera BuildRemoteCamera(Camera camera) => this.RenderingProtocol.BuildRemoteCamera((IRenderHandleOwner)camera); + + internal RemoteVisualContainer BuildRemoteVisualContainer(Visual visual) => this.RenderingProtocol.BuildRemoteVisualContainer((IRenderHandleOwner)visual); + + internal RemoteSprite BuildRemoteSprite(Sprite sprite, RenderWindow window) + { + switch (window.GraphicsDeviceType) + { + case GraphicsDeviceType.Gdi: + return (RemoteSprite)this.NtRenderingProtocol.BuildRemoteGdiSprite((IRenderHandleOwner)sprite); + case GraphicsDeviceType.Direct3D9: + case GraphicsDeviceType.XeDirectX9: + return (RemoteSprite)this.RenderingProtocol.BuildRemoteDx9Sprite((IRenderHandleOwner)sprite); + default: + Debug2.Throw(false, "Unrecognized device type: {0}", (object)window.GraphicsDeviceType); + return (RemoteSprite)null; + } + } + + internal RemoteSoundBuffer BuildSoundBufferFromHandle(RENDERHANDLE handle) => RemoteSoundBuffer.CreateFromHandle(this.RenderingPort, handle); + + internal RemoteSound BuildSoundFromHandle(RENDERHANDLE handle) => RemoteSound.CreateFromHandle(this.RenderingPort, handle); + + public RemoteAnimationManager BuildRemoteAnimationManager( + AnimationSystem owner) + { + Debug2.Validate(this.IsOwningThread(), typeof(InvalidOperationException), "Must be called on the session's owning client thread"); + return this.RenderingProtocol.BuildRemoteAnimationManager((IRenderHandleOwner)owner); + } + + public RemoteAnimation BuildRemoteAnimation( + KeyframeAnimation owner, + AnimationInputType animationType) + { + Debug2.Validate(this.IsOwningThread(), typeof(InvalidOperationException), "Must be called on the session's owning client thread"); + return this.RenderingProtocol.BuildRemoteAnimation((IRenderHandleOwner)owner, animationType, this.RenderingProtocol.LocalAnimationCallbackHandle); + } + + public RemoteExternalAnimationInput BuildRemoteExternalAnimationInput( + ExternalAnimationInput owner, + uint uniqueId) + { + Debug2.Validate(this.IsOwningThread(), typeof(InvalidOperationException), "Must be called on the session's owning client thread"); + return this.RenderingProtocol.BuildRemoteExternalAnimationInput((IRenderHandleOwner)owner, uniqueId); + } + + public RemoteAnimationInputProvider BuildRemoteAnimationInputProvider( + AnimationInputProvider owner, + uint externalAnimationInputId) + { + Debug2.Validate(this.IsOwningThread(), typeof(InvalidOperationException), "Must be called on the session's owning client thread"); + return this.RenderingProtocol.BuildRemoteAnimationInputProvider((IRenderHandleOwner)owner, externalAnimationInputId); + } + + protected override void Invariant() + { + this.AssertOwningThread(); + Debug2.Validate(this.m_owningSession != null, typeof(InvalidOperationException), this.GetType().ToString()); + } } - - internal void Initialize() => this.m_animationSystem = new AnimationSystem(this); - - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose && this.m_animationSystem != null) - this.m_animationSystem.UnregisterUsage((object) this); - this.UnregisterOwningThread(); - this.m_animationSystem = (AnimationSystem) null; - this.m_visPropManager.Dispose(); - } - finally - { - base.Dispose(fInDispose); - } - } - - IGraphicsDevice IRenderSession.GraphicsDevice => (IGraphicsDevice) this.m_renderEngine.Window.GraphicsDevice; - - ISoundDevice IRenderSession.SoundDevice => (ISoundDevice) this.m_renderEngine.SoundDevice; - - internal SoundDevice SoundDevice => this.m_renderEngine.SoundDevice; - - IAnimationSystem IRenderSession.AnimationSystem => (IAnimationSystem) this.m_animationSystem; - - IInputSystem IRenderSession.InputSystem => (IInputSystem) this.m_renderEngine.InputSystem; - - internal MessagingSession Messaging => this.m_owningSession; - - internal RenderPort RenderingPort => this.m_owningSession.RenderingPort; - - internal RenderPort WindowingPort => this.m_owningSession.WindowingPort; - - internal ProtocolSplashDesktop DesktopProtocol => this.m_protocolDesktop; - - internal ProtocolSplashDesktopNt NtDesktopProtocol => this.m_protocolDesktopNt; - - internal ProtocolSplashRendering RenderingProtocol => this.m_protocolRendering; - - internal ProtocolSplashRenderingNt NtRenderingProtocol => this.m_protocolRenderingNt; - - internal ProtocolSplashRendering LocalRenderingProtocol => this.m_protocolRenderingLocal; - - internal bool IsValid => this.m_owningSession.IsConnected; - - internal bool IsForeignByteOrderOnWindowing => this.WindowingPort.ForeignByteOrder; - - internal VisualPropertyManager VisualPropertyManager => this.m_visPropManager; - - internal ObjectCacheManager CacheManager => this.m_cacheManager; - - public IEffectTemplate CreateEffectTemplate(object objUser, string stName) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - EffectTemplate effectTemplate = this.m_renderEngine.Window.GraphicsDevice.CreateEffectTemplate(stName); - effectTemplate.RegisterUsage(objUser); - return (IEffectTemplate) effectTemplate; - } - - public IVideoStream CreateVideoStream(object objUser) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - VideoStream videoStream = new VideoStream(this, this.m_renderEngine.Window.GraphicsDevice); - videoStream.RegisterUsage(objUser); - return (IVideoStream) videoStream; - } - - public IVisualContainer CreateVisualContainer( - object objUser, - object objOwnerData) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - VisualContainer visualContainer = (VisualContainer) null; - if (this.m_cacheContainer != null) - { - visualContainer = (VisualContainer) this.m_cacheContainer.Remove(objUser); - if (visualContainer != null) - visualContainer.OwnerData = objOwnerData; - } - if (visualContainer == null) - { - RemoteVisual remoteVisual; - visualContainer = new VisualContainer(false, this, this.m_renderEngine.Window, objOwnerData, out remoteVisual); - visualContainer.RegisterUsage(objUser); - visualContainer.Cache = this.m_cacheContainer; - } - return (IVisualContainer) visualContainer; - } - - public ICamera CreateCamera(object objUser) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - Camera camera = new Camera(this); - camera.RegisterUsage(objUser); - return (ICamera) camera; - } - - public IGradient CreateGradient(object objUser) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - Gradient gradient = new Gradient(this, this.m_renderEngine.Window.GraphicsDevice.RemoteDevice); - gradient.RegisterUsage(objUser); - return (IGradient) gradient; - } - - public ISprite CreateSprite(object objUser, object objOwnerData) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - Sprite sprite = (Sprite) null; - if (this.m_cacheSprite != null) - { - sprite = (Sprite) this.m_cacheSprite.Remove(objUser); - if (sprite != null) - sprite.OwnerData = objOwnerData; - } - if (sprite == null) - { - sprite = new Sprite(this, this.m_renderEngine.Window, objOwnerData); - sprite.RegisterUsage(objUser); - sprite.Cache = this.m_cacheSprite; - } - return (ISprite) sprite; - } - - public IImage CreateImage( - object objUser, - string identifier, - ContentNotifyHandler handler) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - Debug2.Validate(handler != null, typeof (InvalidOperationException), "Invalid handler"); - Image image = this.m_renderEngine.Window.GraphicsDevice.CreateImage(identifier, handler); - image.RegisterUsage(objUser); - return (IImage) image; - } - - internal GraphicsCaps GetGraphicsCaps(GraphicsDeviceType type) - { - foreach (GraphicsCaps graphicsCap in this.m_renderEngine.GraphicsCaps) - { - if ((GraphicsDeviceType) graphicsCap.DeviceType == type) - return graphicsCap; - } - return new GraphicsCaps(); - } - - private void RegisterOwningThread() => this.m_owningSession = MessagingSession.Current; - - private void UnregisterOwningThread() => this.m_owningSession = (MessagingSession) null; - - internal void AssertOwningThread() - { - } - - internal bool IsOwningThread() => this.m_owningSession == MessagingSession.Current; - - public void DeferredInvoke(Delegate method, object args, DeferredInvokePriority priority) - { - if (this.m_owningSession == null) - return; - this.m_owningSession.DeferredInvoke(method, args, priority, TimeSpan.FromMilliseconds(0.0)); - } - - public void DeferredInvoke( - SharedRenderObject owner, - Delegate method, - object args, - DeferredInvokePriority priority) - { - if (this.m_owningSession == null) - return; - this.m_owningSession.DeferredInvoke(owner, method, args, priority, TimeSpan.FromMilliseconds(0.0)); - } - - internal void DeferredInvoke( - Delegate method, - object args, - DeferredInvokePriority priority, - TimeSpan delay) - { - if (this.m_owningSession == null) - return; - this.m_owningSession.DeferredInvoke(method, args, priority, delay); - } - - internal void ReleaseSharedResources() - { - if (this.m_cacheSprite != null) - { - this.m_cacheManager.UnregisterCache(this.m_cacheSprite); - this.m_cacheSprite.Dispose(); - this.m_cacheSprite = (Microsoft.Iris.Render.Common.ObjectCache) null; - } - if (this.m_cacheContainer == null) - return; - this.m_cacheManager.UnregisterCache(this.m_cacheContainer); - this.m_cacheContainer.Dispose(); - this.m_cacheContainer = (Microsoft.Iris.Render.Common.ObjectCache) null; - } - - internal RENDERHANDLE AllocateRenderHandle(IRenderHandleOwner owner) => this.RenderingPort.AllocHandle(owner); - - internal void FreeRenderHandle(RENDERHANDLE handle) => this.RenderingPort.FreeHandle(handle); - - internal IVisual TryGetHandleOwner(uint dwHandleData) => this.WindowingPort.TryGetHandleOwner(RENDERHANDLE.FromUInt32(dwHandleData)) as IVisual; - - public RemoteDesktopManager BuildRemoteDesktopManager( - DisplayManager owner, - bool fEnumDisplayModes) - { - Debug2.Validate(this.IsOwningThread(), typeof (InvalidOperationException), "Must be called on the session's owning client thread"); - return this.NtDesktopProtocol.BuildRemoteDesktopManager((IRenderHandleOwner) owner, this.NtDesktopProtocol.LocalDesktopManagerCallbackHandle, fEnumDisplayModes); - } - - internal RemoteFormWindow BuildRemoteFormWindow( - RenderWindow window, - DisplayManager displayManager) - { - Debug2.Validate(this.IsOwningThread(), typeof (InvalidOperationException), "Must be called on the session's owning client thread"); - return this.NtDesktopProtocol.BuildRemoteFormWindow((IRenderHandleOwner) window, displayManager.RemoteStub, this.DesktopProtocol.LocalFormWindowCallbackHandle); - } - - internal RemoteInputRouter BuildRemoteInputRouter( - InputSystem inputSystem, - RenderWindow window) - { - Debug2.Validate(this.IsOwningThread(), typeof (InvalidOperationException), "Must be called on the session's owning client thread"); - RemoteInputRouter remoteInputRouter = this.DesktopProtocol.BuildRemoteInputRouter((IRenderHandleOwner) inputSystem, this.DesktopProtocol.LocalInputCallbackHandle); - remoteInputRouter?.SendRegisterWithInputSource(this.WindowingPort.DefaultGroupID, ((IRenderHandleOwner) window).RenderHandle); - return remoteInputRouter; - } - - internal RemoteNtDevice BuildRemoteNtDevice(NtGraphicsDevice device) => this.NtRenderingProtocol.BuildRemoteNtDevice((IRenderHandleOwner) device, this.RenderingProtocol.LocalDeviceCallbackHandle); - - internal RemoteGdiDevice BuildRemoteGdiDevice(GdiGraphicsDevice device) => this.NtRenderingProtocol.BuildRemoteGdiDevice((IRenderHandleOwner) device, this.RenderingProtocol.LocalDeviceCallbackHandle); - - internal RemoteNullDevice BuildRemoteNullDevice( - NullGraphicsDevice device, - bool fUseSplitWindowingPort) - { - return fUseSplitWindowingPort ? this.LocalRenderingProtocol.BuildRemoteNullDevice((IRenderHandleOwner) device, this.LocalRenderingProtocol.LocalDeviceCallbackHandle) : this.RenderingProtocol.BuildRemoteNullDevice((IRenderHandleOwner) device, this.RenderingProtocol.LocalDeviceCallbackHandle); - } - - internal unsafe DataBuffer BuildDataBuffer(IntPtr pData, uint cbSize) => new DataBuffer(this.RenderingPort, pData.ToPointer(), cbSize); - - internal void LoadSurface(DataBuffer buffer, Surface surface, ImageHeader header) => RemoteRasterizer.SendLoadRawImage(this.RenderingProtocol, surface.RemoteStub, buffer.RemoteStub, header); - - internal RemoteDx9EffectResource BuildRemoteDx9EffectResource( - Dx9EffectResource effectResource, - Dx9GraphicsDevice dx9Device, - DataBuffer dataBuffer) - { - return this.RenderingProtocol.BuildRemoteDx9EffectResource((IRenderHandleOwner) effectResource, dx9Device.RemoteDevice, dataBuffer.RemoteStub); - } - - internal RemoteDx9Effect BuildRemoteDx9Effect(Dx9Effect effect) => RemoteDx9Effect.Create(this.RenderingProtocol, (IRenderHandleOwner) effect); - - internal RemoteGdiEffect BuildRemoteGdiEffect(GdiEffect effect) => RemoteGdiEffect.Create(this.NtRenderingProtocol, (IRenderHandleOwner) effect); - - internal RemoteCamera BuildRemoteCamera(Camera camera) => this.RenderingProtocol.BuildRemoteCamera((IRenderHandleOwner) camera); - - internal RemoteVisualContainer BuildRemoteVisualContainer(Visual visual) => this.RenderingProtocol.BuildRemoteVisualContainer((IRenderHandleOwner) visual); - - internal RemoteSprite BuildRemoteSprite(Sprite sprite, RenderWindow window) - { - switch (window.GraphicsDeviceType) - { - case GraphicsDeviceType.Gdi: - return (RemoteSprite) this.NtRenderingProtocol.BuildRemoteGdiSprite((IRenderHandleOwner) sprite); - case GraphicsDeviceType.Direct3D9: - case GraphicsDeviceType.XeDirectX9: - return (RemoteSprite) this.RenderingProtocol.BuildRemoteDx9Sprite((IRenderHandleOwner) sprite); - default: - Debug2.Throw(false, "Unrecognized device type: {0}", (object) window.GraphicsDeviceType); - return (RemoteSprite) null; - } - } - - internal RemoteSoundBuffer BuildSoundBufferFromHandle(RENDERHANDLE handle) => RemoteSoundBuffer.CreateFromHandle(this.RenderingPort, handle); - - internal RemoteSound BuildSoundFromHandle(RENDERHANDLE handle) => RemoteSound.CreateFromHandle(this.RenderingPort, handle); - - public RemoteAnimationManager BuildRemoteAnimationManager( - AnimationSystem owner) - { - Debug2.Validate(this.IsOwningThread(), typeof (InvalidOperationException), "Must be called on the session's owning client thread"); - return this.RenderingProtocol.BuildRemoteAnimationManager((IRenderHandleOwner) owner); - } - - public RemoteAnimation BuildRemoteAnimation( - KeyframeAnimation owner, - AnimationInputType animationType) - { - Debug2.Validate(this.IsOwningThread(), typeof (InvalidOperationException), "Must be called on the session's owning client thread"); - return this.RenderingProtocol.BuildRemoteAnimation((IRenderHandleOwner) owner, animationType, this.RenderingProtocol.LocalAnimationCallbackHandle); - } - - public RemoteExternalAnimationInput BuildRemoteExternalAnimationInput( - ExternalAnimationInput owner, - uint uniqueId) - { - Debug2.Validate(this.IsOwningThread(), typeof (InvalidOperationException), "Must be called on the session's owning client thread"); - return this.RenderingProtocol.BuildRemoteExternalAnimationInput((IRenderHandleOwner) owner, uniqueId); - } - - public RemoteAnimationInputProvider BuildRemoteAnimationInputProvider( - AnimationInputProvider owner, - uint externalAnimationInputId) - { - Debug2.Validate(this.IsOwningThread(), typeof (InvalidOperationException), "Must be called on the session's owning client thread"); - return this.RenderingProtocol.BuildRemoteAnimationInputProvider((IRenderHandleOwner) owner, externalAnimationInputId); - } - - protected override void Invariant() - { - this.AssertOwningThread(); - Debug2.Validate(this.m_owningSession != null, typeof (InvalidOperationException), this.GetType().ToString()); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderWindow.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderWindow.cs index d6daa86..6466d31 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderWindow.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderWindow.cs @@ -18,1173 +18,1173 @@ using System.Security; namespace Microsoft.Iris.Render.Internal { - [SuppressUnmanagedCodeSecurity] - internal sealed class RenderWindow : - IRenderWindow, - ITreeOwner, - IFormWindowCallback, - IRenderHandleOwner - { - private const uint ACT_INACTIVE = 0; - private const uint ACT_ACTIVE = 1; - private const uint ACT_POPUP = 2; - private const uint ACT_SYSUI = 3; - private const uint STCH_MODE = 1; - private const uint STCH_ACTIVATION = 2; - private const uint STCH_VISIBILITY = 4; - private const uint STCH_LOCATION = 8; - private const uint STCH_SIZE = 16; - private const uint STCH_UNPLANNED = 256; - private const uint WM_KEYFIRST = 256; - private const uint WM_KEYLAST = 265; - private const uint WM_MOUSEFIRST = 512; - private const uint WM_MOUSELAST = 526; - private static ushort[] s_ByteOrder_FormStateCallbackMsg; - private RenderSession m_session; - private DisplayManager m_displayManager; - private GraphicsDevice m_device; - private GraphicsDeviceType m_graphicsDeviceType; - private VisualContainer m_rootVisual; - private int m_nX; - private int m_nY; - private int m_nWidth; - private int m_nHeight; - private int m_nMinResizeWidth; - private int m_nMaxResizeWidth; - private Size m_szDefault; - private string m_stText; - private Display m_currentDisplay; - private bool m_fSpanningMonitors; - private bool m_fOnSecondaryMonitor; - private bool m_fRightToLeft; - private bool m_fActivation; - private bool m_fFocused; - private bool m_fVisible; - private bool m_fExclusive; - private bool m_fShownBefore; - private bool m_fSessionHasDisplay; - private bool m_fSessionLocked; - private bool m_fExplicitlyLocked; - private bool m_fClosing; - private bool m_fLoadComplete; - private bool m_fLoadEventFired; - private WindowState m_nWindowState; - private FormStyleInfo m_windowStyles; - private ColorF m_clrBackground; - private ColorF m_clrOutlineAllColor; - private ColorF m_clrOutlineMarkedColor; - private Cursor m_cursor; - private Cursor m_cursorIdle; - private Stack m_stkWaitCursors; - private HWND m_hwnd; - private RemoteFormWindow m_remoteWindow; - private RenderWindow.RenderFlags m_renderFlags; - private bool m_fPreProcessedInput; - private int m_nMouseLockCount; - private ArrayList m_partialDropData; - private bool m_fEnableExternalDragDrop; - private uint m_nDragDropResult; - private uint m_nDragOverResult; - private bool m_fIsDragInProgress; - private FormPlacement m_finalPlacement; - private SmartMap m_mapShutdownHooks; - private ushort m_nextShutdownHookId; - - internal RenderWindow( - RenderSession session, - DisplayManager displayManager, - GraphicsDeviceType graphicsDeviceType, - GraphicsRenderingQuality renderingQuality) - { - Debug2.Validate(session != null, typeof (ArgumentNullException), "must pass a valid session"); - session.AssertOwningThread(); - Debug2.Validate(displayManager != null, typeof (ArgumentNullException), "must pass a valid DisplayManager"); - this.m_session = session; - this.m_displayManager = displayManager; - this.CreateGraphicsDevice(session, graphicsDeviceType, renderingQuality); - this.m_device.RegisterWindow(this); - this.m_clrBackground = new ColorF(0.0f, 0.0f, 0.0f); - this.m_remoteWindow = this.m_session.BuildRemoteFormWindow(this, this.m_displayManager); - this.m_fPreProcessedInput = false; - this.m_cursor = Cursor.Default; - this.m_cursorIdle = Cursor.Default; - this.m_nWindowState = WindowState.Normal; - this.m_fRightToLeft = false; - this.m_fSessionHasDisplay = true; - this.m_fSessionLocked = false; - this.m_szDefault = new Size(640, 480); - this.m_clrOutlineAllColor = new ColorF((int) byte.MaxValue, 0, (int) byte.MaxValue, 0); - this.m_clrOutlineMarkedColor = new ColorF((int) byte.MaxValue, (int) byte.MaxValue, 0, 0); - this.m_mapShutdownHooks = new SmartMap(); - this.m_nextShutdownHookId = (ushort) 1; - this.m_nMouseLockCount = 0; - this.SetFullScreenExclusive(false); - } - - public void Initialize() => this.BuildRootContainer(); - - private GraphicsDevice CreateGraphicsDevice( - RenderSession session, - GraphicsDeviceType graphicsDeviceType, - GraphicsRenderingQuality renderingQuality) - { - GraphicsDevice graphicsDevice = (GraphicsDevice) null; - EngineApi.IFC(FormApi.SpGdiplusInit()); - this.m_graphicsDeviceType = graphicsDeviceType; - switch (this.m_graphicsDeviceType) - { - case GraphicsDeviceType.Gdi: - this.m_device = (GraphicsDevice) new GdiGraphicsDevice(session); - break; - case GraphicsDeviceType.Direct3D9: - this.m_device = (GraphicsDevice) new NtGraphicsDevice(session, renderingQuality); - break; - } - return graphicsDevice; - } - - internal void Dispose() - { - this.Visible = false; - this.m_remoteWindow.SendSetRoot((RemoteVisual) null); - this.m_rootVisual.UnregisterUsage((object) this); - this.StopRendering(); - } - - internal void StopRendering() - { - if (this.m_device != null) - { - this.m_device.Dispose(); - this.m_device = (GraphicsDevice) null; - } - if (this.m_remoteWindow != null) - { - this.m_remoteWindow.Dispose(); - this.m_remoteWindow = (RemoteFormWindow) null; - } - EngineApi.IFC(FormApi.SpGdiplusUninit()); - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteWindow.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteWindow = (RemoteFormWindow) null; - - internal RemoteFormWindow RemoteStub => this.m_remoteWindow; - - public int Left => this.m_nX; - - public int Top => this.m_nY; - - public int Right => this.m_nX + this.m_nWidth; - - public int Bottom => this.m_nY + this.m_nHeight; - - public int Width => this.m_nWidth; - - public int Height => this.m_nHeight; - - public HWND WindowHandle => this.m_hwnd; - - public Size ClientSize - { - get => new Size(this.m_nWidth, this.m_nHeight); - set - { - if (this.m_nWidth == value.Width && this.m_nHeight == value.Height || !this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetSize(value); - } - } - - public Size InitialClientSize - { - get => this.m_szDefault; - set => this.m_szDefault = value; - } - - public FormPlacement InitialPlacement - { - set - { - if (!this.m_session.IsValid || this.m_remoteWindow == null || !(this.m_hwnd == HWND.NULL)) - return; - this.m_remoteWindow.SendSetInitialPlacement(value.ShowState, value.NormalPosition, value.MaximizedLocation); - } - } - - public FormPlacement FinalPlacement => this.m_finalPlacement; - - public int MinResizeWidth - { - get => this.m_nMinResizeWidth; - set - { - if (this.m_nMinResizeWidth == value) - return; - this.m_nMinResizeWidth = value; - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetMinResizeWidth(this.m_nMinResizeWidth); - } - } - - public int MaxResizeWidth - { - get => this.m_nMaxResizeWidth; - set - { - if (this.m_nMaxResizeWidth == value) - return; - this.m_nMaxResizeWidth = value; - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetMaxResizeWidth(this.m_nMaxResizeWidth); - } - } - - public Point Position - { - get => new Point(this.m_nX, this.m_nY); - set - { - if (this.m_nX == value.X && this.m_nY == value.Y || !this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetPosition(value); - } - } - - public string Text - { - get => this.m_stText == null ? "" : this.m_stText; - set - { - this.m_stText = value; - this.UpdateText(true); - } - } - - public Cursor Cursor - { - get => this.m_cursor; - set - { - if (this.m_cursor == value) - return; - this.m_cursor = value; - this.UpdateCursors(); - } - } - - public Cursor IdleCursor - { - get => this.m_cursorIdle; - set - { - if (this.m_cursorIdle == value) - return; - this.m_cursorIdle = value; - this.UpdateCursors(); - } - } - - public bool Visible - { - get => this.m_fVisible; - set - { - if (this.m_fVisible == value) - return; - this.m_fVisible = value; - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetVisible(this.m_fVisible); - } - } - - public bool IsLoaded => this.m_fLoadEventFired; - - public ColorF BackgroundColor - { - get => this.m_clrBackground; - set => this.SetBackgroundColor(value); - } - - IDisplay IRenderWindow.CurrentDisplay - { - get => this.m_currentDisplay == null ? this.m_displayManager.PrimaryDisplay : (IDisplay) this.m_currentDisplay; - set => this.SetCurrentDisplay(value); - } - - private void SetCurrentDisplay(IDisplay inputIDisplay) - { - Debug2.Validate(inputIDisplay is Display, (Type) null, "CurrentDisplay.set param MUST be a valid Display object"); - Display display = this.m_displayManager.DisplayFromUniqueId((inputIDisplay as Display).UniqueId); - if (display == null) - return; - this.m_currentDisplay = display; - } - - public bool FullScreenExclusive - { - get => this.m_fExclusive; - set => this.SetFullScreenExclusive(value); - } - - private void SetFullScreenExclusive(bool fNewValue) - { - switch (this.m_graphicsDeviceType) - { - case GraphicsDeviceType.Direct3D9: - this.m_fExclusive = fNewValue; - break; - case GraphicsDeviceType.XeDirectX9: - this.m_fExclusive = true; - break; - default: - this.m_fExclusive = false; - break; - } - } - - public bool ActivationState => this.m_fActivation; - - public WindowState WindowState - { - get => this.m_nWindowState; - set - { - if (this.m_nWindowState == value) - return; - this.m_nWindowState = value; - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetMode((uint) this.m_nWindowState); - } - } - - public FormStyleInfo Styles - { - get => this.m_windowStyles; - set - { - this.m_windowStyles = value; - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetStyles(value.uStyleRestored, value.uExStyleRestored, value.uStyleMinimized, value.uExStyleMinimized, value.uStyleMaximized, value.uExStyleMaximized, value.uStyleFullscreen, value.uExStyleFullscreen); - } - } - - HWND IRenderWindow.AppNotifyWindow - { - set => this.m_remoteWindow.INPROC_SendSetAppNotifyWindow(value); - } - - IVisualContainer IRenderWindow.VisualRoot => (IVisualContainer) this.m_rootVisual; - - TreeNode ITreeOwner.Root => (TreeNode) this.m_rootVisual; - - internal bool IsClosing => this.m_fClosing; - - internal bool IsSessionActive => this.m_fSessionHasDisplay && !this.m_fSessionLocked; - - internal bool IsSessionRemote => false; - - internal bool IsSpanningMonitors => this.m_fSpanningMonitors; - - internal bool IsOnSecondaryMonitor => this.m_fOnSecondaryMonitor; - - internal ColorF OutlineAllColor - { - get => this.m_clrOutlineAllColor; - set - { - if (!(this.m_clrOutlineAllColor != value)) - return; - this.m_clrOutlineAllColor = value; - this.m_remoteWindow.SendSetOutlineAllColor(value); - } - } - - internal ColorF OutlineMarkedColor - { - get => this.m_clrOutlineMarkedColor; - set - { - if (!(this.m_clrOutlineMarkedColor != value)) - return; - this.m_clrOutlineMarkedColor = value; - this.m_remoteWindow.SendSetOutlineMarkedColor(value); - } - } - - internal GraphicsDevice GraphicsDevice => this.m_device; - - internal RenderSession Session => this.m_session; - - internal GraphicsDeviceType GraphicsDeviceType => this.m_graphicsDeviceType; - - internal bool IsRightToLeft => this.m_fRightToLeft; - - public event LocationChangedHandler LocationChangedEvent; - - public event SizeChangedHandler SizeChangedEvent; - - public event MonitorChangedHandler MonitorChangedEvent; - - public event WindowStateChangedHandler WindowStateChangedEvent; - - public event CloseHandler CloseEvent; - - public event CloseRequestHandler CloseRequestEvent; - - public event SysCommandHandler SysCommandEvent; - - public event MouseIdleHandler MouseIdleEvent; - - public event ShowHandler ShowEvent; - - public event ActivationChangeHandler ActivationChangeEvent; - - public event SessionActivateHandler SessionActivateEvent; - - public event SessionConnectHandler SessionConnectEvent; - - public event SetFocusHandler SetFocusEvent; - - public event LoadHandler LoadEvent; - - public event ForwardMessageHandler ForwardMessageEvent; - - public event RenderWindow.RendererSuspendedHandler RendererSuspendedEvent; - - internal event EventHandler WindowCreatedEvent; - - private void OnCreated() - { - if (this.WindowCreatedEvent == null) - return; - this.WindowCreatedEvent((object) this, EventArgs.Empty); - } - - private void OnForwardWndMsg(uint msg, IntPtr wParam, IntPtr lParam) - { - if (this.ForwardMessageEvent == null) - return; - this.ForwardMessageEvent(msg, wParam, lParam); - } - - private void FireLoadEvent() - { - if (this.m_fLoadEventFired || !this.m_fLoadComplete || this.m_nWidth == 0 && this.m_nHeight == 0) - return; - if (this.LoadEvent != null) - this.LoadEvent(); - this.m_fLoadEventFired = true; - } - - private void OnLocationChanged() - { - if (this.LocationChangedEvent == null) - return; - this.LocationChangedEvent(this.Position); - } - - internal void NotifyDisplayReconfigured() => this.OnSizeChanged(); - - private void OnSizeChanged() - { - this.FireLoadEvent(); - if (this.SizeChangedEvent == null) - return; - this.SizeChangedEvent(); - } - - private void OnMonitorChanged() - { - if (this.MonitorChangedEvent == null) - return; - this.MonitorChangedEvent(); - } - - private void OnWindowStateChanged(bool fUnplanned) - { - if (this.WindowStateChangedEvent == null) - return; - this.WindowStateChangedEvent(fUnplanned); - } - - private void OnDestroyed() - { - } - - private void OnSysCommand(IntPtr uParam1, IntPtr uParam2) - { - if (this.SysCommandEvent == null) - return; - this.SysCommandEvent(uParam1, uParam2); - } - - private void OnMouseIdle(bool fIdle) - { - if (this.MouseIdleEvent == null) - return; - this.MouseIdleEvent(fIdle); - } - - private void OnShow(bool fShow, bool fFirstShow) - { - if (this.ShowEvent == null) - return; - this.ShowEvent(fShow, fFirstShow); - } - - private void OnActivationChange() - { - if (this.ActivationChangeEvent == null) - return; - this.ActivationChangeEvent(); - } - - private void OnTermSessionChange(uint uParam) - { - bool flag = false; - bool isSessionActive = this.IsSessionActive; - switch (uParam) - { - case 1: - case 3: - this.m_fSessionHasDisplay = true; - break; - case 2: - case 4: - this.m_fSessionHasDisplay = false; - break; - case 7: - this.m_fSessionLocked = true; - this.m_fExplicitlyLocked = true; - break; - case 8: - this.m_fSessionLocked = false; - flag = flag || !this.m_fExplicitlyLocked; - break; - } - if (this.IsSessionActive != isSessionActive || flag) - this.FireSessionActivate(this.IsSessionActive); - if (uParam != 2U && uParam != 1U && (uParam != 4U && uParam != 3U)) - return; - this.FireSessionConnect(uParam == 1U || uParam == 3U); - } - - public void FireSessionActivate(bool fIsActive) => this.OnSessionActivate(fIsActive); - - private void OnSessionActivate(bool fIsActive) - { - if (fIsActive && this.Visible && this.m_fExclusive) - { - this.Focus(); - this.m_remoteWindow.SendSetForeground(false); - } - if (this.SessionActivateEvent == null) - return; - this.SessionActivateEvent(fIsActive); - } - - private void FireSessionConnect(bool fIsConnected) - { - if (this.SessionConnectEvent == null) - return; - this.SessionConnectEvent(fIsConnected); - } - - private void OnNativeScreensave(bool fStart) - { - } - - private void OnDroppedFiles(IEnumerable files) - { - } - - public void EnableShellShutdownHook(string hookName, EventHandler handler) => this.GetShutdownHookInfo(hookName, true).Handler += handler; - - private RenderWindow.ShutdownHookInfo GetShutdownHookInfo( - string hookName, - bool fCanAdd) - { - RenderWindow.ShutdownHookInfo desired = new RenderWindow.ShutdownHookInfo(hookName); - if (this.m_mapShutdownHooks.Lookup(desired, out uint _)) - return desired; - if (fCanAdd) - { - ushort uIdMsg = this.m_nextShutdownHookId++; - this.m_mapShutdownHooks.SetValue((uint) uIdMsg, desired); - this.m_remoteWindow.SendEnableShellShutdownHook(hookName, uIdMsg); - } - else - desired = (RenderWindow.ShutdownHookInfo) null; - return desired; - } - - void IFormWindowCallback.OnTerminalSessionChange( - RENDERHANDLE target, - IntPtr wParam, - IntPtr lParam) - { - this.OnTermSessionChange((uint) wParam.ToInt32()); - } - - void IFormWindowCallback.OnPrivateSysCommand( - RENDERHANDLE target, - IntPtr wParam, - IntPtr lParam) - { - this.OnSysCommand(wParam, lParam); - } - - void IFormWindowCallback.OnMouseIdle(RENDERHANDLE target, bool fNewIdle) => this.OnMouseIdle(fNewIdle); - - void IFormWindowCallback.OnCloseRequested(RENDERHANDLE target) => this.EngineCloseRequest(); - - void IFormWindowCallback.OnLoad(RENDERHANDLE target) - { - this.m_fLoadComplete = true; - if (this.m_fClosing) - return; - this.FireLoadEvent(); - } - - void IFormWindowCallback.OnWindowDestroyed( - RENDERHANDLE target, - uint nFinalShowState, - Rectangle rcFinalPosition, - Point ptFinalMaximizedLocation) - { - this.m_finalPlacement.NormalPosition = rcFinalPosition; - this.m_finalPlacement.MaximizedLocation = ptFinalMaximizedLocation; - this.m_finalPlacement.ShowState = nFinalShowState; - this.m_hwnd = HWND.NULL; - this.m_fClosing = true; - if (this.CloseEvent == null) - return; - this.CloseEvent(); - } - - void IFormWindowCallback.OnWindowCreated(RENDERHANDLE target, HWND hWnd) - { - this.m_hwnd = hWnd; - this.m_device.PostCreate(); - this.UpdateText(false); - this.OnCreated(); - } - - unsafe void IFormWindowCallback.OnStateChange( - RENDERHANDLE target, - Message* pmsgRaw) - { - RenderWindow.FormStateCallbackMsg* stateCallbackMsgPtr = (RenderWindow.FormStateCallbackMsg*) pmsgRaw; - if (this.m_session.IsForeignByteOrderOnWindowing) - MarshalHelper.SwapByteOrder((byte*) stateCallbackMsgPtr, ref RenderWindow.s_ByteOrder_FormStateCallbackMsg, typeof (RenderWindow.FormStateCallbackMsg), 0, 0); - uint num = 0; - if (this.m_currentDisplay != null) - num = this.m_currentDisplay.UniqueId; - bool flag1 = stateCallbackMsgPtr->fOnSecondaryMonitor != 0; - bool flag2 = stateCallbackMsgPtr->cSpanningMonitors > 1U; - bool flag3 = false; - if (stateCallbackMsgPtr->idDisplay != uint.MaxValue) - flag3 = (int) num != (int) stateCallbackMsgPtr->idDisplay || this.m_fOnSecondaryMonitor != flag1 || this.m_fSpanningMonitors != flag2; - bool flag4 = this.m_nX != stateCallbackMsgPtr->rcWindowGlobal_left || this.m_nY != stateCallbackMsgPtr->rcWindowGlobal_top; - bool flag5 = this.m_nWidth != stateCallbackMsgPtr->szClientDims_cx || this.m_nHeight != stateCallbackMsgPtr->szClientDims_cy; - this.m_nX = stateCallbackMsgPtr->rcWindowGlobal_left; - this.m_nY = stateCallbackMsgPtr->rcWindowGlobal_top; - this.m_nWidth = stateCallbackMsgPtr->szClientDims_cx; - this.m_nHeight = stateCallbackMsgPtr->szClientDims_cy; - this.m_nWindowState = (WindowState) stateCallbackMsgPtr->uCurrentMode; - this.m_fVisible = stateCallbackMsgPtr->fVisible != 0; - this.m_fSpanningMonitors = flag2; - this.m_fOnSecondaryMonitor = flag1; - this.SetFullScreenExclusive(stateCallbackMsgPtr->fExclusive != 0); - bool fActivation = this.m_fActivation; - this.m_fActivation = stateCallbackMsgPtr->uActivation == 1U; - if (flag3) - this.m_currentDisplay = this.m_displayManager.DisplayFromUniqueId(stateCallbackMsgPtr->idDisplay); - if (flag3) - this.OnMonitorChanged(); - if (flag4) - this.OnLocationChanged(); - if (flag5) - { - this.m_rootVisual.Size = new Vector2((float) this.m_nWidth, (float) this.m_nHeight); - this.OnSizeChanged(); - } - if (((int) stateCallbackMsgPtr->uRecentlyChanged & 1) != 0) - this.OnWindowStateChanged(((int) stateCallbackMsgPtr->uRecentlyChanged & 256) != 0); - if (((int) stateCallbackMsgPtr->uRecentlyChanged & 4) != 0) - { - bool fFirstShow = this.m_fVisible && !this.m_fShownBefore; - if (this.m_fVisible) - this.m_fShownBefore = true; - this.OnShow(this.m_fVisible, fFirstShow); - } - if (((int) stateCallbackMsgPtr->uRecentlyChanged & 2) == 0 || this.m_fActivation == fActivation) - return; - this.OnActivationChange(); - } - - void IFormWindowCallback.OnPartialDrop(RENDERHANDLE target, string file) - { - if (this.m_partialDropData == null) - this.m_partialDropData = new ArrayList(); - this.m_partialDropData.Add((object) file); - } - - void IFormWindowCallback.OnDropComplete(RENDERHANDLE target) - { - if (this.m_partialDropData == null || this.m_partialDropData.Count <= 0) - return; - IEnumerable partialDropData = (IEnumerable) this.m_partialDropData; - this.m_partialDropData = (ArrayList) null; - this.OnDroppedFiles(partialDropData); - } - - void IFormWindowCallback.OnSetFocus( - RENDERHANDLE target, - bool focused, - HWND hwndFocusChange) - { - this.m_fFocused = focused; - int num = focused ? 1 : 0; - if (this.SetFocusEvent == null) - return; - this.SetFocusEvent(focused); - } - - void IFormWindowCallback.OnShellShutdownHook( - RENDERHANDLE target, - ushort hookId) - { - RenderWindow.ShutdownHookInfo shutdownHookInfo; - if (!this.m_mapShutdownHooks.TryGetValue((uint) hookId, out shutdownHookInfo)) - return; - shutdownHookInfo.OnHook((object) this, EventArgs.Empty); - } - - void IFormWindowCallback.OnNativeScreensave( - RENDERHANDLE target, - bool fStartScreensave) - { - this.m_session.DeferredInvoke((Delegate) new DeferredHandler(this.DoNativeScreensave), (object) fStartScreensave, DeferredInvokePriority.Idle); - } - - private void DoNativeScreensave(object objParam) => this.OnNativeScreensave((bool) objParam); - - private void DoPopAnimations(object objParam) - { - } - - void IFormWindowCallback.OnRendererSuspended( - RENDERHANDLE target, - bool fSuspended) - { - this.FireRendererSuspended(fSuspended); - } - - private void FireRendererSuspended(bool fSuspended) - { - if (this.RendererSuspendedEvent == null) - return; - this.RendererSuspendedEvent((object) this.m_device, new RenderWindow.RendererSuspendedArgs(fSuspended)); - } - - internal RenderWindow.RenderFlags GlobalRenderFlags - { - get => this.m_renderFlags; - set => this.SetGlobalRenderFlags(value, RenderWindow.RenderFlags.All); - } - - internal bool SetGlobalRenderFlags( - RenderWindow.RenderFlags flags, - RenderWindow.RenderFlags mask) - { - bool flag = false; - RenderWindow.RenderFlags renderFlags = this.m_renderFlags & ~mask | flags & mask; - if (this.m_renderFlags != renderFlags) - { - this.m_renderFlags = renderFlags; - flag = true; - this.m_remoteWindow.SendChangeDataBits((uint) flags, (uint) mask); - } - return flag; - } - - public void SetWindowOptions(WindowOptions optionMask, bool enable) - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetOptions((uint) optionMask, enable ? (uint) optionMask : 0U); - } - - public void SetMouseIdleOptions(Size mouseIdleTolerance, uint mouseIdleDelay) - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetMouseIdleOptions(mouseIdleTolerance, mouseIdleDelay); - } - - public void ForwardWindowMessage(ref Win32Api.MSG msg) - { - if (msg.message < 256U || msg.message > 265U) - return; - this.OnForwardWndMsg(msg.message, msg.wParam, msg.lParam); - } - - private void BuildRootContainer() - { - this.m_remoteWindow.SendSetSize(this.m_szDefault); - this.m_remoteWindow.SendCreateRootContainer(); - this.m_remoteWindow.SendSetHitMasks(1U, 2U, 4U, 8U); - RemoteVisual remoteVisual; - this.m_rootVisual = new VisualContainer(true, this.m_session, this, (object) null, out remoteVisual); - this.m_rootVisual.RegisterUsage((object) this); - this.m_remoteWindow.SendSetRoot(remoteVisual); - this.m_rootVisual.Size = new Vector2((float) this.m_nWidth, (float) this.m_nHeight); - } - - void IRenderWindow.ClientToScreen(ref Point point) - { - Win32Api.POINT pt; - pt.x = !this.m_fRightToLeft ? point.X : this.ClientSize.Width - point.X; - pt.y = point.Y; - Win32Api.ClientToScreen(this.m_hwnd, ref pt); - point.X = pt.x; - point.Y = pt.y; - } - - void IRenderWindow.ScreenToClient(ref Point point) - { - Win32Api.POINT pt; - pt.x = point.X; - pt.y = point.Y; - Win32Api.ScreenToClient(this.m_hwnd, ref pt); - point.X = !this.m_fRightToLeft ? pt.x : this.ClientSize.Width - pt.x; - point.Y = pt.y; - } - - void IRenderWindow.TakeFocus() => this.Focus(); - - private void Focus() - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendTakeFocus(); - } - - void IRenderWindow.TakeForeground(bool fForce) - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetForeground(fForce); - } - - void IRenderWindow.BringToTop() - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendBringToTop(); - } - - void IRenderWindow.RefreshHitTarget() - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendRefreshHitTarget(); - } - - private void EngineCloseRequest() - { - if (this.CloseRequestEvent != null) - this.CloseRequestEvent(); - else - this.Close(FormCloseReason.RendererRequest); - } - - public void Close(FormCloseReason nReason) - { - if (this.m_fClosing) - return; - this.ForceCloseWorker(nReason); - } - - private void ForceClose() => this.ForceCloseWorker(FormCloseReason.ForcedClose); - - private void ForceCloseWorker(FormCloseReason nReason) - { - if (this.m_fClosing) - return; - this.m_fClosing = true; - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendDestroy(); - } - - public void PushWaitCursor(Cursor cursor) - { - if (this.m_stkWaitCursors == null) - this.m_stkWaitCursors = new Stack(); - this.m_stkWaitCursors.Push((object) cursor); - this.UpdateCursors(); - } - - public void PopWaitCursor() - { - this.m_stkWaitCursors.Pop(); - this.UpdateCursors(); - } - - public void ForceMouseIdle(bool fIdle) - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendForceMouseIdle(fIdle); - } - - public void SetCapture(IRawInputSite captureSite, bool state) - { - if (captureSite == null) - return; - this.m_remoteWindow.SendSetCapture((captureSite as Visual).RemoteStub, state); - } - - public void SetBackgroundColor(ColorF color) - { - if (!(this.m_clrBackground != color)) - return; - this.m_clrBackground = color; - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetBackgroundColor(color); - } - - public void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions) - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetIcon(sModuleName, nResourceID, (uint) nOptions); - } - - public void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges) - { - if (!this.m_session.IsValid) - return; - Debug2.Validate(edges != null, (Type) null, "Must pass non-null edges set"); - Debug2.Validate(edges.Length == 4, (Type) null, "Must pass exactly 4 edges, LTRB"); - for (int index = 0; index < 4; ++index) - { - Debug2.Validate(edges[index].ModuleName != null, (Type) null, "Must pass non-null ModuleName:" + index.ToString()); - Debug2.Validate(edges[index].ResourceName != null, (Type) null, "Must pass non-null ResourceName:" + index.ToString()); - } - Debug2.Validate(string.Equals(edges[0].ModuleName, edges[1].ModuleName), (Type) null, "Module names differ - not supported"); - Debug2.Validate(string.Equals(edges[0].ModuleName, edges[2].ModuleName), (Type) null, "Module names differ - not supported"); - Debug2.Validate(string.Equals(edges[0].ModuleName, edges[3].ModuleName), (Type) null, "Module names differ - not supported"); - Debug2.Validate(edges[0].SplitPoints == edges[2].SplitPoints, (Type) null, "L+R splits differ - not supported"); - Debug2.Validate(edges[1].SplitPoints == edges[3].SplitPoints, (Type) null, "T+B splits differ - not supported"); - Inset insetSplits = new Inset(edges[1].SplitPoints.Left, edges[0].SplitPoints.Top, edges[1].SplitPoints.Right, edges[0].SplitPoints.Bottom); - this.m_remoteWindow.SendSetEdgeImageParts(fActiveEdges, edges[0].ModuleName, edges[0].ResourceName, edges[1].ResourceName, edges[2].ResourceName, edges[3].ResourceName, insetSplits); - } - - public bool EnableExternalDragDrop - { - get => this.m_fEnableExternalDragDrop; - set - { - if (this.m_fEnableExternalDragDrop == value) - return; - this.m_fEnableExternalDragDrop = value; - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendEnableExternalDragDrop(value); - } - } - - public void SetDragDropResult(uint nDragOverResult, uint nDragDropResult) - { - if ((int) this.m_nDragOverResult == (int) nDragOverResult && (int) this.m_nDragDropResult == (int) nDragDropResult) - return; - this.m_nDragDropResult = nDragDropResult; - this.m_nDragOverResult = nDragOverResult; - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetDragDropResult(nDragOverResult, nDragDropResult); - } - - public bool IsDragInProgress - { - get => this.m_fIsDragInProgress; - set - { - if (this.m_fIsDragInProgress == value) - return; - this.m_fIsDragInProgress = value; - if (!this.m_session.IsValid) - return; - if (this.m_fIsDragInProgress) - this.m_remoteWindow.SendEnterInternalDrag(); - else - this.m_remoteWindow.SendExitInternalDrag(); - } - } - - public void Restore() - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendRestore(); - } - - public void TemporarilyExitExclusiveMode() - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendTemporarilyExitExclusiveMode(); - } - - public IHwndHostWindow CreateHwndHostWindow() => (IHwndHostWindow) new HwndHostWindow(this); - - public void UnlockForegroundWindow() - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendUpdateForegroundLockState(); - } - - public void BringToTop() - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendBringToTop(); - } - - public void LockMouseActive(bool fLock) - { - if (fLock) - { - ++this.m_nMouseLockCount; - if (this.m_nMouseLockCount != 1) - return; - this.SetWindowOptions(WindowOptions.LockMouseActive, true); - } - else - { - this.m_nMouseLockCount = Math.Max(this.m_nMouseLockCount - 1, 0); - if (this.m_nMouseLockCount != 0) - return; - this.SetWindowOptions(WindowOptions.LockMouseActive, false); - } - } - - private void UpdateText(bool fChanged) - { - if (!(this.m_hwnd != HWND.NULL) || this.m_stText == null && !fChanged || !this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetText(this.Text); - } - - private void UpdateCursors() - { - Cursor cursor1 = Cursor.NullCursor; - Cursor nullCursor = Cursor.NullCursor; - Cursor cursor2 = (Cursor) null; - if (this.m_stkWaitCursors != null && this.m_stkWaitCursors.Count > 0) - cursor2 = this.m_stkWaitCursors.Peek() as Cursor; - Cursor cursor3; - if (cursor2 != null) - { - cursor1 = cursor3 = cursor2; - } - else - { - if (this.m_cursor != null) - cursor1 = this.m_cursor; - cursor3 = this.m_cursorIdle == null ? cursor1 : this.m_cursorIdle; - } - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendSetCursors(cursor1.ResourceId, cursor3.ResourceId); - } - - public bool IsPreProcessedInput => this.m_fPreProcessedInput; - - public delegate void RendererSuspendedHandler( - object sender, - RenderWindow.RendererSuspendedArgs args); - - internal class ShutdownHookInfo - { - private string m_stHookId; - - public ShutdownHookInfo(string stHookId) => this.m_stHookId = stHookId; - - public event EventHandler Handler; - - public void OnHook(object sender, EventArgs args) - { - if (this.Handler == null) - return; - this.Handler(sender, args); - } - - public override bool Equals(object obj) => obj is RenderWindow.ShutdownHookInfo shutdownHookInfo && this.m_stHookId == shutdownHookInfo.m_stHookId; - - public override int GetHashCode() => this.m_stHookId.GetHashCode(); - } - - internal class RendererSuspendedArgs : EventArgs - { - private bool m_fSuspended; - - public RendererSuspendedArgs(bool fSuspended) => this.m_fSuspended = fSuspended; - - public bool Suspended => this.m_fSuspended; - } - - [System.Flags] - internal enum RenderFlags - { - None = 0, - DebugPainting = 1, - OutlineMarked = 2, - OutlineAll = 4, - RenderDump = 8, - Wireframe = 16, // 0x00000010 - InvalidationDebug = 32, // 0x00000020 - NoLighting = 64, // 0x00000040 - NoVertexAlpha = 128, // 0x00000080 - NoTextures = 256, // 0x00000100 - NoAlpha = 512, // 0x00000200 - RemoteDebugMode = 1024, // 0x00000400 - DumpRopsOneTime = 2048, // 0x00000800 - All = DumpRopsOneTime | RemoteDebugMode | NoAlpha | NoTextures | NoVertexAlpha | NoLighting | InvalidationDebug | Wireframe | RenderDump | OutlineAll | OutlineMarked | DebugPainting, // 0x00000FFF - } - - [ComVisible(false)] - private struct FormStateCallbackMsg - { - public uint cbSize; - public int nMsg; - public RENDERHANDLE idObjectSubject; - public uint uRecentlyChanged; - public uint uCurrentMode; - public uint uActivation; - public int fVisible; - public int szClientDims_cx; - public int szClientDims_cy; - public int rcWindowGlobal_left; - public int rcWindowGlobal_top; - public int rcWindowGlobal_right; - public int rcWindowGlobal_bottom; - public uint idDisplay; - public uint cSpanningMonitors; - public int fExclusive; - public int fOnSecondaryMonitor; + [SuppressUnmanagedCodeSecurity] + internal sealed class RenderWindow : + IRenderWindow, + ITreeOwner, + IFormWindowCallback, + IRenderHandleOwner + { + private const uint ACT_INACTIVE = 0; + private const uint ACT_ACTIVE = 1; + private const uint ACT_POPUP = 2; + private const uint ACT_SYSUI = 3; + private const uint STCH_MODE = 1; + private const uint STCH_ACTIVATION = 2; + private const uint STCH_VISIBILITY = 4; + private const uint STCH_LOCATION = 8; + private const uint STCH_SIZE = 16; + private const uint STCH_UNPLANNED = 256; + private const uint WM_KEYFIRST = 256; + private const uint WM_KEYLAST = 265; + private const uint WM_MOUSEFIRST = 512; + private const uint WM_MOUSELAST = 526; + private static ushort[] s_ByteOrder_FormStateCallbackMsg; + private RenderSession m_session; + private DisplayManager m_displayManager; + private GraphicsDevice m_device; + private GraphicsDeviceType m_graphicsDeviceType; + private VisualContainer m_rootVisual; + private int m_nX; + private int m_nY; + private int m_nWidth; + private int m_nHeight; + private int m_nMinResizeWidth; + private int m_nMaxResizeWidth; + private Size m_szDefault; + private string m_stText; + private Display m_currentDisplay; + private bool m_fSpanningMonitors; + private bool m_fOnSecondaryMonitor; + private bool m_fRightToLeft; + private bool m_fActivation; + private bool m_fFocused; + private bool m_fVisible; + private bool m_fExclusive; + private bool m_fShownBefore; + private bool m_fSessionHasDisplay; + private bool m_fSessionLocked; + private bool m_fExplicitlyLocked; + private bool m_fClosing; + private bool m_fLoadComplete; + private bool m_fLoadEventFired; + private WindowState m_nWindowState; + private FormStyleInfo m_windowStyles; + private ColorF m_clrBackground; + private ColorF m_clrOutlineAllColor; + private ColorF m_clrOutlineMarkedColor; + private Cursor m_cursor; + private Cursor m_cursorIdle; + private Stack m_stkWaitCursors; + private HWND m_hwnd; + private RemoteFormWindow m_remoteWindow; + private RenderWindow.RenderFlags m_renderFlags; + private bool m_fPreProcessedInput; + private int m_nMouseLockCount; + private ArrayList m_partialDropData; + private bool m_fEnableExternalDragDrop; + private uint m_nDragDropResult; + private uint m_nDragOverResult; + private bool m_fIsDragInProgress; + private FormPlacement m_finalPlacement; + private SmartMap m_mapShutdownHooks; + private ushort m_nextShutdownHookId; + + internal RenderWindow( + RenderSession session, + DisplayManager displayManager, + GraphicsDeviceType graphicsDeviceType, + GraphicsRenderingQuality renderingQuality) + { + Debug2.Validate(session != null, typeof(ArgumentNullException), "must pass a valid session"); + session.AssertOwningThread(); + Debug2.Validate(displayManager != null, typeof(ArgumentNullException), "must pass a valid DisplayManager"); + this.m_session = session; + this.m_displayManager = displayManager; + this.CreateGraphicsDevice(session, graphicsDeviceType, renderingQuality); + this.m_device.RegisterWindow(this); + this.m_clrBackground = new ColorF(0.0f, 0.0f, 0.0f); + this.m_remoteWindow = this.m_session.BuildRemoteFormWindow(this, this.m_displayManager); + this.m_fPreProcessedInput = false; + this.m_cursor = Cursor.Default; + this.m_cursorIdle = Cursor.Default; + this.m_nWindowState = WindowState.Normal; + this.m_fRightToLeft = false; + this.m_fSessionHasDisplay = true; + this.m_fSessionLocked = false; + this.m_szDefault = new Size(640, 480); + this.m_clrOutlineAllColor = new ColorF((int)byte.MaxValue, 0, (int)byte.MaxValue, 0); + this.m_clrOutlineMarkedColor = new ColorF((int)byte.MaxValue, (int)byte.MaxValue, 0, 0); + this.m_mapShutdownHooks = new SmartMap(); + this.m_nextShutdownHookId = (ushort)1; + this.m_nMouseLockCount = 0; + this.SetFullScreenExclusive(false); + } + + public void Initialize() => this.BuildRootContainer(); + + private GraphicsDevice CreateGraphicsDevice( + RenderSession session, + GraphicsDeviceType graphicsDeviceType, + GraphicsRenderingQuality renderingQuality) + { + GraphicsDevice graphicsDevice = (GraphicsDevice)null; + EngineApi.IFC(FormApi.SpGdiplusInit()); + this.m_graphicsDeviceType = graphicsDeviceType; + switch (this.m_graphicsDeviceType) + { + case GraphicsDeviceType.Gdi: + this.m_device = (GraphicsDevice)new GdiGraphicsDevice(session); + break; + case GraphicsDeviceType.Direct3D9: + this.m_device = (GraphicsDevice)new NtGraphicsDevice(session, renderingQuality); + break; + } + return graphicsDevice; + } + + internal void Dispose() + { + this.Visible = false; + this.m_remoteWindow.SendSetRoot((RemoteVisual)null); + this.m_rootVisual.UnregisterUsage((object)this); + this.StopRendering(); + } + + internal void StopRendering() + { + if (this.m_device != null) + { + this.m_device.Dispose(); + this.m_device = (GraphicsDevice)null; + } + if (this.m_remoteWindow != null) + { + this.m_remoteWindow.Dispose(); + this.m_remoteWindow = (RemoteFormWindow)null; + } + EngineApi.IFC(FormApi.SpGdiplusUninit()); + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteWindow.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteWindow = (RemoteFormWindow)null; + + internal RemoteFormWindow RemoteStub => this.m_remoteWindow; + + public int Left => this.m_nX; + + public int Top => this.m_nY; + + public int Right => this.m_nX + this.m_nWidth; + + public int Bottom => this.m_nY + this.m_nHeight; + + public int Width => this.m_nWidth; + + public int Height => this.m_nHeight; + + public HWND WindowHandle => this.m_hwnd; + + public Size ClientSize + { + get => new Size(this.m_nWidth, this.m_nHeight); + set + { + if (this.m_nWidth == value.Width && this.m_nHeight == value.Height || !this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetSize(value); + } + } + + public Size InitialClientSize + { + get => this.m_szDefault; + set => this.m_szDefault = value; + } + + public FormPlacement InitialPlacement + { + set + { + if (!this.m_session.IsValid || this.m_remoteWindow == null || !(this.m_hwnd == HWND.NULL)) + return; + this.m_remoteWindow.SendSetInitialPlacement(value.ShowState, value.NormalPosition, value.MaximizedLocation); + } + } + + public FormPlacement FinalPlacement => this.m_finalPlacement; + + public int MinResizeWidth + { + get => this.m_nMinResizeWidth; + set + { + if (this.m_nMinResizeWidth == value) + return; + this.m_nMinResizeWidth = value; + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetMinResizeWidth(this.m_nMinResizeWidth); + } + } + + public int MaxResizeWidth + { + get => this.m_nMaxResizeWidth; + set + { + if (this.m_nMaxResizeWidth == value) + return; + this.m_nMaxResizeWidth = value; + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetMaxResizeWidth(this.m_nMaxResizeWidth); + } + } + + public Point Position + { + get => new Point(this.m_nX, this.m_nY); + set + { + if (this.m_nX == value.X && this.m_nY == value.Y || !this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetPosition(value); + } + } + + public string Text + { + get => this.m_stText == null ? "" : this.m_stText; + set + { + this.m_stText = value; + this.UpdateText(true); + } + } + + public Cursor Cursor + { + get => this.m_cursor; + set + { + if (this.m_cursor == value) + return; + this.m_cursor = value; + this.UpdateCursors(); + } + } + + public Cursor IdleCursor + { + get => this.m_cursorIdle; + set + { + if (this.m_cursorIdle == value) + return; + this.m_cursorIdle = value; + this.UpdateCursors(); + } + } + + public bool Visible + { + get => this.m_fVisible; + set + { + if (this.m_fVisible == value) + return; + this.m_fVisible = value; + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetVisible(this.m_fVisible); + } + } + + public bool IsLoaded => this.m_fLoadEventFired; + + public ColorF BackgroundColor + { + get => this.m_clrBackground; + set => this.SetBackgroundColor(value); + } + + IDisplay IRenderWindow.CurrentDisplay + { + get => this.m_currentDisplay == null ? this.m_displayManager.PrimaryDisplay : (IDisplay)this.m_currentDisplay; + set => this.SetCurrentDisplay(value); + } + + private void SetCurrentDisplay(IDisplay inputIDisplay) + { + Debug2.Validate(inputIDisplay is Display, (Type)null, "CurrentDisplay.set param MUST be a valid Display object"); + Display display = this.m_displayManager.DisplayFromUniqueId((inputIDisplay as Display).UniqueId); + if (display == null) + return; + this.m_currentDisplay = display; + } + + public bool FullScreenExclusive + { + get => this.m_fExclusive; + set => this.SetFullScreenExclusive(value); + } + + private void SetFullScreenExclusive(bool fNewValue) + { + switch (this.m_graphicsDeviceType) + { + case GraphicsDeviceType.Direct3D9: + this.m_fExclusive = fNewValue; + break; + case GraphicsDeviceType.XeDirectX9: + this.m_fExclusive = true; + break; + default: + this.m_fExclusive = false; + break; + } + } + + public bool ActivationState => this.m_fActivation; + + public WindowState WindowState + { + get => this.m_nWindowState; + set + { + if (this.m_nWindowState == value) + return; + this.m_nWindowState = value; + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetMode((uint)this.m_nWindowState); + } + } + + public FormStyleInfo Styles + { + get => this.m_windowStyles; + set + { + this.m_windowStyles = value; + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetStyles(value.uStyleRestored, value.uExStyleRestored, value.uStyleMinimized, value.uExStyleMinimized, value.uStyleMaximized, value.uExStyleMaximized, value.uStyleFullscreen, value.uExStyleFullscreen); + } + } + + HWND IRenderWindow.AppNotifyWindow + { + set => this.m_remoteWindow.INPROC_SendSetAppNotifyWindow(value); + } + + IVisualContainer IRenderWindow.VisualRoot => (IVisualContainer)this.m_rootVisual; + + TreeNode ITreeOwner.Root => (TreeNode)this.m_rootVisual; + + internal bool IsClosing => this.m_fClosing; + + internal bool IsSessionActive => this.m_fSessionHasDisplay && !this.m_fSessionLocked; + + internal bool IsSessionRemote => false; + + internal bool IsSpanningMonitors => this.m_fSpanningMonitors; + + internal bool IsOnSecondaryMonitor => this.m_fOnSecondaryMonitor; + + internal ColorF OutlineAllColor + { + get => this.m_clrOutlineAllColor; + set + { + if (!(this.m_clrOutlineAllColor != value)) + return; + this.m_clrOutlineAllColor = value; + this.m_remoteWindow.SendSetOutlineAllColor(value); + } + } + + internal ColorF OutlineMarkedColor + { + get => this.m_clrOutlineMarkedColor; + set + { + if (!(this.m_clrOutlineMarkedColor != value)) + return; + this.m_clrOutlineMarkedColor = value; + this.m_remoteWindow.SendSetOutlineMarkedColor(value); + } + } + + internal GraphicsDevice GraphicsDevice => this.m_device; + + internal RenderSession Session => this.m_session; + + internal GraphicsDeviceType GraphicsDeviceType => this.m_graphicsDeviceType; + + internal bool IsRightToLeft => this.m_fRightToLeft; + + public event LocationChangedHandler LocationChangedEvent; + + public event SizeChangedHandler SizeChangedEvent; + + public event MonitorChangedHandler MonitorChangedEvent; + + public event WindowStateChangedHandler WindowStateChangedEvent; + + public event CloseHandler CloseEvent; + + public event CloseRequestHandler CloseRequestEvent; + + public event SysCommandHandler SysCommandEvent; + + public event MouseIdleHandler MouseIdleEvent; + + public event ShowHandler ShowEvent; + + public event ActivationChangeHandler ActivationChangeEvent; + + public event SessionActivateHandler SessionActivateEvent; + + public event SessionConnectHandler SessionConnectEvent; + + public event SetFocusHandler SetFocusEvent; + + public event LoadHandler LoadEvent; + + public event ForwardMessageHandler ForwardMessageEvent; + + public event RenderWindow.RendererSuspendedHandler RendererSuspendedEvent; + + internal event EventHandler WindowCreatedEvent; + + private void OnCreated() + { + if (this.WindowCreatedEvent == null) + return; + this.WindowCreatedEvent((object)this, EventArgs.Empty); + } + + private void OnForwardWndMsg(uint msg, IntPtr wParam, IntPtr lParam) + { + if (this.ForwardMessageEvent == null) + return; + this.ForwardMessageEvent(msg, wParam, lParam); + } + + private void FireLoadEvent() + { + if (this.m_fLoadEventFired || !this.m_fLoadComplete || this.m_nWidth == 0 && this.m_nHeight == 0) + return; + if (this.LoadEvent != null) + this.LoadEvent(); + this.m_fLoadEventFired = true; + } + + private void OnLocationChanged() + { + if (this.LocationChangedEvent == null) + return; + this.LocationChangedEvent(this.Position); + } + + internal void NotifyDisplayReconfigured() => this.OnSizeChanged(); + + private void OnSizeChanged() + { + this.FireLoadEvent(); + if (this.SizeChangedEvent == null) + return; + this.SizeChangedEvent(); + } + + private void OnMonitorChanged() + { + if (this.MonitorChangedEvent == null) + return; + this.MonitorChangedEvent(); + } + + private void OnWindowStateChanged(bool fUnplanned) + { + if (this.WindowStateChangedEvent == null) + return; + this.WindowStateChangedEvent(fUnplanned); + } + + private void OnDestroyed() + { + } + + private void OnSysCommand(IntPtr uParam1, IntPtr uParam2) + { + if (this.SysCommandEvent == null) + return; + this.SysCommandEvent(uParam1, uParam2); + } + + private void OnMouseIdle(bool fIdle) + { + if (this.MouseIdleEvent == null) + return; + this.MouseIdleEvent(fIdle); + } + + private void OnShow(bool fShow, bool fFirstShow) + { + if (this.ShowEvent == null) + return; + this.ShowEvent(fShow, fFirstShow); + } + + private void OnActivationChange() + { + if (this.ActivationChangeEvent == null) + return; + this.ActivationChangeEvent(); + } + + private void OnTermSessionChange(uint uParam) + { + bool flag = false; + bool isSessionActive = this.IsSessionActive; + switch (uParam) + { + case 1: + case 3: + this.m_fSessionHasDisplay = true; + break; + case 2: + case 4: + this.m_fSessionHasDisplay = false; + break; + case 7: + this.m_fSessionLocked = true; + this.m_fExplicitlyLocked = true; + break; + case 8: + this.m_fSessionLocked = false; + flag = flag || !this.m_fExplicitlyLocked; + break; + } + if (this.IsSessionActive != isSessionActive || flag) + this.FireSessionActivate(this.IsSessionActive); + if (uParam != 2U && uParam != 1U && (uParam != 4U && uParam != 3U)) + return; + this.FireSessionConnect(uParam == 1U || uParam == 3U); + } + + public void FireSessionActivate(bool fIsActive) => this.OnSessionActivate(fIsActive); + + private void OnSessionActivate(bool fIsActive) + { + if (fIsActive && this.Visible && this.m_fExclusive) + { + this.Focus(); + this.m_remoteWindow.SendSetForeground(false); + } + if (this.SessionActivateEvent == null) + return; + this.SessionActivateEvent(fIsActive); + } + + private void FireSessionConnect(bool fIsConnected) + { + if (this.SessionConnectEvent == null) + return; + this.SessionConnectEvent(fIsConnected); + } + + private void OnNativeScreensave(bool fStart) + { + } + + private void OnDroppedFiles(IEnumerable files) + { + } + + public void EnableShellShutdownHook(string hookName, EventHandler handler) => this.GetShutdownHookInfo(hookName, true).Handler += handler; + + private RenderWindow.ShutdownHookInfo GetShutdownHookInfo( + string hookName, + bool fCanAdd) + { + RenderWindow.ShutdownHookInfo desired = new RenderWindow.ShutdownHookInfo(hookName); + if (this.m_mapShutdownHooks.Lookup(desired, out uint _)) + return desired; + if (fCanAdd) + { + ushort uIdMsg = this.m_nextShutdownHookId++; + this.m_mapShutdownHooks.SetValue((uint)uIdMsg, desired); + this.m_remoteWindow.SendEnableShellShutdownHook(hookName, uIdMsg); + } + else + desired = (RenderWindow.ShutdownHookInfo)null; + return desired; + } + + void IFormWindowCallback.OnTerminalSessionChange( + RENDERHANDLE target, + IntPtr wParam, + IntPtr lParam) + { + this.OnTermSessionChange((uint)wParam.ToInt32()); + } + + void IFormWindowCallback.OnPrivateSysCommand( + RENDERHANDLE target, + IntPtr wParam, + IntPtr lParam) + { + this.OnSysCommand(wParam, lParam); + } + + void IFormWindowCallback.OnMouseIdle(RENDERHANDLE target, bool fNewIdle) => this.OnMouseIdle(fNewIdle); + + void IFormWindowCallback.OnCloseRequested(RENDERHANDLE target) => this.EngineCloseRequest(); + + void IFormWindowCallback.OnLoad(RENDERHANDLE target) + { + this.m_fLoadComplete = true; + if (this.m_fClosing) + return; + this.FireLoadEvent(); + } + + void IFormWindowCallback.OnWindowDestroyed( + RENDERHANDLE target, + uint nFinalShowState, + Rectangle rcFinalPosition, + Point ptFinalMaximizedLocation) + { + this.m_finalPlacement.NormalPosition = rcFinalPosition; + this.m_finalPlacement.MaximizedLocation = ptFinalMaximizedLocation; + this.m_finalPlacement.ShowState = nFinalShowState; + this.m_hwnd = HWND.NULL; + this.m_fClosing = true; + if (this.CloseEvent == null) + return; + this.CloseEvent(); + } + + void IFormWindowCallback.OnWindowCreated(RENDERHANDLE target, HWND hWnd) + { + this.m_hwnd = hWnd; + this.m_device.PostCreate(); + this.UpdateText(false); + this.OnCreated(); + } + + unsafe void IFormWindowCallback.OnStateChange( + RENDERHANDLE target, + Message* pmsgRaw) + { + RenderWindow.FormStateCallbackMsg* stateCallbackMsgPtr = (RenderWindow.FormStateCallbackMsg*)pmsgRaw; + if (this.m_session.IsForeignByteOrderOnWindowing) + MarshalHelper.SwapByteOrder((byte*)stateCallbackMsgPtr, ref RenderWindow.s_ByteOrder_FormStateCallbackMsg, typeof(RenderWindow.FormStateCallbackMsg), 0, 0); + uint num = 0; + if (this.m_currentDisplay != null) + num = this.m_currentDisplay.UniqueId; + bool flag1 = stateCallbackMsgPtr->fOnSecondaryMonitor != 0; + bool flag2 = stateCallbackMsgPtr->cSpanningMonitors > 1U; + bool flag3 = false; + if (stateCallbackMsgPtr->idDisplay != uint.MaxValue) + flag3 = (int)num != (int)stateCallbackMsgPtr->idDisplay || this.m_fOnSecondaryMonitor != flag1 || this.m_fSpanningMonitors != flag2; + bool flag4 = this.m_nX != stateCallbackMsgPtr->rcWindowGlobal_left || this.m_nY != stateCallbackMsgPtr->rcWindowGlobal_top; + bool flag5 = this.m_nWidth != stateCallbackMsgPtr->szClientDims_cx || this.m_nHeight != stateCallbackMsgPtr->szClientDims_cy; + this.m_nX = stateCallbackMsgPtr->rcWindowGlobal_left; + this.m_nY = stateCallbackMsgPtr->rcWindowGlobal_top; + this.m_nWidth = stateCallbackMsgPtr->szClientDims_cx; + this.m_nHeight = stateCallbackMsgPtr->szClientDims_cy; + this.m_nWindowState = (WindowState)stateCallbackMsgPtr->uCurrentMode; + this.m_fVisible = stateCallbackMsgPtr->fVisible != 0; + this.m_fSpanningMonitors = flag2; + this.m_fOnSecondaryMonitor = flag1; + this.SetFullScreenExclusive(stateCallbackMsgPtr->fExclusive != 0); + bool fActivation = this.m_fActivation; + this.m_fActivation = stateCallbackMsgPtr->uActivation == 1U; + if (flag3) + this.m_currentDisplay = this.m_displayManager.DisplayFromUniqueId(stateCallbackMsgPtr->idDisplay); + if (flag3) + this.OnMonitorChanged(); + if (flag4) + this.OnLocationChanged(); + if (flag5) + { + this.m_rootVisual.Size = new Vector2((float)this.m_nWidth, (float)this.m_nHeight); + this.OnSizeChanged(); + } + if (((int)stateCallbackMsgPtr->uRecentlyChanged & 1) != 0) + this.OnWindowStateChanged(((int)stateCallbackMsgPtr->uRecentlyChanged & 256) != 0); + if (((int)stateCallbackMsgPtr->uRecentlyChanged & 4) != 0) + { + bool fFirstShow = this.m_fVisible && !this.m_fShownBefore; + if (this.m_fVisible) + this.m_fShownBefore = true; + this.OnShow(this.m_fVisible, fFirstShow); + } + if (((int)stateCallbackMsgPtr->uRecentlyChanged & 2) == 0 || this.m_fActivation == fActivation) + return; + this.OnActivationChange(); + } + + void IFormWindowCallback.OnPartialDrop(RENDERHANDLE target, string file) + { + if (this.m_partialDropData == null) + this.m_partialDropData = new ArrayList(); + this.m_partialDropData.Add((object)file); + } + + void IFormWindowCallback.OnDropComplete(RENDERHANDLE target) + { + if (this.m_partialDropData == null || this.m_partialDropData.Count <= 0) + return; + IEnumerable partialDropData = (IEnumerable)this.m_partialDropData; + this.m_partialDropData = (ArrayList)null; + this.OnDroppedFiles(partialDropData); + } + + void IFormWindowCallback.OnSetFocus( + RENDERHANDLE target, + bool focused, + HWND hwndFocusChange) + { + this.m_fFocused = focused; + int num = focused ? 1 : 0; + if (this.SetFocusEvent == null) + return; + this.SetFocusEvent(focused); + } + + void IFormWindowCallback.OnShellShutdownHook( + RENDERHANDLE target, + ushort hookId) + { + RenderWindow.ShutdownHookInfo shutdownHookInfo; + if (!this.m_mapShutdownHooks.TryGetValue((uint)hookId, out shutdownHookInfo)) + return; + shutdownHookInfo.OnHook((object)this, EventArgs.Empty); + } + + void IFormWindowCallback.OnNativeScreensave( + RENDERHANDLE target, + bool fStartScreensave) + { + this.m_session.DeferredInvoke((Delegate)new DeferredHandler(this.DoNativeScreensave), (object)fStartScreensave, DeferredInvokePriority.Idle); + } + + private void DoNativeScreensave(object objParam) => this.OnNativeScreensave((bool)objParam); + + private void DoPopAnimations(object objParam) + { + } + + void IFormWindowCallback.OnRendererSuspended( + RENDERHANDLE target, + bool fSuspended) + { + this.FireRendererSuspended(fSuspended); + } + + private void FireRendererSuspended(bool fSuspended) + { + if (this.RendererSuspendedEvent == null) + return; + this.RendererSuspendedEvent((object)this.m_device, new RenderWindow.RendererSuspendedArgs(fSuspended)); + } + + internal RenderWindow.RenderFlags GlobalRenderFlags + { + get => this.m_renderFlags; + set => this.SetGlobalRenderFlags(value, RenderWindow.RenderFlags.All); + } + + internal bool SetGlobalRenderFlags( + RenderWindow.RenderFlags flags, + RenderWindow.RenderFlags mask) + { + bool flag = false; + RenderWindow.RenderFlags renderFlags = this.m_renderFlags & ~mask | flags & mask; + if (this.m_renderFlags != renderFlags) + { + this.m_renderFlags = renderFlags; + flag = true; + this.m_remoteWindow.SendChangeDataBits((uint)flags, (uint)mask); + } + return flag; + } + + public void SetWindowOptions(WindowOptions optionMask, bool enable) + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetOptions((uint)optionMask, enable ? (uint)optionMask : 0U); + } + + public void SetMouseIdleOptions(Size mouseIdleTolerance, uint mouseIdleDelay) + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetMouseIdleOptions(mouseIdleTolerance, mouseIdleDelay); + } + + public void ForwardWindowMessage(ref Win32Api.MSG msg) + { + if (msg.message < 256U || msg.message > 265U) + return; + this.OnForwardWndMsg(msg.message, msg.wParam, msg.lParam); + } + + private void BuildRootContainer() + { + this.m_remoteWindow.SendSetSize(this.m_szDefault); + this.m_remoteWindow.SendCreateRootContainer(); + this.m_remoteWindow.SendSetHitMasks(1U, 2U, 4U, 8U); + RemoteVisual remoteVisual; + this.m_rootVisual = new VisualContainer(true, this.m_session, this, (object)null, out remoteVisual); + this.m_rootVisual.RegisterUsage((object)this); + this.m_remoteWindow.SendSetRoot(remoteVisual); + this.m_rootVisual.Size = new Vector2((float)this.m_nWidth, (float)this.m_nHeight); + } + + void IRenderWindow.ClientToScreen(ref Point point) + { + Win32Api.POINT pt; + pt.x = !this.m_fRightToLeft ? point.X : this.ClientSize.Width - point.X; + pt.y = point.Y; + Win32Api.ClientToScreen(this.m_hwnd, ref pt); + point.X = pt.x; + point.Y = pt.y; + } + + void IRenderWindow.ScreenToClient(ref Point point) + { + Win32Api.POINT pt; + pt.x = point.X; + pt.y = point.Y; + Win32Api.ScreenToClient(this.m_hwnd, ref pt); + point.X = !this.m_fRightToLeft ? pt.x : this.ClientSize.Width - pt.x; + point.Y = pt.y; + } + + void IRenderWindow.TakeFocus() => this.Focus(); + + private void Focus() + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendTakeFocus(); + } + + void IRenderWindow.TakeForeground(bool fForce) + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetForeground(fForce); + } + + void IRenderWindow.BringToTop() + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendBringToTop(); + } + + void IRenderWindow.RefreshHitTarget() + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendRefreshHitTarget(); + } + + private void EngineCloseRequest() + { + if (this.CloseRequestEvent != null) + this.CloseRequestEvent(); + else + this.Close(FormCloseReason.RendererRequest); + } + + public void Close(FormCloseReason nReason) + { + if (this.m_fClosing) + return; + this.ForceCloseWorker(nReason); + } + + private void ForceClose() => this.ForceCloseWorker(FormCloseReason.ForcedClose); + + private void ForceCloseWorker(FormCloseReason nReason) + { + if (this.m_fClosing) + return; + this.m_fClosing = true; + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendDestroy(); + } + + public void PushWaitCursor(Cursor cursor) + { + if (this.m_stkWaitCursors == null) + this.m_stkWaitCursors = new Stack(); + this.m_stkWaitCursors.Push((object)cursor); + this.UpdateCursors(); + } + + public void PopWaitCursor() + { + this.m_stkWaitCursors.Pop(); + this.UpdateCursors(); + } + + public void ForceMouseIdle(bool fIdle) + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendForceMouseIdle(fIdle); + } + + public void SetCapture(IRawInputSite captureSite, bool state) + { + if (captureSite == null) + return; + this.m_remoteWindow.SendSetCapture((captureSite as Visual).RemoteStub, state); + } + + public void SetBackgroundColor(ColorF color) + { + if (!(this.m_clrBackground != color)) + return; + this.m_clrBackground = color; + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetBackgroundColor(color); + } + + public void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions) + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetIcon(sModuleName, nResourceID, (uint)nOptions); + } + + public void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges) + { + if (!this.m_session.IsValid) + return; + Debug2.Validate(edges != null, (Type)null, "Must pass non-null edges set"); + Debug2.Validate(edges.Length == 4, (Type)null, "Must pass exactly 4 edges, LTRB"); + for (int index = 0; index < 4; ++index) + { + Debug2.Validate(edges[index].ModuleName != null, (Type)null, "Must pass non-null ModuleName:" + index.ToString()); + Debug2.Validate(edges[index].ResourceName != null, (Type)null, "Must pass non-null ResourceName:" + index.ToString()); + } + Debug2.Validate(string.Equals(edges[0].ModuleName, edges[1].ModuleName), (Type)null, "Module names differ - not supported"); + Debug2.Validate(string.Equals(edges[0].ModuleName, edges[2].ModuleName), (Type)null, "Module names differ - not supported"); + Debug2.Validate(string.Equals(edges[0].ModuleName, edges[3].ModuleName), (Type)null, "Module names differ - not supported"); + Debug2.Validate(edges[0].SplitPoints == edges[2].SplitPoints, (Type)null, "L+R splits differ - not supported"); + Debug2.Validate(edges[1].SplitPoints == edges[3].SplitPoints, (Type)null, "T+B splits differ - not supported"); + Inset insetSplits = new Inset(edges[1].SplitPoints.Left, edges[0].SplitPoints.Top, edges[1].SplitPoints.Right, edges[0].SplitPoints.Bottom); + this.m_remoteWindow.SendSetEdgeImageParts(fActiveEdges, edges[0].ModuleName, edges[0].ResourceName, edges[1].ResourceName, edges[2].ResourceName, edges[3].ResourceName, insetSplits); + } + + public bool EnableExternalDragDrop + { + get => this.m_fEnableExternalDragDrop; + set + { + if (this.m_fEnableExternalDragDrop == value) + return; + this.m_fEnableExternalDragDrop = value; + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendEnableExternalDragDrop(value); + } + } + + public void SetDragDropResult(uint nDragOverResult, uint nDragDropResult) + { + if ((int)this.m_nDragOverResult == (int)nDragOverResult && (int)this.m_nDragDropResult == (int)nDragDropResult) + return; + this.m_nDragDropResult = nDragDropResult; + this.m_nDragOverResult = nDragOverResult; + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetDragDropResult(nDragOverResult, nDragDropResult); + } + + public bool IsDragInProgress + { + get => this.m_fIsDragInProgress; + set + { + if (this.m_fIsDragInProgress == value) + return; + this.m_fIsDragInProgress = value; + if (!this.m_session.IsValid) + return; + if (this.m_fIsDragInProgress) + this.m_remoteWindow.SendEnterInternalDrag(); + else + this.m_remoteWindow.SendExitInternalDrag(); + } + } + + public void Restore() + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendRestore(); + } + + public void TemporarilyExitExclusiveMode() + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendTemporarilyExitExclusiveMode(); + } + + public IHwndHostWindow CreateHwndHostWindow() => (IHwndHostWindow)new HwndHostWindow(this); + + public void UnlockForegroundWindow() + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendUpdateForegroundLockState(); + } + + public void BringToTop() + { + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendBringToTop(); + } + + public void LockMouseActive(bool fLock) + { + if (fLock) + { + ++this.m_nMouseLockCount; + if (this.m_nMouseLockCount != 1) + return; + this.SetWindowOptions(WindowOptions.LockMouseActive, true); + } + else + { + this.m_nMouseLockCount = Math.Max(this.m_nMouseLockCount - 1, 0); + if (this.m_nMouseLockCount != 0) + return; + this.SetWindowOptions(WindowOptions.LockMouseActive, false); + } + } + + private void UpdateText(bool fChanged) + { + if (!(this.m_hwnd != HWND.NULL) || this.m_stText == null && !fChanged || !this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetText(this.Text); + } + + private void UpdateCursors() + { + Cursor cursor1 = Cursor.NullCursor; + Cursor nullCursor = Cursor.NullCursor; + Cursor cursor2 = (Cursor)null; + if (this.m_stkWaitCursors != null && this.m_stkWaitCursors.Count > 0) + cursor2 = this.m_stkWaitCursors.Peek() as Cursor; + Cursor cursor3; + if (cursor2 != null) + { + cursor1 = cursor3 = cursor2; + } + else + { + if (this.m_cursor != null) + cursor1 = this.m_cursor; + cursor3 = this.m_cursorIdle == null ? cursor1 : this.m_cursorIdle; + } + if (!this.m_session.IsValid) + return; + this.m_remoteWindow.SendSetCursors(cursor1.ResourceId, cursor3.ResourceId); + } + + public bool IsPreProcessedInput => this.m_fPreProcessedInput; + + public delegate void RendererSuspendedHandler( + object sender, + RenderWindow.RendererSuspendedArgs args); + + internal class ShutdownHookInfo + { + private string m_stHookId; + + public ShutdownHookInfo(string stHookId) => this.m_stHookId = stHookId; + + public event EventHandler Handler; + + public void OnHook(object sender, EventArgs args) + { + if (this.Handler == null) + return; + this.Handler(sender, args); + } + + public override bool Equals(object obj) => obj is RenderWindow.ShutdownHookInfo shutdownHookInfo && this.m_stHookId == shutdownHookInfo.m_stHookId; + + public override int GetHashCode() => this.m_stHookId.GetHashCode(); + } + + internal class RendererSuspendedArgs : EventArgs + { + private bool m_fSuspended; + + public RendererSuspendedArgs(bool fSuspended) => this.m_fSuspended = fSuspended; + + public bool Suspended => this.m_fSuspended; + } + + [System.Flags] + internal enum RenderFlags + { + None = 0, + DebugPainting = 1, + OutlineMarked = 2, + OutlineAll = 4, + RenderDump = 8, + Wireframe = 16, // 0x00000010 + InvalidationDebug = 32, // 0x00000020 + NoLighting = 64, // 0x00000040 + NoVertexAlpha = 128, // 0x00000080 + NoTextures = 256, // 0x00000100 + NoAlpha = 512, // 0x00000200 + RemoteDebugMode = 1024, // 0x00000400 + DumpRopsOneTime = 2048, // 0x00000800 + All = DumpRopsOneTime | RemoteDebugMode | NoAlpha | NoTextures | NoVertexAlpha | NoLighting | InvalidationDebug | Wireframe | RenderDump | OutlineAll | OutlineMarked | DebugPainting, // 0x00000FFF + } + + [ComVisible(false)] + private struct FormStateCallbackMsg + { + public uint cbSize; + public int nMsg; + public RENDERHANDLE idObjectSubject; + public uint uRecentlyChanged; + public uint uCurrentMode; + public uint uActivation; + public int fVisible; + public int szClientDims_cx; + public int szClientDims_cy; + public int rcWindowGlobal_left; + public int rcWindowGlobal_top; + public int rcWindowGlobal_right; + public int rcWindowGlobal_bottom; + public uint idDisplay; + public uint cSpanningMonitors; + public int fExclusive; + public int fOnSecondaryMonitor; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/SoundCaps.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/SoundCaps.cs index 91bea9e..ae284ad 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/SoundCaps.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/SoundCaps.cs @@ -9,10 +9,10 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Internal { - [ComVisible(false)] - [Serializable] - internal struct SoundCaps - { - internal uint DeviceType; - } + [ComVisible(false)] + [Serializable] + internal struct SoundCaps + { + internal uint DeviceType; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/StackIListEnumerator.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/StackIListEnumerator.cs index efed217..6eb8b86 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/StackIListEnumerator.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/StackIListEnumerator.cs @@ -8,24 +8,24 @@ using System.Collections; namespace Microsoft.Iris.Render.Internal { - internal struct StackIListEnumerator : IEnumerator - { - private const int START_INVALID_INDEX = -1; - private IList m_list; - private int m_idxCurrent; - - internal StackIListEnumerator(IList list) + internal struct StackIListEnumerator : IEnumerator { - this.m_list = list; - this.m_idxCurrent = -1; + private const int START_INVALID_INDEX = -1; + private IList m_list; + private int m_idxCurrent; + + internal StackIListEnumerator(IList list) + { + this.m_list = list; + this.m_idxCurrent = -1; + } + + public StackIListEnumerator GetEnumerator() => this; + + public bool MoveNext() => ++this.m_idxCurrent < this.m_list.Count; + + public object Current => this.m_list[this.m_idxCurrent]; + + public void Reset() => this.m_idxCurrent = -1; } - - public StackIListEnumerator GetEnumerator() => this; - - public bool MoveNext() => ++this.m_idxCurrent < this.m_list.Count; - - public object Current => this.m_list[this.m_idxCurrent]; - - public void Reset() => this.m_idxCurrent = -1; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Win32Api.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Win32Api.cs index 14523d9..293a302 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Win32Api.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Win32Api.cs @@ -12,382 +12,382 @@ using System.Text; namespace Microsoft.Iris.Render.Internal { - [SuppressUnmanagedCodeSecurity] - internal static class Win32Api - { - public const int IDC_ARROW = 32512; - public const int IDC_IBEAM = 32513; - public const int IDC_WAIT = 32514; - public const int IDC_CROSS = 32515; - public const int IDC_UPARROW = 32516; - public const int IDC_SIZENWSE = 32642; - public const int IDC_SIZENESW = 32643; - public const int IDC_SIZEWE = 32644; - public const int IDC_SIZENS = 32645; - public const int IDC_SIZEALL = 32646; - public const int IDC_NO = 32648; - public const int IDC_HAND = 32649; - public const int IDC_APPSTARTING = 32550; - public const int IDC_HELP = 32651; - public const int SM_CXSCREEN = 0; - public const int SM_CYSCREEN = 1; - public const int RT_RCDATA = 10; - public const uint EVENT_MODIFY_STATE = 2; - public const uint LOAD_LIBRARY_AS_DATAFILE = 2; - public const int REG_NOTIFY_CHANGE_NAME = 1; - public const int REG_NOTIFY_CHANGE_ATTRIBUTES = 2; - public const int REG_NOTIFY_CHANGE_LAST_SET = 4; - public const int REG_NOTIFY_CHANGE_SECURITY = 8; - public const int KEY_NOTIFY = 16; - public const int KEY_READ = 131097; - public const int REG_SZ = 1; - public const int REG_DWORD = 4; - public const uint STATUS_ABANDONED_WAIT_0 = 128; - public const uint WAIT_ABANDONED = 128; - public const uint WAIT_TIMEOUT = 258; - public const uint WAIT_OBJECT_0 = 0; - public const uint INFINITE = 4294967295; - public const uint ERROR_SUCCESS = 0; - public const uint ERROR_FILE_NOT_FOUND = 2; - public const uint ERROR_PATH_NOT_FOUND = 3; - public const uint ERROR_ACCESS_DENIED = 5; - public const uint ERROR_INVALID_HANDLE = 6; - public const uint ERROR_NOT_ENOUGH_MEMORY = 8; - public const uint ERROR_OUTOFMEMORY = 14; - public const uint ERROR_NOT_SUPPORTED = 50; - public const uint ERROR_INVALID_PARAMETER = 87; - public const uint ERROR_CALL_NOT_IMPLEMENTED = 120; - public const uint ERROR_NOT_FOUND = 1168; - public const uint ERROR_NO_MATCH = 1169; - public const uint ERROR_SET_NOT_FOUND = 1170; - public const uint PM_REMOVE = 1; - public const uint WM_QUIT = 18; - public const uint WTS_CONSOLE_CONNECT = 1; - public const uint WTS_CONSOLE_DISCONNECT = 2; - public const uint WTS_REMOTE_CONNECT = 3; - public const uint WTS_REMOTE_DISCONNECT = 4; - public const uint WTS_SESSION_LOGON = 5; - public const uint WTS_SESSION_LOGOFF = 6; - public const uint WTS_SESSION_LOCK = 7; - public const uint WTS_SESSION_UNLOCK = 8; - public static readonly IntPtr HKEY_CURRENT_USER = new IntPtr(-2147483647); - public static IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); - private static readonly string[] s_rgsMessageNames = new string[0]; - - public static Win32Api.COLORREF ARGB(byte a, byte r, byte g, byte b) => new Win32Api.COLORREF((uint) ((int) a << 24 | (int) b << 16 | (int) g << 8) | (uint) r); - - public static Win32Api.COLORREF RGB(byte r, byte g, byte b) => new Win32Api.COLORREF((uint) ((int) b << 16 | (int) g << 8) | (uint) r); - - public static Win32Api.COLORREF RGB(int r, int g, int b) => Win32Api.RGB((byte) r, (byte) g, (byte) b); - - public static int GetRValue(Win32Api.COLORREF cr) => (int) cr.cr & (int) byte.MaxValue; - - public static int GetGValue(Win32Api.COLORREF cr) => (int) ((cr.cr & 65280U) >> 8); - - public static int GetBValue(Win32Api.COLORREF cr) => (int) ((cr.cr & 16711680U) >> 16); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern bool TranslateMessage(ref Win32Api.MSG msg); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern IntPtr DispatchMessage(ref Win32Api.MSG msg); - - [DllImport("user32.dll", EntryPoint = "GetWindowTextW", CharSet = CharSet.Unicode)] - public static extern int GetWindowText(HWND hWnd, StringBuilder text, int nMax); - - [DllImport("user32.dll", EntryPoint = "GetClassNameW", CharSet = CharSet.Unicode)] - public static extern int GetClassName(HWND hWnd, StringBuilder text, int nMax); - - [DllImport("user32.dll")] - public static extern bool ClientToScreen(HWND hwnd, [In, Out] ref Win32Api.POINT pt); - - [DllImport("user32.dll")] - public static extern bool ScreenToClient(HWND hwnd, [In, Out] ref Win32Api.POINT pt); - - [DllImport("user32.dll")] - public static extern int GetSystemMetrics(int metric); - - [DllImport("kernel32.dll")] - internal static extern Win32Api.HANDLE CreateEvent( - IntPtr lpSecurityAttributes, - bool bManualReset, - bool bInitialState, - string lpName); - - [DllImport("kernel32.dll")] - internal static extern bool CloseHandle(Win32Api.HANDLE hObject); - - [DllImport("kernel32.dll")] - public static extern void OutputDebugString(string lpOutputString); - - [DllImport("kernel32.dll")] - public static extern bool IsDebuggerPresent(); - - [DllImport("kernel32.dll")] - public static extern void DebugBreak(); - - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - internal static extern Win32Api.HINSTANCE LoadLibraryEx( - string stModuleName, - Win32Api.HANDLE hFile, - uint dwFlags); - - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - internal static extern bool FreeLibrary(Win32Api.HINSTANCE hinst); - - [DllImport("kernel32.dll", EntryPoint = "FindResourceW", CharSet = CharSet.Unicode)] - public static extern IntPtr FindResource(IntPtr hinst, string resource, IntPtr type); - - [DllImport("kernel32.dll")] - public static extern IntPtr LoadResource(IntPtr hinst, IntPtr i); - - [DllImport("kernel32.dll")] - public static extern IntPtr LockResource(IntPtr i); - - [DllImport("kernel32.dll")] - public static extern int SizeofResource(IntPtr hinst, IntPtr i); - - [DllImport("advapi32.dll")] - internal static extern int RegNotifyChangeKeyValue( - IntPtr hkey, - bool bWatchSubtree, - int dwNotifyFilter, - Win32Api.HANDLE hEvent, - bool fAsynchronous); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode)] - internal static extern int RegOpenKeyExW( - IntPtr hkey, - string szSubKey, - int dwOptions, - int samDesired, - out IntPtr phkResult); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode)] - public static extern int RegQueryValueExW( - IntPtr hKey, - string lpValueName, - IntPtr reserved, - out int lpType, - out int lpData, - ref int lpcbData); - - [DllImport("Advapi32.dll", CharSet = CharSet.Unicode)] - public static extern int RegQueryValueExW( - IntPtr hKey, - string lpValueName, - IntPtr reserved, - out int lpType, - char[] lpData, - ref int lpcbData); - - [DllImport("advapi32.dll")] - internal static extern int RegCloseKey(IntPtr hkey); - - [DllImport("kernel32.dll")] - public static extern void GetSystemInfo(out Win32Api.SYSTEM_INFO info); - - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern int RegisterWaitForSingleObject( - out IntPtr phNewWaitObject, - IntPtr hObject, - Win32Api.WaitOrTimerCallBack Callback, - IntPtr Context, - uint dwMilliseconds, - uint dwFlags); - - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern bool UnregisterWait(IntPtr hWaitHandle); - - internal static uint GetSystemPageSize() + [SuppressUnmanagedCodeSecurity] + internal static class Win32Api { - Win32Api.SYSTEM_INFO info; - Win32Api.GetSystemInfo(out info); - return info.dwPageSize; + public const int IDC_ARROW = 32512; + public const int IDC_IBEAM = 32513; + public const int IDC_WAIT = 32514; + public const int IDC_CROSS = 32515; + public const int IDC_UPARROW = 32516; + public const int IDC_SIZENWSE = 32642; + public const int IDC_SIZENESW = 32643; + public const int IDC_SIZEWE = 32644; + public const int IDC_SIZENS = 32645; + public const int IDC_SIZEALL = 32646; + public const int IDC_NO = 32648; + public const int IDC_HAND = 32649; + public const int IDC_APPSTARTING = 32550; + public const int IDC_HELP = 32651; + public const int SM_CXSCREEN = 0; + public const int SM_CYSCREEN = 1; + public const int RT_RCDATA = 10; + public const uint EVENT_MODIFY_STATE = 2; + public const uint LOAD_LIBRARY_AS_DATAFILE = 2; + public const int REG_NOTIFY_CHANGE_NAME = 1; + public const int REG_NOTIFY_CHANGE_ATTRIBUTES = 2; + public const int REG_NOTIFY_CHANGE_LAST_SET = 4; + public const int REG_NOTIFY_CHANGE_SECURITY = 8; + public const int KEY_NOTIFY = 16; + public const int KEY_READ = 131097; + public const int REG_SZ = 1; + public const int REG_DWORD = 4; + public const uint STATUS_ABANDONED_WAIT_0 = 128; + public const uint WAIT_ABANDONED = 128; + public const uint WAIT_TIMEOUT = 258; + public const uint WAIT_OBJECT_0 = 0; + public const uint INFINITE = 4294967295; + public const uint ERROR_SUCCESS = 0; + public const uint ERROR_FILE_NOT_FOUND = 2; + public const uint ERROR_PATH_NOT_FOUND = 3; + public const uint ERROR_ACCESS_DENIED = 5; + public const uint ERROR_INVALID_HANDLE = 6; + public const uint ERROR_NOT_ENOUGH_MEMORY = 8; + public const uint ERROR_OUTOFMEMORY = 14; + public const uint ERROR_NOT_SUPPORTED = 50; + public const uint ERROR_INVALID_PARAMETER = 87; + public const uint ERROR_CALL_NOT_IMPLEMENTED = 120; + public const uint ERROR_NOT_FOUND = 1168; + public const uint ERROR_NO_MATCH = 1169; + public const uint ERROR_SET_NOT_FOUND = 1170; + public const uint PM_REMOVE = 1; + public const uint WM_QUIT = 18; + public const uint WTS_CONSOLE_CONNECT = 1; + public const uint WTS_CONSOLE_DISCONNECT = 2; + public const uint WTS_REMOTE_CONNECT = 3; + public const uint WTS_REMOTE_DISCONNECT = 4; + public const uint WTS_SESSION_LOGON = 5; + public const uint WTS_SESSION_LOGOFF = 6; + public const uint WTS_SESSION_LOCK = 7; + public const uint WTS_SESSION_UNLOCK = 8; + public static readonly IntPtr HKEY_CURRENT_USER = new IntPtr(-2147483647); + public static IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); + private static readonly string[] s_rgsMessageNames = new string[0]; + + public static Win32Api.COLORREF ARGB(byte a, byte r, byte g, byte b) => new Win32Api.COLORREF((uint)((int)a << 24 | (int)b << 16 | (int)g << 8) | (uint)r); + + public static Win32Api.COLORREF RGB(byte r, byte g, byte b) => new Win32Api.COLORREF((uint)((int)b << 16 | (int)g << 8) | (uint)r); + + public static Win32Api.COLORREF RGB(int r, int g, int b) => Win32Api.RGB((byte)r, (byte)g, (byte)b); + + public static int GetRValue(Win32Api.COLORREF cr) => (int)cr.cr & (int)byte.MaxValue; + + public static int GetGValue(Win32Api.COLORREF cr) => (int)((cr.cr & 65280U) >> 8); + + public static int GetBValue(Win32Api.COLORREF cr) => (int)((cr.cr & 16711680U) >> 16); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + public static extern bool TranslateMessage(ref Win32Api.MSG msg); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + public static extern IntPtr DispatchMessage(ref Win32Api.MSG msg); + + [DllImport("user32.dll", EntryPoint = "GetWindowTextW", CharSet = CharSet.Unicode)] + public static extern int GetWindowText(HWND hWnd, StringBuilder text, int nMax); + + [DllImport("user32.dll", EntryPoint = "GetClassNameW", CharSet = CharSet.Unicode)] + public static extern int GetClassName(HWND hWnd, StringBuilder text, int nMax); + + [DllImport("user32.dll")] + public static extern bool ClientToScreen(HWND hwnd, [In, Out] ref Win32Api.POINT pt); + + [DllImport("user32.dll")] + public static extern bool ScreenToClient(HWND hwnd, [In, Out] ref Win32Api.POINT pt); + + [DllImport("user32.dll")] + public static extern int GetSystemMetrics(int metric); + + [DllImport("kernel32.dll")] + internal static extern Win32Api.HANDLE CreateEvent( + IntPtr lpSecurityAttributes, + bool bManualReset, + bool bInitialState, + string lpName); + + [DllImport("kernel32.dll")] + internal static extern bool CloseHandle(Win32Api.HANDLE hObject); + + [DllImport("kernel32.dll")] + public static extern void OutputDebugString(string lpOutputString); + + [DllImport("kernel32.dll")] + public static extern bool IsDebuggerPresent(); + + [DllImport("kernel32.dll")] + public static extern void DebugBreak(); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto)] + internal static extern Win32Api.HINSTANCE LoadLibraryEx( + string stModuleName, + Win32Api.HANDLE hFile, + uint dwFlags); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto)] + internal static extern bool FreeLibrary(Win32Api.HINSTANCE hinst); + + [DllImport("kernel32.dll", EntryPoint = "FindResourceW", CharSet = CharSet.Unicode)] + public static extern IntPtr FindResource(IntPtr hinst, string resource, IntPtr type); + + [DllImport("kernel32.dll")] + public static extern IntPtr LoadResource(IntPtr hinst, IntPtr i); + + [DllImport("kernel32.dll")] + public static extern IntPtr LockResource(IntPtr i); + + [DllImport("kernel32.dll")] + public static extern int SizeofResource(IntPtr hinst, IntPtr i); + + [DllImport("advapi32.dll")] + internal static extern int RegNotifyChangeKeyValue( + IntPtr hkey, + bool bWatchSubtree, + int dwNotifyFilter, + Win32Api.HANDLE hEvent, + bool fAsynchronous); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode)] + internal static extern int RegOpenKeyExW( + IntPtr hkey, + string szSubKey, + int dwOptions, + int samDesired, + out IntPtr phkResult); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode)] + public static extern int RegQueryValueExW( + IntPtr hKey, + string lpValueName, + IntPtr reserved, + out int lpType, + out int lpData, + ref int lpcbData); + + [DllImport("Advapi32.dll", CharSet = CharSet.Unicode)] + public static extern int RegQueryValueExW( + IntPtr hKey, + string lpValueName, + IntPtr reserved, + out int lpType, + char[] lpData, + ref int lpcbData); + + [DllImport("advapi32.dll")] + internal static extern int RegCloseKey(IntPtr hkey); + + [DllImport("kernel32.dll")] + public static extern void GetSystemInfo(out Win32Api.SYSTEM_INFO info); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto)] + public static extern int RegisterWaitForSingleObject( + out IntPtr phNewWaitObject, + IntPtr hObject, + Win32Api.WaitOrTimerCallBack Callback, + IntPtr Context, + uint dwMilliseconds, + uint dwFlags); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto)] + public static extern bool UnregisterWait(IntPtr hWaitHandle); + + internal static uint GetSystemPageSize() + { + Win32Api.SYSTEM_INFO info; + Win32Api.GetSystemInfo(out info); + return info.dwPageSize; + } + + internal static string DumpMessage(uint uMsg) => Win32Api.DumpMessageWorker(uMsg) ?? "UNKNOWN MESSAGE"; + + private static string DumpMessageWorker(uint uMsg) + { + Win32Api.InitMessageDump(); + if ((long)uMsg >= (long)Win32Api.s_rgsMessageNames.Length) + return (string)null; + string rgsMessageName = Win32Api.s_rgsMessageNames[(IntPtr)uMsg]; + if (rgsMessageName != null) + return rgsMessageName; + uint num = uMsg; + while (uMsg > 0U) + { + --num; + rgsMessageName = Win32Api.s_rgsMessageNames[(IntPtr)num]; + if (rgsMessageName != null) + break; + } + if (rgsMessageName == null) + return (string)null; + return string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} + {1}", (object)rgsMessageName, (object)(uint)((int)uMsg - (int)num)); + } + + private static void InitMessageDump() + { + } + + [StructLayout(LayoutKind.Sequential)] + internal class CRITICAL_SECTION + { + public IntPtr DebugInfo; + public long LockCount; + public long RecursionCount; + public int OwningThread; + public int LockSemaphore; + public IntPtr SpinCount; + } + + [Serializable] + internal struct HANDLE + { + public IntPtr h; + + public bool IsValid => this.h != Win32Api.INVALID_HANDLE_VALUE; + + public static Win32Api.HANDLE NULL => new Win32Api.HANDLE() + { + h = IntPtr.Zero + }; + + public static Win32Api.HANDLE INVALID => new Win32Api.HANDLE() + { + h = Win32Api.INVALID_HANDLE_VALUE + }; + + public static bool operator ==(Win32Api.HANDLE hl, Win32Api.HANDLE hr) => hl.h == hr.h; + + public static bool operator !=(Win32Api.HANDLE hl, Win32Api.HANDLE hr) => hl.h != hr.h; + + public override bool Equals(object oCompare) => this.h == (IntPtr)oCompare; + + public override int GetHashCode() => (int)this.h.ToInt64(); + } + + internal struct HINSTANCE + { + public IntPtr h; + + public static Win32Api.HINSTANCE NULL => new Win32Api.HINSTANCE() + { + h = IntPtr.Zero + }; + + public static bool operator ==(Win32Api.HINSTANCE hl, Win32Api.HINSTANCE hr) => hl.h == hr.h; + + public static bool operator !=(Win32Api.HINSTANCE hl, Win32Api.HINSTANCE hr) => hl.h != hr.h; + + public override bool Equals(object oCompare) => this.h == (IntPtr)oCompare; + + public override int GetHashCode() => (int)this.h.ToInt64(); + } + + internal struct MSG + { + public HWND hwnd; + public uint message; + public IntPtr wParam; + public IntPtr lParam; + public uint time; + public int pt_x; + public int pt_y; + } + + [ComVisible(false)] + public struct SYSTEM_INFO + { + public ushort wProcessorArchitecture; + public ushort wReserved; + public uint dwPageSize; + public IntPtr lpMinimumApplicationAddress; + public IntPtr lpMaximumApplicationAddress; + public IntPtr dwActiveProcessorMask; + public uint dwNumberOfProcessors; + public uint dwProcessorType; + public uint dwAllocationGranularity; + public ushort wProcessorLevel; + public ushort wProcessorRevision; + } + + public struct SIZE + { + public int cx; + public int cy; + + public SIZE(int cx, int cy) + { + this.cx = cx; + this.cy = cy; + } + } + + [Serializable] + public struct POINT + { + public int x; + public int y; + + public POINT(int x, int y) + { + this.x = x; + this.y = y; + } + } + + [Serializable] + public struct RECT + { + public int left; + public int top; + public int right; + public int bottom; + + public RECT(int left, int top, int right, int bottom) + { + this.left = left; + this.top = top; + this.right = right; + this.bottom = bottom; + } + + public RECT(Win32Api.RECT rcSrc) + { + this.left = rcSrc.left; + this.top = rcSrc.top; + this.right = rcSrc.right; + this.bottom = rcSrc.bottom; + } + + public int Width + { + get => this.right - this.left; + set => this.right = this.left + value; + } + + public int Height + { + get => this.bottom - this.top; + set => this.bottom = this.top + value; + } + + public static Win32Api.RECT FromXYWH(int x, int y, int width, int height) => new Win32Api.RECT(x, y, x + width, y + height); + } + + public struct COLORREF + { + public uint cr; + + public COLORREF(uint cr) => this.cr = cr; + + public COLORREF(Win32Api.COLORREF cr) => this.cr = cr.cr; + } + + public delegate void WaitOrTimerCallBack(IntPtr lpParameter, byte f); } - - internal static string DumpMessage(uint uMsg) => Win32Api.DumpMessageWorker(uMsg) ?? "UNKNOWN MESSAGE"; - - private static string DumpMessageWorker(uint uMsg) - { - Win32Api.InitMessageDump(); - if ((long) uMsg >= (long) Win32Api.s_rgsMessageNames.Length) - return (string) null; - string rgsMessageName = Win32Api.s_rgsMessageNames[(IntPtr) uMsg]; - if (rgsMessageName != null) - return rgsMessageName; - uint num = uMsg; - while (uMsg > 0U) - { - --num; - rgsMessageName = Win32Api.s_rgsMessageNames[(IntPtr) num]; - if (rgsMessageName != null) - break; - } - if (rgsMessageName == null) - return (string) null; - return string.Format((IFormatProvider) CultureInfo.InvariantCulture, "{0} + {1}", (object) rgsMessageName, (object) (uint) ((int) uMsg - (int) num)); - } - - private static void InitMessageDump() - { - } - - [StructLayout(LayoutKind.Sequential)] - internal class CRITICAL_SECTION - { - public IntPtr DebugInfo; - public long LockCount; - public long RecursionCount; - public int OwningThread; - public int LockSemaphore; - public IntPtr SpinCount; - } - - [Serializable] - internal struct HANDLE - { - public IntPtr h; - - public bool IsValid => this.h != Win32Api.INVALID_HANDLE_VALUE; - - public static Win32Api.HANDLE NULL => new Win32Api.HANDLE() - { - h = IntPtr.Zero - }; - - public static Win32Api.HANDLE INVALID => new Win32Api.HANDLE() - { - h = Win32Api.INVALID_HANDLE_VALUE - }; - - public static bool operator ==(Win32Api.HANDLE hl, Win32Api.HANDLE hr) => hl.h == hr.h; - - public static bool operator !=(Win32Api.HANDLE hl, Win32Api.HANDLE hr) => hl.h != hr.h; - - public override bool Equals(object oCompare) => this.h == (IntPtr) oCompare; - - public override int GetHashCode() => (int) this.h.ToInt64(); - } - - internal struct HINSTANCE - { - public IntPtr h; - - public static Win32Api.HINSTANCE NULL => new Win32Api.HINSTANCE() - { - h = IntPtr.Zero - }; - - public static bool operator ==(Win32Api.HINSTANCE hl, Win32Api.HINSTANCE hr) => hl.h == hr.h; - - public static bool operator !=(Win32Api.HINSTANCE hl, Win32Api.HINSTANCE hr) => hl.h != hr.h; - - public override bool Equals(object oCompare) => this.h == (IntPtr) oCompare; - - public override int GetHashCode() => (int) this.h.ToInt64(); - } - - internal struct MSG - { - public HWND hwnd; - public uint message; - public IntPtr wParam; - public IntPtr lParam; - public uint time; - public int pt_x; - public int pt_y; - } - - [ComVisible(false)] - public struct SYSTEM_INFO - { - public ushort wProcessorArchitecture; - public ushort wReserved; - public uint dwPageSize; - public IntPtr lpMinimumApplicationAddress; - public IntPtr lpMaximumApplicationAddress; - public IntPtr dwActiveProcessorMask; - public uint dwNumberOfProcessors; - public uint dwProcessorType; - public uint dwAllocationGranularity; - public ushort wProcessorLevel; - public ushort wProcessorRevision; - } - - public struct SIZE - { - public int cx; - public int cy; - - public SIZE(int cx, int cy) - { - this.cx = cx; - this.cy = cy; - } - } - - [Serializable] - public struct POINT - { - public int x; - public int y; - - public POINT(int x, int y) - { - this.x = x; - this.y = y; - } - } - - [Serializable] - public struct RECT - { - public int left; - public int top; - public int right; - public int bottom; - - public RECT(int left, int top, int right, int bottom) - { - this.left = left; - this.top = top; - this.right = right; - this.bottom = bottom; - } - - public RECT(Win32Api.RECT rcSrc) - { - this.left = rcSrc.left; - this.top = rcSrc.top; - this.right = rcSrc.right; - this.bottom = rcSrc.bottom; - } - - public int Width - { - get => this.right - this.left; - set => this.right = this.left + value; - } - - public int Height - { - get => this.bottom - this.top; - set => this.bottom = this.top + value; - } - - public static Win32Api.RECT FromXYWH(int x, int y, int width, int height) => new Win32Api.RECT(x, y, x + width, y + height); - } - - public struct COLORREF - { - public uint cr; - - public COLORREF(uint cr) => this.cr = cr; - - public COLORREF(Win32Api.COLORREF cr) => this.cr = cr.cr; - } - - public delegate void WaitOrTimerCallBack(IntPtr lpParameter, byte f); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/InterpolateElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/InterpolateElement.cs index 72da5b9..2785bd1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/InterpolateElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/InterpolateElement.cs @@ -10,68 +10,68 @@ using System; namespace Microsoft.Iris.Render { - public class InterpolateElement : EffectInput - { - internal const string ValuePropertyName = "Value"; - private EffectInput m_effectInput1; - private EffectInput m_effectInput2; - private float m_flValue; - private byte m_nValueID; - - public InterpolateElement( - string stName, - EffectInput effectInput1, - EffectInput effectInput2, - float flValue) - : this() + public class InterpolateElement : EffectInput { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate(effectInput1 != null, typeof (ArgumentNullException), nameof (effectInput1)); - Debug2.Validate(effectInput2 != null, typeof (ArgumentNullException), nameof (effectInput2)); - Debug2.Validate((double) flValue >= 0.0 && (double) flValue <= 1.0, typeof (ArgumentOutOfRangeException), nameof (flValue)); - this.m_stName = stName; - this.m_effectInput1 = effectInput1; - this.m_effectInput2 = effectInput2; - this.m_flValue = flValue; + internal const string ValuePropertyName = "Value"; + private EffectInput m_effectInput1; + private EffectInput m_effectInput2; + private float m_flValue; + private byte m_nValueID; + + public InterpolateElement( + string stName, + EffectInput effectInput1, + EffectInput effectInput2, + float flValue) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate(effectInput1 != null, typeof(ArgumentNullException), nameof(effectInput1)); + Debug2.Validate(effectInput2 != null, typeof(ArgumentNullException), nameof(effectInput2)); + Debug2.Validate((double)flValue >= 0.0 && (double)flValue <= 1.0, typeof(ArgumentOutOfRangeException), nameof(flValue)); + this.m_stName = stName; + this.m_effectInput1 = effectInput1; + this.m_effectInput2 = effectInput2; + this.m_flValue = flValue; + } + + public InterpolateElement() => this.m_typeInput = EffectInputType.Interpolate; + + public EffectInput Input1 + { + get => this.m_effectInput1; + set => this.m_effectInput1 = value; + } + + public EffectInput Input2 + { + get => this.m_effectInput2; + set => this.m_effectInput2 = value; + } + + public float Value + { + get => this.m_flValue; + set => this.m_flValue = value; + } + + internal byte ValueID => this.m_nValueID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.m_effectInput1.PreProcessProperties(dictionary, ref nNextUniqueID) + this.m_effectInput2.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Value", (byte)8, ref this.m_nValueID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.m_effectInput1.Process(dictProperties) && this.m_effectInput2.Process(dictProperties) && this.GenerateProperty("Value", EffectPropertyType.Float, (object)this.m_flValue, this.m_nValueID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.m_effectInput1.AddCacheKey(cacheKey); + this.m_effectInput2.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Value", this.ValueID, this.Value, cacheKey); + } } - - public InterpolateElement() => this.m_typeInput = EffectInputType.Interpolate; - - public EffectInput Input1 - { - get => this.m_effectInput1; - set => this.m_effectInput1 = value; - } - - public EffectInput Input2 - { - get => this.m_effectInput2; - set => this.m_effectInput2 = value; - } - - public float Value - { - get => this.m_flValue; - set => this.m_flValue = value; - } - - internal byte ValueID => this.m_nValueID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.m_effectInput1.PreProcessProperties(dictionary, ref nNextUniqueID) + this.m_effectInput2.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Value", (byte) 8, ref this.m_nValueID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.m_effectInput1.Process(dictProperties) && this.m_effectInput2.Process(dictProperties) && this.GenerateProperty("Value", EffectPropertyType.Float, (object) this.m_flValue, this.m_nValueID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.m_effectInput1.AddCacheKey(cacheKey); - this.m_effectInput2.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Value", this.ValueID, this.Value, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvAlphaElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvAlphaElement.cs index 88f4415..14be554 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvAlphaElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvAlphaElement.cs @@ -6,8 +6,8 @@ namespace Microsoft.Iris.Render { - public class InvAlphaElement : EffectOperation - { - public InvAlphaElement() => this.m_typeOperation = EffectOperationType.InvAlpha; - } + public class InvAlphaElement : EffectOperation + { + public InvAlphaElement() => this.m_typeOperation = EffectOperationType.InvAlpha; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvColorElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvColorElement.cs index 87d4181..e6f81ac 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvColorElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvColorElement.cs @@ -6,8 +6,8 @@ namespace Microsoft.Iris.Render { - public class InvColorElement : EffectOperation - { - public InvColorElement() => this.m_typeOperation = EffectOperationType.InvColor; - } + public class InvColorElement : EffectOperation + { + public InvColorElement() => this.m_typeOperation = EffectOperationType.InvColor; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvalidateContentHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvalidateContentHandler.cs index 33e24ff..3423c07 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvalidateContentHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvalidateContentHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void InvalidateContentHandler(); + public delegate void InvalidateContentHandler(); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvertElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvertElement.cs index 8f33bd8..cc551a0 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvertElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/InvertElement.cs @@ -9,15 +9,15 @@ using System; namespace Microsoft.Iris.Render { - public class InvertElement : EffectOperation - { - public InvertElement(string stName) - : this() + public class InvertElement : EffectOperation { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - this.m_stName = stName; - } + public InvertElement(string stName) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + this.m_stName = stName; + } - public InvertElement() => this.m_typeOperation = EffectOperationType.Invert; - } + public InvertElement() => this.m_typeOperation = EffectOperationType.Invert; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IrisEngineInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IrisEngineInfo.cs index 416b82a..a3c9632 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IrisEngineInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IrisEngineInfo.cs @@ -9,34 +9,34 @@ using System; namespace Microsoft.Iris.Render { - public sealed class IrisEngineInfo : EngineInfo - { - private ConnectionInfo m_connectionInfo; - - public static EngineInfo CreateLocal() => (EngineInfo) new IrisEngineInfo(true); - - public static EngineInfo CreateRemote() => (EngineInfo) new IrisEngineInfo(true, TransportProtocol.TCP, "127.0.0.1", false); - - internal IrisEngineInfo(bool isPrimary) - : base(EngineType.Iris) + public sealed class IrisEngineInfo : EngineInfo { - if (!isPrimary) - throw new NotImplementedException("Local connections to an existing engine are not supported yet"); - this.m_connectionInfo = (ConnectionInfo) new LocalConnectionInfo(); - } + private ConnectionInfo m_connectionInfo; - internal IrisEngineInfo( - bool isPrimary, - TransportProtocol protocol, - string sessionName, - bool swapByteOrder) - : base(EngineType.Iris) - { - if (!isPrimary) - throw new NotImplementedException("Local connections to an existing engine are not supported yet"); - this.m_connectionInfo = (ConnectionInfo) new RemoteConnectionInfo(protocol, sessionName, swapByteOrder); - } + public static EngineInfo CreateLocal() => (EngineInfo)new IrisEngineInfo(true); - internal ConnectionInfo ConnectionInfo => this.m_connectionInfo; - } + public static EngineInfo CreateRemote() => (EngineInfo)new IrisEngineInfo(true, TransportProtocol.TCP, "127.0.0.1", false); + + internal IrisEngineInfo(bool isPrimary) + : base(EngineType.Iris) + { + if (!isPrimary) + throw new NotImplementedException("Local connections to an existing engine are not supported yet"); + this.m_connectionInfo = (ConnectionInfo)new LocalConnectionInfo(); + } + + internal IrisEngineInfo( + bool isPrimary, + TransportProtocol protocol, + string sessionName, + bool swapByteOrder) + : base(EngineType.Iris) + { + if (!isPrimary) + throw new NotImplementedException("Local connections to an existing engine are not supported yet"); + this.m_connectionInfo = (ConnectionInfo)new RemoteConnectionInfo(protocol, sessionName, swapByteOrder); + } + + internal ConnectionInfo ConnectionInfo => this.m_connectionInfo; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Key.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Key.cs index c3efdab..21585f8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Key.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Key.cs @@ -8,41 +8,41 @@ using Microsoft.Iris.Render.Common; namespace Microsoft.Iris.Render { - internal static class Key - { - public const string PublicKey = "0x0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"; - public const string PublicKeyToken = "31bf3856ad364e35"; - public const string PublicKeyTokenAttrib = ",PublicKeyToken=31bf3856ad364e35"; - public const string PublicKeyAttrib = ",PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"; - private static readonly byte[] s_arPublicKeyBinary = Key.ComputeBinaryKey(); - - public static byte[] PublicKeyBinary => (byte[]) Key.s_arPublicKeyBinary.Clone(); - - private static byte[] ComputeBinaryKey() + internal static class Key { - int length = "0x0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9".Length / 2 - 1; - byte[] numArray = new byte[length]; - int index1 = 2; - int index2 = 0; - while (index2 < length) - { - numArray[index2] = (byte) (Key.ParseNibble("0x0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"[index1]) << 4 | Key.ParseNibble("0x0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"[index1 + 1])); - ++index2; - index1 += 2; - } - return numArray; - } + public const string PublicKey = "0x0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"; + public const string PublicKeyToken = "31bf3856ad364e35"; + public const string PublicKeyTokenAttrib = ",PublicKeyToken=31bf3856ad364e35"; + public const string PublicKeyAttrib = ",PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"; + private static readonly byte[] s_arPublicKeyBinary = Key.ComputeBinaryKey(); - private static uint ParseNibble(char c) - { - if (c >= '0' && c <= '9') - return (uint) c - 48U; - if (c >= 'a' && c <= 'f') - return (uint) (10 + ((int) c - 97)); - if (c >= 'A' && c <= 'F') - return (uint) (10 + ((int) c - 65)); - Debug2.Throw(false, "invalid number format"); - return 0; + public static byte[] PublicKeyBinary => (byte[])Key.s_arPublicKeyBinary.Clone(); + + private static byte[] ComputeBinaryKey() + { + int length = "0x0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9".Length / 2 - 1; + byte[] numArray = new byte[length]; + int index1 = 2; + int index2 = 0; + while (index2 < length) + { + numArray[index2] = (byte)(Key.ParseNibble("0x0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"[index1]) << 4 | Key.ParseNibble("0x0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"[index1 + 1])); + ++index2; + index1 += 2; + } + return numArray; + } + + private static uint ParseNibble(char c) + { + if (c >= '0' && c <= '9') + return (uint)c - 48U; + if (c >= 'a' && c <= 'f') + return (uint)(10 + ((int)c - 97)); + if (c >= 'A' && c <= 'F') + return (uint)(10 + ((int)c - 65)); + Debug2.Throw(false, "invalid number format"); + return 0; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/LightShaftElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/LightShaftElement.cs index ee6d176..a6b35a2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/LightShaftElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/LightShaftElement.cs @@ -10,140 +10,140 @@ using System; namespace Microsoft.Iris.Render { - public class LightShaftElement : EffectOperation - { - internal const string PositionPropertyName = "Position"; - internal const string DecayPropertyName = "Decay"; - internal const string DensityPropertyName = "Density"; - internal const string IntensityPropertyName = "Intensity"; - internal const string FallOffPropertyName = "FallOff"; - internal const string WeightPropertyName = "Weight"; - private Vector3 m_vPosition; - private byte m_nPositionID; - private float m_flDecay; - private byte m_nDecayID; - private float m_flDensity; - private byte m_nDensityID; - private float m_flIntensity; - private byte m_nIntensityID; - private float m_flFallOff; - private byte m_nFallOffID; - private float m_flWeight; - private byte m_nWeightID; - - public LightShaftElement( - string stName, - Vector3 vPosition, - float flDecay, - float flDensity, - float flFallOff, - float flIntensity, - float flWeight) - : this() + public class LightShaftElement : EffectOperation { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate((double) flDecay >= 0.0 && (double) flDecay <= 1.0, typeof (ArgumentOutOfRangeException), "Valid range for Decay is [0,1]"); - Debug2.Validate((double) flDensity > 0.0 && (double) flDensity <= 1.0, typeof (ArgumentOutOfRangeException), "Valid range for Density is (0..1]"); - Debug2.Validate((double) flFallOff >= 0.0 && (double) flFallOff <= 2.0, typeof (ArgumentOutOfRangeException), "Valid range for FallOff is [0..2])"); - Debug2.Validate((double) flIntensity >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Intensity is [0..)"); - Debug2.Validate((double) flWeight >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Weight is [0..)"); - this.m_stName = stName; - this.m_vPosition = vPosition; - this.m_flDecay = flDecay; - this.m_flDensity = flDensity; - this.m_flIntensity = flIntensity; - this.m_flFallOff = flFallOff; - this.m_flWeight = flWeight; + internal const string PositionPropertyName = "Position"; + internal const string DecayPropertyName = "Decay"; + internal const string DensityPropertyName = "Density"; + internal const string IntensityPropertyName = "Intensity"; + internal const string FallOffPropertyName = "FallOff"; + internal const string WeightPropertyName = "Weight"; + private Vector3 m_vPosition; + private byte m_nPositionID; + private float m_flDecay; + private byte m_nDecayID; + private float m_flDensity; + private byte m_nDensityID; + private float m_flIntensity; + private byte m_nIntensityID; + private float m_flFallOff; + private byte m_nFallOffID; + private float m_flWeight; + private byte m_nWeightID; + + public LightShaftElement( + string stName, + Vector3 vPosition, + float flDecay, + float flDensity, + float flFallOff, + float flIntensity, + float flWeight) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate((double)flDecay >= 0.0 && (double)flDecay <= 1.0, typeof(ArgumentOutOfRangeException), "Valid range for Decay is [0,1]"); + Debug2.Validate((double)flDensity > 0.0 && (double)flDensity <= 1.0, typeof(ArgumentOutOfRangeException), "Valid range for Density is (0..1]"); + Debug2.Validate((double)flFallOff >= 0.0 && (double)flFallOff <= 2.0, typeof(ArgumentOutOfRangeException), "Valid range for FallOff is [0..2])"); + Debug2.Validate((double)flIntensity >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Intensity is [0..)"); + Debug2.Validate((double)flWeight >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Weight is [0..)"); + this.m_stName = stName; + this.m_vPosition = vPosition; + this.m_flDecay = flDecay; + this.m_flDensity = flDensity; + this.m_flIntensity = flIntensity; + this.m_flFallOff = flFallOff; + this.m_flWeight = flWeight; + } + + public LightShaftElement() => this.m_typeOperation = EffectOperationType.LightShaft; + + public Vector3 Position + { + get => this.m_vPosition; + set => this.m_vPosition = value; + } + + internal byte PositionID => this.m_nPositionID; + + public float Decay + { + get => this.m_flDecay; + set + { + Debug2.Validate((double)value >= 0.0 && (double)value <= 1.0, typeof(ArgumentOutOfRangeException), "Valid range for Decay is [0,1]"); + this.m_flDecay = value; + } + } + + internal byte DecayID => this.m_nDecayID; + + public float Density + { + get => this.m_flDensity; + set + { + Debug2.Validate((double)value > 0.0 && (double)value <= 1.0, typeof(ArgumentOutOfRangeException), "Valid range for Density is (0..1]"); + this.m_flDensity = value; + } + } + + internal byte DensityID => this.m_nDensityID; + + public float Intensity + { + get => this.m_flIntensity; + set + { + Debug2.Validate((double)value >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Intensity is [0..)"); + this.m_flIntensity = value; + } + } + + internal byte IntensityID => this.m_nIntensityID; + + public float FallOff + { + get => this.m_flFallOff; + set + { + Debug2.Validate((double)value >= 0.0 && (double)value <= 2.0, typeof(ArgumentOutOfRangeException), "Valid range for FallOff is [0..2])"); + this.m_flFallOff = value; + } + } + + internal byte FallOffID => this.m_nFallOffID; + + public float Weight + { + get => this.m_flWeight; + set + { + Debug2.Validate((double)value >= 0.0 && (double)value <= 1.0, typeof(ArgumentOutOfRangeException), "Valid range for Weight is [0..)"); + this.m_flWeight = value; + } + } + + internal byte WeightID => this.m_nWeightID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Position", (byte)16, ref this.m_nPositionID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Decay", (byte)8, ref this.m_nDecayID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Density", (byte)8, ref this.m_nDensityID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Intensity", (byte)8, ref this.m_nIntensityID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "FallOff", (byte)8, ref this.m_nFallOffID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Weight", (byte)8, ref this.m_nWeightID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("Position", EffectPropertyType.Vector3, (object)this.m_vPosition, this.m_nPositionID, dictProperties) && this.GenerateProperty("Decay", EffectPropertyType.Float, (object)this.m_flDecay, this.m_nDecayID, dictProperties) && (this.GenerateProperty("Density", EffectPropertyType.Float, (object)this.m_flDensity, this.m_nDensityID, dictProperties) && this.GenerateProperty("Intensity", EffectPropertyType.Float, (object)this.m_flIntensity, this.m_nIntensityID, dictProperties)) && this.GenerateProperty("FallOff", EffectPropertyType.Float, (object)this.m_flFallOff, this.m_nFallOffID, dictProperties) && this.GenerateProperty("Weight", EffectPropertyType.Float, (object)this.m_flWeight, this.m_nWeightID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Position", this.PositionID, this.Position, cacheKey); + this.GeneratePropertyCacheKey("Decay", this.DecayID, this.Decay, cacheKey); + this.GeneratePropertyCacheKey("Density", this.DensityID, this.Density, cacheKey); + this.GeneratePropertyCacheKey("Intensity", this.IntensityID, this.Intensity, cacheKey); + this.GeneratePropertyCacheKey("FallOff", this.FallOffID, this.FallOff, cacheKey); + this.GeneratePropertyCacheKey("Weight", this.WeightID, this.Weight, cacheKey); + } } - - public LightShaftElement() => this.m_typeOperation = EffectOperationType.LightShaft; - - public Vector3 Position - { - get => this.m_vPosition; - set => this.m_vPosition = value; - } - - internal byte PositionID => this.m_nPositionID; - - public float Decay - { - get => this.m_flDecay; - set - { - Debug2.Validate((double) value >= 0.0 && (double) value <= 1.0, typeof (ArgumentOutOfRangeException), "Valid range for Decay is [0,1]"); - this.m_flDecay = value; - } - } - - internal byte DecayID => this.m_nDecayID; - - public float Density - { - get => this.m_flDensity; - set - { - Debug2.Validate((double) value > 0.0 && (double) value <= 1.0, typeof (ArgumentOutOfRangeException), "Valid range for Density is (0..1]"); - this.m_flDensity = value; - } - } - - internal byte DensityID => this.m_nDensityID; - - public float Intensity - { - get => this.m_flIntensity; - set - { - Debug2.Validate((double) value >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Intensity is [0..)"); - this.m_flIntensity = value; - } - } - - internal byte IntensityID => this.m_nIntensityID; - - public float FallOff - { - get => this.m_flFallOff; - set - { - Debug2.Validate((double) value >= 0.0 && (double) value <= 2.0, typeof (ArgumentOutOfRangeException), "Valid range for FallOff is [0..2])"); - this.m_flFallOff = value; - } - } - - internal byte FallOffID => this.m_nFallOffID; - - public float Weight - { - get => this.m_flWeight; - set - { - Debug2.Validate((double) value >= 0.0 && (double) value <= 1.0, typeof (ArgumentOutOfRangeException), "Valid range for Weight is [0..)"); - this.m_flWeight = value; - } - } - - internal byte WeightID => this.m_nWeightID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Position", (byte) 16, ref this.m_nPositionID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Decay", (byte) 8, ref this.m_nDecayID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Density", (byte) 8, ref this.m_nDensityID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Intensity", (byte) 8, ref this.m_nIntensityID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "FallOff", (byte) 8, ref this.m_nFallOffID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Weight", (byte) 8, ref this.m_nWeightID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("Position", EffectPropertyType.Vector3, (object) this.m_vPosition, this.m_nPositionID, dictProperties) && this.GenerateProperty("Decay", EffectPropertyType.Float, (object) this.m_flDecay, this.m_nDecayID, dictProperties) && (this.GenerateProperty("Density", EffectPropertyType.Float, (object) this.m_flDensity, this.m_nDensityID, dictProperties) && this.GenerateProperty("Intensity", EffectPropertyType.Float, (object) this.m_flIntensity, this.m_nIntensityID, dictProperties)) && this.GenerateProperty("FallOff", EffectPropertyType.Float, (object) this.m_flFallOff, this.m_nFallOffID, dictProperties) && this.GenerateProperty("Weight", EffectPropertyType.Float, (object) this.m_flWeight, this.m_nWeightID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Position", this.PositionID, this.Position, cacheKey); - this.GeneratePropertyCacheKey("Decay", this.DecayID, this.Decay, cacheKey); - this.GeneratePropertyCacheKey("Density", this.DensityID, this.Density, cacheKey); - this.GeneratePropertyCacheKey("Intensity", this.IntensityID, this.Intensity, cacheKey); - this.GeneratePropertyCacheKey("FallOff", this.FallOffID, this.FallOff, cacheKey); - this.GeneratePropertyCacheKey("Weight", this.WeightID, this.Weight, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/LinearInterpolation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/LinearInterpolation.cs index 3094789..6b1a6fd 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/LinearInterpolation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/LinearInterpolation.cs @@ -6,7 +6,7 @@ namespace Microsoft.Iris.Render { - public sealed class LinearInterpolation : AnimationInterpolation - { - } + public sealed class LinearInterpolation : AnimationInterpolation + { + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/LoadHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/LoadHandler.cs index 9f85f78..0f16929 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/LoadHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/LoadHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void LoadHandler(); + public delegate void LoadHandler(); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/LocationChangedHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/LocationChangedHandler.cs index fb398a1..dbe0e9f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/LocationChangedHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/LocationChangedHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void LocationChangedHandler(Point ptPosition); + public delegate void LocationChangedHandler(Point ptPosition); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/LogarithmicInterpolation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/LogarithmicInterpolation.cs index 28e82a5..1b08088 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/LogarithmicInterpolation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/LogarithmicInterpolation.cs @@ -9,16 +9,16 @@ using System; namespace Microsoft.Iris.Render { - public sealed class LogarithmicInterpolation : AnimationInterpolation - { - private float m_weight; - - public LogarithmicInterpolation(float weight) + public sealed class LogarithmicInterpolation : AnimationInterpolation { - Debug2.Validate((double) weight > 0.0, typeof (ArgumentOutOfRangeException), "'weight' must be > 0"); - this.m_weight = weight; - } + private float m_weight; - internal float Weight => this.m_weight; - } + public LogarithmicInterpolation(float weight) + { + Debug2.Validate((double)weight > 0.0, typeof(ArgumentOutOfRangeException), "'weight' must be > 0"); + this.m_weight = weight; + } + + internal float Weight => this.m_weight; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/MonitorChangedHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/MonitorChangedHandler.cs index b277e8a..db98a3f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/MonitorChangedHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/MonitorChangedHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void MonitorChangedHandler(); + public delegate void MonitorChangedHandler(); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/MouseIdleHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/MouseIdleHandler.cs index f4a91d8..ec0940a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/MouseIdleHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/MouseIdleHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void MouseIdleHandler(bool fIdle); + public delegate void MouseIdleHandler(bool fIdle); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/MouseOptions.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/MouseOptions.cs index 3644856..1970108 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/MouseOptions.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/MouseOptions.cs @@ -8,14 +8,14 @@ using System; namespace Microsoft.Iris.Render { - [Flags] - public enum MouseOptions - { - Traversable = 1, - Hittable = 2, - Returnable = 4, - ClipChildren = 8, - None = 0, - ValidMask = ClipChildren | Returnable | Hittable | Traversable, // 0x0000000F - } + [Flags] + public enum MouseOptions + { + Traversable = 1, + Hittable = 2, + Returnable = 4, + ClipChildren = 8, + None = 0, + ValidMask = ClipChildren | Returnable | Hittable | Traversable, // 0x0000000F + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Orientation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Orientation.cs index 70a1473..3dd4134 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Orientation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Orientation.cs @@ -6,9 +6,9 @@ namespace Microsoft.Iris.Render { - public enum Orientation - { - Horizontal, - Vertical, - } + public enum Orientation + { + Horizontal, + Vertical, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Point.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Point.cs index b09cedd..e243cda 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Point.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Point.cs @@ -8,81 +8,81 @@ using System; namespace Microsoft.Iris.Render { - [Serializable] - public struct Point - { - private int m_x; - private int m_y; - public static readonly Point Zero = new Point(0, 0); - - public Point(int x, int y) + [Serializable] + public struct Point { - this.m_x = x; - this.m_y = y; + private int m_x; + private int m_y; + public static readonly Point Zero = new Point(0, 0); + + public Point(int x, int y) + { + this.m_x = x; + this.m_y = y; + } + + public Point(Size size) + { + this.m_x = size.Width; + this.m_y = size.Height; + } + + public int X + { + get => this.m_x; + set => this.m_x = value; + } + + public int Y + { + get => this.m_y; + set => this.m_y = value; + } + + public int GetDimension(Orientation orientation) => orientation != Orientation.Horizontal ? this.Y : this.X; + + public void SetDimension(Orientation orientation, int value) + { + if (orientation == Orientation.Horizontal) + this.X = value; + else + this.Y = value; + } + + public static Point operator +(Point left, Point right) => new Point(left.X + right.X, left.Y + right.Y); + + public static Point Add(Point left, Point right) => left + right; + + public static Point operator -(Point left, Point right) => new Point(left.X - right.X, left.Y - right.Y); + + public static Point operator -(Point pt) => new Point(-pt.X, -pt.Y); + + public static Point Subtract(Point left, Point right) => left - right; + + public static Point Offset(Point point, int x, int y) => new Point(point.X + x, point.Y + y); + + public override bool Equals(object obj) => obj is Point point && point.X == this.X && point.Y == this.Y; + + public bool Equals(Point comp) => comp.X == this.X && comp.Y == this.Y; + + public static bool operator ==(Point left, Point right) => left.X == right.X && left.Y == right.Y; + + public static bool operator !=(Point left, Point right) => !(left == right); + + public override int GetHashCode() => this.X ^ this.Y; + + public override string ToString() => base.ToString(); + + public bool IsZero => this.Equals(Point.Zero); + + public void Offset(int dx, int dy) + { + this.X += dx; + this.Y += dy; + } + + public Size ToSize() => new Size(this.X, this.Y); + + public static Point Negate(Point point) => new Point(-point.X, -point.Y); } - - public Point(Size size) - { - this.m_x = size.Width; - this.m_y = size.Height; - } - - public int X - { - get => this.m_x; - set => this.m_x = value; - } - - public int Y - { - get => this.m_y; - set => this.m_y = value; - } - - public int GetDimension(Orientation orientation) => orientation != Orientation.Horizontal ? this.Y : this.X; - - public void SetDimension(Orientation orientation, int value) - { - if (orientation == Orientation.Horizontal) - this.X = value; - else - this.Y = value; - } - - public static Point operator +(Point left, Point right) => new Point(left.X + right.X, left.Y + right.Y); - - public static Point Add(Point left, Point right) => left + right; - - public static Point operator -(Point left, Point right) => new Point(left.X - right.X, left.Y - right.Y); - - public static Point operator -(Point pt) => new Point(-pt.X, -pt.Y); - - public static Point Subtract(Point left, Point right) => left - right; - - public static Point Offset(Point point, int x, int y) => new Point(point.X + x, point.Y + y); - - public override bool Equals(object obj) => obj is Point point && point.X == this.X && point.Y == this.Y; - - public bool Equals(Point comp) => comp.X == this.X && comp.Y == this.Y; - - public static bool operator ==(Point left, Point right) => left.X == right.X && left.Y == right.Y; - - public static bool operator !=(Point left, Point right) => !(left == right); - - public override int GetHashCode() => this.X ^ this.Y; - - public override string ToString() => base.ToString(); - - public bool IsZero => this.Equals(Point.Zero); - - public void Offset(int dx, int dy) - { - this.X += dx; - this.Y += dy; - } - - public Size ToSize() => new Size(this.X, this.Y); - - public static Point Negate(Point point) => new Point(-point.X, -point.Y); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/PointLight2DElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/PointLight2DElement.cs index a201e8e..c32698e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/PointLight2DElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/PointLight2DElement.cs @@ -10,107 +10,107 @@ using System; namespace Microsoft.Iris.Render { - public class PointLight2DElement : EffectInput - { - internal const string PositionPropertyName = "Position"; - internal const string RadiusPropertyName = "Radius"; - internal const string LightColorPropertyName = "LightColor"; - internal const string AmbientColorPropertyName = "AmbientColor"; - internal const string AttenuationPropertyName = "Attenuation"; - private Vector3 m_vPosition; - private byte m_nPositionID; - private float m_flRadius; - private byte m_nRadiusID; - private ColorF m_clrLight; - private byte m_nLightColorID; - private ColorF m_clrAmbient; - private byte m_nAmbientColorID; - private Vector3 m_vAttenuation; - private byte m_nAttenuationID; - - public PointLight2DElement( - string stName, - Vector3 vPosition, - float flRadius, - ColorF clrLight, - ColorF clrAmbient, - Vector3 vAttenuation) - : this() + public class PointLight2DElement : EffectInput { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate((double) flRadius >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for flRadius is [0..)"); - this.m_stName = stName; - this.m_vPosition = vPosition; - this.m_flRadius = flRadius; - this.m_clrLight = clrLight; - this.m_clrAmbient = clrAmbient; - this.m_vAttenuation = vAttenuation; + internal const string PositionPropertyName = "Position"; + internal const string RadiusPropertyName = "Radius"; + internal const string LightColorPropertyName = "LightColor"; + internal const string AmbientColorPropertyName = "AmbientColor"; + internal const string AttenuationPropertyName = "Attenuation"; + private Vector3 m_vPosition; + private byte m_nPositionID; + private float m_flRadius; + private byte m_nRadiusID; + private ColorF m_clrLight; + private byte m_nLightColorID; + private ColorF m_clrAmbient; + private byte m_nAmbientColorID; + private Vector3 m_vAttenuation; + private byte m_nAttenuationID; + + public PointLight2DElement( + string stName, + Vector3 vPosition, + float flRadius, + ColorF clrLight, + ColorF clrAmbient, + Vector3 vAttenuation) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate((double)flRadius >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for flRadius is [0..)"); + this.m_stName = stName; + this.m_vPosition = vPosition; + this.m_flRadius = flRadius; + this.m_clrLight = clrLight; + this.m_clrAmbient = clrAmbient; + this.m_vAttenuation = vAttenuation; + } + + public PointLight2DElement() + { + this.m_typeInput = EffectInputType.PointLight2D; + this.m_vAttenuation = new Vector3(0.0f, 1f, 0.0f); + this.m_clrAmbient = new ColorF(0, 0, 0, 0); + } + + public Vector3 Position + { + get => this.m_vPosition; + set => this.m_vPosition = value; + } + + internal byte PositionID => this.m_nPositionID; + + public float Radius + { + get => this.m_flRadius; + set => this.m_flRadius = value; + } + + internal byte RadiusID => this.m_nRadiusID; + + public ColorF LightColor + { + get => this.m_clrLight; + set => this.m_clrLight = value; + } + + internal byte LightColorID => this.m_nLightColorID; + + public ColorF AmbientColor + { + get => this.m_clrAmbient; + set => this.m_clrAmbient = value; + } + + internal byte AmbientColorID => this.m_nAmbientColorID; + + public Vector3 Attenuation + { + get => this.m_vAttenuation; + set => this.m_vAttenuation = value; + } + + internal byte AttenuationID => this.m_nAttenuationID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Position", (byte)16, ref this.m_nPositionID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Radius", (byte)8, ref this.m_nRadiusID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "LightColor", (byte)20, ref this.m_nLightColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "AmbientColor", (byte)20, ref this.m_nAmbientColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Attenuation", (byte)16, ref this.m_nAttenuationID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("Position", EffectPropertyType.Vector3, (object)this.m_vPosition, this.m_nPositionID, dictProperties) && this.GenerateProperty("Radius", EffectPropertyType.Float, (object)this.m_flRadius, this.m_nRadiusID, dictProperties) && (this.GenerateProperty("LightColor", EffectPropertyType.Color, (object)this.m_clrLight, this.m_nLightColorID, dictProperties) && this.GenerateProperty("AmbientColor", EffectPropertyType.Color, (object)this.m_clrAmbient, this.m_nAmbientColorID, dictProperties)) && this.GenerateProperty("Attenuation", EffectPropertyType.Vector3, (object)this.m_vAttenuation, this.m_nAttenuationID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Position", this.PositionID, this.Position, cacheKey); + this.GeneratePropertyCacheKey("Radius", this.RadiusID, this.Radius, cacheKey); + this.GeneratePropertyCacheKey("LightColor", this.LightColorID, this.LightColor.ToVector4(), cacheKey); + this.GeneratePropertyCacheKey("AmbientColor", this.AmbientColorID, this.AmbientColor.ToVector4(), cacheKey); + this.GeneratePropertyCacheKey("Attenuation", this.AttenuationID, this.Attenuation, cacheKey); + } } - - public PointLight2DElement() - { - this.m_typeInput = EffectInputType.PointLight2D; - this.m_vAttenuation = new Vector3(0.0f, 1f, 0.0f); - this.m_clrAmbient = new ColorF(0, 0, 0, 0); - } - - public Vector3 Position - { - get => this.m_vPosition; - set => this.m_vPosition = value; - } - - internal byte PositionID => this.m_nPositionID; - - public float Radius - { - get => this.m_flRadius; - set => this.m_flRadius = value; - } - - internal byte RadiusID => this.m_nRadiusID; - - public ColorF LightColor - { - get => this.m_clrLight; - set => this.m_clrLight = value; - } - - internal byte LightColorID => this.m_nLightColorID; - - public ColorF AmbientColor - { - get => this.m_clrAmbient; - set => this.m_clrAmbient = value; - } - - internal byte AmbientColorID => this.m_nAmbientColorID; - - public Vector3 Attenuation - { - get => this.m_vAttenuation; - set => this.m_vAttenuation = value; - } - - internal byte AttenuationID => this.m_nAttenuationID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Position", (byte) 16, ref this.m_nPositionID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Radius", (byte) 8, ref this.m_nRadiusID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "LightColor", (byte) 20, ref this.m_nLightColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "AmbientColor", (byte) 20, ref this.m_nAmbientColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Attenuation", (byte) 16, ref this.m_nAttenuationID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("Position", EffectPropertyType.Vector3, (object) this.m_vPosition, this.m_nPositionID, dictProperties) && this.GenerateProperty("Radius", EffectPropertyType.Float, (object) this.m_flRadius, this.m_nRadiusID, dictProperties) && (this.GenerateProperty("LightColor", EffectPropertyType.Color, (object) this.m_clrLight, this.m_nLightColorID, dictProperties) && this.GenerateProperty("AmbientColor", EffectPropertyType.Color, (object) this.m_clrAmbient, this.m_nAmbientColorID, dictProperties)) && this.GenerateProperty("Attenuation", EffectPropertyType.Vector3, (object) this.m_vAttenuation, this.m_nAttenuationID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Position", this.PositionID, this.Position, cacheKey); - this.GeneratePropertyCacheKey("Radius", this.RadiusID, this.Radius, cacheKey); - this.GeneratePropertyCacheKey("LightColor", this.LightColorID, this.LightColor.ToVector4(), cacheKey); - this.GeneratePropertyCacheKey("AmbientColor", this.AmbientColorID, this.AmbientColor.ToVector4(), cacheKey); - this.GeneratePropertyCacheKey("Attenuation", this.AttenuationID, this.Attenuation, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BLOBREF.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BLOBREF.cs index 8776ead..2d2c5d0 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BLOBREF.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BLOBREF.cs @@ -8,24 +8,24 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - [ComVisible(false)] - internal struct BLOBREF - { - public static readonly BLOBREF NULL = new BLOBREF(); - private uint value; + [ComVisible(false)] + internal struct BLOBREF + { + public static readonly BLOBREF NULL = new BLOBREF(); + private uint value; - private BLOBREF(uint value) => this.value = value; + private BLOBREF(uint value) => this.value = value; - public static bool operator ==(BLOBREF hl, BLOBREF hr) => (int) hl.value == (int) hr.value; + public static bool operator ==(BLOBREF hl, BLOBREF hr) => (int)hl.value == (int)hr.value; - public static bool operator !=(BLOBREF hl, BLOBREF hr) => (int) hl.value != (int) hr.value; + public static bool operator !=(BLOBREF hl, BLOBREF hr) => (int)hl.value != (int)hr.value; - public override bool Equals(object oCompare) => (int) this.value == (int) (uint) oCompare; + public override bool Equals(object oCompare) => (int)this.value == (int)(uint)oCompare; - public override int GetHashCode() => (int) this.value; + public override int GetHashCode() => (int)this.value; - public static BLOBREF FromUInt32(uint value) => new BLOBREF(value); + public static BLOBREF FromUInt32(uint value) => new BLOBREF(value); - public static uint ToUInt32(BLOBREF handle) => handle.value; - } + public static uint ToUInt32(BLOBREF handle) => handle.value; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BatchCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BatchCallback.cs index cc64e3d..5898cc1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BatchCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BatchCallback.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render.Protocol { - internal delegate void BatchCallback(); + internal delegate void BatchCallback(); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BlobInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BlobInfo.cs index 6597232..6d949e1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BlobInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/BlobInfo.cs @@ -9,143 +9,143 @@ using System; namespace Microsoft.Iris.Render.Protocol { - internal struct BlobInfo - { - private const int c_SizeOfChar = 2; - private const int c_SizeOfUInt = 4; - private Vector m_data; - private unsafe Message* m_pmsgBlob; - private uint m_totalSize; - private uint m_blobsOffset; - private bool m_foreignByteOrder; - private static object s_msgBlobSentinal = new object(); - private static Vector s_cache; - - public unsafe BlobInfo(RenderPort port, uint origTotal) + internal struct BlobInfo { - this.m_foreignByteOrder = port.ForeignByteOrder; - this.m_data = BlobInfo.s_cache; - BlobInfo.s_cache = (Vector) null; - if (this.m_data == null) - this.m_data = new Vector(); - this.m_totalSize = origTotal; - this.m_blobsOffset = origTotal; - this.m_pmsgBlob = (Message*) null; - } + private const int c_SizeOfChar = 2; + private const int c_SizeOfUInt = 4; + private Vector m_data; + private unsafe Message* m_pmsgBlob; + private uint m_totalSize; + private uint m_blobsOffset; + private bool m_foreignByteOrder; + private static object s_msgBlobSentinal = new object(); + private static Vector s_cache; - public uint AdjustedTotalSize => this.m_totalSize; - - public uint BlobDataSize => this.m_totalSize - this.m_blobsOffset; - - public BLOBREF Add(RENDERHANDLE[] param) - { - uint cbData = param == null ? 0U : (uint) (param.Length * 4); - return this.Add((object) param, cbData); - } - - public BLOBREF Add(string param) - { - if (param == null) - param = ""; - uint cbData = (uint) ((param.Length + 1) * 2); - return this.Add((object) param, cbData); - } - - public unsafe BLOBREF Add(Message* pmsg) - { - uint cbData = 0; - if ((IntPtr) pmsg != IntPtr.Zero) - { - this.m_pmsgBlob = pmsg; - cbData = pmsg->cbSize; - } - return this.Add(BlobInfo.s_msgBlobSentinal, cbData); - } - - private BLOBREF Add(object param, uint cbData) - { - Debug2.Validate(cbData < (uint) ushort.MaxValue, typeof (ArgumentException), (object) "data blob too large", (object) nameof (param)); - BLOBREF blobref = BLOBREF.FromUInt32(this.m_totalSize | cbData << 16); - if (cbData != 0U) - { - if (this.m_totalSize + cbData > (uint) ushort.MaxValue) - throw new InvalidOperationException("insufficient space in message for data blob"); - this.m_totalSize += cbData; - this.m_data.Add(param); - } - return blobref; - } - - public unsafe void Attach(Message* pMessage) - { - byte* numPtr1 = (byte*) ((IntPtr) pMessage + (int) this.m_blobsOffset); - foreach (object obj in this.m_data) - { - if (obj is string) + public unsafe BlobInfo(RenderPort port, uint origTotal) { - string str = (string) obj; - fixed (char* chPtr1 = str) - { - if (!this.m_foreignByteOrder) - { - char* chPtr2 = (char*) numPtr1; - char* chPtr3 = chPtr1; - char* chPtr4 = chPtr1 + (str.Length + 1); - while (chPtr3 < chPtr4) - *chPtr2++ = *chPtr3++; - numPtr1 = (byte*) chPtr2; - } - else - { - byte* numPtr2 = (byte*) chPtr1; - for (byte* numPtr3 = numPtr2 + ((IntPtr) (str.Length + 1) * 2).ToInt64(); numPtr2 < numPtr3; numPtr2 += 2) - { - *numPtr1++ = numPtr2[1]; - *numPtr1++ = *numPtr2; - } - } - } + this.m_foreignByteOrder = port.ForeignByteOrder; + this.m_data = BlobInfo.s_cache; + BlobInfo.s_cache = (Vector)null; + if (this.m_data == null) + this.m_data = new Vector(); + this.m_totalSize = origTotal; + this.m_blobsOffset = origTotal; + this.m_pmsgBlob = (Message*)null; } - else if (obj is RENDERHANDLE[]) + + public uint AdjustedTotalSize => this.m_totalSize; + + public uint BlobDataSize => this.m_totalSize - this.m_blobsOffset; + + public BLOBREF Add(RENDERHANDLE[] param) { - RENDERHANDLE[] renderhandleArray = (RENDERHANDLE[]) obj; - fixed (RENDERHANDLE* renderhandlePtr = renderhandleArray) - { - if (!this.m_foreignByteOrder) - { - uint* numPtr2 = (uint*) numPtr1; - uint* numPtr3 = (uint*) renderhandlePtr; - uint* numPtr4 = numPtr3 + renderhandleArray.Length; - while (numPtr3 < numPtr4) - *numPtr2++ = *numPtr3++; - numPtr1 = (byte*) numPtr2; - } - else - { - byte* numPtr2 = (byte*) renderhandlePtr; - for (byte* numPtr3 = numPtr2 + ((IntPtr) renderhandleArray.Length * 4).ToInt64(); numPtr2 < numPtr3; numPtr2 += 4) - { - *numPtr1++ = numPtr2[3]; - *numPtr1++ = numPtr2[2]; - *numPtr1++ = numPtr2[1]; - *numPtr1++ = *numPtr2; - } - } - } + uint cbData = param == null ? 0U : (uint)(param.Length * 4); + return this.Add((object)param, cbData); } - else if (obj == BlobInfo.s_msgBlobSentinal) + + public BLOBREF Add(string param) { - byte* pmsgBlob = (byte*) this.m_pmsgBlob; - byte* numPtr2 = pmsgBlob + (int) this.m_pmsgBlob->cbSize; - while (pmsgBlob < numPtr2) - *numPtr1++ = *pmsgBlob++; + if (param == null) + param = ""; + uint cbData = (uint)((param.Length + 1) * 2); + return this.Add((object)param, cbData); + } + + public unsafe BLOBREF Add(Message* pmsg) + { + uint cbData = 0; + if ((IntPtr)pmsg != IntPtr.Zero) + { + this.m_pmsgBlob = pmsg; + cbData = pmsg->cbSize; + } + return this.Add(BlobInfo.s_msgBlobSentinal, cbData); + } + + private BLOBREF Add(object param, uint cbData) + { + Debug2.Validate(cbData < (uint)ushort.MaxValue, typeof(ArgumentException), (object)"data blob too large", (object)nameof(param)); + BLOBREF blobref = BLOBREF.FromUInt32(this.m_totalSize | cbData << 16); + if (cbData != 0U) + { + if (this.m_totalSize + cbData > (uint)ushort.MaxValue) + throw new InvalidOperationException("insufficient space in message for data blob"); + this.m_totalSize += cbData; + this.m_data.Add(param); + } + return blobref; + } + + public unsafe void Attach(Message* pMessage) + { + byte* numPtr1 = (byte*)((IntPtr)pMessage + (int)this.m_blobsOffset); + foreach (object obj in this.m_data) + { + if (obj is string) + { + string str = (string)obj; + fixed (char* chPtr1 = str) + { + if (!this.m_foreignByteOrder) + { + char* chPtr2 = (char*)numPtr1; + char* chPtr3 = chPtr1; + char* chPtr4 = chPtr1 + (str.Length + 1); + while (chPtr3 < chPtr4) + *chPtr2++ = *chPtr3++; + numPtr1 = (byte*)chPtr2; + } + else + { + byte* numPtr2 = (byte*)chPtr1; + for (byte* numPtr3 = numPtr2 + ((IntPtr)(str.Length + 1) * 2).ToInt64(); numPtr2 < numPtr3; numPtr2 += 2) + { + *numPtr1++ = numPtr2[1]; + *numPtr1++ = *numPtr2; + } + } + } + } + else if (obj is RENDERHANDLE[]) + { + RENDERHANDLE[] renderhandleArray = (RENDERHANDLE[])obj; + fixed (RENDERHANDLE* renderhandlePtr = renderhandleArray) + { + if (!this.m_foreignByteOrder) + { + uint* numPtr2 = (uint*)numPtr1; + uint* numPtr3 = (uint*)renderhandlePtr; + uint* numPtr4 = numPtr3 + renderhandleArray.Length; + while (numPtr3 < numPtr4) + *numPtr2++ = *numPtr3++; + numPtr1 = (byte*)numPtr2; + } + else + { + byte* numPtr2 = (byte*)renderhandlePtr; + for (byte* numPtr3 = numPtr2 + ((IntPtr)renderhandleArray.Length * 4).ToInt64(); numPtr2 < numPtr3; numPtr2 += 4) + { + *numPtr1++ = numPtr2[3]; + *numPtr1++ = numPtr2[2]; + *numPtr1++ = numPtr2[1]; + *numPtr1++ = *numPtr2; + } + } + } + } + else if (obj == BlobInfo.s_msgBlobSentinal) + { + byte* pmsgBlob = (byte*)this.m_pmsgBlob; + byte* numPtr2 = pmsgBlob + (int)this.m_pmsgBlob->cbSize; + while (pmsgBlob < numPtr2) + *numPtr1++ = *pmsgBlob++; + } + else + Debug2.Throw(false, "Unexpected type."); + } + this.m_data.Clear(); + BlobInfo.s_cache = this.m_data; + this.m_data = (Vector)null; } - else - Debug2.Throw(false, "Unexpected type."); - } - this.m_data.Clear(); - BlobInfo.s_cache = this.m_data; - this.m_data = (Vector) null; } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/CallbackMessage.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/CallbackMessage.cs index a975dfc..3283a2a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/CallbackMessage.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/CallbackMessage.cs @@ -8,12 +8,12 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - [ComVisible(false)] - internal struct CallbackMessage - { - public uint cbSize; - public uint nMsg; - public RENDERHANDLE idObjectSubject; - public RENDERHANDLE hTarget; - } + [ComVisible(false)] + internal struct CallbackMessage + { + public uint cbSize; + public uint nMsg; + public RENDERHANDLE idObjectSubject; + public RENDERHANDLE hTarget; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ConnectionInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ConnectionInfo.cs index f75b41a..014bbde 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ConnectionInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ConnectionInfo.cs @@ -8,9 +8,9 @@ using System; namespace Microsoft.Iris.Render.Protocol { - [Serializable] - internal abstract class ConnectionInfo - { - public static readonly ConnectionInfo Default = (ConnectionInfo) new LocalConnectionInfo(); - } + [Serializable] + internal abstract class ConnectionInfo + { + public static readonly ConnectionInfo Default = (ConnectionInfo)new LocalConnectionInfo(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ContextID.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ContextID.cs index 433cb2f..3f2dcc6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ContextID.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ContextID.cs @@ -9,26 +9,26 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - [ComVisible(false)] - [Serializable] - internal struct ContextID - { - public static readonly ContextID NULL = new ContextID(); - public static readonly ContextID CURRENT = new ContextID(uint.MaxValue); - private uint value; + [ComVisible(false)] + [Serializable] + internal struct ContextID + { + public static readonly ContextID NULL = new ContextID(); + public static readonly ContextID CURRENT = new ContextID(uint.MaxValue); + private uint value; - private ContextID(uint value) => this.value = value; + private ContextID(uint value) => this.value = value; - public static bool operator ==(ContextID hl, ContextID hr) => (int) hl.value == (int) hr.value; + public static bool operator ==(ContextID hl, ContextID hr) => (int)hl.value == (int)hr.value; - public static bool operator !=(ContextID hl, ContextID hr) => (int) hl.value != (int) hr.value; + public static bool operator !=(ContextID hl, ContextID hr) => (int)hl.value != (int)hr.value; - public override bool Equals(object oCompare) => oCompare is ContextID contextId && (int) this.value == (int) contextId.value; + public override bool Equals(object oCompare) => oCompare is ContextID contextId && (int)this.value == (int)contextId.value; - public override int GetHashCode() => (int) this.value; + public override int GetHashCode() => (int)this.value; - public static ContextID FromUInt32(uint value) => new ContextID(value); + public static ContextID FromUInt32(uint value) => new ContextID(value); - public static uint ToUInt32(ContextID handle) => handle.value; - } + public static uint ToUInt32(ContextID handle) => handle.value; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBuffer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBuffer.cs index 7237450..5e32389 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBuffer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBuffer.cs @@ -9,97 +9,97 @@ using System; namespace Microsoft.Iris.Render.Protocol { - internal class DataBuffer : IDataBufferCallback, IRenderHandleOwner - { - private RenderPort m_port; - private RemoteDataBuffer m_remoteBuffer; - private unsafe void* m_pvData; - private uint m_cbSize; - - public unsafe DataBuffer(RenderPort port, void* pvData, uint cbSize) + internal class DataBuffer : IDataBufferCallback, IRenderHandleOwner { - this.m_port = port; - this.m_remoteBuffer = (RemoteDataBuffer) null; - this.m_pvData = pvData; - this.m_cbSize = cbSize; - } + private RenderPort m_port; + private RemoteDataBuffer m_remoteBuffer; + private unsafe void* m_pvData; + private uint m_cbSize; - ~DataBuffer() => this.Dispose(false); - - public void Dispose() - { - this.m_port.Session.AssertOwningThread(); - GC.SuppressFinalize((object) this); - this.Dispose(true); - } - - private void Dispose(bool fInDispose) - { - if (fInDispose && this.m_remoteBuffer != null) - this.m_remoteBuffer.Dispose(); - this.m_remoteBuffer = (RemoteDataBuffer) null; - } - - public RenderPort Port => this.m_port; - - public uint DataSize => this.m_cbSize; - - public unsafe void* Data => this.m_pvData; - - public RemoteDataBuffer RemoteStub => this.m_remoteBuffer; - - public unsafe void Commit() - { - RENDERHANDLE renderhandle = this.m_port.AllocHandle((IRenderHandleOwner) this); - try - { - this.m_port.SendDataBuffer(this.m_pvData, this.m_cbSize, renderhandle); - this.m_remoteBuffer = RemoteDataBuffer.CreateFromHandle(this.m_port, renderhandle); - this.m_remoteBuffer.SendRegisterOwner(this.m_port.MessagingProtocol.LocalDataBufferCallbackHandle); - renderhandle = RENDERHANDLE.NULL; - } - finally - { - if (renderhandle != RENDERHANDLE.NULL) + public unsafe DataBuffer(RenderPort port, void* pvData, uint cbSize) { - if (this.m_remoteBuffer != null) - { - this.m_remoteBuffer.Dispose(); - this.m_remoteBuffer = (RemoteDataBuffer) null; - } - else - this.m_port.FreeHandle(renderhandle); + this.m_port = port; + this.m_remoteBuffer = (RemoteDataBuffer)null; + this.m_pvData = pvData; + this.m_cbSize = cbSize; } - } + + ~DataBuffer() => this.Dispose(false); + + public void Dispose() + { + this.m_port.Session.AssertOwningThread(); + GC.SuppressFinalize((object)this); + this.Dispose(true); + } + + private void Dispose(bool fInDispose) + { + if (fInDispose && this.m_remoteBuffer != null) + this.m_remoteBuffer.Dispose(); + this.m_remoteBuffer = (RemoteDataBuffer)null; + } + + public RenderPort Port => this.m_port; + + public uint DataSize => this.m_cbSize; + + public unsafe void* Data => this.m_pvData; + + public RemoteDataBuffer RemoteStub => this.m_remoteBuffer; + + public unsafe void Commit() + { + RENDERHANDLE renderhandle = this.m_port.AllocHandle((IRenderHandleOwner)this); + try + { + this.m_port.SendDataBuffer(this.m_pvData, this.m_cbSize, renderhandle); + this.m_remoteBuffer = RemoteDataBuffer.CreateFromHandle(this.m_port, renderhandle); + this.m_remoteBuffer.SendRegisterOwner(this.m_port.MessagingProtocol.LocalDataBufferCallbackHandle); + renderhandle = RENDERHANDLE.NULL; + } + finally + { + if (renderhandle != RENDERHANDLE.NULL) + { + if (this.m_remoteBuffer != null) + { + this.m_remoteBuffer.Dispose(); + this.m_remoteBuffer = (RemoteDataBuffer)null; + } + else + this.m_port.FreeHandle(renderhandle); + } + } + } + + public event EventHandler DataConsumed; + + protected virtual void OnDataConsumed(object sender, EventArgs args) + { + this.OnReleaseLocalData(); + if (this.DataConsumed == null) + return; + this.DataConsumed(sender, args); + } + + protected void OnDataConsumed() => this.OnDataConsumed((object)this, EventArgs.Empty); + + public event EventHandler ReleaseLocalData; + + protected virtual void OnReleaseLocalData(object sender, EventArgs args) + { + if (this.ReleaseLocalData == null) + return; + this.ReleaseLocalData(sender, args); + } + + protected void OnReleaseLocalData() => this.OnReleaseLocalData((object)this, EventArgs.Empty); + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteBuffer.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteBuffer = (RemoteDataBuffer)null; + + void IDataBufferCallback.OnComplete(RENDERHANDLE target) => this.OnDataConsumed(); } - - public event EventHandler DataConsumed; - - protected virtual void OnDataConsumed(object sender, EventArgs args) - { - this.OnReleaseLocalData(); - if (this.DataConsumed == null) - return; - this.DataConsumed(sender, args); - } - - protected void OnDataConsumed() => this.OnDataConsumed((object) this, EventArgs.Empty); - - public event EventHandler ReleaseLocalData; - - protected virtual void OnReleaseLocalData(object sender, EventArgs args) - { - if (this.ReleaseLocalData == null) - return; - this.ReleaseLocalData(sender, args); - } - - protected void OnReleaseLocalData() => this.OnReleaseLocalData((object) this, EventArgs.Empty); - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteBuffer.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteBuffer = (RemoteDataBuffer) null; - - void IDataBufferCallback.OnComplete(RENDERHANDLE target) => this.OnDataConsumed(); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBufferTracker.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBufferTracker.cs index 44ffd7c..26f66b8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBufferTracker.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/DataBufferTracker.cs @@ -9,143 +9,143 @@ using System; namespace Microsoft.Iris.Render.Protocol { - internal class DataBufferTracker - { - private Vector m_alTracking; - - internal DataBufferTracker(object objUser) => this.m_alTracking = new Vector(); - - ~DataBufferTracker() => this.Dispose(false); - - internal void Dispose() + internal class DataBufferTracker { - GC.SuppressFinalize((object) this); - this.Dispose(true); - } + private Vector m_alTracking; - private void Dispose(bool fInDispose) - { - if (fInDispose && this.m_alTracking != null && this.m_alTracking.Count > 0) - { - foreach (DataBufferTracker.TrackingInfo trackingInfo in this.m_alTracking) - trackingInfo.DataBuffer.Dispose(); - this.m_alTracking.Clear(); - } - this.m_alTracking = (Vector) null; - } + internal DataBufferTracker(object objUser) => this.m_alTracking = new Vector(); - internal int Count => this.m_alTracking.Count; + ~DataBufferTracker() => this.Dispose(false); - internal string DEBUG_Description => (string) null; - - internal object DEBUG_User => (object) null; - - internal event EventHandler TrackerEmpty; - - protected virtual void OnTrackerEmpty(object sender, EventArgs args) - { - if (this.TrackerEmpty == null) - return; - this.TrackerEmpty(sender, args); - } - - internal void Track(DataBuffer dataBuffer) => this.Track(dataBuffer, (DataBufferTracker.CleanupEventHandler) null, (object) null); - - internal void Track( - DataBuffer dataBuffer, - DataBufferTracker.CleanupEventHandler handler, - object contextData) - { - DataBufferTracker.TrackingInfo trackingInfo = new DataBufferTracker.TrackingInfo(dataBuffer, DataBufferTracker.Users.Valid, handler, contextData); - dataBuffer.DataConsumed += new EventHandler(this.OnDataConsumed); - dataBuffer.ReleaseLocalData += new EventHandler(this.OnReleaseLocalData); - this.m_alTracking.Add((object) trackingInfo); - } - - internal void Release(DataBuffer dataBuffer, DataBufferTracker.Users userFlags) - { - DataBufferTracker.TrackingInfo trackingInfo1 = (DataBufferTracker.TrackingInfo) null; - foreach (DataBufferTracker.TrackingInfo trackingInfo2 in this.m_alTracking) - { - if (trackingInfo2.DataBuffer == dataBuffer) + internal void Dispose() { - trackingInfo1 = trackingInfo2; - break; + GC.SuppressFinalize((object)this); + this.Dispose(true); + } + + private void Dispose(bool fInDispose) + { + if (fInDispose && this.m_alTracking != null && this.m_alTracking.Count > 0) + { + foreach (DataBufferTracker.TrackingInfo trackingInfo in this.m_alTracking) + trackingInfo.DataBuffer.Dispose(); + this.m_alTracking.Clear(); + } + this.m_alTracking = (Vector)null; + } + + internal int Count => this.m_alTracking.Count; + + internal string DEBUG_Description => (string)null; + + internal object DEBUG_User => (object)null; + + internal event EventHandler TrackerEmpty; + + protected virtual void OnTrackerEmpty(object sender, EventArgs args) + { + if (this.TrackerEmpty == null) + return; + this.TrackerEmpty(sender, args); + } + + internal void Track(DataBuffer dataBuffer) => this.Track(dataBuffer, (DataBufferTracker.CleanupEventHandler)null, (object)null); + + internal void Track( + DataBuffer dataBuffer, + DataBufferTracker.CleanupEventHandler handler, + object contextData) + { + DataBufferTracker.TrackingInfo trackingInfo = new DataBufferTracker.TrackingInfo(dataBuffer, DataBufferTracker.Users.Valid, handler, contextData); + dataBuffer.DataConsumed += new EventHandler(this.OnDataConsumed); + dataBuffer.ReleaseLocalData += new EventHandler(this.OnReleaseLocalData); + this.m_alTracking.Add((object)trackingInfo); + } + + internal void Release(DataBuffer dataBuffer, DataBufferTracker.Users userFlags) + { + DataBufferTracker.TrackingInfo trackingInfo1 = (DataBufferTracker.TrackingInfo)null; + foreach (DataBufferTracker.TrackingInfo trackingInfo2 in this.m_alTracking) + { + if (trackingInfo2.DataBuffer == dataBuffer) + { + trackingInfo1 = trackingInfo2; + break; + } + } + if (trackingInfo1 == null) + return; + uint userFlags1 = (uint)trackingInfo1.UserFlags; + Bits.ClearFlag(ref userFlags1, (uint)userFlags); + trackingInfo1.UserFlags = (DataBufferTracker.Users)userFlags1; + if (userFlags1 != 0U) + return; + if (trackingInfo1.CleanupHandler != null) + trackingInfo1.CleanupHandler((object)this, new DataBufferTracker.CleanupEventArgs(trackingInfo1.CleanupHandlerData)); + this.m_alTracking.Remove((object)trackingInfo1); + trackingInfo1.DataBuffer.DataConsumed -= new EventHandler(this.OnDataConsumed); + trackingInfo1.DataBuffer.ReleaseLocalData -= new EventHandler(this.OnReleaseLocalData); + trackingInfo1.DataBuffer.Dispose(); + trackingInfo1.DataBuffer = (DataBuffer)null; + trackingInfo1.CleanupHandler = (DataBufferTracker.CleanupEventHandler)null; + trackingInfo1.CleanupHandlerData = (object)null; + if (this.m_alTracking.Count != 0) + return; + this.OnTrackerEmpty((object)this, EventArgs.Empty); + } + + private void OnDataConsumed(object oSender, EventArgs args) => this.Release(oSender as DataBuffer, DataBufferTracker.Users.Consumed); + + private void OnReleaseLocalData(object oSender, EventArgs args) => this.Release(oSender as DataBuffer, DataBufferTracker.Users.LocalData); + + internal void DEBUG_SetDescription(string stDescription) + { + } + + internal void DEBUG_DumpTrackingList() + { + } + + [System.Flags] + internal enum Users : uint + { + Consumed = 1, + LocalData = 2, + Valid = LocalData | Consumed, // 0x00000003 + } + + internal class CleanupEventArgs : EventArgs + { + public object ContextData; + + internal CleanupEventArgs(object contextData) => this.ContextData = contextData; + } + + internal delegate void CleanupEventHandler( + object sender, + DataBufferTracker.CleanupEventArgs args); + + private class TrackingInfo + { + private static uint s_idSeed; + internal DataBuffer DataBuffer; + internal DataBufferTracker.Users UserFlags; + internal uint Id; + internal DataBufferTracker.CleanupEventHandler CleanupHandler; + internal object CleanupHandlerData; + + internal TrackingInfo( + DataBuffer dataBuffer, + DataBufferTracker.Users userFlags, + DataBufferTracker.CleanupEventHandler handler, + object contextData) + { + this.DataBuffer = dataBuffer; + this.UserFlags = userFlags; + this.Id = DataBufferTracker.TrackingInfo.s_idSeed++; + this.CleanupHandler = handler; + this.CleanupHandlerData = contextData; + } } - } - if (trackingInfo1 == null) - return; - uint userFlags1 = (uint) trackingInfo1.UserFlags; - Bits.ClearFlag(ref userFlags1, (uint) userFlags); - trackingInfo1.UserFlags = (DataBufferTracker.Users) userFlags1; - if (userFlags1 != 0U) - return; - if (trackingInfo1.CleanupHandler != null) - trackingInfo1.CleanupHandler((object) this, new DataBufferTracker.CleanupEventArgs(trackingInfo1.CleanupHandlerData)); - this.m_alTracking.Remove((object) trackingInfo1); - trackingInfo1.DataBuffer.DataConsumed -= new EventHandler(this.OnDataConsumed); - trackingInfo1.DataBuffer.ReleaseLocalData -= new EventHandler(this.OnReleaseLocalData); - trackingInfo1.DataBuffer.Dispose(); - trackingInfo1.DataBuffer = (DataBuffer) null; - trackingInfo1.CleanupHandler = (DataBufferTracker.CleanupEventHandler) null; - trackingInfo1.CleanupHandlerData = (object) null; - if (this.m_alTracking.Count != 0) - return; - this.OnTrackerEmpty((object) this, EventArgs.Empty); } - - private void OnDataConsumed(object oSender, EventArgs args) => this.Release(oSender as DataBuffer, DataBufferTracker.Users.Consumed); - - private void OnReleaseLocalData(object oSender, EventArgs args) => this.Release(oSender as DataBuffer, DataBufferTracker.Users.LocalData); - - internal void DEBUG_SetDescription(string stDescription) - { - } - - internal void DEBUG_DumpTrackingList() - { - } - - [System.Flags] - internal enum Users : uint - { - Consumed = 1, - LocalData = 2, - Valid = LocalData | Consumed, // 0x00000003 - } - - internal class CleanupEventArgs : EventArgs - { - public object ContextData; - - internal CleanupEventArgs(object contextData) => this.ContextData = contextData; - } - - internal delegate void CleanupEventHandler( - object sender, - DataBufferTracker.CleanupEventArgs args); - - private class TrackingInfo - { - private static uint s_idSeed; - internal DataBuffer DataBuffer; - internal DataBufferTracker.Users UserFlags; - internal uint Id; - internal DataBufferTracker.CleanupEventHandler CleanupHandler; - internal object CleanupHandlerData; - - internal TrackingInfo( - DataBuffer dataBuffer, - DataBufferTracker.Users userFlags, - DataBufferTracker.CleanupEventHandler handler, - object contextData) - { - this.DataBuffer = dataBuffer; - this.UserFlags = userFlags; - this.Id = DataBufferTracker.TrackingInfo.s_idSeed++; - this.CleanupHandler = handler; - this.CleanupHandlerData = contextData; - } - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/EngineApi.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/EngineApi.cs index e000959..d76e940 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/EngineApi.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/EngineApi.cs @@ -13,251 +13,251 @@ using System.Security; namespace Microsoft.Iris.Render.Protocol { - [SuppressUnmanagedCodeSecurity] - internal static class EngineApi - { - private const string s_stEhRenderDll = "UIXRender.dll"; - - public static void IFC(HRESULT hr) + [SuppressUnmanagedCodeSecurity] + internal static class EngineApi { - if (hr.Int >= 0) - return; - RenderException.ErrorCode code = (RenderException.ErrorCode) hr.Int; - switch (hr.Int) - { - case -2147221503: - case -2147221502: - throw new OutOfMemoryException(); - case -2147221494: - throw new RenderException(code, "Generic failure."); - case -2147221493: - throw new RenderException(code, "The object is in a \"busy\" state and is not available to process the request."); - case -2147221492: - throw new RenderException(code, "The object is not in a usable state to process the request."); - case -2147221484: - throw new RenderException(code, "The Context has not been initialized."); - case -2147221474: - throw new RenderException(code, "The object was used in the incorrect context."); - case -2147221473: - throw new RenderException(code, "The Context has been marked to only allow read-only operations. For example, this may be in the middle of a read-only callback."); - case -2147221472: - throw new RenderException(code, "The threading model has already be determined by a previous call to SpInit() and can no longer be changed."); - case -2147221471: - throw new RenderException(code, "Unable to use the IGMM_STANDARD messaging model because it is either unsupported or cannot be installed."); - case -2147221464: - throw new RenderException(code, "Can not mix an invalid coordinate mapping, for example having a non-relative child of a relative parent."); - case -2147221454: - throw new RenderException(code, "Could not find a MSGID for one of the requested messages. This will be represented by a '0' in the MSGID field for that message."); - case -2147221444: - throw new RenderException(code, "The operation is not legal because the specified Gadget does not have a GS_BUFFERED style."); - case -2147221434: - throw new RenderException(code, "The specific Gadget has started the destruction and can not be be modified in this manner."); - case -2147221433: - throw new RenderException(code, "The specific object is locked and may not be modified."); - case -2147221432: - throw new InvalidOperationException("The operation is not supported."); - case -2147221424: - throw new RenderException(code, "The specified optional component has not yet been initialized with InitGadgetComponent()."); - case -2147221414: - throw new RenderException(code, "The specified object was not found."); - case -2147221413: - throw new RenderException(code, "The ObjectID is already in use."); - case -2147221412: - throw new FileNotFoundException("The specified file could not be found"); - case -2147221411: - throw new ArgumentOutOfRangeException("", "The argument is out of range"); - case -2147221404: - throw new RenderException(code, "The specified parmeters are mismatched for the current object state."); - case -2147221394: - throw new RenderException(code, "GDI+ was unable to be loaded. It may not be installed on the system or may not be properly initialized."); - case -2147221393: - throw new RenderException(code, "Direct3D was unable to be loaded. It may not be installed on the system or may not be properly initialized."); - case -2147221384: - throw new RenderException(code, "The specified class was already registered."); - case -2147221383: - throw new RenderException(code, "The specified message was not found during class registration."); - case -2147221382: - throw new RenderException(code, "The specified message was not implemented during class registration."); - case -2147221381: - throw new RenderException(code, "The implementation of the specific class has not yet been registered."); - case -2147221380: - throw new RenderException(code, "Sending the message failed."); - case -2147221379: - throw new RenderException(code, "The message data is too large."); - case -2147221374: - throw new RenderException(code, "The specified object does not have any content."); - case -2147221373: - throw new RenderException(code, "The specified object is not properly setup to store the data."); - case -2147221364: - throw new RenderException(code, "Generic failure from Win32 that did not SetLastError()."); - case -2147221363: - throw new RenderException(code, "Generic failure from GDI+."); - case -2147221362: - throw new RenderException(code, "Generic failure from driver or rendering."); - case -2147221354: - throw new RenderException(code, "Unable to connect to remote renderer."); - default: - Marshal.ThrowExceptionForHR(hr.Int); - break; - } + private const string s_stEhRenderDll = "UIXRender.dll"; + + public static void IFC(HRESULT hr) + { + if (hr.Int >= 0) + return; + RenderException.ErrorCode code = (RenderException.ErrorCode)hr.Int; + switch (hr.Int) + { + case -2147221503: + case -2147221502: + throw new OutOfMemoryException(); + case -2147221494: + throw new RenderException(code, "Generic failure."); + case -2147221493: + throw new RenderException(code, "The object is in a \"busy\" state and is not available to process the request."); + case -2147221492: + throw new RenderException(code, "The object is not in a usable state to process the request."); + case -2147221484: + throw new RenderException(code, "The Context has not been initialized."); + case -2147221474: + throw new RenderException(code, "The object was used in the incorrect context."); + case -2147221473: + throw new RenderException(code, "The Context has been marked to only allow read-only operations. For example, this may be in the middle of a read-only callback."); + case -2147221472: + throw new RenderException(code, "The threading model has already be determined by a previous call to SpInit() and can no longer be changed."); + case -2147221471: + throw new RenderException(code, "Unable to use the IGMM_STANDARD messaging model because it is either unsupported or cannot be installed."); + case -2147221464: + throw new RenderException(code, "Can not mix an invalid coordinate mapping, for example having a non-relative child of a relative parent."); + case -2147221454: + throw new RenderException(code, "Could not find a MSGID for one of the requested messages. This will be represented by a '0' in the MSGID field for that message."); + case -2147221444: + throw new RenderException(code, "The operation is not legal because the specified Gadget does not have a GS_BUFFERED style."); + case -2147221434: + throw new RenderException(code, "The specific Gadget has started the destruction and can not be be modified in this manner."); + case -2147221433: + throw new RenderException(code, "The specific object is locked and may not be modified."); + case -2147221432: + throw new InvalidOperationException("The operation is not supported."); + case -2147221424: + throw new RenderException(code, "The specified optional component has not yet been initialized with InitGadgetComponent()."); + case -2147221414: + throw new RenderException(code, "The specified object was not found."); + case -2147221413: + throw new RenderException(code, "The ObjectID is already in use."); + case -2147221412: + throw new FileNotFoundException("The specified file could not be found"); + case -2147221411: + throw new ArgumentOutOfRangeException("", "The argument is out of range"); + case -2147221404: + throw new RenderException(code, "The specified parmeters are mismatched for the current object state."); + case -2147221394: + throw new RenderException(code, "GDI+ was unable to be loaded. It may not be installed on the system or may not be properly initialized."); + case -2147221393: + throw new RenderException(code, "Direct3D was unable to be loaded. It may not be installed on the system or may not be properly initialized."); + case -2147221384: + throw new RenderException(code, "The specified class was already registered."); + case -2147221383: + throw new RenderException(code, "The specified message was not found during class registration."); + case -2147221382: + throw new RenderException(code, "The specified message was not implemented during class registration."); + case -2147221381: + throw new RenderException(code, "The implementation of the specific class has not yet been registered."); + case -2147221380: + throw new RenderException(code, "Sending the message failed."); + case -2147221379: + throw new RenderException(code, "The message data is too large."); + case -2147221374: + throw new RenderException(code, "The specified object does not have any content."); + case -2147221373: + throw new RenderException(code, "The specified object is not properly setup to store the data."); + case -2147221364: + throw new RenderException(code, "Generic failure from Win32 that did not SetLastError()."); + case -2147221363: + throw new RenderException(code, "Generic failure from GDI+."); + case -2147221362: + throw new RenderException(code, "Generic failure from driver or rendering."); + case -2147221354: + throw new RenderException(code, "Unable to connect to remote renderer."); + default: + Marshal.ThrowExceptionForHR(hr.Int); + break; + } + } + + [DllImport("UIXRender.dll")] + public static extern HRESULT SpInit(ref EngineApi.InitArgs args); + + [DllImport("UIXRender.dll")] + public static extern HRESULT SpUninit(); + + [DllImport("UIXRender.dll")] + public static extern unsafe HRESULT SpBufferOpen( + EngineApi.BufferInfo* phdrData, + void* pvData); + + [DllImport("UIXRender.dll")] + public static extern unsafe HRESULT SpWrapBufferProc( + EngineApi.MessageBufferEventHandler pfnProcessBufferProc, + IntPtr* ppNativeProc); + + [DllImport("UIXRender.dll", CharSet = CharSet.Auto)] + public static extern HRESULT SpPeekMessage( + out Win32Api.MSG msg, + HWND hwnd, + uint nMsgFilterMin, + uint nMsgFilterMax, + uint wRemoveMsg, + out EngineApi.WorkResult nResult); + + [DllImport("UIXRender.dll")] + public static extern HRESULT SpWaitMessage(uint nTimeOutMs, IntPtr _unused); + + [DllImport("UIXRender.dll")] + public static extern HRESULT SpInvoke( + ContextID idContext, + IntPtr pfnInvoke, + IntPtr pvArgs, + bool synchronous); + + [DllImport("UIXRender.dll")] + public static extern HRESULT SpRenderThreadInit( + ref EngineApi.InitArgs argsRender, + out IntPtr pThread); + + [DllImport("UIXRender.dll")] + public static extern HRESULT SpRenderThreadUninit(IntPtr pThread); + + [DllImport("UIXRender.dll", CharSet = CharSet.Unicode)] + public static extern HRESULT SpRemoteCreateServerStreams( + string stSession, + TransportProtocol nProtocol, + out IntPtr pSendStream, + out IntPtr pReceiveStream); + + [DllImport("UIXRender.dll")] + public static extern HRESULT SpRemoteWaitServerStreamsConnected( + TransportProtocol nProtocol, + IntPtr pSendStream, + IntPtr pReceiveStream); + + [DllImport("UIXRender.dll")] + public static extern HRESULT SpRemoteServerInit( + IntPtr pSendStream, + IntPtr pReceiveStream, + EngineApi.InitArgs argsSend, + out IntPtr pSession); + + [DllImport("UIXRender.dll")] + public static extern HRESULT SpRemoteServerUninit( + IntPtr pSession, + bool fForceShutdown, + out ShutdownReason nShutdownReason); + + [DllImport("UIXRender.dll", CharSet = CharSet.Ansi)] + public static extern HRESULT SpDx9CompileEffect( + string stEffect, + string stDefines, + out IntPtr pErrorString, + out IntPtr pErrorBuffer, + out IntPtr pEffectBlob, + out uint EffectBlobSize, + out IntPtr pEffectBlobBuffer); + + [DllImport("UIXRender.dll")] + public static extern void SpObjectRelease(IntPtr pUnknown); + + [System.Flags] + public enum BufferFlags + { + IsBatch = 1, + CopyData = 2, + Valid = CopyData | IsBatch, // 0x00000003 + } + + [ComVisible(false)] + public struct BufferInfo + { + public ContextID idContextSrc; + public ContextID idContextDest; + public RENDERHANDLE idBuffer; + public EngineApi.BufferFlags nFlags; + public uint cbSizeBuffer; + } + + internal delegate void TimeoutEventHandler(IntPtr pData); + + [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 InitArgs(MessageCookieLayout layout, ContextID idContextNew) + { + Debug2.Validate(idContextNew != ContextID.NULL, typeof(ArgumentNullException), nameof(idContextNew)); + this.cbSize = (uint)Marshal.SizeOf(typeof(EngineApi.InitArgs)); + this.idContext = idContextNew; + this.cItemsPerGroupBits = (int)layout.numberOfObjectBits; + this.cGroupBits = (int)layout.numberOfGroupBits; + this.pfnProcessBuffer = IntPtr.Zero; + this.pvProcessData = IntPtr.Zero; + this.idObjectBrokerClass = RENDERHANDLE.FromUInt32(0U); + this.pfnTimeout = (EngineApi.TimeoutEventHandler)null; + this.pvTimeoutData = IntPtr.Zero; + this.nTimeOutSec = 0U; + } + + public unsafe InitArgs( + MessageCookieLayout layout, + ContextID idContextNew, + EngineApi.MessageBufferEventHandler pfnProcessBufferProc) + : this(layout, idContextNew) + { + if (pfnProcessBufferProc == null) + return; + IntPtr num; + EngineApi.IFC(EngineApi.SpWrapBufferProc(pfnProcessBufferProc, &num)); + this.pfnProcessBuffer = num; + } + } + + internal unsafe delegate int MessageBufferEventHandler( + IntPtr pData, + uint hContext, + EngineApi.BufferInfo* pBufferInfo, + void* pvBufferData); + + [System.Flags] + public enum WorkResult : uint + { + ProcessedMessage = 1, + NewUserMessage = 2, + } } - - [DllImport("UIXRender.dll")] - public static extern HRESULT SpInit(ref EngineApi.InitArgs args); - - [DllImport("UIXRender.dll")] - public static extern HRESULT SpUninit(); - - [DllImport("UIXRender.dll")] - public static extern unsafe HRESULT SpBufferOpen( - EngineApi.BufferInfo* phdrData, - void* pvData); - - [DllImport("UIXRender.dll")] - public static extern unsafe HRESULT SpWrapBufferProc( - EngineApi.MessageBufferEventHandler pfnProcessBufferProc, - IntPtr* ppNativeProc); - - [DllImport("UIXRender.dll", CharSet = CharSet.Auto)] - public static extern HRESULT SpPeekMessage( - out Win32Api.MSG msg, - HWND hwnd, - uint nMsgFilterMin, - uint nMsgFilterMax, - uint wRemoveMsg, - out EngineApi.WorkResult nResult); - - [DllImport("UIXRender.dll")] - public static extern HRESULT SpWaitMessage(uint nTimeOutMs, IntPtr _unused); - - [DllImport("UIXRender.dll")] - public static extern HRESULT SpInvoke( - ContextID idContext, - IntPtr pfnInvoke, - IntPtr pvArgs, - bool synchronous); - - [DllImport("UIXRender.dll")] - public static extern HRESULT SpRenderThreadInit( - ref EngineApi.InitArgs argsRender, - out IntPtr pThread); - - [DllImport("UIXRender.dll")] - public static extern HRESULT SpRenderThreadUninit(IntPtr pThread); - - [DllImport("UIXRender.dll", CharSet = CharSet.Unicode)] - public static extern HRESULT SpRemoteCreateServerStreams( - string stSession, - TransportProtocol nProtocol, - out IntPtr pSendStream, - out IntPtr pReceiveStream); - - [DllImport("UIXRender.dll")] - public static extern HRESULT SpRemoteWaitServerStreamsConnected( - TransportProtocol nProtocol, - IntPtr pSendStream, - IntPtr pReceiveStream); - - [DllImport("UIXRender.dll")] - public static extern HRESULT SpRemoteServerInit( - IntPtr pSendStream, - IntPtr pReceiveStream, - EngineApi.InitArgs argsSend, - out IntPtr pSession); - - [DllImport("UIXRender.dll")] - public static extern HRESULT SpRemoteServerUninit( - IntPtr pSession, - bool fForceShutdown, - out ShutdownReason nShutdownReason); - - [DllImport("UIXRender.dll", CharSet = CharSet.Ansi)] - public static extern HRESULT SpDx9CompileEffect( - string stEffect, - string stDefines, - out IntPtr pErrorString, - out IntPtr pErrorBuffer, - out IntPtr pEffectBlob, - out uint EffectBlobSize, - out IntPtr pEffectBlobBuffer); - - [DllImport("UIXRender.dll")] - public static extern void SpObjectRelease(IntPtr pUnknown); - - [System.Flags] - public enum BufferFlags - { - IsBatch = 1, - CopyData = 2, - Valid = CopyData | IsBatch, // 0x00000003 - } - - [ComVisible(false)] - public struct BufferInfo - { - public ContextID idContextSrc; - public ContextID idContextDest; - public RENDERHANDLE idBuffer; - public EngineApi.BufferFlags nFlags; - public uint cbSizeBuffer; - } - - internal delegate void TimeoutEventHandler(IntPtr pData); - - [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 InitArgs(MessageCookieLayout layout, ContextID idContextNew) - { - Debug2.Validate(idContextNew != ContextID.NULL, typeof (ArgumentNullException), nameof (idContextNew)); - this.cbSize = (uint) Marshal.SizeOf(typeof (EngineApi.InitArgs)); - this.idContext = idContextNew; - this.cItemsPerGroupBits = (int) layout.numberOfObjectBits; - this.cGroupBits = (int) layout.numberOfGroupBits; - this.pfnProcessBuffer = IntPtr.Zero; - this.pvProcessData = IntPtr.Zero; - this.idObjectBrokerClass = RENDERHANDLE.FromUInt32(0U); - this.pfnTimeout = (EngineApi.TimeoutEventHandler) null; - this.pvTimeoutData = IntPtr.Zero; - this.nTimeOutSec = 0U; - } - - public unsafe InitArgs( - MessageCookieLayout layout, - ContextID idContextNew, - EngineApi.MessageBufferEventHandler pfnProcessBufferProc) - : this(layout, idContextNew) - { - if (pfnProcessBufferProc == null) - return; - IntPtr num; - EngineApi.IFC(EngineApi.SpWrapBufferProc(pfnProcessBufferProc, &num)); - this.pfnProcessBuffer = num; - } - } - - internal unsafe delegate int MessageBufferEventHandler( - IntPtr pData, - uint hContext, - EngineApi.BufferInfo* pBufferInfo, - void* pvBufferData); - - [System.Flags] - public enum WorkResult : uint - { - ProcessedMessage = 1, - NewUserMessage = 2, - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/HandleGroup.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/HandleGroup.cs index 13ba1ee..ac2bdca 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/HandleGroup.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/HandleGroup.cs @@ -11,357 +11,357 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - internal class HandleGroup : RenderObject, IDisposable, IEnumerable, IRenderHandleOwner - { - private const int USAGE_INDEX_SHIFT = 5; - private const uint USAGE_INDEX_MASK = 31; - private const uint USAGE_SLOT_COUNT = 32; - private const uint USAGE_FULL_MASK = 4294967295; - private const uint LOWEST_BIT = 1; - private const uint INITIAL_BSEARCH_SPLIT = 16; - private const uint INITIAL_BSEARCH_TEST = 65535; - private static GCHandle s_gchEmpty = new GCHandle(); - private RenderPort m_portOwner; - private GCHandleType m_ht; - private GCHandle[] m_objects; - private uint[] m_usage; - private byte[] m_uniqueness; - private uint m_alloc; - private uint m_used; - private uint m_hint; - private uint m_maxObjects; - - public HandleGroup(GCHandleType ht, RenderPort portOwner) - : this(ht, portOwner, false, uint.MaxValue) + internal class HandleGroup : RenderObject, IDisposable, IEnumerable, IRenderHandleOwner { - } + private const int USAGE_INDEX_SHIFT = 5; + private const uint USAGE_INDEX_MASK = 31; + private const uint USAGE_SLOT_COUNT = 32; + private const uint USAGE_FULL_MASK = 4294967295; + private const uint LOWEST_BIT = 1; + private const uint INITIAL_BSEARCH_SPLIT = 16; + private const uint INITIAL_BSEARCH_TEST = 65535; + private static GCHandle s_gchEmpty = new GCHandle(); + private RenderPort m_portOwner; + private GCHandleType m_ht; + private GCHandle[] m_objects; + private uint[] m_usage; + private byte[] m_uniqueness; + private uint m_alloc; + private uint m_used; + private uint m_hint; + private uint m_maxObjects; - public HandleGroup(GCHandleType ht, RenderPort portOwner, bool uniquify) - : this(ht, portOwner, uniquify, uint.MaxValue) - { - } - - public HandleGroup(GCHandleType ht, RenderPort portOwner, uint maxObjects) - : this(ht, portOwner, false, maxObjects) - { - } - - public HandleGroup(GCHandleType ht, RenderPort portOwner, bool uniquify, uint maxObjects) - { - Debug2.Validate(portOwner != null, typeof (ArgumentNullException), (object) nameof (portOwner), (object) "Must specify valid owner"); - this.m_ht = ht; - this.m_portOwner = portOwner; - this.m_maxObjects = maxObjects; - if (!uniquify) - return; - this.m_uniqueness = new byte[1]; - } - - protected override void Dispose(bool inDispose) - { - try - { - this.Clear(); - } - finally - { - base.Dispose(inDispose); - } - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => RENDERHANDLE.NULL; - - void IRenderHandleOwner.OnDisconnect() - { - } - - public IRenderHandleOwner this[uint index] - { - get - { - this.ValidateSlot(index); - GCHandle gcHandle = this.m_objects[(IntPtr) index]; - return !gcHandle.IsAllocated ? (IRenderHandleOwner) null : (IRenderHandleOwner) gcHandle.Target; - } - set - { - this.ValidateSlot(index); - this.SetIndex(index, value); - } - } - - public uint Count => this.m_alloc; - - public IEnumerator GetEnumerator() => new HandleGroup.ObjectCopy(this).GetEnumerator(); - - public IRenderHandleOwner Get( - uint index, - uint expectedUniqueness, - bool fAllowInvalid) - { - if (!this.ValidateAccess(index, expectedUniqueness, fAllowInvalid)) - return (IRenderHandleOwner) null; - GCHandle gcHandle = this.m_objects[(IntPtr) index]; - return !gcHandle.IsAllocated ? (IRenderHandleOwner) null : (IRenderHandleOwner) gcHandle.Target; - } - - public IRenderHandleOwner Get(uint index, uint expectedUniqueness) => this.Get(index, expectedUniqueness, false); - - public void Set(uint index, uint expectedUniqueness, IRenderHandleOwner owner) - { - this.ValidateAccess(index, expectedUniqueness); - this.SetIndex(index, owner); - } - - public void Clear() - { - if (this.m_objects == null) - return; - for (uint index = 0; (long) index < (long) this.m_objects.Length; ++index) - this.SetIndex(index, (IRenderHandleOwner) null); - this.m_objects = (GCHandle[]) null; - this.m_usage = (uint[]) null; - if (this.m_uniqueness != null) - this.m_uniqueness = new byte[1]; - this.m_alloc = 0U; - this.m_used = 0U; - this.m_hint = 0U; - } - - public uint Add(IRenderHandleOwner owner) => this.Add(owner, out uint _); - - public uint Add(IRenderHandleOwner owner, out uint unique) - { - if (this.m_used >= this.m_alloc) - this.GrowStorage(); - uint index = this.AllocSlot(); - this.SetIndex(index, owner); - this.UpdateUniqueness(index, out unique); - return index; - } - - public void AddAtIndex(IRenderHandleOwner owner, uint index) => this.AddAtIndex(owner, index, out uint _); - - public void AddAtIndex(IRenderHandleOwner owner, uint index, out uint unique) - { - if (index >= this.m_alloc) - this.GrowStorageTo(index + 1U); - this.AllocSlotAt(index); - this.SetIndex(index, owner); - this.UpdateUniqueness(index, out unique); - } - - public void AddAtIndexWithKnownUniqueness( - IRenderHandleOwner owner, - uint index, - uint unique, - bool fUpdateExisting) - { - if (index >= this.m_alloc) - this.GrowStorageTo(index + 1U); - if (fUpdateExisting && !this.ValidateSlotFree(index, true)) - Debug2.Validate(this.Get(index, unique) == null, typeof (ArgumentException), "Should only be updating a null owner"); - else - this.AllocSlotAt(index); - this.SetIndex(index, owner); - this.SetUniqueness(index, unique); - } - - public void Remove(uint index) - { - this.ValidateSlot(index); - this.SetIndex(index, (IRenderHandleOwner) null); - this.FreeSlot(index); - } - - public void Remove(uint index, uint expectedUniqueness) - { - this.ValidateAccess(index, expectedUniqueness); - this.SetIndex(index, (IRenderHandleOwner) null); - this.FreeSlot(index); - } - - private static bool IsEmpty(GCHandle gch) => GCHandle.ToIntPtr(gch) == IntPtr.Zero; - - private void SetIndex(uint index, IRenderHandleOwner newOwner) - { - GCHandle gch = this.m_objects[(IntPtr) index]; - if (!HandleGroup.IsEmpty(gch)) - { - ((IRenderHandleOwner) gch.Target)?.OnDisconnect(); - gch.Free(); - } - if (newOwner != null) - this.m_objects[(IntPtr) index] = GCHandle.Alloc((object) newOwner, this.m_ht); - else - this.m_objects[(IntPtr) index] = HandleGroup.s_gchEmpty; - } - - private void UpdateUniqueness(uint index, out uint unique) - { - byte num1 = 0; - if (this.m_uniqueness != null) - { - byte num2 = this.m_uniqueness[(IntPtr) index]; - num1 = num2 >= byte.MaxValue ? (byte) 1 : (byte) ((uint) num2 + 1U); - this.m_uniqueness[(IntPtr) index] = num1; - } - unique = (uint) num1; - } - - private void SetUniqueness(uint index, uint unique) - { - Debug2.Validate(unique <= (uint) byte.MaxValue, typeof (ArgumentOutOfRangeException), "Uniqueness must be a byte"); - if (this.m_uniqueness == null) - return; - this.m_uniqueness[(IntPtr) index] = (byte) (unique & (uint) byte.MaxValue); - } - - private void ValidateSlot(uint index) => this.ValidateSlot(index, false); - - private bool ValidateSlot(uint index, bool fAllowInvalid) - { - bool flag = false; - if (index < this.m_alloc && ((int) this.m_usage[(IntPtr) (index >> 5)] & 1 << (int) index) != 0) - flag = true; - Debug2.Throw(flag || fAllowInvalid, "Slot is not allocated"); - return flag; - } - - private void ValidateSlotFree(uint index) => this.ValidateSlotFree(index, false); - - private bool ValidateSlotFree(uint index, bool fAllowInvalid) - { - bool flag = false; - if (index < this.m_alloc && ((int) this.m_usage[(IntPtr) (index >> 5)] & 1 << (int) index) == 0) - flag = true; - Debug2.Throw(flag || fAllowInvalid, "Slot is not free"); - return flag; - } - - private void ValidateAccess(uint index, uint expectedUniqueness) => this.ValidateAccess(index, expectedUniqueness, false); - - private bool ValidateAccess(uint index, uint expectedUniqueness, bool fAllowInvalid) - { - if (!this.ValidateSlot(index, fAllowInvalid)) - return false; - uint num = 0; - if (this.m_uniqueness != null) - num = (uint) this.m_uniqueness[(IntPtr) index]; - bool flag = (int) expectedUniqueness == (int) num; - Debug2.Throw(flag || fAllowInvalid, "Slot uniqueness is stale"); - return flag; - } - - private uint AllocSlot() - { - uint num1 = 0; - uint hint; - for (hint = this.m_hint; (long) hint < (long) this.m_usage.Length; ++hint) - { - num1 = this.m_usage[(IntPtr) hint]; - if (num1 != uint.MaxValue) - break; - } - this.m_hint = hint; - uint num2 = 16; - uint maxValue = (uint) ushort.MaxValue; - uint num3 = 0; - do - { - if (((int) num1 & (int) maxValue) == (int) maxValue) + public HandleGroup(GCHandleType ht, RenderPort portOwner) + : this(ht, portOwner, false, uint.MaxValue) { - num1 >>= (int) num2; - num3 += num2; } - num2 >>= 1; - maxValue >>= (int) num2; - } - while (num2 != 0U); - this.m_usage[(IntPtr) hint] |= 1U << (int) num3; - ++this.m_used; - return hint << 5 | num3; - } - private void AllocSlotAt(uint index) - { - this.ValidateSlotFree(index); - this.m_usage[(IntPtr) (index >> 5)] |= 1U << (int) index; - ++this.m_used; - } - - private void FreeSlot(uint index) - { - uint num = index >> 5; - this.m_usage[(IntPtr) num] &= (uint) ~(1 << (int) index); - --this.m_used; - if (this.m_hint <= num) - return; - this.m_hint = num; - } - - private void GrowStorage() - { - Debug2.Validate(this.m_alloc < this.m_maxObjects, typeof (InvalidOperationException), "Too many video resources have been allocated"); - uint newSize = this.m_alloc * 2U; - if (newSize == 0U) - newSize = 32U; - if (newSize > this.m_maxObjects) - newSize = this.m_maxObjects; - this.GrowStorageTo(newSize); - } - - private void GrowStorageTo(uint newSize) - { - Debug2.Validate(newSize > this.m_alloc, typeof (ArgumentException), nameof (newSize)); - Debug2.Validate(newSize <= this.m_maxObjects, typeof (InvalidOperationException), "Too many video resources have been allocated"); - GCHandle[] gcHandleArray = new GCHandle[(IntPtr) newSize]; - uint[] numArray1 = (uint[]) null; - byte[] numArray2 = (byte[]) null; - uint num = (uint) ((int) newSize + 32 - 1) >> 5; - if (this.m_usage == null || (long) this.m_usage.Length < (long) num) - numArray1 = new uint[(IntPtr) num]; - if (this.m_uniqueness != null) - { - numArray2 = new byte[(IntPtr) newSize]; - Array.Copy((Array) this.m_uniqueness, (Array) numArray2, this.m_uniqueness.Length); - } - if (this.m_objects != null) - { - Array.Copy((Array) this.m_objects, (Array) gcHandleArray, this.m_objects.Length); - if (numArray1 != null) - Array.Copy((Array) this.m_usage, (Array) numArray1, this.m_usage.Length); - this.m_hint = (uint) this.m_usage.Length; - } - this.m_objects = gcHandleArray; - if (numArray1 != null) - this.m_usage = numArray1; - this.m_uniqueness = numArray2; - this.m_alloc = newSize; - } - - private class ObjectCopy - { - private IRenderHandleOwner[] m_arObjects; - - public ObjectCopy(HandleGroup map) - { - uint used = map.m_used; - this.m_arObjects = new IRenderHandleOwner[(IntPtr) used]; - uint num = 0; - for (uint index = 0; index < used; ++index) + public HandleGroup(GCHandleType ht, RenderPort portOwner, bool uniquify) + : this(ht, portOwner, uniquify, uint.MaxValue) { - GCHandle gch = map.m_objects[(IntPtr) index]; - if (!HandleGroup.IsEmpty(gch)) - { - IRenderHandleOwner target = (IRenderHandleOwner) gch.Target; - if (target != null) - this.m_arObjects[(IntPtr) num++] = target; - } } - } - public IEnumerator GetEnumerator() => this.m_arObjects.GetEnumerator(); + public HandleGroup(GCHandleType ht, RenderPort portOwner, uint maxObjects) + : this(ht, portOwner, false, maxObjects) + { + } + + public HandleGroup(GCHandleType ht, RenderPort portOwner, bool uniquify, uint maxObjects) + { + Debug2.Validate(portOwner != null, typeof(ArgumentNullException), (object)nameof(portOwner), (object)"Must specify valid owner"); + this.m_ht = ht; + this.m_portOwner = portOwner; + this.m_maxObjects = maxObjects; + if (!uniquify) + return; + this.m_uniqueness = new byte[1]; + } + + protected override void Dispose(bool inDispose) + { + try + { + this.Clear(); + } + finally + { + base.Dispose(inDispose); + } + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => RENDERHANDLE.NULL; + + void IRenderHandleOwner.OnDisconnect() + { + } + + public IRenderHandleOwner this[uint index] + { + get + { + this.ValidateSlot(index); + GCHandle gcHandle = this.m_objects[(IntPtr)index]; + return !gcHandle.IsAllocated ? (IRenderHandleOwner)null : (IRenderHandleOwner)gcHandle.Target; + } + set + { + this.ValidateSlot(index); + this.SetIndex(index, value); + } + } + + public uint Count => this.m_alloc; + + public IEnumerator GetEnumerator() => new HandleGroup.ObjectCopy(this).GetEnumerator(); + + public IRenderHandleOwner Get( + uint index, + uint expectedUniqueness, + bool fAllowInvalid) + { + if (!this.ValidateAccess(index, expectedUniqueness, fAllowInvalid)) + return (IRenderHandleOwner)null; + GCHandle gcHandle = this.m_objects[(IntPtr)index]; + return !gcHandle.IsAllocated ? (IRenderHandleOwner)null : (IRenderHandleOwner)gcHandle.Target; + } + + public IRenderHandleOwner Get(uint index, uint expectedUniqueness) => this.Get(index, expectedUniqueness, false); + + public void Set(uint index, uint expectedUniqueness, IRenderHandleOwner owner) + { + this.ValidateAccess(index, expectedUniqueness); + this.SetIndex(index, owner); + } + + public void Clear() + { + if (this.m_objects == null) + return; + for (uint index = 0; (long)index < (long)this.m_objects.Length; ++index) + this.SetIndex(index, (IRenderHandleOwner)null); + this.m_objects = (GCHandle[])null; + this.m_usage = (uint[])null; + if (this.m_uniqueness != null) + this.m_uniqueness = new byte[1]; + this.m_alloc = 0U; + this.m_used = 0U; + this.m_hint = 0U; + } + + public uint Add(IRenderHandleOwner owner) => this.Add(owner, out uint _); + + public uint Add(IRenderHandleOwner owner, out uint unique) + { + if (this.m_used >= this.m_alloc) + this.GrowStorage(); + uint index = this.AllocSlot(); + this.SetIndex(index, owner); + this.UpdateUniqueness(index, out unique); + return index; + } + + public void AddAtIndex(IRenderHandleOwner owner, uint index) => this.AddAtIndex(owner, index, out uint _); + + public void AddAtIndex(IRenderHandleOwner owner, uint index, out uint unique) + { + if (index >= this.m_alloc) + this.GrowStorageTo(index + 1U); + this.AllocSlotAt(index); + this.SetIndex(index, owner); + this.UpdateUniqueness(index, out unique); + } + + public void AddAtIndexWithKnownUniqueness( + IRenderHandleOwner owner, + uint index, + uint unique, + bool fUpdateExisting) + { + if (index >= this.m_alloc) + this.GrowStorageTo(index + 1U); + if (fUpdateExisting && !this.ValidateSlotFree(index, true)) + Debug2.Validate(this.Get(index, unique) == null, typeof(ArgumentException), "Should only be updating a null owner"); + else + this.AllocSlotAt(index); + this.SetIndex(index, owner); + this.SetUniqueness(index, unique); + } + + public void Remove(uint index) + { + this.ValidateSlot(index); + this.SetIndex(index, (IRenderHandleOwner)null); + this.FreeSlot(index); + } + + public void Remove(uint index, uint expectedUniqueness) + { + this.ValidateAccess(index, expectedUniqueness); + this.SetIndex(index, (IRenderHandleOwner)null); + this.FreeSlot(index); + } + + private static bool IsEmpty(GCHandle gch) => GCHandle.ToIntPtr(gch) == IntPtr.Zero; + + private void SetIndex(uint index, IRenderHandleOwner newOwner) + { + GCHandle gch = this.m_objects[(IntPtr)index]; + if (!HandleGroup.IsEmpty(gch)) + { + ((IRenderHandleOwner)gch.Target)?.OnDisconnect(); + gch.Free(); + } + if (newOwner != null) + this.m_objects[(IntPtr)index] = GCHandle.Alloc((object)newOwner, this.m_ht); + else + this.m_objects[(IntPtr)index] = HandleGroup.s_gchEmpty; + } + + private void UpdateUniqueness(uint index, out uint unique) + { + byte num1 = 0; + if (this.m_uniqueness != null) + { + byte num2 = this.m_uniqueness[(IntPtr)index]; + num1 = num2 >= byte.MaxValue ? (byte)1 : (byte)((uint)num2 + 1U); + this.m_uniqueness[(IntPtr)index] = num1; + } + unique = (uint)num1; + } + + private void SetUniqueness(uint index, uint unique) + { + Debug2.Validate(unique <= (uint)byte.MaxValue, typeof(ArgumentOutOfRangeException), "Uniqueness must be a byte"); + if (this.m_uniqueness == null) + return; + this.m_uniqueness[(IntPtr)index] = (byte)(unique & (uint)byte.MaxValue); + } + + private void ValidateSlot(uint index) => this.ValidateSlot(index, false); + + private bool ValidateSlot(uint index, bool fAllowInvalid) + { + bool flag = false; + if (index < this.m_alloc && ((int)this.m_usage[(IntPtr)(index >> 5)] & 1 << (int)index) != 0) + flag = true; + Debug2.Throw(flag || fAllowInvalid, "Slot is not allocated"); + return flag; + } + + private void ValidateSlotFree(uint index) => this.ValidateSlotFree(index, false); + + private bool ValidateSlotFree(uint index, bool fAllowInvalid) + { + bool flag = false; + if (index < this.m_alloc && ((int)this.m_usage[(IntPtr)(index >> 5)] & 1 << (int)index) == 0) + flag = true; + Debug2.Throw(flag || fAllowInvalid, "Slot is not free"); + return flag; + } + + private void ValidateAccess(uint index, uint expectedUniqueness) => this.ValidateAccess(index, expectedUniqueness, false); + + private bool ValidateAccess(uint index, uint expectedUniqueness, bool fAllowInvalid) + { + if (!this.ValidateSlot(index, fAllowInvalid)) + return false; + uint num = 0; + if (this.m_uniqueness != null) + num = (uint)this.m_uniqueness[(IntPtr)index]; + bool flag = (int)expectedUniqueness == (int)num; + Debug2.Throw(flag || fAllowInvalid, "Slot uniqueness is stale"); + return flag; + } + + private uint AllocSlot() + { + uint num1 = 0; + uint hint; + for (hint = this.m_hint; (long)hint < (long)this.m_usage.Length; ++hint) + { + num1 = this.m_usage[(IntPtr)hint]; + if (num1 != uint.MaxValue) + break; + } + this.m_hint = hint; + uint num2 = 16; + uint maxValue = (uint)ushort.MaxValue; + uint num3 = 0; + do + { + if (((int)num1 & (int)maxValue) == (int)maxValue) + { + num1 >>= (int)num2; + num3 += num2; + } + num2 >>= 1; + maxValue >>= (int)num2; + } + while (num2 != 0U); + this.m_usage[(IntPtr)hint] |= 1U << (int)num3; + ++this.m_used; + return hint << 5 | num3; + } + + private void AllocSlotAt(uint index) + { + this.ValidateSlotFree(index); + this.m_usage[(IntPtr)(index >> 5)] |= 1U << (int)index; + ++this.m_used; + } + + private void FreeSlot(uint index) + { + uint num = index >> 5; + this.m_usage[(IntPtr)num] &= (uint)~(1 << (int)index); + --this.m_used; + if (this.m_hint <= num) + return; + this.m_hint = num; + } + + private void GrowStorage() + { + Debug2.Validate(this.m_alloc < this.m_maxObjects, typeof(InvalidOperationException), "Too many video resources have been allocated"); + uint newSize = this.m_alloc * 2U; + if (newSize == 0U) + newSize = 32U; + if (newSize > this.m_maxObjects) + newSize = this.m_maxObjects; + this.GrowStorageTo(newSize); + } + + private void GrowStorageTo(uint newSize) + { + Debug2.Validate(newSize > this.m_alloc, typeof(ArgumentException), nameof(newSize)); + Debug2.Validate(newSize <= this.m_maxObjects, typeof(InvalidOperationException), "Too many video resources have been allocated"); + GCHandle[] gcHandleArray = new GCHandle[(IntPtr)newSize]; + uint[] numArray1 = (uint[])null; + byte[] numArray2 = (byte[])null; + uint num = (uint)((int)newSize + 32 - 1) >> 5; + if (this.m_usage == null || (long)this.m_usage.Length < (long)num) + numArray1 = new uint[(IntPtr)num]; + if (this.m_uniqueness != null) + { + numArray2 = new byte[(IntPtr)newSize]; + Array.Copy((Array)this.m_uniqueness, (Array)numArray2, this.m_uniqueness.Length); + } + if (this.m_objects != null) + { + Array.Copy((Array)this.m_objects, (Array)gcHandleArray, this.m_objects.Length); + if (numArray1 != null) + Array.Copy((Array)this.m_usage, (Array)numArray1, this.m_usage.Length); + this.m_hint = (uint)this.m_usage.Length; + } + this.m_objects = gcHandleArray; + if (numArray1 != null) + this.m_usage = numArray1; + this.m_uniqueness = numArray2; + this.m_alloc = newSize; + } + + private class ObjectCopy + { + private IRenderHandleOwner[] m_arObjects; + + public ObjectCopy(HandleGroup map) + { + uint used = map.m_used; + this.m_arObjects = new IRenderHandleOwner[(IntPtr)used]; + uint num = 0; + for (uint index = 0; index < used; ++index) + { + GCHandle gch = map.m_objects[(IntPtr)index]; + if (!HandleGroup.IsEmpty(gch)) + { + IRenderHandleOwner target = (IRenderHandleOwner)gch.Target; + if (target != null) + this.m_arObjects[(IntPtr)num++] = target; + } + } + } + + public IEnumerator GetEnumerator() => this.m_arObjects.GetEnumerator(); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/HandleTable.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/HandleTable.cs index 9bcea06..c2acbb9 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/HandleTable.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/HandleTable.cs @@ -11,169 +11,169 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - internal class HandleTable : RenderObject, IComparer - { - private RenderPort m_portOwner; - private HandleGroup m_groups; - private uint m_MaxObjectsPerGroup; - private int m_GroupShift; - private int m_UniqueShift; - private uint m_GroupMask; - private uint m_ObjectMask; - private uint m_UniqueMask; - - public HandleTable(RenderPort portOwner, MessageCookieLayout layout) + internal class HandleTable : RenderObject, IComparer { - Debug2.Validate(portOwner != null, typeof (ArgumentNullException), nameof (portOwner)); - this.m_portOwner = portOwner; - uint maxObjects = 1U << (int) layout.numberOfGroupBits; - this.m_MaxObjectsPerGroup = 1U << (int) layout.numberOfObjectBits; - this.m_GroupShift = (int) layout.numberOfObjectBits; - this.m_UniqueShift = (int) layout.numberOfObjectBits + (int) layout.numberOfGroupBits; - this.m_GroupMask = (uint) ((int) maxObjects - 1 << this.m_GroupShift); - this.m_ObjectMask = this.m_MaxObjectsPerGroup - 1U; - this.m_UniqueMask = (uint) ~((int) this.m_GroupMask | (int) this.m_ObjectMask); - this.m_groups = new HandleGroup(GCHandleType.Normal, this.m_portOwner, maxObjects); - } + private RenderPort m_portOwner; + private HandleGroup m_groups; + private uint m_MaxObjectsPerGroup; + private int m_GroupShift; + private int m_UniqueShift; + private uint m_GroupMask; + private uint m_ObjectMask; + private uint m_UniqueMask; - protected override void Dispose(bool inDispose) - { - try - { - if (!inDispose) - return; - foreach (HandleGroup group in this.m_groups) - group?.Dispose(); - this.m_groups.Clear(); - this.m_groups = (HandleGroup) null; - } - finally - { - base.Dispose(inDispose); - } - } - - public RENDERHANDLE Alloc(RENDERGROUP groupId, IRenderHandleOwner owner) - { - uint uint32 = RENDERGROUP.ToUInt32(groupId); - HandleGroup group = this.m_groups[uint32] as HandleGroup; - Debug2.Validate(group != null, typeof (ArgumentException), (object) "Group does not exist", (object) nameof (groupId)); - uint unique; - uint num = group.Add(owner, out unique); - return RENDERHANDLE.FromUInt32((uint) ((int) unique << this.m_UniqueShift | (int) uint32 << this.m_GroupShift) | num); - } - - public void AllocWithId(IRenderHandleOwner owner, RENDERHANDLE handle, bool fUpdateExisting) - { - uint unique; - HandleGroup group; - uint index; - this.MapHandle(handle, true, out unique, out group, out index); - group.AddAtIndexWithKnownUniqueness(owner, index, unique, fUpdateExisting); - } - - public void Free(RENDERHANDLE handle) - { - uint unique; - HandleGroup group; - uint index; - this.MapHandle(handle, false, out unique, out group, out index); - group.Remove(index, unique); - } - - public IRenderHandleOwner GetOwner(RENDERHANDLE handle) => this.GetOwner(handle, false); - - public IRenderHandleOwner GetOwner(RENDERHANDLE handle, bool fAllowInvalid) - { - uint unique; - HandleGroup group; - uint index; - this.MapHandle(handle, false, out unique, out group, out index, fAllowInvalid); - return group.Get(index, unique, fAllowInvalid); - } - - public void SetOwner(RENDERHANDLE handle, IRenderHandleOwner owner) - { - uint unique; - HandleGroup group; - uint index; - this.MapHandle(handle, false, out unique, out group, out index); - group.Set(index, unique, owner); - } - - public RENDERGROUP GetGroup(RENDERHANDLE handle) => RENDERGROUP.FromUInt32((RENDERHANDLE.ToUInt32(handle) & this.m_GroupMask) >> this.m_GroupShift); - - public RENDERGROUP AllocGroup() => RENDERGROUP.FromUInt32(this.m_groups.Add((IRenderHandleOwner) this.CreateNewGroup())); - - public void AllocGroupWithId(RENDERGROUP groupId) - { - uint uint32 = RENDERGROUP.ToUInt32(groupId); - this.m_groups.AddAtIndex((IRenderHandleOwner) this.CreateNewGroup(), uint32); - } - - public void FreeGroup(RENDERGROUP groupId) => this.m_groups.Remove(RENDERGROUP.ToUInt32(groupId)); - - public void Validate(RENDERHANDLE handle) - { - uint unique; - HandleGroup group; - uint index; - this.MapHandle(handle, false, out unique, out group, out index); - Debug2.Validate((object) group.Get(index, unique) != null, typeof (ArgumentException), (object) "Must point to valid object", (object) nameof (handle)); - } - - private HandleGroup CreateNewGroup() => new HandleGroup(GCHandleType.Weak, this.m_portOwner, true, this.m_MaxObjectsPerGroup); - - private void MapHandle( - RENDERHANDLE handle, - bool fCreateGroup, - out uint unique, - out HandleGroup group, - out uint index) - { - this.MapHandle(handle, fCreateGroup, out unique, out group, out index, false); - } - - private void MapHandle( - RENDERHANDLE handle, - bool fCreateGroup, - out uint unique, - out HandleGroup group, - out uint index, - bool fAllowInvalid) - { - uint uint32 = RENDERHANDLE.ToUInt32(handle); - uint num1 = (uint32 & this.m_UniqueMask) >> this.m_UniqueShift; - uint index1 = (uint32 & this.m_GroupMask) >> this.m_GroupShift; - uint num2 = uint32 & this.m_ObjectMask; - group = (HandleGroup) null; - if (index1 <= this.m_groups.Count) - group = this.m_groups[index1] as HandleGroup; - if (group == null) - { - if (fCreateGroup) + public HandleTable(RenderPort portOwner, MessageCookieLayout layout) { - group = this.CreateNewGroup(); - this.m_groups.AddAtIndex((IRenderHandleOwner) group, index1); + Debug2.Validate(portOwner != null, typeof(ArgumentNullException), nameof(portOwner)); + this.m_portOwner = portOwner; + uint maxObjects = 1U << (int)layout.numberOfGroupBits; + this.m_MaxObjectsPerGroup = 1U << (int)layout.numberOfObjectBits; + this.m_GroupShift = (int)layout.numberOfObjectBits; + this.m_UniqueShift = (int)layout.numberOfObjectBits + (int)layout.numberOfGroupBits; + this.m_GroupMask = (uint)((int)maxObjects - 1 << this.m_GroupShift); + this.m_ObjectMask = this.m_MaxObjectsPerGroup - 1U; + this.m_UniqueMask = (uint)~((int)this.m_GroupMask | (int)this.m_ObjectMask); + this.m_groups = new HandleGroup(GCHandleType.Normal, this.m_portOwner, maxObjects); } - else - Debug2.Throw(fAllowInvalid, "Group does not exist"); - } - unique = num1; - index = num2; - } - int IComparer.Compare(object a, object b) - { - KeyValueEntry keyValueEntry1 = (KeyValueEntry) a; - KeyValueEntry keyValueEntry2 = (KeyValueEntry) b; - uint num1 = keyValueEntry1.Value; - uint num2 = keyValueEntry2.Value; - if (num1 > num2) - return -1; - return num1 < num2 ? 1 : string.Compare(keyValueEntry1.Key, keyValueEntry2.Key, StringComparison.Ordinal); - } + protected override void Dispose(bool inDispose) + { + try + { + if (!inDispose) + return; + foreach (HandleGroup group in this.m_groups) + group?.Dispose(); + this.m_groups.Clear(); + this.m_groups = (HandleGroup)null; + } + finally + { + base.Dispose(inDispose); + } + } - protected override void Invariant() => Debug2.Validate(this.m_groups != null, typeof (InvalidOperationException), "HandleTable has no HandleGroups"); - } + public RENDERHANDLE Alloc(RENDERGROUP groupId, IRenderHandleOwner owner) + { + uint uint32 = RENDERGROUP.ToUInt32(groupId); + HandleGroup group = this.m_groups[uint32] as HandleGroup; + Debug2.Validate(group != null, typeof(ArgumentException), (object)"Group does not exist", (object)nameof(groupId)); + uint unique; + uint num = group.Add(owner, out unique); + return RENDERHANDLE.FromUInt32((uint)((int)unique << this.m_UniqueShift | (int)uint32 << this.m_GroupShift) | num); + } + + public void AllocWithId(IRenderHandleOwner owner, RENDERHANDLE handle, bool fUpdateExisting) + { + uint unique; + HandleGroup group; + uint index; + this.MapHandle(handle, true, out unique, out group, out index); + group.AddAtIndexWithKnownUniqueness(owner, index, unique, fUpdateExisting); + } + + public void Free(RENDERHANDLE handle) + { + uint unique; + HandleGroup group; + uint index; + this.MapHandle(handle, false, out unique, out group, out index); + group.Remove(index, unique); + } + + public IRenderHandleOwner GetOwner(RENDERHANDLE handle) => this.GetOwner(handle, false); + + public IRenderHandleOwner GetOwner(RENDERHANDLE handle, bool fAllowInvalid) + { + uint unique; + HandleGroup group; + uint index; + this.MapHandle(handle, false, out unique, out group, out index, fAllowInvalid); + return group.Get(index, unique, fAllowInvalid); + } + + public void SetOwner(RENDERHANDLE handle, IRenderHandleOwner owner) + { + uint unique; + HandleGroup group; + uint index; + this.MapHandle(handle, false, out unique, out group, out index); + group.Set(index, unique, owner); + } + + public RENDERGROUP GetGroup(RENDERHANDLE handle) => RENDERGROUP.FromUInt32((RENDERHANDLE.ToUInt32(handle) & this.m_GroupMask) >> this.m_GroupShift); + + public RENDERGROUP AllocGroup() => RENDERGROUP.FromUInt32(this.m_groups.Add((IRenderHandleOwner)this.CreateNewGroup())); + + public void AllocGroupWithId(RENDERGROUP groupId) + { + uint uint32 = RENDERGROUP.ToUInt32(groupId); + this.m_groups.AddAtIndex((IRenderHandleOwner)this.CreateNewGroup(), uint32); + } + + public void FreeGroup(RENDERGROUP groupId) => this.m_groups.Remove(RENDERGROUP.ToUInt32(groupId)); + + public void Validate(RENDERHANDLE handle) + { + uint unique; + HandleGroup group; + uint index; + this.MapHandle(handle, false, out unique, out group, out index); + Debug2.Validate((object)group.Get(index, unique) != null, typeof(ArgumentException), (object)"Must point to valid object", (object)nameof(handle)); + } + + private HandleGroup CreateNewGroup() => new HandleGroup(GCHandleType.Weak, this.m_portOwner, true, this.m_MaxObjectsPerGroup); + + private void MapHandle( + RENDERHANDLE handle, + bool fCreateGroup, + out uint unique, + out HandleGroup group, + out uint index) + { + this.MapHandle(handle, fCreateGroup, out unique, out group, out index, false); + } + + private void MapHandle( + RENDERHANDLE handle, + bool fCreateGroup, + out uint unique, + out HandleGroup group, + out uint index, + bool fAllowInvalid) + { + uint uint32 = RENDERHANDLE.ToUInt32(handle); + uint num1 = (uint32 & this.m_UniqueMask) >> this.m_UniqueShift; + uint index1 = (uint32 & this.m_GroupMask) >> this.m_GroupShift; + uint num2 = uint32 & this.m_ObjectMask; + group = (HandleGroup)null; + if (index1 <= this.m_groups.Count) + group = this.m_groups[index1] as HandleGroup; + if (group == null) + { + if (fCreateGroup) + { + group = this.CreateNewGroup(); + this.m_groups.AddAtIndex((IRenderHandleOwner)group, index1); + } + else + Debug2.Throw(fAllowInvalid, "Group does not exist"); + } + unique = num1; + index = num2; + } + + int IComparer.Compare(object a, object b) + { + KeyValueEntry keyValueEntry1 = (KeyValueEntry)a; + KeyValueEntry keyValueEntry2 = (KeyValueEntry)b; + uint num1 = keyValueEntry1.Value; + uint num2 = keyValueEntry2.Value; + if (num1 > num2) + return -1; + return num1 < num2 ? 1 : string.Compare(keyValueEntry1.Key, keyValueEntry2.Key, StringComparison.Ordinal); + } + + protected override void Invariant() => Debug2.Validate(this.m_groups != null, typeof(InvalidOperationException), "HandleTable has no HandleGroups"); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/IChannel.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/IChannel.cs index 1a2972e..417203b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/IChannel.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/IChannel.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render.Protocol { - internal interface IChannel - { - void Connect(ContextID idRemoteContext, RENDERHANDLE hBrokerClass, MessageCookieLayout layout); + internal interface IChannel + { + void Connect(ContextID idRemoteContext, RENDERHANDLE hBrokerClass, MessageCookieLayout layout); - void Dispose(); + void Dispose(); - bool IsConnected { get; } - } + bool IsConnected { get; } + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/IRenderHandleOwner.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/IRenderHandleOwner.cs index af492e4..d08432d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/IRenderHandleOwner.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/IRenderHandleOwner.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render.Protocol { - internal interface IRenderHandleOwner - { - RENDERHANDLE RenderHandle { get; } + internal interface IRenderHandleOwner + { + RENDERHANDLE RenderHandle { get; } - void OnDisconnect(); - } + void OnDisconnect(); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalChannel.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalChannel.cs index 43dbffc..1941d0d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalChannel.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalChannel.cs @@ -9,41 +9,41 @@ using System; namespace Microsoft.Iris.Render.Protocol { - internal class LocalChannel : RenderObject, IChannel - { - private IntPtr m_renderThread; - - public LocalChannel(LocalConnectionInfo connectionInfo) + internal class LocalChannel : RenderObject, IChannel { - } + private IntPtr m_renderThread; - public bool IsConnected => this.m_renderThread != IntPtr.Zero; + public LocalChannel(LocalConnectionInfo connectionInfo) + { + } - public void Connect( - ContextID remoteContextId, - RENDERHANDLE brokerClassHandle, - MessageCookieLayout layout) - { - Debug2.Validate(remoteContextId != ContextID.NULL, typeof (ArgumentNullException), nameof (remoteContextId)); - EngineApi.IFC(EngineApi.SpRenderThreadInit(ref new EngineApi.InitArgs(layout, remoteContextId) - { - idObjectBrokerClass = brokerClassHandle - }, out this.m_renderThread)); - } + public bool IsConnected => this.m_renderThread != IntPtr.Zero; - protected override void Dispose(bool inDispose) - { - try - { - if (!(this.m_renderThread != IntPtr.Zero)) - return; - EngineApi.IFC(EngineApi.SpRenderThreadUninit(this.m_renderThread)); - this.m_renderThread = IntPtr.Zero; - } - finally - { - base.Dispose(inDispose); - } + public void Connect( + ContextID remoteContextId, + RENDERHANDLE brokerClassHandle, + MessageCookieLayout layout) + { + Debug2.Validate(remoteContextId != ContextID.NULL, typeof(ArgumentNullException), nameof(remoteContextId)); + EngineApi.IFC(EngineApi.SpRenderThreadInit(ref new EngineApi.InitArgs(layout, remoteContextId) + { + idObjectBrokerClass = brokerClassHandle + }, out this.m_renderThread)); + } + + protected override void Dispose(bool inDispose) + { + try + { + if (!(this.m_renderThread != IntPtr.Zero)) + return; + EngineApi.IFC(EngineApi.SpRenderThreadUninit(this.m_renderThread)); + this.m_renderThread = IntPtr.Zero; + } + finally + { + base.Dispose(inDispose); + } + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalConnectionInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalConnectionInfo.cs index 1d37b8c..ff85c8b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalConnectionInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/LocalConnectionInfo.cs @@ -8,8 +8,8 @@ using System; namespace Microsoft.Iris.Render.Protocol { - [Serializable] - internal sealed class LocalConnectionInfo : ConnectionInfo - { - } + [Serializable] + internal sealed class LocalConnectionInfo : ConnectionInfo + { + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MarshalHelper.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MarshalHelper.cs index da4c682..ff827ea 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MarshalHelper.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MarshalHelper.cs @@ -11,166 +11,166 @@ using System.Text; namespace Microsoft.Iris.Render.Protocol { - internal class MarshalHelper - { - private static RENDERHANDLE[] s_EmptyRenderHandleArray = new RENDERHANDLE[0]; - - public static unsafe void Decode( - RenderPort port, - Message* pmsg, - BLOBREF refParam, - out string param) + internal class MarshalHelper { - uint uint32 = BLOBREF.ToUInt32(refParam); - uint num1 = uint32 & (uint) ushort.MaxValue; - uint num2 = (uint32 & 4294901760U) >> 16; - byte* numPtr = (byte*) ((IntPtr) pmsg + (int) num1); - int length = (int) num2 - 2; - byte[] numArray = new byte[length]; - Marshal.Copy(new IntPtr((void*) numPtr), numArray, 0, length); - Encoding encoding = Encoding.Unicode; - if (port.AlwaysBigEndian) - encoding = Encoding.BigEndianUnicode; - param = encoding.GetString(numArray); - } + private static RENDERHANDLE[] s_EmptyRenderHandleArray = new RENDERHANDLE[0]; - public static unsafe void Decode( - RenderPort port, - Message* pmsgOuter, - BLOBREF refMsgInner, - out Message* pmsgInner) - { - byte* numPtr = (byte*) pmsgOuter; - uint num = (uint) ushort.MaxValue & BLOBREF.ToUInt32(refMsgInner); - pmsgInner = (Message*) (numPtr + (int) num); - } - - private static ushort[] ComputeByteOrderMap(Type targetType, bool fCompact) - { - ushort[] fieldMap = new ushort[10]; - MarshalHelper.ComputeByteOrderMapWorker(ref fieldMap, targetType, 0); - if (fCompact) - { - int length = (int) fieldMap[0] + 1; - if (fieldMap.Length > length) + public static unsafe void Decode( + RenderPort port, + Message* pmsg, + BLOBREF refParam, + out string param) { - ushort[] numArray = new ushort[length]; - Array.Copy((Array) fieldMap, (Array) numArray, length); - fieldMap = numArray; + uint uint32 = BLOBREF.ToUInt32(refParam); + uint num1 = uint32 & (uint)ushort.MaxValue; + uint num2 = (uint32 & 4294901760U) >> 16; + byte* numPtr = (byte*)((IntPtr)pmsg + (int)num1); + int length = (int)num2 - 2; + byte[] numArray = new byte[length]; + Marshal.Copy(new IntPtr((void*)numPtr), numArray, 0, length); + Encoding encoding = Encoding.Unicode; + if (port.AlwaysBigEndian) + encoding = Encoding.BigEndianUnicode; + param = encoding.GetString(numArray); } - } - return fieldMap; - } - public static unsafe void SwapByteOrder( - byte* pMem, - ref ushort[] fieldMapByRef, - Type type, - int startOffset, - int stopOffset) - { - if (fieldMapByRef == null) - fieldMapByRef = MarshalHelper.ComputeByteOrderMap(type, true); - ushort[] numArray = fieldMapByRef; - if (stopOffset <= 0) - stopOffset = int.MaxValue; - int num1 = (int) numArray[0] + 1; - for (int index1 = 1; index1 < num1; ++index1) - { - ushort num2 = numArray[index1]; - int num3 = (int) num2 >> 2; - if (num3 >= startOffset) + public static unsafe void Decode( + RenderPort port, + Message* pmsgOuter, + BLOBREF refMsgInner, + out Message* pmsgInner) { - if (num3 >= stopOffset) - break; - int num4 = 1 << ((int) num2 & 3); - byte* numPtr = pMem + num3; - int num5 = num4 / 2; - for (int index2 = 0; index2 < num5; ++index2) - { - int index3 = num4 - (index2 + 1); - byte num6 = numPtr[index2]; - numPtr[index2] = numPtr[index3]; - numPtr[index3] = num6; - } + byte* numPtr = (byte*)pmsgOuter; + uint num = (uint)ushort.MaxValue & BLOBREF.ToUInt32(refMsgInner); + pmsgInner = (Message*)(numPtr + (int)num); } - } - } - public static object MakeDumpable(string value) => (object) value; - - public static object MakeDumpable(object value) => value; - - public static unsafe object MakeDumpable(void* value) => (object) new IntPtr(value); - - private static void ComputeByteOrderMapWorker( - ref ushort[] fieldMap, - Type targetType, - int parentOffset) - { - if (targetType.IsPrimitive) - return; - int packingForType = MarshalHelper.GetPackingForType(targetType); - int num1 = 0; - foreach (FieldInfo field in targetType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) - { - Type type = field.FieldType; - if (type.IsEnum) - type = Enum.GetUnderlyingType(type); - int size = Marshal.SizeOf(type); - int num2 = size; - if (type.IsPrimitive) + private static ushort[] ComputeByteOrderMap(Type targetType, bool fCompact) { - if (num2 > packingForType) - num2 = packingForType; + ushort[] fieldMap = new ushort[10]; + MarshalHelper.ComputeByteOrderMapWorker(ref fieldMap, targetType, 0); + if (fCompact) + { + int length = (int)fieldMap[0] + 1; + if (fieldMap.Length > length) + { + ushort[] numArray = new ushort[length]; + Array.Copy((Array)fieldMap, (Array)numArray, length); + fieldMap = numArray; + } + } + return fieldMap; } - else if (num2 > 4) - num2 = 4; - int num3 = num2 - 1; - int num4 = num1 + num3 & ~num3; - int num5 = num4 + parentOffset; - if (type.IsPrimitive) - MarshalHelper.AddByteOrderEntry(ref fieldMap, num5, size); - else - MarshalHelper.ComputeByteOrderMapWorker(ref fieldMap, type, num5); - num1 = num4 + size; - } + + public static unsafe void SwapByteOrder( + byte* pMem, + ref ushort[] fieldMapByRef, + Type type, + int startOffset, + int stopOffset) + { + if (fieldMapByRef == null) + fieldMapByRef = MarshalHelper.ComputeByteOrderMap(type, true); + ushort[] numArray = fieldMapByRef; + if (stopOffset <= 0) + stopOffset = int.MaxValue; + int num1 = (int)numArray[0] + 1; + for (int index1 = 1; index1 < num1; ++index1) + { + ushort num2 = numArray[index1]; + int num3 = (int)num2 >> 2; + if (num3 >= startOffset) + { + if (num3 >= stopOffset) + break; + int num4 = 1 << ((int)num2 & 3); + byte* numPtr = pMem + num3; + int num5 = num4 / 2; + for (int index2 = 0; index2 < num5; ++index2) + { + int index3 = num4 - (index2 + 1); + byte num6 = numPtr[index2]; + numPtr[index2] = numPtr[index3]; + numPtr[index3] = num6; + } + } + } + } + + public static object MakeDumpable(string value) => (object)value; + + public static object MakeDumpable(object value) => value; + + public static unsafe object MakeDumpable(void* value) => (object)new IntPtr(value); + + private static void ComputeByteOrderMapWorker( + ref ushort[] fieldMap, + Type targetType, + int parentOffset) + { + if (targetType.IsPrimitive) + return; + int packingForType = MarshalHelper.GetPackingForType(targetType); + int num1 = 0; + foreach (FieldInfo field in targetType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) + { + Type type = field.FieldType; + if (type.IsEnum) + type = Enum.GetUnderlyingType(type); + int size = Marshal.SizeOf(type); + int num2 = size; + if (type.IsPrimitive) + { + if (num2 > packingForType) + num2 = packingForType; + } + else if (num2 > 4) + num2 = 4; + int num3 = num2 - 1; + int num4 = num1 + num3 & ~num3; + int num5 = num4 + parentOffset; + if (type.IsPrimitive) + MarshalHelper.AddByteOrderEntry(ref fieldMap, num5, size); + else + MarshalHelper.ComputeByteOrderMapWorker(ref fieldMap, type, num5); + num1 = num4 + size; + } + } + + private static int GetPackingForType(Type t) => 8; + + private static void AddByteOrderEntry(ref ushort[] fieldMap, int offset, int size) + { + ushort num; + switch (size) + { + case 1: + return; + case 2: + num = (ushort)1; + break; + case 3: + return; + case 4: + num = (ushort)2; + break; + case 8: + num = (ushort)3; + break; + default: + return; + } + int index = (int)fieldMap[0] + 1; + if (index >= fieldMap.Length) + { + ushort[] numArray = new ushort[2 * fieldMap.Length]; + Array.Copy((Array)fieldMap, (Array)numArray, fieldMap.Length); + fieldMap = numArray; + } + fieldMap[0] = (ushort)index; + fieldMap[index] = (ushort)((uint)(offset << 2) | (uint)num); + } + + public static RENDERHANDLE[] CreateRenderHandleArray(int length) => length == 0 ? MarshalHelper.s_EmptyRenderHandleArray : new RENDERHANDLE[length]; } - - private static int GetPackingForType(Type t) => 8; - - private static void AddByteOrderEntry(ref ushort[] fieldMap, int offset, int size) - { - ushort num; - switch (size) - { - case 1: - return; - case 2: - num = (ushort) 1; - break; - case 3: - return; - case 4: - num = (ushort) 2; - break; - case 8: - num = (ushort) 3; - break; - default: - return; - } - int index = (int) fieldMap[0] + 1; - if (index >= fieldMap.Length) - { - ushort[] numArray = new ushort[2 * fieldMap.Length]; - Array.Copy((Array) fieldMap, (Array) numArray, fieldMap.Length); - fieldMap = numArray; - } - fieldMap[0] = (ushort) index; - fieldMap[index] = (ushort) ((uint) (offset << 2) | (uint) num); - } - - public static RENDERHANDLE[] CreateRenderHandleArray(int length) => length == 0 ? MarshalHelper.s_EmptyRenderHandleArray : new RENDERHANDLE[length]; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Memory.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Memory.cs index 7ee2918..ef64cfc 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Memory.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Memory.cs @@ -9,91 +9,91 @@ using System; namespace Microsoft.Iris.Render.Protocol { - internal static class Memory - { - public static unsafe bool IsOverlap(IntPtr pvA, int cbA, IntPtr pvB, int cbB) + internal static class Memory { - byte* pointer1 = (byte*) pvA.ToPointer(); - byte* pointer2 = (byte*) pvB.ToPointer(); - if (pointer1 >= pointer2 && pointer1 < pointer2 + cbB) - return true; - return pointer2 >= pointer1 && pointer2 < pointer1 + cbA; - } + public static unsafe bool IsOverlap(IntPtr pvA, int cbA, IntPtr pvB, int cbB) + { + byte* pointer1 = (byte*)pvA.ToPointer(); + byte* pointer2 = (byte*)pvB.ToPointer(); + if (pointer1 >= pointer2 && pointer1 < pointer2 + cbB) + return true; + return pointer2 >= pointer1 && pointer2 < pointer1 + cbA; + } - public static unsafe void Zero(IntPtr pvDest, int cbZero) - { - uint* pointer = (uint*) pvDest.ToPointer(); - int num1 = cbZero / 4; - int num2 = num1; - while (num2-- > 0) - *pointer++ = 0U; - byte* numPtr = (byte*) pointer; - int num3 = cbZero - num1 * 4; - while (num3-- > 0) - *numPtr++ = (byte) 0; - } + public static unsafe void Zero(IntPtr pvDest, int cbZero) + { + uint* pointer = (uint*)pvDest.ToPointer(); + int num1 = cbZero / 4; + int num2 = num1; + while (num2-- > 0) + *pointer++ = 0U; + byte* numPtr = (byte*)pointer; + int num3 = cbZero - num1 * 4; + while (num3-- > 0) + *numPtr++ = (byte)0; + } - public static unsafe void Copy(IntPtr pvDest, IntPtr pvSrc, int cbCopy) - { - uint* pointer1 = (uint*) pvDest.ToPointer(); - uint* pointer2 = (uint*) pvSrc.ToPointer(); - int num1 = cbCopy / 4; - int num2 = num1; - while (num2-- > 0) - *pointer1++ = *pointer2++; - byte* numPtr1 = (byte*) pointer1; - byte* numPtr2 = (byte*) pointer2; - int num3 = cbCopy - num1 * 4; - while (num3-- > 0) - *numPtr1++ = *numPtr2++; - } + public static unsafe void Copy(IntPtr pvDest, IntPtr pvSrc, int cbCopy) + { + uint* pointer1 = (uint*)pvDest.ToPointer(); + uint* pointer2 = (uint*)pvSrc.ToPointer(); + int num1 = cbCopy / 4; + int num2 = num1; + while (num2-- > 0) + *pointer1++ = *pointer2++; + byte* numPtr1 = (byte*)pointer1; + byte* numPtr2 = (byte*)pointer2; + int num3 = cbCopy - num1 * 4; + while (num3-- > 0) + *numPtr1++ = *numPtr2++; + } - public static unsafe void ConvertEndian( - IntPtr pvDest, - IntPtr pvSrc, - int cbConvert, - int cUnitBits) - { - switch (cUnitBits) - { - case 8: - break; - case 16: - uint* pointer1 = (uint*) pvDest.ToPointer(); - uint* pointer2 = (uint*) pvSrc.ToPointer(); - int num1 = cbConvert / 4; - while (num1-- > 0) - { - uint num2 = *pointer2++; - *pointer1++ = (uint) ((int) ((num2 & 4278190080U) >> 8) | ((int) num2 & 16711680) << 8 | (int) ((num2 & 65280U) >> 8) | ((int) num2 & (int) byte.MaxValue) << 8); - } - if (cbConvert % 4 == 0) - break; - ushort* numPtr1 = (ushort*) pointer1; - ushort* numPtr2 = (ushort*) pointer1; - ushort* numPtr3 = (ushort*) ((IntPtr) numPtr2 + new IntPtr(2)); - ushort num3 = *numPtr2; - ushort* numPtr4 = numPtr1; - ushort* numPtr5 = (ushort*) ((IntPtr) numPtr4 + new IntPtr(2)); - int num4 = (int) (ushort) (((int) num3 & 65280) >> 8 | ((int) num3 & (int) byte.MaxValue) << 8); - *numPtr4 = (ushort) num4; - break; - case 32: - uint* pointer3 = (uint*) pvDest.ToPointer(); - uint* pointer4 = (uint*) pvSrc.ToPointer(); - int num5 = cbConvert / 4; - while (num5-- > 0) - { - uint num2 = *pointer4++; - *pointer3++ = (uint) ((int) ((num2 & 4278190080U) >> 24) | (int) ((num2 & 16711680U) >> 8) | ((int) num2 & 65280) << 8 | ((int) num2 & (int) byte.MaxValue) << 24); - } - break; - default: - Debug2.Throw(false, "Unsupported data format"); - break; - } - } + public static unsafe void ConvertEndian( + IntPtr pvDest, + IntPtr pvSrc, + int cbConvert, + int cUnitBits) + { + switch (cUnitBits) + { + case 8: + break; + case 16: + uint* pointer1 = (uint*)pvDest.ToPointer(); + uint* pointer2 = (uint*)pvSrc.ToPointer(); + int num1 = cbConvert / 4; + while (num1-- > 0) + { + uint num2 = *pointer2++; + *pointer1++ = (uint)((int)((num2 & 4278190080U) >> 8) | ((int)num2 & 16711680) << 8 | (int)((num2 & 65280U) >> 8) | ((int)num2 & (int)byte.MaxValue) << 8); + } + if (cbConvert % 4 == 0) + break; + ushort* numPtr1 = (ushort*)pointer1; + ushort* numPtr2 = (ushort*)pointer1; + ushort* numPtr3 = (ushort*)((IntPtr)numPtr2 + new IntPtr(2)); + ushort num3 = *numPtr2; + ushort* numPtr4 = numPtr1; + ushort* numPtr5 = (ushort*)((IntPtr)numPtr4 + new IntPtr(2)); + int num4 = (int)(ushort)(((int)num3 & 65280) >> 8 | ((int)num3 & (int)byte.MaxValue) << 8); + *numPtr4 = (ushort)num4; + break; + case 32: + uint* pointer3 = (uint*)pvDest.ToPointer(); + uint* pointer4 = (uint*)pvSrc.ToPointer(); + int num5 = cbConvert / 4; + while (num5-- > 0) + { + uint num2 = *pointer4++; + *pointer3++ = (uint)((int)((num2 & 4278190080U) >> 24) | (int)((num2 & 16711680U) >> 8) | ((int)num2 & 65280) << 8 | ((int)num2 & (int)byte.MaxValue) << 24); + } + 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 & (int) byte.MaxValue) << 24); - } + public static uint ConvertEndian(uint src) => (uint)((int)((src & 4278190080U) >> 24) | (int)((src & 16711680U) >> 8) | ((int)src & 65280) << 8 | ((int)src & (int)byte.MaxValue) << 24); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Message.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Message.cs index bbbaa2d..0e64fe6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Message.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/Message.cs @@ -8,11 +8,11 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - [ComVisible(false)] - internal struct Message - { - public uint cbSize; - public uint nMsg; - public RENDERHANDLE idObjectSubject; - } + [ComVisible(false)] + internal struct Message + { + public uint cbSize; + public uint nMsg; + public RENDERHANDLE idObjectSubject; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageBatchEntry.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageBatchEntry.cs index 6214a90..65c95c4 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageBatchEntry.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageBatchEntry.cs @@ -8,9 +8,9 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - [ComVisible(false)] - internal struct MessageBatchEntry - { - public uint uOffsetNextEntry; - } + [ComVisible(false)] + internal struct MessageBatchEntry + { + public uint uOffsetNextEntry; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageBatchHeader.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageBatchHeader.cs index 56c9516..df79f18 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageBatchHeader.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageBatchHeader.cs @@ -8,10 +8,10 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - [ComVisible(false)] - internal struct MessageBatchHeader - { - public RENDERHANDLE idPredicateBuffer; - public uint uOffsetFirstEntry; - } + [ComVisible(false)] + internal struct MessageBatchHeader + { + public RENDERHANDLE idPredicateBuffer; + public uint uOffsetFirstEntry; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageCookieLayout.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageCookieLayout.cs index 961239c..2024967 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageCookieLayout.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageCookieLayout.cs @@ -6,15 +6,15 @@ namespace Microsoft.Iris.Render.Protocol { - internal struct MessageCookieLayout - { - public short numberOfGroupBits; - public short numberOfObjectBits; - - public static MessageCookieLayout Default => new MessageCookieLayout() + internal struct MessageCookieLayout { - numberOfGroupBits = 4, - numberOfObjectBits = 20 - }; - } + public short numberOfGroupBits; + public short numberOfObjectBits; + + public static MessageCookieLayout Default => new MessageCookieLayout() + { + numberOfGroupBits = 4, + numberOfObjectBits = 20 + }; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageHeap.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageHeap.cs index 1c8d914..15dfe01 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageHeap.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessageHeap.cs @@ -10,245 +10,245 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - internal class MessageHeap : RenderObject - { - private MessageHeap.BlockInfo headBlock; - private MessageHeap.BlockInfo tailBlock; - private uint nextBlockId; - private uint smallBlockSize; - private uint blockHeaderSize; - private uint allocExtraSize; - private uint key; - - public MessageHeap(uint blockSize, uint headerSize, uint allocationExtra) + internal class MessageHeap : RenderObject { - Debug2.Validate(blockSize > headerSize, typeof (ArgumentException), "Blocks must be larger than their headers"); - this.smallBlockSize = blockSize; - this.blockHeaderSize = headerSize; - this.allocExtraSize = allocationExtra; - this.nextBlockId = 1U; - this.CreateBlock(MessageHeap.BlockType.First, this.smallBlockSize); - } + private MessageHeap.BlockInfo headBlock; + private MessageHeap.BlockInfo tailBlock; + private uint nextBlockId; + private uint smallBlockSize; + private uint blockHeaderSize; + private uint allocExtraSize; + private uint key; - protected override void Dispose(bool inDispose) - { - try - { - if (this.IsDisposed) - return; - this.ReleaseAll(true); - } - finally - { - base.Dispose(inDispose); - } - } - - internal bool IsDisposed => this.headBlock == null; - - public unsafe void* Alloc(uint size) - { - size += this.allocExtraSize; - uint num = (uint) (sizeof (void*) - 1); - size = (uint) ((int) size + (int) num & ~(int) num); - MessageHeap.BlockInfo block = this.tailBlock; - if (size > block.size - block.used) - { - MessageHeap.BlockType type = MessageHeap.BlockType.Normal; - uint actualSize = this.smallBlockSize; - if (size > this.smallBlockSize - this.blockHeaderSize) + public MessageHeap(uint blockSize, uint headerSize, uint allocationExtra) { - type = MessageHeap.BlockType.Large; - actualSize = this.blockHeaderSize + size; + Debug2.Validate(blockSize > headerSize, typeof(ArgumentException), "Blocks must be larger than their headers"); + this.smallBlockSize = blockSize; + this.blockHeaderSize = headerSize; + this.allocExtraSize = allocationExtra; + this.nextBlockId = 1U; + this.CreateBlock(MessageHeap.BlockType.First, this.smallBlockSize); } - block = this.CreateBlock(type, actualSize); - } - this.ZeroMemoryBlock(block, block.used, this.allocExtraSize); - void* voidPtr = (void*) ((IntPtr) block.data + ((int) block.used + (int) this.allocExtraSize)); - block.used += size; - ++this.key; - return voidPtr; - } - public unsafe MessageHeap.Block LookupBlock(void* p) - { - MessageHeap.BlockInfo blockInfo = this.LookupBlockWorker(p); - return new MessageHeap.Block(blockInfo.id, blockInfo.data, blockInfo.used); - } - - public void Reset() => this.ReleaseAll(false); - - public int BlockCount - { - get - { - int num = 0; - MessageHeap.BlockInfo blockInfo = this.headBlock; - while (blockInfo != null) + protected override void Dispose(bool inDispose) { - blockInfo = blockInfo.next; - ++num; + try + { + if (this.IsDisposed) + return; + this.ReleaseAll(true); + } + finally + { + base.Dispose(inDispose); + } } - return num; - } - } - public MessageHeap.Enumerator GetEnumerator() => new MessageHeap.Enumerator(this); + internal bool IsDisposed => this.headBlock == null; - private unsafe MessageHeap.BlockInfo CreateBlock( - MessageHeap.BlockType type, - uint actualSize) - { - ++this.key; - MessageHeap.BlockInfo block = new MessageHeap.BlockInfo(); - block.data = Marshal.AllocCoTaskMem((int) actualSize).ToPointer(); - block.id = this.nextBlockId++; - block.type = type; - block.size = actualSize; - switch (type) - { - case MessageHeap.BlockType.First: - block.next = (MessageHeap.BlockInfo) null; - this.headBlock = block; - this.tailBlock = block; - break; - case MessageHeap.BlockType.Normal: - case MessageHeap.BlockType.Large: - block.next = this.tailBlock.next; - this.tailBlock.next = block; - this.tailBlock = block; - break; - } - block.used = this.blockHeaderSize; - this.ZeroMemoryBlock(block, 0U, this.blockHeaderSize); - return block; - } - - private unsafe void DestroyBlock(MessageHeap.BlockInfo block) - { - Marshal.FreeCoTaskMem(new IntPtr(block.data)); - block.data = (void*) null; - } - - private void ReleaseAll(bool finalRelease) - { - ++this.key; - MessageHeap.BlockInfo block; - if (finalRelease) - { - block = this.headBlock; - this.headBlock = (MessageHeap.BlockInfo) null; - this.tailBlock = (MessageHeap.BlockInfo) null; - } - else - { - this.ZeroMemoryBlock(this.headBlock, 0U, this.blockHeaderSize); - block = this.headBlock.next; - this.headBlock.next = (MessageHeap.BlockInfo) null; - this.headBlock.used = this.blockHeaderSize; - this.tailBlock = this.headBlock; - this.nextBlockId = 2U; - } - MessageHeap.BlockInfo next; - for (; block != null; block = next) - { - next = block.next; - switch (block.type) + public unsafe void* Alloc(uint size) { - case MessageHeap.BlockType.First: - case MessageHeap.BlockType.Normal: - case MessageHeap.BlockType.Large: - this.DestroyBlock(block); - break; + size += this.allocExtraSize; + uint num = (uint)(sizeof(void*) - 1); + size = (uint)((int)size + (int)num & ~(int)num); + MessageHeap.BlockInfo block = this.tailBlock; + if (size > block.size - block.used) + { + MessageHeap.BlockType type = MessageHeap.BlockType.Normal; + uint actualSize = this.smallBlockSize; + if (size > this.smallBlockSize - this.blockHeaderSize) + { + type = MessageHeap.BlockType.Large; + actualSize = this.blockHeaderSize + size; + } + block = this.CreateBlock(type, actualSize); + } + this.ZeroMemoryBlock(block, block.used, this.allocExtraSize); + void* voidPtr = (void*)((IntPtr)block.data + ((int)block.used + (int)this.allocExtraSize)); + block.used += size; + ++this.key; + return voidPtr; } - } - } - private unsafe MessageHeap.BlockInfo LookupBlockWorker(void* p) - { - for (MessageHeap.BlockInfo blockInfo = this.headBlock; blockInfo != null; blockInfo = blockInfo.next) - { - if (p >= blockInfo.data) + public unsafe MessageHeap.Block LookupBlock(void* p) { - void* voidPtr = (void*) ((IntPtr) blockInfo.data + (int) blockInfo.used); - if (p < voidPtr) - return blockInfo; + MessageHeap.BlockInfo blockInfo = this.LookupBlockWorker(p); + return new MessageHeap.Block(blockInfo.id, blockInfo.data, blockInfo.used); } - } - throw new ArgumentException("pointer is not on this heap"); - } - private unsafe void ZeroMemoryBlock(MessageHeap.BlockInfo block, uint offset, uint size) - { - Debug2.Validate(offset + size <= block.size, typeof (ArgumentOutOfRangeException), "Invalid memory range for block"); - byte* numPtr1 = (byte*) ((IntPtr) block.data + (int) offset); - for (byte* numPtr2 = numPtr1 + (int) size; numPtr1 < numPtr2; ++numPtr1) - *numPtr1 = (byte) 0; - } + public void Reset() => this.ReleaseAll(false); - protected override void Invariant() => Debug2.Validate(!this.IsDisposed, typeof (InvalidOperationException), "MessageHeap has already been disposed"); - - internal struct Enumerator - { - private MessageHeap heap; - private MessageHeap.BlockInfo current; - private uint key; - - public Enumerator(MessageHeap heap) - { - this.heap = heap; - this.current = (MessageHeap.BlockInfo) null; - this.key = heap.key; - } - - public bool MoveNext() - { - if ((int) this.key != (int) this.heap.key) - throw new InvalidOperationException("heap modified while enumerator is in use"); - this.current = this.current != null ? this.current.next : this.heap.headBlock; - return this.current != null; - } - - public unsafe MessageHeap.Block Current - { - get + public int BlockCount { - if ((int) this.key != (int) this.heap.key) - throw new InvalidOperationException("heap modified while enumerator in use"); - return new MessageHeap.Block(this.current.id, this.current.data, this.current.used); + get + { + int num = 0; + MessageHeap.BlockInfo blockInfo = this.headBlock; + while (blockInfo != null) + { + blockInfo = blockInfo.next; + ++num; + } + return num; + } } - } - } - internal struct Block - { - public uint id; - public unsafe void* data; - public uint size; + public MessageHeap.Enumerator GetEnumerator() => new MessageHeap.Enumerator(this); - public unsafe Block(uint id, void* data, uint size) - { - this.id = id; - this.data = data; - this.size = size; - } - } + private unsafe MessageHeap.BlockInfo CreateBlock( + MessageHeap.BlockType type, + uint actualSize) + { + ++this.key; + MessageHeap.BlockInfo block = new MessageHeap.BlockInfo(); + block.data = Marshal.AllocCoTaskMem((int)actualSize).ToPointer(); + block.id = this.nextBlockId++; + block.type = type; + block.size = actualSize; + switch (type) + { + case MessageHeap.BlockType.First: + block.next = (MessageHeap.BlockInfo)null; + this.headBlock = block; + this.tailBlock = block; + break; + case MessageHeap.BlockType.Normal: + case MessageHeap.BlockType.Large: + block.next = this.tailBlock.next; + this.tailBlock.next = block; + this.tailBlock = block; + break; + } + block.used = this.blockHeaderSize; + this.ZeroMemoryBlock(block, 0U, this.blockHeaderSize); + return block; + } - private enum BlockType - { - First, - Normal, - Large, - } + private unsafe void DestroyBlock(MessageHeap.BlockInfo block) + { + Marshal.FreeCoTaskMem(new IntPtr(block.data)); + block.data = (void*)null; + } - private class BlockInfo - { - public MessageHeap.BlockInfo next; - public MessageHeap.BlockType type; - public uint id; - public unsafe void* data; - public uint size; - public uint used; + private void ReleaseAll(bool finalRelease) + { + ++this.key; + MessageHeap.BlockInfo block; + if (finalRelease) + { + block = this.headBlock; + this.headBlock = (MessageHeap.BlockInfo)null; + this.tailBlock = (MessageHeap.BlockInfo)null; + } + else + { + this.ZeroMemoryBlock(this.headBlock, 0U, this.blockHeaderSize); + block = this.headBlock.next; + this.headBlock.next = (MessageHeap.BlockInfo)null; + this.headBlock.used = this.blockHeaderSize; + this.tailBlock = this.headBlock; + this.nextBlockId = 2U; + } + MessageHeap.BlockInfo next; + for (; block != null; block = next) + { + next = block.next; + switch (block.type) + { + case MessageHeap.BlockType.First: + case MessageHeap.BlockType.Normal: + case MessageHeap.BlockType.Large: + this.DestroyBlock(block); + break; + } + } + } + + private unsafe MessageHeap.BlockInfo LookupBlockWorker(void* p) + { + for (MessageHeap.BlockInfo blockInfo = this.headBlock; blockInfo != null; blockInfo = blockInfo.next) + { + if (p >= blockInfo.data) + { + void* voidPtr = (void*)((IntPtr)blockInfo.data + (int)blockInfo.used); + if (p < voidPtr) + return blockInfo; + } + } + throw new ArgumentException("pointer is not on this heap"); + } + + private unsafe void ZeroMemoryBlock(MessageHeap.BlockInfo block, uint offset, uint size) + { + Debug2.Validate(offset + size <= block.size, typeof(ArgumentOutOfRangeException), "Invalid memory range for block"); + byte* numPtr1 = (byte*)((IntPtr)block.data + (int)offset); + for (byte* numPtr2 = numPtr1 + (int)size; numPtr1 < numPtr2; ++numPtr1) + *numPtr1 = (byte)0; + } + + protected override void Invariant() => Debug2.Validate(!this.IsDisposed, typeof(InvalidOperationException), "MessageHeap has already been disposed"); + + internal struct Enumerator + { + private MessageHeap heap; + private MessageHeap.BlockInfo current; + private uint key; + + public Enumerator(MessageHeap heap) + { + this.heap = heap; + this.current = (MessageHeap.BlockInfo)null; + this.key = heap.key; + } + + public bool MoveNext() + { + if ((int)this.key != (int)this.heap.key) + throw new InvalidOperationException("heap modified while enumerator is in use"); + this.current = this.current != null ? this.current.next : this.heap.headBlock; + return this.current != null; + } + + public unsafe MessageHeap.Block Current + { + get + { + if ((int)this.key != (int)this.heap.key) + throw new InvalidOperationException("heap modified while enumerator in use"); + return new MessageHeap.Block(this.current.id, this.current.data, this.current.used); + } + } + } + + internal struct Block + { + public uint id; + public unsafe void* data; + public uint size; + + public unsafe Block(uint id, void* data, uint size) + { + this.id = id; + this.data = data; + this.size = size; + } + } + + private enum BlockType + { + First, + Normal, + Large, + } + + private class BlockInfo + { + public MessageHeap.BlockInfo next; + public MessageHeap.BlockType type; + public uint id; + public unsafe void* data; + public uint size; + public uint used; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessagingSession.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessagingSession.cs index 25e4a13..5e932c1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessagingSession.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/MessagingSession.cs @@ -11,401 +11,401 @@ using System.Threading; namespace Microsoft.Iris.Render.Protocol { - internal sealed class MessagingSession : RenderObject - { - private static Map s_sessions = new Map(); - private readonly ContextID m_localContextId; - private bool m_isConnected; - private int m_pingRequestCount; - private IRenderHost m_renderHost; - private Thread m_owningThread; - private Vector m_ports; - private Vector m_activeTrackers; - private RenderPort m_portRendering; - private RenderPort m_portWindowing; - private bool m_isBatchingMessages; - private BatchCallback m_batchFillCallback; - private BatchCallback m_batchBeginCallbacks; - private BatchCallback m_batchEndCallbacks; - private BatchCallback m_batchDeliveryCallbacks; - private bool m_fBatchFlushRequested; - private DeferredInvokeItem m_batchFlushInvokeItem; - private EngineApi.MessageBufferEventHandler m_messageBufferHandler; - private TimeoutHandler m_externalTimeoutHandler; - private EngineApi.TimeoutEventHandler m_internalTimeoutHandler; - - internal MessagingSession(IRenderHost renderHost, RenderToken token) - : this(renderHost, token, (TimeoutHandler) null, 0U) + internal sealed class MessagingSession : RenderObject { - } + private static Map s_sessions = new Map(); + private readonly ContextID m_localContextId; + private bool m_isConnected; + private int m_pingRequestCount; + private IRenderHost m_renderHost; + private Thread m_owningThread; + private Vector m_ports; + private Vector m_activeTrackers; + private RenderPort m_portRendering; + private RenderPort m_portWindowing; + private bool m_isBatchingMessages; + private BatchCallback m_batchFillCallback; + private BatchCallback m_batchBeginCallbacks; + private BatchCallback m_batchEndCallbacks; + private BatchCallback m_batchDeliveryCallbacks; + private bool m_fBatchFlushRequested; + private DeferredInvokeItem m_batchFlushInvokeItem; + private EngineApi.MessageBufferEventHandler m_messageBufferHandler; + private TimeoutHandler m_externalTimeoutHandler; + private EngineApi.TimeoutEventHandler m_internalTimeoutHandler; - internal MessagingSession( - IRenderHost renderHost, - RenderToken token, - TimeoutHandler handlerTimeout, - uint nTimeoutSec) - { - Debug2.Validate(renderHost != null, typeof (ArgumentNullException), nameof (renderHost)); - Debug2.Validate(token != null, typeof (ArgumentNullException), nameof (token)); - Debug2.Validate(token.LocalContextId != ContextID.NULL, typeof (ArgumentNullException), "token.LocalContextId"); - Debug2.Validate(token.EngineInfo is IrisEngineInfo, typeof (ArgumentException), "token.EngineInfo"); - this.m_pingRequestCount = 0; - this.m_renderHost = renderHost; - this.m_ports = new Vector(2); - this.m_localContextId = token.LocalContextId; - this.m_batchFlushInvokeItem = new DeferredInvokeItem((SharedRenderObject) null, (Delegate) new DeferredHandler(this.ProcessDeferredFlushBatch), (object) null); - this.m_batchFillCallback = new BatchCallback(this.OnBatchFirstMessage); - this.InitializeLocalMessaging(this.m_localContextId, new EngineApi.MessageBufferEventHandler(this.OnIncomingMessageBuffer), nTimeoutSec, handlerTimeout); - this.m_portRendering = this.CreatePort((token.EngineInfo as IrisEngineInfo).ConnectionInfo, token.DestinationContextId, token.RenderGroupId); - this.m_portWindowing = (RenderPort) null; - this.m_activeTrackers = new Vector(); - } - - protected override void Dispose(bool fInDispose) - { - try - { - if (fInDispose) + internal MessagingSession(IRenderHost renderHost, RenderToken token) + : this(renderHost, token, (TimeoutHandler)null, 0U) { - if (this.IsConnected) - this.Disconnect(); - this.DisposeRemainingDataBufferTrackers(); - foreach (RenderPort port in this.m_ports) - port.Dispose(); - this.m_ports.Clear(); - this.ShutdownLocalMessaging(); } - this.m_activeTrackers = (Vector) null; - this.m_portWindowing = (RenderPort) null; - this.m_portRendering = (RenderPort) null; - this.m_ports = (Vector) null; - this.m_renderHost = (IRenderHost) null; - } - finally - { - base.Dispose(fInDispose); - } - } - internal static MessagingSession Current - { - get - { - lock (MessagingSession.s_sessions) - return MessagingSession.s_sessions.ContainsKey(Thread.CurrentThread) ? MessagingSession.s_sessions[Thread.CurrentThread] : (MessagingSession) null; - } - } - - internal Thread OwningThread => this.m_owningThread; - - internal bool IsConnected => this.m_isConnected; - - internal ContextID LocalContext => this.m_localContextId; - - internal RenderPort RenderingPort => this.m_portRendering; - - internal RenderPort WindowingPort => this.m_portWindowing == null ? this.m_portRendering : this.m_portWindowing; - - private void InitializeLocalMessaging( - ContextID localContextId, - EngineApi.MessageBufferEventHandler messageHandler, - uint timeoutInSeconds, - TimeoutHandler timeoutHandler) - { - this.m_messageBufferHandler = messageHandler; - this.m_externalTimeoutHandler = timeoutHandler; - this.m_internalTimeoutHandler = new EngineApi.TimeoutEventHandler(this.OnTimedOut); - EngineApi.InitArgs args = new EngineApi.InitArgs(MessageCookieLayout.Default, localContextId, messageHandler); - if (timeoutInSeconds > 0U && timeoutHandler != null) - { - args.pfnTimeout = this.m_internalTimeoutHandler; - args.nTimeOutSec = timeoutInSeconds; - } - EngineApi.IFC(EngineApi.SpInit(ref args)); - lock (MessagingSession.s_sessions) - { - this.m_owningThread = Thread.CurrentThread; - MessagingSession.s_sessions[this.m_owningThread] = this; - } - } - - private void ShutdownLocalMessaging() - { - lock (MessagingSession.s_sessions) - { - MessagingSession.s_sessions.Remove(this.m_owningThread); - this.m_owningThread = (Thread) null; - } - EngineApi.IFC(EngineApi.SpUninit()); - this.m_messageBufferHandler = (EngineApi.MessageBufferEventHandler) null; - this.m_externalTimeoutHandler = (TimeoutHandler) null; - this.m_internalTimeoutHandler = (EngineApi.TimeoutEventHandler) null; - } - - internal static void DoEvents(uint nTimeoutInMsecs) - { - EngineApi.SpWaitMessage(nTimeoutInMsecs, IntPtr.Zero); - EngineApi.SpPeekMessage(out Win32Api.MSG _, HWND.NULL, 0U, 0U, 1U, out EngineApi.WorkResult _); - } - - private RenderPort CreatePort( - ConnectionInfo connectionInfo, - ContextID destinationContextId, - RENDERGROUP grpObjects) - { - foreach (RenderPort port in this.m_ports) - Debug2.Validate(port.RemoteContext != destinationContextId, typeof (ArgumentException), "There already is a RenderPort allocated for this destination context"); - bool foreignByteOrder = false; - IChannel channel; - switch (connectionInfo) - { - case LocalConnectionInfo _: - channel = (IChannel) new LocalChannel((LocalConnectionInfo) connectionInfo); - break; - case RemoteConnectionInfo _: - RemoteConnectionInfo connectionInfo1 = (RemoteConnectionInfo) connectionInfo; - channel = (IChannel) new RemoteChannel(connectionInfo1); - foreignByteOrder = connectionInfo1.SwapByteOrder; - break; - default: - return (RenderPort) null; - } - RenderPort renderPort = new RenderPort(this, channel, destinationContextId, grpObjects, MessageCookieLayout.Default, foreignByteOrder); - if (this.m_isConnected) - renderPort.Connect(); - this.m_ports.Add((object) renderPort); - return renderPort; - } - - internal DataBufferTracker CreateDataBufferTracker(object objUser) => new DataBufferTracker(objUser); - - internal void ReturnDataBufferTracker(DataBufferTracker tracker) - { - if (tracker.Count != 0) - { - tracker.TrackerEmpty += new EventHandler(this.OnDataBufferTrackerEmpty); - this.m_activeTrackers.Add((object) tracker); - } - else - tracker.Dispose(); - } - - private void OnDataBufferTrackerEmpty(object objSender, EventArgs args) - { - DataBufferTracker dataBufferTracker = (DataBufferTracker) objSender; - this.m_activeTrackers.Remove((object) dataBufferTracker); - dataBufferTracker.TrackerEmpty -= new EventHandler(this.OnDataBufferTrackerEmpty); - dataBufferTracker.Dispose(); - } - - private void DisposeRemainingDataBufferTrackers() - { - if (this.m_activeTrackers.Count <= 0) - return; - foreach (DataBufferTracker activeTracker in this.m_activeTrackers) - activeTracker.Dispose(); - this.m_activeTrackers.Clear(); - } - - internal void Connect() - { - Debug2.Throw(!this.m_isConnected, "MessagingSession is already connected"); - foreach (RenderPort port in this.m_ports) - port.Connect(); - this.Synchronize(); - this.StartNewBatch(); - this.m_isConnected = true; - } - - internal void Disconnect() - { - Debug2.Throw(this.m_isConnected, "MessagingSession is not connected"); - this.FlushCurrentBatch(true); - this.Synchronize(); - foreach (RenderPort port in this.m_ports) - port.DisposeObjectMaps(); - foreach (RenderPort port in this.m_ports) - port.Dispose(); - this.m_ports.Clear(); - this.m_isConnected = false; - } - - internal void Synchronize() - { - foreach (RenderPort port in this.m_ports) - { - port.PingReply += new EventHandler(this.OnPingReply); - ++this.m_pingRequestCount; - port.PingConnection(); - } - if (this.m_isBatchingMessages) - this.FlushBatch(); - while (this.m_pingRequestCount > 0) - MessagingSession.DoEvents(uint.MaxValue); - } - - private void OnPingReply(object sender, EventArgs args) - { - (sender as RenderPort).PingReply -= new EventHandler(this.OnPingReply); - --this.m_pingRequestCount; - } - - private void StartNewBatch() - { - if (this.m_isBatchingMessages || this.m_ports.Count <= 0) - return; - foreach (RenderPort port in this.m_ports) - port.BeginMessageBatch(this.m_batchFillCallback); - this.m_isBatchingMessages = true; - if (this.m_batchBeginCallbacks == null) - return; - this.m_batchBeginCallbacks(); - this.m_batchBeginCallbacks = (BatchCallback) null; - } - - internal void FlushBatch() => this.FlushCurrentBatch(false); - - private void FlushCurrentBatch(bool stopBatching) - { - if (!this.m_isBatchingMessages) - return; - if (this.m_batchEndCallbacks != null) - { - this.m_batchEndCallbacks(); - this.m_batchEndCallbacks = (BatchCallback) null; - } - this.m_isBatchingMessages = false; - BatchCallback deliveryCallbacks = this.m_batchDeliveryCallbacks; - this.m_batchDeliveryCallbacks = (BatchCallback) null; - foreach (RenderPort port in this.m_ports) - port.EndMessageBatch(deliveryCallbacks); - if (stopBatching) - return; - this.StartNewBatch(); - } - - internal void ScheduleBatchFlush() - { - if (this.m_fBatchFlushRequested) - return; - this.AssertOwningThread(); - this.DeferredInvoke(this.m_batchFlushInvokeItem, DeferredInvokePriority.Low); - this.m_fBatchFlushRequested = true; - } - - internal void ProcessDeferredFlushBatch(object args) - { - this.AssertOwningThread(); - if (!this.m_fBatchFlushRequested) - return; - this.FlushBatch(); - this.m_fBatchFlushRequested = false; - } - - public void NotifyOnBeginBatch(BatchCallback newCallback) - { - if (!this.m_isBatchingMessages) - return; - this.m_batchBeginCallbacks += newCallback; - } - - public void NotifyOnEndBatch(BatchCallback newCallback, bool notifyEmptyBatches) - { - if (!this.m_isBatchingMessages) - return; - if (notifyEmptyBatches) - this.ScheduleBatchFlush(); - this.m_batchEndCallbacks += newCallback; - } - - public void NotifyOnCurrentBatchDelivered(BatchCallback newCallback) - { - if (!this.m_isBatchingMessages) - return; - this.m_batchDeliveryCallbacks += newCallback; - } - - private void OnBatchFirstMessage() => this.ScheduleBatchFlush(); - - private unsafe int OnIncomingMessageBuffer( - IntPtr pData, - uint hContext, - EngineApi.BufferInfo* pBufferInfo, - void* pvBufferData) - { - RenderPort renderPort = (RenderPort) null; - for (int index = 0; index < this.m_ports.Count; ++index) - { - RenderPort port = (RenderPort) this.m_ports[index]; - if (port.RemoteContext == pBufferInfo->idContextSrc) + internal MessagingSession( + IRenderHost renderHost, + RenderToken token, + TimeoutHandler handlerTimeout, + uint nTimeoutSec) { - renderPort = port; - break; + Debug2.Validate(renderHost != null, typeof(ArgumentNullException), nameof(renderHost)); + Debug2.Validate(token != null, typeof(ArgumentNullException), nameof(token)); + Debug2.Validate(token.LocalContextId != ContextID.NULL, typeof(ArgumentNullException), "token.LocalContextId"); + Debug2.Validate(token.EngineInfo is IrisEngineInfo, typeof(ArgumentException), "token.EngineInfo"); + this.m_pingRequestCount = 0; + this.m_renderHost = renderHost; + this.m_ports = new Vector(2); + this.m_localContextId = token.LocalContextId; + this.m_batchFlushInvokeItem = new DeferredInvokeItem((SharedRenderObject)null, (Delegate)new DeferredHandler(this.ProcessDeferredFlushBatch), (object)null); + this.m_batchFillCallback = new BatchCallback(this.OnBatchFirstMessage); + this.InitializeLocalMessaging(this.m_localContextId, new EngineApi.MessageBufferEventHandler(this.OnIncomingMessageBuffer), nTimeoutSec, handlerTimeout); + this.m_portRendering = this.CreatePort((token.EngineInfo as IrisEngineInfo).ConnectionInfo, token.DestinationContextId, token.RenderGroupId); + this.m_portWindowing = (RenderPort)null; + this.m_activeTrackers = new Vector(); + } + + protected override void Dispose(bool fInDispose) + { + try + { + if (fInDispose) + { + if (this.IsConnected) + this.Disconnect(); + this.DisposeRemainingDataBufferTrackers(); + foreach (RenderPort port in this.m_ports) + port.Dispose(); + this.m_ports.Clear(); + this.ShutdownLocalMessaging(); + } + this.m_activeTrackers = (Vector)null; + this.m_portWindowing = (RenderPort)null; + this.m_portRendering = (RenderPort)null; + this.m_ports = (Vector)null; + this.m_renderHost = (IRenderHost)null; + } + finally + { + base.Dispose(fInDispose); + } + } + + internal static MessagingSession Current + { + get + { + lock (MessagingSession.s_sessions) + return MessagingSession.s_sessions.ContainsKey(Thread.CurrentThread) ? MessagingSession.s_sessions[Thread.CurrentThread] : (MessagingSession)null; + } + } + + internal Thread OwningThread => this.m_owningThread; + + internal bool IsConnected => this.m_isConnected; + + internal ContextID LocalContext => this.m_localContextId; + + internal RenderPort RenderingPort => this.m_portRendering; + + internal RenderPort WindowingPort => this.m_portWindowing == null ? this.m_portRendering : this.m_portWindowing; + + private void InitializeLocalMessaging( + ContextID localContextId, + EngineApi.MessageBufferEventHandler messageHandler, + uint timeoutInSeconds, + TimeoutHandler timeoutHandler) + { + this.m_messageBufferHandler = messageHandler; + this.m_externalTimeoutHandler = timeoutHandler; + this.m_internalTimeoutHandler = new EngineApi.TimeoutEventHandler(this.OnTimedOut); + EngineApi.InitArgs args = new EngineApi.InitArgs(MessageCookieLayout.Default, localContextId, messageHandler); + if (timeoutInSeconds > 0U && timeoutHandler != null) + { + args.pfnTimeout = this.m_internalTimeoutHandler; + args.nTimeOutSec = timeoutInSeconds; + } + EngineApi.IFC(EngineApi.SpInit(ref args)); + lock (MessagingSession.s_sessions) + { + this.m_owningThread = Thread.CurrentThread; + MessagingSession.s_sessions[this.m_owningThread] = this; + } + } + + private void ShutdownLocalMessaging() + { + lock (MessagingSession.s_sessions) + { + MessagingSession.s_sessions.Remove(this.m_owningThread); + this.m_owningThread = (Thread)null; + } + EngineApi.IFC(EngineApi.SpUninit()); + this.m_messageBufferHandler = (EngineApi.MessageBufferEventHandler)null; + this.m_externalTimeoutHandler = (TimeoutHandler)null; + this.m_internalTimeoutHandler = (EngineApi.TimeoutEventHandler)null; + } + + internal static void DoEvents(uint nTimeoutInMsecs) + { + EngineApi.SpWaitMessage(nTimeoutInMsecs, IntPtr.Zero); + EngineApi.SpPeekMessage(out Win32Api.MSG _, HWND.NULL, 0U, 0U, 1U, out EngineApi.WorkResult _); + } + + private RenderPort CreatePort( + ConnectionInfo connectionInfo, + ContextID destinationContextId, + RENDERGROUP grpObjects) + { + foreach (RenderPort port in this.m_ports) + Debug2.Validate(port.RemoteContext != destinationContextId, typeof(ArgumentException), "There already is a RenderPort allocated for this destination context"); + bool foreignByteOrder = false; + IChannel channel; + switch (connectionInfo) + { + case LocalConnectionInfo _: + channel = (IChannel)new LocalChannel((LocalConnectionInfo)connectionInfo); + break; + case RemoteConnectionInfo _: + RemoteConnectionInfo connectionInfo1 = (RemoteConnectionInfo)connectionInfo; + channel = (IChannel)new RemoteChannel(connectionInfo1); + foreignByteOrder = connectionInfo1.SwapByteOrder; + break; + default: + return (RenderPort)null; + } + RenderPort renderPort = new RenderPort(this, channel, destinationContextId, grpObjects, MessageCookieLayout.Default, foreignByteOrder); + if (this.m_isConnected) + renderPort.Connect(); + this.m_ports.Add((object)renderPort); + return renderPort; + } + + internal DataBufferTracker CreateDataBufferTracker(object objUser) => new DataBufferTracker(objUser); + + internal void ReturnDataBufferTracker(DataBufferTracker tracker) + { + if (tracker.Count != 0) + { + tracker.TrackerEmpty += new EventHandler(this.OnDataBufferTrackerEmpty); + this.m_activeTrackers.Add((object)tracker); + } + else + tracker.Dispose(); + } + + private void OnDataBufferTrackerEmpty(object objSender, EventArgs args) + { + DataBufferTracker dataBufferTracker = (DataBufferTracker)objSender; + this.m_activeTrackers.Remove((object)dataBufferTracker); + dataBufferTracker.TrackerEmpty -= new EventHandler(this.OnDataBufferTrackerEmpty); + dataBufferTracker.Dispose(); + } + + private void DisposeRemainingDataBufferTrackers() + { + if (this.m_activeTrackers.Count <= 0) + return; + foreach (DataBufferTracker activeTracker in this.m_activeTrackers) + activeTracker.Dispose(); + this.m_activeTrackers.Clear(); + } + + internal void Connect() + { + Debug2.Throw(!this.m_isConnected, "MessagingSession is already connected"); + foreach (RenderPort port in this.m_ports) + port.Connect(); + this.Synchronize(); + this.StartNewBatch(); + this.m_isConnected = true; + } + + internal void Disconnect() + { + Debug2.Throw(this.m_isConnected, "MessagingSession is not connected"); + this.FlushCurrentBatch(true); + this.Synchronize(); + foreach (RenderPort port in this.m_ports) + port.DisposeObjectMaps(); + foreach (RenderPort port in this.m_ports) + port.Dispose(); + this.m_ports.Clear(); + this.m_isConnected = false; + } + + internal void Synchronize() + { + foreach (RenderPort port in this.m_ports) + { + port.PingReply += new EventHandler(this.OnPingReply); + ++this.m_pingRequestCount; + port.PingConnection(); + } + if (this.m_isBatchingMessages) + this.FlushBatch(); + while (this.m_pingRequestCount > 0) + MessagingSession.DoEvents(uint.MaxValue); + } + + private void OnPingReply(object sender, EventArgs args) + { + (sender as RenderPort).PingReply -= new EventHandler(this.OnPingReply); + --this.m_pingRequestCount; + } + + private void StartNewBatch() + { + if (this.m_isBatchingMessages || this.m_ports.Count <= 0) + return; + foreach (RenderPort port in this.m_ports) + port.BeginMessageBatch(this.m_batchFillCallback); + this.m_isBatchingMessages = true; + if (this.m_batchBeginCallbacks == null) + return; + this.m_batchBeginCallbacks(); + this.m_batchBeginCallbacks = (BatchCallback)null; + } + + internal void FlushBatch() => this.FlushCurrentBatch(false); + + private void FlushCurrentBatch(bool stopBatching) + { + if (!this.m_isBatchingMessages) + return; + if (this.m_batchEndCallbacks != null) + { + this.m_batchEndCallbacks(); + this.m_batchEndCallbacks = (BatchCallback)null; + } + this.m_isBatchingMessages = false; + BatchCallback deliveryCallbacks = this.m_batchDeliveryCallbacks; + this.m_batchDeliveryCallbacks = (BatchCallback)null; + foreach (RenderPort port in this.m_ports) + port.EndMessageBatch(deliveryCallbacks); + if (stopBatching) + return; + this.StartNewBatch(); + } + + internal void ScheduleBatchFlush() + { + if (this.m_fBatchFlushRequested) + return; + this.AssertOwningThread(); + this.DeferredInvoke(this.m_batchFlushInvokeItem, DeferredInvokePriority.Low); + this.m_fBatchFlushRequested = true; + } + + internal void ProcessDeferredFlushBatch(object args) + { + this.AssertOwningThread(); + if (!this.m_fBatchFlushRequested) + return; + this.FlushBatch(); + this.m_fBatchFlushRequested = false; + } + + public void NotifyOnBeginBatch(BatchCallback newCallback) + { + if (!this.m_isBatchingMessages) + return; + this.m_batchBeginCallbacks += newCallback; + } + + public void NotifyOnEndBatch(BatchCallback newCallback, bool notifyEmptyBatches) + { + if (!this.m_isBatchingMessages) + return; + if (notifyEmptyBatches) + this.ScheduleBatchFlush(); + this.m_batchEndCallbacks += newCallback; + } + + public void NotifyOnCurrentBatchDelivered(BatchCallback newCallback) + { + if (!this.m_isBatchingMessages) + return; + this.m_batchDeliveryCallbacks += newCallback; + } + + private void OnBatchFirstMessage() => this.ScheduleBatchFlush(); + + private unsafe int OnIncomingMessageBuffer( + IntPtr pData, + uint hContext, + EngineApi.BufferInfo* pBufferInfo, + void* pvBufferData) + { + RenderPort renderPort = (RenderPort)null; + for (int index = 0; index < this.m_ports.Count; ++index) + { + RenderPort port = (RenderPort)this.m_ports[index]; + if (port.RemoteContext == pBufferInfo->idContextSrc) + { + renderPort = port; + break; + } + } + Debug2.Throw(renderPort != null, "Expected a render port if we are receiving buffers"); + renderPort.ProcessMessageBuffer(pBufferInfo, pvBufferData); + return 0; + } + + private void OnTimedOut(IntPtr pData) + { + if (this.m_externalTimeoutHandler == null) + return; + this.m_externalTimeoutHandler(); + } + + internal void AssertOwningThread() + { + } + + internal bool IsOwningThread() => this.m_owningThread == Thread.CurrentThread; + + internal void DeferredInvoke(Delegate method, object args, DeferredInvokePriority priority) => this.DeferredInvoke(method, args, priority, TimeSpan.FromMilliseconds(0.0)); + + internal void DeferredInvoke( + SharedRenderObject owner, + Delegate method, + object args, + DeferredInvokePriority priority) + { + this.DeferredInvoke(owner, method, args, priority, TimeSpan.FromMilliseconds(0.0)); + } + + internal void DeferredInvoke( + Delegate method, + object args, + DeferredInvokePriority priority, + TimeSpan delay) + { + this.DeferredInvoke((SharedRenderObject)null, method, args, priority, delay); + } + + internal void DeferredInvoke( + SharedRenderObject instanceOwner, + Delegate method, + object args, + DeferredInvokePriority priority, + TimeSpan delay) + { + if (this.m_owningThread == null) + return; + DeferredInvokeItem deferredInvokeItem = new DeferredInvokeItem(instanceOwner, method, args); + this.m_renderHost.DeferredInvoke(priority, (IDeferredInvokeItem)deferredInvokeItem, delay); + } + + private void DeferredInvoke(DeferredInvokeItem item, DeferredInvokePriority priority) + { + if (this.m_owningThread == null) + return; + this.m_renderHost.DeferredInvoke(priority, (IDeferredInvokeItem)item, TimeSpan.FromMilliseconds(0.0)); + } + + protected override void Invariant() + { + Debug2.Validate(this.m_owningThread != null, typeof(InvalidOperationException), this.GetType().ToString()); + Debug2.Validate(this.m_renderHost != null, typeof(InvalidOperationException), this.GetType().ToString()); + Debug2.Validate(this.m_isConnected, typeof(InvalidOperationException), this.GetType().ToString()); } - } - Debug2.Throw(renderPort != null, "Expected a render port if we are receiving buffers"); - renderPort.ProcessMessageBuffer(pBufferInfo, pvBufferData); - return 0; } - - private void OnTimedOut(IntPtr pData) - { - if (this.m_externalTimeoutHandler == null) - return; - this.m_externalTimeoutHandler(); - } - - internal void AssertOwningThread() - { - } - - internal bool IsOwningThread() => this.m_owningThread == Thread.CurrentThread; - - internal void DeferredInvoke(Delegate method, object args, DeferredInvokePriority priority) => this.DeferredInvoke(method, args, priority, TimeSpan.FromMilliseconds(0.0)); - - internal void DeferredInvoke( - SharedRenderObject owner, - Delegate method, - object args, - DeferredInvokePriority priority) - { - this.DeferredInvoke(owner, method, args, priority, TimeSpan.FromMilliseconds(0.0)); - } - - internal void DeferredInvoke( - Delegate method, - object args, - DeferredInvokePriority priority, - TimeSpan delay) - { - this.DeferredInvoke((SharedRenderObject) null, method, args, priority, delay); - } - - internal void DeferredInvoke( - SharedRenderObject instanceOwner, - Delegate method, - object args, - DeferredInvokePriority priority, - TimeSpan delay) - { - if (this.m_owningThread == null) - return; - DeferredInvokeItem deferredInvokeItem = new DeferredInvokeItem(instanceOwner, method, args); - this.m_renderHost.DeferredInvoke(priority, (IDeferredInvokeItem) deferredInvokeItem, delay); - } - - private void DeferredInvoke(DeferredInvokeItem item, DeferredInvokePriority priority) - { - if (this.m_owningThread == null) - return; - this.m_renderHost.DeferredInvoke(priority, (IDeferredInvokeItem) item, TimeSpan.FromMilliseconds(0.0)); - } - - protected override void Invariant() - { - Debug2.Validate(this.m_owningThread != null, typeof (InvalidOperationException), this.GetType().ToString()); - Debug2.Validate(this.m_renderHost != null, typeof (InvalidOperationException), this.GetType().ToString()); - Debug2.Validate(this.m_isConnected, typeof (InvalidOperationException), this.GetType().ToString()); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ObjectCache.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ObjectCache.cs index f185f36..cc02725 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ObjectCache.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ObjectCache.cs @@ -9,72 +9,72 @@ using System; namespace Microsoft.Iris.Render.Protocol { - internal class ObjectCache - { - private ObjectCache.Callback m_callback; - private object[] m_arFreeObjs; - private int m_idxFree; - - public ObjectCache(ObjectCache.Callback callback, int cFreeItems, bool fPrePopulate) + internal class ObjectCache { - Debug2.Validate(callback != null, typeof (ArgumentNullException), "calback"); - Debug2.Validate(cFreeItems > 0, typeof (ArgumentException), (object) "Free list must have at least one entry", (object) nameof (cFreeItems)); - this.m_callback = callback; - this.m_arFreeObjs = new object[cFreeItems]; - this.m_idxFree = -1; - if (!fPrePopulate) - return; - for (int index = 0; index < cFreeItems; ++index) - this.Push(this.DoCallback(ObjectCache.Operation.Alloc, (object) null)); + private ObjectCache.Callback m_callback; + private object[] m_arFreeObjs; + private int m_idxFree; + + public ObjectCache(ObjectCache.Callback callback, int cFreeItems, bool fPrePopulate) + { + Debug2.Validate(callback != null, typeof(ArgumentNullException), "calback"); + Debug2.Validate(cFreeItems > 0, typeof(ArgumentException), (object)"Free list must have at least one entry", (object)nameof(cFreeItems)); + this.m_callback = callback; + this.m_arFreeObjs = new object[cFreeItems]; + this.m_idxFree = -1; + if (!fPrePopulate) + return; + for (int index = 0; index < cFreeItems; ++index) + this.Push(this.DoCallback(ObjectCache.Operation.Alloc, (object)null)); + } + + public void Dispose() + { + object[] arFreeObjs = this.m_arFreeObjs; + if (arFreeObjs == null) + return; + int idxFree = this.m_idxFree; + this.m_idxFree = -1; + this.m_arFreeObjs = (object[])null; + for (; idxFree >= 0; --idxFree) + this.DoCallback(ObjectCache.Operation.Free, arFreeObjs[idxFree]); + } + + public object Pop() + { + ObjectCache.Operation operation = ObjectCache.Operation.Alloc; + object data = (object)null; + if (this.m_idxFree >= 0) + { + operation = ObjectCache.Operation.Thaw; + data = this.m_arFreeObjs[this.m_idxFree--]; + } + return this.DoCallback(operation, data); + } + + public void Push(object data) + { + if (this.m_idxFree + 1 >= this.m_arFreeObjs.Length) + { + this.DoCallback(ObjectCache.Operation.Free, data); + } + else + { + data = this.DoCallback(ObjectCache.Operation.Freeze, data); + this.m_arFreeObjs[++this.m_idxFree] = data; + } + } + + private object DoCallback(ObjectCache.Operation operation, object data) => this.m_callback(operation, data); + + public enum Operation + { + Alloc, + Free, + Thaw, + Freeze, + } + + public delegate object Callback(ObjectCache.Operation operation, object data); } - - public void Dispose() - { - object[] arFreeObjs = this.m_arFreeObjs; - if (arFreeObjs == null) - return; - int idxFree = this.m_idxFree; - this.m_idxFree = -1; - this.m_arFreeObjs = (object[]) null; - for (; idxFree >= 0; --idxFree) - this.DoCallback(ObjectCache.Operation.Free, arFreeObjs[idxFree]); - } - - public object Pop() - { - ObjectCache.Operation operation = ObjectCache.Operation.Alloc; - object data = (object) null; - if (this.m_idxFree >= 0) - { - operation = ObjectCache.Operation.Thaw; - data = this.m_arFreeObjs[this.m_idxFree--]; - } - return this.DoCallback(operation, data); - } - - public void Push(object data) - { - if (this.m_idxFree + 1 >= this.m_arFreeObjs.Length) - { - this.DoCallback(ObjectCache.Operation.Free, data); - } - else - { - data = this.DoCallback(ObjectCache.Operation.Freeze, data); - this.m_arFreeObjs[++this.m_idxFree] = data; - } - } - - private object DoCallback(ObjectCache.Operation operation, object data) => this.m_callback(operation, data); - - public enum Operation - { - Alloc, - Free, - Thaw, - Freeze, - } - - public delegate object Callback(ObjectCache.Operation operation, object data); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/PortCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/PortCallback.cs index 659a894..b0bea32 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/PortCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/PortCallback.cs @@ -6,8 +6,8 @@ namespace Microsoft.Iris.Render.Protocol { - internal unsafe delegate void PortCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message); + internal unsafe delegate void PortCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ProtocolInstance.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ProtocolInstance.cs index a4189f3..a61e0a0 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ProtocolInstance.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ProtocolInstance.cs @@ -6,23 +6,23 @@ namespace Microsoft.Iris.Render.Protocol { - internal abstract class ProtocolInstance - { - private RenderPort m_port; - private string m_name; - - protected ProtocolInstance(RenderPort port, string name) + internal abstract class ProtocolInstance { - this.m_port = port; - this.m_name = name; + private RenderPort m_port; + private string m_name; + + protected ProtocolInstance(RenderPort port, string name) + { + this.m_port = port; + this.m_name = name; + } + + public RenderPort Port => this.m_port; + + public string Name => this.m_name; + + internal void OnConnect() => this.Init(); + + protected abstract void Init(); } - - public RenderPort Port => this.m_port; - - public string Name => this.m_name; - - internal void OnConnect() => this.Init(); - - protected abstract void Init(); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RENDERGROUP.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RENDERGROUP.cs index 9bec53f..a54268a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RENDERGROUP.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RENDERGROUP.cs @@ -9,25 +9,25 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - [ComVisible(false)] - [Serializable] - internal struct RENDERGROUP - { - public static readonly RENDERGROUP NULL = new RENDERGROUP(); - private uint value; + [ComVisible(false)] + [Serializable] + internal struct RENDERGROUP + { + public static readonly RENDERGROUP NULL = new RENDERGROUP(); + private uint value; - private RENDERGROUP(uint value) => this.value = value; + private RENDERGROUP(uint value) => this.value = value; - public static bool operator ==(RENDERGROUP hl, RENDERGROUP hr) => (int) hl.value == (int) hr.value; + public static bool operator ==(RENDERGROUP hl, RENDERGROUP hr) => (int)hl.value == (int)hr.value; - public static bool operator !=(RENDERGROUP hl, RENDERGROUP hr) => (int) hl.value != (int) hr.value; + public static bool operator !=(RENDERGROUP hl, RENDERGROUP hr) => (int)hl.value != (int)hr.value; - public override bool Equals(object oCompare) => oCompare is RENDERGROUP rendergroup && (int) this.value == (int) rendergroup.value; + public override bool Equals(object oCompare) => oCompare is RENDERGROUP rendergroup && (int)this.value == (int)rendergroup.value; - public override int GetHashCode() => (int) this.value; + public override int GetHashCode() => (int)this.value; - public static RENDERGROUP FromUInt32(uint value) => new RENDERGROUP(value); + public static RENDERGROUP FromUInt32(uint value) => new RENDERGROUP(value); - public static uint ToUInt32(RENDERGROUP handle) => handle.value; - } + public static uint ToUInt32(RENDERGROUP handle) => handle.value; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RENDERHANDLE.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RENDERHANDLE.cs index 507e3ef..c941c7b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RENDERHANDLE.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RENDERHANDLE.cs @@ -9,25 +9,25 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocol { - [ComVisible(false)] - [Serializable] - internal struct RENDERHANDLE - { - public static readonly RENDERHANDLE NULL = new RENDERHANDLE(); - private uint value; + [ComVisible(false)] + [Serializable] + internal struct RENDERHANDLE + { + public static readonly RENDERHANDLE NULL = new RENDERHANDLE(); + private uint value; - private RENDERHANDLE(uint value) => this.value = value; + private RENDERHANDLE(uint value) => this.value = value; - public static bool operator ==(RENDERHANDLE hl, RENDERHANDLE hr) => (int) hl.value == (int) hr.value; + public static bool operator ==(RENDERHANDLE hl, RENDERHANDLE hr) => (int)hl.value == (int)hr.value; - public static bool operator !=(RENDERHANDLE hl, RENDERHANDLE hr) => (int) hl.value != (int) hr.value; + public static bool operator !=(RENDERHANDLE hl, RENDERHANDLE hr) => (int)hl.value != (int)hr.value; - public override bool Equals(object oCompare) => oCompare is RENDERHANDLE renderhandle && (int) this.value == (int) renderhandle.value; + public override bool Equals(object oCompare) => oCompare is RENDERHANDLE renderhandle && (int)this.value == (int)renderhandle.value; - public override int GetHashCode() => (int) this.value; + public override int GetHashCode() => (int)this.value; - public static RENDERHANDLE FromUInt32(uint value) => new RENDERHANDLE(value); + public static RENDERHANDLE FromUInt32(uint value) => new RENDERHANDLE(value); - public static uint ToUInt32(RENDERHANDLE handle) => handle.value; - } + public static uint ToUInt32(RENDERHANDLE handle) => handle.value; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RelayConnectionInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RelayConnectionInfo.cs index 815c8cd..71b4538 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RelayConnectionInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RelayConnectionInfo.cs @@ -9,18 +9,18 @@ using System; namespace Microsoft.Iris.Render.Protocol { - [Serializable] - internal sealed class RelayConnectionInfo : RemoteConnectionInfoBase - { - private string m_serverName; - - public RelayConnectionInfo(RemoteConnectionInfo serverInfo, string serverName) - : base(serverInfo.TransportProtocol, serverInfo.SessionName, serverInfo.SwapByteOrder) + [Serializable] + internal sealed class RelayConnectionInfo : RemoteConnectionInfoBase { - Debug2.Validate(serverName != null, typeof (ArgumentNullException), nameof (serverName)); - this.m_serverName = serverName; - } + private string m_serverName; - public string Server => this.m_serverName; - } + public RelayConnectionInfo(RemoteConnectionInfo serverInfo, string serverName) + : base(serverInfo.TransportProtocol, serverInfo.SessionName, serverInfo.SwapByteOrder) + { + Debug2.Validate(serverName != null, typeof(ArgumentNullException), nameof(serverName)); + this.m_serverName = serverName; + } + + public string Server => this.m_serverName; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteChannel.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteChannel.cs index a412571..9e4f15b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteChannel.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteChannel.cs @@ -9,50 +9,50 @@ using System; namespace Microsoft.Iris.Render.Protocol { - internal class RemoteChannel : RenderObject, IChannel - { - private string m_sessionName; - private TransportProtocol m_protocol; - private IntPtr m_pSendStream; - private IntPtr m_pReceiveStream; - private IntPtr m_pSession; - - public RemoteChannel(RemoteConnectionInfo connectionInfo) + internal class RemoteChannel : RenderObject, IChannel { - this.m_sessionName = connectionInfo.SessionName; - this.m_protocol = connectionInfo.TransportProtocol; - EngineApi.IFC(EngineApi.SpRemoteCreateServerStreams(this.m_sessionName, this.m_protocol, out this.m_pSendStream, out this.m_pReceiveStream)); - } + private string m_sessionName; + private TransportProtocol m_protocol; + private IntPtr m_pSendStream; + private IntPtr m_pReceiveStream; + private IntPtr m_pSession; - protected override void Dispose(bool inDispose) - { - try - { - if (!(this.m_pSession != IntPtr.Zero)) - return; - EngineApi.IFC(EngineApi.SpRemoteServerUninit(this.m_pSession, true, out ShutdownReason _)); - this.m_pSession = IntPtr.Zero; - } - finally - { - base.Dispose(inDispose); - } - } + public RemoteChannel(RemoteConnectionInfo connectionInfo) + { + this.m_sessionName = connectionInfo.SessionName; + this.m_protocol = connectionInfo.TransportProtocol; + EngineApi.IFC(EngineApi.SpRemoteCreateServerStreams(this.m_sessionName, this.m_protocol, out this.m_pSendStream, out this.m_pReceiveStream)); + } - public bool IsConnected => this.m_pSession != IntPtr.Zero; + protected override void Dispose(bool inDispose) + { + try + { + if (!(this.m_pSession != IntPtr.Zero)) + return; + EngineApi.IFC(EngineApi.SpRemoteServerUninit(this.m_pSession, true, out ShutdownReason _)); + this.m_pSession = IntPtr.Zero; + } + finally + { + base.Dispose(inDispose); + } + } - public void Connect( - ContextID idRemoteContext, - RENDERHANDLE hBrokerClass, - MessageCookieLayout layout) - { - EngineApi.IFC(EngineApi.SpRemoteWaitServerStreamsConnected(this.m_protocol, this.m_pSendStream, this.m_pReceiveStream)); - EngineApi.IFC(EngineApi.SpRemoteServerInit(this.m_pSendStream, this.m_pReceiveStream, new EngineApi.InitArgs(layout, idRemoteContext) - { - idObjectBrokerClass = hBrokerClass - }, out this.m_pSession)); - EngineApi.SpObjectRelease(this.m_pSendStream); - EngineApi.SpObjectRelease(this.m_pReceiveStream); + public bool IsConnected => this.m_pSession != IntPtr.Zero; + + public void Connect( + ContextID idRemoteContext, + RENDERHANDLE hBrokerClass, + MessageCookieLayout layout) + { + EngineApi.IFC(EngineApi.SpRemoteWaitServerStreamsConnected(this.m_protocol, this.m_pSendStream, this.m_pReceiveStream)); + EngineApi.IFC(EngineApi.SpRemoteServerInit(this.m_pSendStream, this.m_pReceiveStream, new EngineApi.InitArgs(layout, idRemoteContext) + { + idObjectBrokerClass = hBrokerClass + }, out this.m_pSession)); + EngineApi.SpObjectRelease(this.m_pSendStream); + EngineApi.SpObjectRelease(this.m_pReceiveStream); + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteConnectionInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteConnectionInfo.cs index b4e0c48..0a21603 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteConnectionInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteConnectionInfo.cs @@ -8,12 +8,12 @@ using System; namespace Microsoft.Iris.Render.Protocol { - [Serializable] - internal sealed class RemoteConnectionInfo : RemoteConnectionInfoBase - { - public RemoteConnectionInfo(TransportProtocol protocol, string sessionName, bool swapByteOrder) - : base(protocol, sessionName, swapByteOrder) + [Serializable] + internal sealed class RemoteConnectionInfo : RemoteConnectionInfoBase { + public RemoteConnectionInfo(TransportProtocol protocol, string sessionName, bool swapByteOrder) + : base(protocol, sessionName, swapByteOrder) + { + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteConnectionInfoBase.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteConnectionInfoBase.cs index fd96946..01895c8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteConnectionInfoBase.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteConnectionInfoBase.cs @@ -9,29 +9,29 @@ using System; namespace Microsoft.Iris.Render.Protocol { - [Serializable] - internal abstract class RemoteConnectionInfoBase : ConnectionInfo - { - private string m_sessionName; - private TransportProtocol m_protocol; - private bool m_swapByteOrder; - - public RemoteConnectionInfoBase( - TransportProtocol protocol, - string sessionName, - bool swapByteOrder) + [Serializable] + internal abstract class RemoteConnectionInfoBase : ConnectionInfo { - Debug2.Validate(protocol >= TransportProtocol.Min && protocol <= TransportProtocol.PIPE, typeof (ArgumentException), nameof (protocol)); - Debug2.Validate(sessionName != null, typeof (ArgumentNullException), nameof (sessionName)); - this.m_protocol = protocol; - this.m_sessionName = sessionName; - this.m_swapByteOrder = swapByteOrder; + private string m_sessionName; + private TransportProtocol m_protocol; + private bool m_swapByteOrder; + + public RemoteConnectionInfoBase( + TransportProtocol protocol, + string sessionName, + bool swapByteOrder) + { + Debug2.Validate(protocol >= TransportProtocol.Min && protocol <= TransportProtocol.PIPE, typeof(ArgumentException), nameof(protocol)); + Debug2.Validate(sessionName != null, typeof(ArgumentNullException), nameof(sessionName)); + this.m_protocol = protocol; + this.m_sessionName = sessionName; + this.m_swapByteOrder = swapByteOrder; + } + + public string SessionName => this.m_sessionName; + + public TransportProtocol TransportProtocol => this.m_protocol; + + public bool SwapByteOrder => this.m_swapByteOrder; } - - public string SessionName => this.m_sessionName; - - public TransportProtocol TransportProtocol => this.m_protocol; - - public bool SwapByteOrder => this.m_swapByteOrder; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteObject.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteObject.cs index 02cc5d2..13eb089 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteObject.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RemoteObject.cs @@ -9,64 +9,64 @@ using System; namespace Microsoft.Iris.Render.Protocol { - internal abstract class RemoteObject : RenderObject - { - private bool m_fFreeOnDispose; - protected RenderPort m_renderPort; - protected RENDERHANDLE m_renderHandle; - - public RemoteObject(RenderPort port, IRenderHandleOwner owner) + internal abstract class RemoteObject : RenderObject { - RENDERHANDLE handle = port.AllocHandle(owner); - this.Init(port, handle, true); + private bool m_fFreeOnDispose; + protected RenderPort m_renderPort; + protected RENDERHANDLE m_renderHandle; + + public RemoteObject(RenderPort port, IRenderHandleOwner owner) + { + RENDERHANDLE handle = port.AllocHandle(owner); + this.Init(port, handle, true); + } + + public RemoteObject(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) => this.Init(port, handle, fFreeOnDispose); + + private void Init(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + { + this.m_renderPort = port; + this.m_renderHandle = handle; + this.m_fFreeOnDispose = fFreeOnDispose; + if (this.m_fFreeOnDispose) + return; + GC.SuppressFinalize((object)this); + } + + protected RemoteObject() + { + } + + protected override void Dispose(bool fInDispose) + { + try + { + if (!fInDispose) + return; + this.SafeDelete(); + } + finally + { + base.Dispose(fInDispose); + } + } + + public bool IsValid => this.m_renderHandle != RENDERHANDLE.NULL; + + public RenderPort Port => this.m_renderPort; + + public RENDERHANDLE RenderHandle => this.m_renderHandle; + + public override bool Equals(object other) => other is RemoteObject && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => this.m_renderHandle.GetHashCode(); + + private void SafeDelete() + { + if (this.IsValid && this.m_fFreeOnDispose && this.m_renderPort != null) + this.m_renderPort.FreeHandle(this.m_renderHandle); + this.m_renderHandle = RENDERHANDLE.NULL; + this.m_renderPort = (RenderPort)null; + } } - - public RemoteObject(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) => this.Init(port, handle, fFreeOnDispose); - - private void Init(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - { - this.m_renderPort = port; - this.m_renderHandle = handle; - this.m_fFreeOnDispose = fFreeOnDispose; - if (this.m_fFreeOnDispose) - return; - GC.SuppressFinalize((object) this); - } - - protected RemoteObject() - { - } - - protected override void Dispose(bool fInDispose) - { - try - { - if (!fInDispose) - return; - this.SafeDelete(); - } - finally - { - base.Dispose(fInDispose); - } - } - - public bool IsValid => this.m_renderHandle != RENDERHANDLE.NULL; - - public RenderPort Port => this.m_renderPort; - - public RENDERHANDLE RenderHandle => this.m_renderHandle; - - public override bool Equals(object other) => other is RemoteObject && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => this.m_renderHandle.GetHashCode(); - - private void SafeDelete() - { - if (this.IsValid && this.m_fFreeOnDispose && this.m_renderPort != null) - this.m_renderPort.FreeHandle(this.m_renderHandle); - this.m_renderHandle = RENDERHANDLE.NULL; - this.m_renderPort = (RenderPort) null; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderException.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderException.cs index e54170f..b84aa6f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderException.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderException.cs @@ -8,72 +8,72 @@ using System; namespace Microsoft.Iris.Render.Protocol { - [Serializable] - internal class RenderException : InvalidOperationException - { - private const int ErrorPrefix = -2147221504; - private RenderException.ErrorCode m_code; - - public RenderException() + [Serializable] + internal class RenderException : InvalidOperationException { + private const int ErrorPrefix = -2147221504; + private RenderException.ErrorCode m_code; + + public RenderException() + { + } + + public RenderException(string stReason) + : base(stReason) + { + } + + public RenderException(string stReason, Exception innerException) + : base(stReason, innerException) + { + } + + public RenderException(RenderException.ErrorCode code) => this.m_code = code; + + public RenderException(RenderException.ErrorCode code, string stReason) + : base(stReason) + => this.m_code = code; + + public RenderException.ErrorCode Error => this.m_code; + + public enum ErrorCode + { + OutOfKernelResources = -2147221503, // 0x80040001 + OutOfGdiResources = -2147221502, // 0x80040002 + Generic = -2147221494, // 0x8004000A + Busy = -2147221493, // 0x8004000B + Unusable = -2147221492, // 0x8004000C + NoContext = -2147221484, // 0x80040014 + InvalidContext = -2147221474, // 0x8004001E + ReadOnlyContext = -2147221473, // 0x8004001F + ThreadingAlreadySet = -2147221472, // 0x80040020 + CannotUseStandardMessaging = -2147221471, // 0x80040021 + BadCoordinateMap = -2147221464, // 0x80040028 + CannotFindMsgID = -2147221454, // 0x80040032 + NotBuffered = -2147221444, // 0x8004003C + StartDestroy = -2147221434, // 0x80040046 + ObjectLocked = -2147221433, // 0x80040047 + InvalidOperation = -2147221432, // 0x80040048 + NotInitialized = -2147221424, // 0x80040050 + NotFound = -2147221414, // 0x8004005A + IdAlreadyUsed = -2147221413, // 0x8004005B + FileNotFound = -2147221412, // 0x8004005C + OutOfRange = -2147221411, // 0x8004005D + MismatchedTypes = -2147221404, // 0x80040064 + CannotLoadGdiplus = -2147221394, // 0x8004006E + CannotLoadDirect3D = -2147221393, // 0x8004006F + ClassAlreadyRegistered = -2147221384, // 0x80040078 + MessageNotFound = -2147221383, // 0x80040079 + MessageNotImplemented = -2147221382, // 0x8004007A + ClassNotImplemented = -2147221381, // 0x8004007B + MessageFailed = -2147221380, // 0x8004007C + MessageData = -2147221379, // 0x8004007D + NoContent = -2147221374, // 0x80040082 + NoStorage = -2147221373, // 0x80040083 + GenericWin32 = -2147221364, // 0x8004008C + GenericGdiPlus = -2147221363, // 0x8004008D + GenericDriver = -2147221362, // 0x8004008E + UnableToConnect = -2147221354, // 0x80040096 + } } - - public RenderException(string stReason) - : base(stReason) - { - } - - public RenderException(string stReason, Exception innerException) - : base(stReason, innerException) - { - } - - public RenderException(RenderException.ErrorCode code) => this.m_code = code; - - public RenderException(RenderException.ErrorCode code, string stReason) - : base(stReason) - => this.m_code = code; - - public RenderException.ErrorCode Error => this.m_code; - - public enum ErrorCode - { - OutOfKernelResources = -2147221503, // 0x80040001 - OutOfGdiResources = -2147221502, // 0x80040002 - Generic = -2147221494, // 0x8004000A - Busy = -2147221493, // 0x8004000B - Unusable = -2147221492, // 0x8004000C - NoContext = -2147221484, // 0x80040014 - InvalidContext = -2147221474, // 0x8004001E - ReadOnlyContext = -2147221473, // 0x8004001F - ThreadingAlreadySet = -2147221472, // 0x80040020 - CannotUseStandardMessaging = -2147221471, // 0x80040021 - BadCoordinateMap = -2147221464, // 0x80040028 - CannotFindMsgID = -2147221454, // 0x80040032 - NotBuffered = -2147221444, // 0x8004003C - StartDestroy = -2147221434, // 0x80040046 - ObjectLocked = -2147221433, // 0x80040047 - InvalidOperation = -2147221432, // 0x80040048 - NotInitialized = -2147221424, // 0x80040050 - NotFound = -2147221414, // 0x8004005A - IdAlreadyUsed = -2147221413, // 0x8004005B - FileNotFound = -2147221412, // 0x8004005C - OutOfRange = -2147221411, // 0x8004005D - MismatchedTypes = -2147221404, // 0x80040064 - CannotLoadGdiplus = -2147221394, // 0x8004006E - CannotLoadDirect3D = -2147221393, // 0x8004006F - ClassAlreadyRegistered = -2147221384, // 0x80040078 - MessageNotFound = -2147221383, // 0x80040079 - MessageNotImplemented = -2147221382, // 0x8004007A - ClassNotImplemented = -2147221381, // 0x8004007B - MessageFailed = -2147221380, // 0x8004007C - MessageData = -2147221379, // 0x8004007D - NoContent = -2147221374, // 0x80040082 - NoStorage = -2147221373, // 0x80040083 - GenericWin32 = -2147221364, // 0x8004008C - GenericGdiPlus = -2147221363, // 0x8004008D - GenericDriver = -2147221362, // 0x8004008E - UnableToConnect = -2147221354, // 0x80040096 - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderPort.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderPort.cs index ba367ca..9cccdb1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderPort.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/RenderPort.cs @@ -12,787 +12,787 @@ using System.Collections; namespace Microsoft.Iris.Render.Protocol { - internal class RenderPort : IRenderPortCallback, IRenderHandleOwner - { - private const uint c_maxCachedBatchSendInfos = 25; - private MessagingSession _session; - private IChannel _channel; - private ContextID _idRemoteContext; - private ProtocolSplashMessaging _protocolMessaging; - private ArrayList _protocols = new ArrayList(); - private HandleTable _handleTable; - private Map _groupProxies; - private MessageCookieLayout _layoutOfRenderHandles; - private RENDERGROUP _defaultGroupId; - private RENDERHANDLE _rootHandle; - private ArrayList _callbackHandlers = new ArrayList(); - private MessageHeap _currentMessageHeap; - private ObjectCache _spareHeapCache; - private Map _activeHeaps; - private uint _nextBatchId; - private RenderPort.BatchSendInfo _sentBatchesHead; - private RenderPort.BatchSendInfo _sentBatchesTail; - private RenderPort.BatchSendInfo _freeBatchSendInfos; - private uint _numFreeBatchSendInfos; - private unsafe MessageBatchEntry* _lastBatchEntry; - private uint _lastBatchBlockId; - private RENDERHANDLE[] _pendingBatchDeletes; - private uint _pendingBatchDeleteSlot; - private RENDERGROUP[] _pendingBatchGroupDeletes; - private uint _pendingBatchGroupDeleteSlot; - private BatchCallback _batchPopulateCallback; - private bool _individualMessageMode; - private uint _uBatchedMessages; - private DeferredHandler _deferredObjectReleaseWorker; - private DeferredHandler _deferredGroupReleaseWorker; - private DeferredHandler _deferredHeapReleaseWorker; - private DeferredHandler _deferredTrafficUpdate; - private bool _foreignByteOrder; - private static object s_SyncLock = new object(); - private static ushort[] s_ByteOrder_CallbackMessage; - private static ushort[] s_ByteOrder_MessageBatchHeader; - private static ushort[] s_ByteOrder_MessageBatchEntry; - private ulong _ulOverallControlTraffic; - private uint _uRecentControlTraffic; - private ulong _ulOverallDataTraffic; - private uint _uRecentDataTraffic; - private ulong _ulOverallTotalTraffic; - private DateTime _dtRecentTrafficTime; - private bool _fPendingTrafficSummary; - private static TimeSpan s_timeTrafficWindow = TimeSpan.FromMilliseconds(500.0); - - internal RenderPort( - MessagingSession session, - IChannel channel, - ContextID idRemoteContext, - RENDERGROUP idGroup, - MessageCookieLayout layout, - bool foreignByteOrder) + internal class RenderPort : IRenderPortCallback, IRenderHandleOwner { - Debug2.Validate(session != null, typeof (ArgumentNullException), nameof (session)); - Debug2.Validate(channel != null, typeof (ArgumentNullException), nameof (channel)); - Debug2.Validate(idRemoteContext != ContextID.NULL, typeof (ArgumentNullException), nameof (idRemoteContext)); - this._deferredObjectReleaseWorker = new DeferredHandler(this.DeferredObjectReleaseWorker); - this._deferredGroupReleaseWorker = new DeferredHandler(this.DeferredGroupReleaseWorker); - this._deferredHeapReleaseWorker = new DeferredHandler(this.DeferredHeapReleaseWorker); - this._deferredTrafficUpdate = new DeferredHandler(this.DeferredTrafficUpdate); - this._activeHeaps = new Map(); - this._spareHeapCache = new ObjectCache(new ObjectCache.Callback(this.HeapCacheCallback), 10, false); - this._individualMessageMode = true; - this._layoutOfRenderHandles = layout; - this._handleTable = new HandleTable(this, this._layoutOfRenderHandles); - this._defaultGroupId = this.AllocHandleGroup(false); - this._rootHandle = this.AllocHandle((IRenderHandleOwner) this); - if (idGroup != RENDERGROUP.NULL) - { - this.AllocHandleGroupWithId(idGroup); - this._defaultGroupId = idGroup; - } - this._channel = channel; - this._session = session; - this._foreignByteOrder = foreignByteOrder; - this._idRemoteContext = idRemoteContext; - this._protocolMessaging = ProtocolSplashMessaging.Bind(this); - } + private const uint c_maxCachedBatchSendInfos = 25; + private MessagingSession _session; + private IChannel _channel; + private ContextID _idRemoteContext; + private ProtocolSplashMessaging _protocolMessaging; + private ArrayList _protocols = new ArrayList(); + private HandleTable _handleTable; + private Map _groupProxies; + private MessageCookieLayout _layoutOfRenderHandles; + private RENDERGROUP _defaultGroupId; + private RENDERHANDLE _rootHandle; + private ArrayList _callbackHandlers = new ArrayList(); + private MessageHeap _currentMessageHeap; + private ObjectCache _spareHeapCache; + private Map _activeHeaps; + private uint _nextBatchId; + private RenderPort.BatchSendInfo _sentBatchesHead; + private RenderPort.BatchSendInfo _sentBatchesTail; + private RenderPort.BatchSendInfo _freeBatchSendInfos; + private uint _numFreeBatchSendInfos; + private unsafe MessageBatchEntry* _lastBatchEntry; + private uint _lastBatchBlockId; + private RENDERHANDLE[] _pendingBatchDeletes; + private uint _pendingBatchDeleteSlot; + private RENDERGROUP[] _pendingBatchGroupDeletes; + private uint _pendingBatchGroupDeleteSlot; + private BatchCallback _batchPopulateCallback; + private bool _individualMessageMode; + private uint _uBatchedMessages; + private DeferredHandler _deferredObjectReleaseWorker; + private DeferredHandler _deferredGroupReleaseWorker; + private DeferredHandler _deferredHeapReleaseWorker; + private DeferredHandler _deferredTrafficUpdate; + private bool _foreignByteOrder; + private static object s_SyncLock = new object(); + private static ushort[] s_ByteOrder_CallbackMessage; + private static ushort[] s_ByteOrder_MessageBatchHeader; + private static ushort[] s_ByteOrder_MessageBatchEntry; + private ulong _ulOverallControlTraffic; + private uint _uRecentControlTraffic; + private ulong _ulOverallDataTraffic; + private uint _uRecentDataTraffic; + private ulong _ulOverallTotalTraffic; + private DateTime _dtRecentTrafficTime; + private bool _fPendingTrafficSummary; + private static TimeSpan s_timeTrafficWindow = TimeSpan.FromMilliseconds(500.0); - public void Connect() - { - Debug2.Throw(this._handleTable != null && this._channel != null, "must be valid to connect"); - Debug2.Throw(!this._channel.IsConnected, "already connected"); - this._channel.Connect(this._idRemoteContext, this._rootHandle, this._layoutOfRenderHandles); - foreach (ProtocolInstance protocol in this._protocols) - protocol.OnConnect(); - } - - internal void PingConnection() => LocalRenderPortCallback.AutoSendOnPingReply(this._protocolMessaging, RENDERHANDLE.NULL); - - internal event EventHandler PingReply; - - public void Dispose() - { - this.PingReply = (EventHandler) null; - this.DisposeObjectMaps(); - if (this._channel != null) - { - this._channel.Dispose(); - this._channel = (IChannel) null; - } - if (this._spareHeapCache == null) - return; - if (this._currentMessageHeap != null) - this.ReleaseHeap(this._currentMessageHeap); - this._currentMessageHeap = (MessageHeap) null; - this._spareHeapCache.Dispose(); - this._spareHeapCache = (ObjectCache) null; - } - - public void DisposeObjectMaps() - { - if (this._handleTable == null) - return; - this._handleTable.Dispose(); - this._handleTable = (HandleTable) null; - } - - public MessagingSession Session => this._session; - - public ContextID RemoteContext => this._idRemoteContext; - - public bool ForeignByteOrder => this._foreignByteOrder; - - public bool AlwaysBigEndian => this._foreignByteOrder; - - internal uint DefaultGroupID => RENDERGROUP.ToUInt32(this._defaultGroupId); - - RENDERHANDLE IRenderHandleOwner.RenderHandle => RENDERHANDLE.NULL; - - void IRenderHandleOwner.OnDisconnect() - { - } - - internal ProtocolSplashMessaging MessagingProtocol => this._protocolMessaging; - - public ProtocolInstance LookUpProtocol(string name) - { - ProtocolInstance protocolInstance = (ProtocolInstance) null; - foreach (ProtocolInstance protocol in this._protocols) - { - if (protocol.Name == name) - protocolInstance = protocol; - } - return protocolInstance; - } - - internal void BindProtocol(ProtocolInstance protocol) - { - Debug2.Validate(this.LookUpProtocol(protocol.Name) == null, typeof (InvalidOperationException), (object) nameof (protocol), (object) "protocol already bound"); - this._protocols.Add((object) protocol); - if (this._channel == null || !this._channel.IsConnected) - return; - protocol.OnConnect(); - } - - internal RENDERHANDLE InitRemoteClass(string className) - { - if (className.Equals("Splash::Messaging::Broker")) - return this._rootHandle; - RENDERHANDLE idObjectClass = this.AllocHandle((IRenderHandleOwner) this); - RemoteBroker.SendCreateClass(this._protocolMessaging, className, idObjectClass); - return idObjectClass; - } - - internal unsafe void CreateRemoteObject( - RENDERHANDLE classCreate, - RENDERHANDLE hNewObject, - Message* pmsgConstructor) - { - RemoteBroker.SendCreateObject(this._protocolMessaging, classCreate, hNewObject, pmsgConstructor); - } - - internal unsafe void SendLocalCallbackMessage(Message* pmsgCallback) => Microsoft.Iris.Render.Protocols.Splash.Messaging.RemoteContext.SendForwardMessage(this._protocolMessaging, this._session.LocalContext, pmsgCallback); - - internal void LinkContext(ContextID idContextExisting, ContextID idContextAlias) => RemoteContextRelay.SendLinkContext(this._protocolMessaging, idContextExisting, idContextAlias); - - internal void UnlinkContext(ContextID idContextExisting, ContextID idContextAlias) => RemoteContextRelay.SendUnlinkContext(this._protocolMessaging, idContextExisting, idContextAlias); - - public void BeginMessageBatch(BatchCallback populateCallback) - { - this.Session.AssertOwningThread(); - Debug2.Throw(this._individualMessageMode, "Already in batch mode"); - this._batchPopulateCallback = populateCallback; - this._individualMessageMode = false; - } - - public void EndMessageBatch(BatchCallback deliveryCallback) - { - this.Session.AssertOwningThread(); - Debug2.Throw(!this._individualMessageMode, "Must be collecting a batch to end"); - this.SendCurrentBatch(deliveryCallback); - this._individualMessageMode = true; - } - - public unsafe void SendDataBuffer(void* pvData, uint cbSize, RENDERHANDLE idRemoteBuffer) - { - Debug2.Validate(idRemoteBuffer != RENDERHANDLE.NULL, typeof (ArgumentNullException), nameof (idRemoteBuffer)); - this.UpdateTraffic(0U, cbSize); - EngineApi.IFC(EngineApi.SpBufferOpen(&new EngineApi.BufferInfo() - { - idContextSrc = this._session.LocalContext, - idContextDest = this._idRemoteContext, - idBuffer = idRemoteBuffer, - nFlags = (EngineApi.BufferFlags) 0, - cbSizeBuffer = cbSize - }, pvData)); - } - - public unsafe void SendBatchBuffer(void* pvData, uint cbSize, RENDERHANDLE idRemoteBuffer) - { - int num = idRemoteBuffer != RENDERHANDLE.NULL ? 1 : 0; - this.UpdateTraffic(cbSize, 0U); - EngineApi.IFC(EngineApi.SpBufferOpen(&new EngineApi.BufferInfo() - { - idContextSrc = this._session.LocalContext, - idContextDest = this._idRemoteContext, - idBuffer = idRemoteBuffer, - nFlags = EngineApi.BufferFlags.IsBatch, - cbSizeBuffer = cbSize - }, pvData)); - } - - public unsafe void SendMessageBuffer(Message* pmsg) - { - this.UpdateTraffic(pmsg->cbSize, 0U); - uint src = pmsg->cbSize; - if (this.ForeignByteOrder) - src = Memory.ConvertEndian(src); - EngineApi.IFC(EngineApi.SpBufferOpen(&new EngineApi.BufferInfo() - { - idContextSrc = this._session.LocalContext, - idContextDest = this._idRemoteContext, - idBuffer = RENDERHANDLE.NULL, - nFlags = EngineApi.BufferFlags.CopyData, - cbSizeBuffer = src - }, (void*) pmsg)); - } - - private void UpdateTraffic(uint uControl, uint uData) - { - this._uRecentControlTraffic += uControl; - this._uRecentDataTraffic += uData; - this._dtRecentTrafficTime = DateTime.UtcNow; - if (Debug2.IsCategoryEnabled(DebugCategory.Protocol, 1)) - { - if (this._fPendingTrafficSummary || !this.Session.IsConnected) - return; - this.Session.DeferredInvoke((Delegate) this._deferredTrafficUpdate, (object) null, DeferredInvokePriority.Idle, RenderPort.s_timeTrafficWindow); - this._fPendingTrafficSummary = true; - } - else - this.TrafficUpdateWorker(); - } - - private void DeferredTrafficUpdate(object obj) - { - if (!this._fPendingTrafficSummary) - return; - if (DateTime.UtcNow - this._dtRecentTrafficTime < RenderPort.s_timeTrafficWindow) - { - this.Session.DeferredInvoke((Delegate) this._deferredTrafficUpdate, (object) null, DeferredInvokePriority.Idle, this._dtRecentTrafficTime + RenderPort.s_timeTrafficWindow - DateTime.UtcNow); - } - else - { - this._fPendingTrafficSummary = false; - this.TrafficUpdateWorker(); - } - } - - private void TrafficUpdateWorker() - { - this._ulOverallControlTraffic += (ulong) this._uRecentControlTraffic; - this._ulOverallDataTraffic += (ulong) this._uRecentDataTraffic; - this._ulOverallTotalTraffic += (ulong) (this._uRecentControlTraffic + this._uRecentDataTraffic); - Debug2.IsCategoryEnabled(DebugCategory.Protocol, 1); - this._uRecentControlTraffic = 0U; - this._uRecentDataTraffic = 0U; - } - - public unsafe void* AllocMessageBuffer(uint size) - { - this.Session.AssertOwningThread(); - if (this._currentMessageHeap == null) - this._currentMessageHeap = this.AllocHeap(); - return this._currentMessageHeap.Alloc(size); - } - - public unsafe void SendRemoteMessage(Message* pmsg) - { - this.Session.AssertOwningThread(); - Debug2.Throw(this._channel != null, "Not connected to renderer"); - if (this._individualMessageMode) - { - this.SendMessageBuffer(pmsg); - if (this._currentMessageHeap == null) - return; - this._currentMessageHeap.Reset(); - } - else - this.StoreMessageEntry(pmsg); - } - - public RENDERHANDLE AllocHandle(IRenderHandleOwner owner) - { - Debug2.Throw(this._handleTable != null, "Render port has already shut down"); - Debug2.Validate(owner != null, typeof (ArgumentNullException), nameof (owner)); - return this._handleTable.Alloc(this._defaultGroupId, owner); - } - - public void RegisterKnownHandle(IRenderHandleOwner owner, RENDERHANDLE handle) - { - Debug2.Throw(this._handleTable != null, "Render port has already shut down"); - Debug2.Validate(owner != null, typeof (ArgumentNullException), nameof (owner)); - this._handleTable.AllocWithId(owner, handle, true); - } - - public void FreeHandle(RENDERHANDLE handle) - { - if (this.Session.IsOwningThread()) - { - if (this._handleTable == null) - return; - if (this._channel != null && this._handleTable.GetGroup(handle) == this._defaultGroupId) + internal RenderPort( + MessagingSession session, + IChannel channel, + ContextID idRemoteContext, + RENDERGROUP idGroup, + MessageCookieLayout layout, + bool foreignByteOrder) { - this._handleTable.SetOwner(handle, (IRenderHandleOwner) null); - this.AddPendingDelete(handle); - RemoteBroker.SendDestroyObject(this._protocolMessaging, handle); - } - else - this._handleTable.Free(handle); - } - else - this.Session.DeferredInvoke((Delegate) this._deferredObjectReleaseWorker, (object) handle, DeferredInvokePriority.High); - } - - public void CancelAllocHandle(RENDERHANDLE handle) - { - if (this._handleTable == null) - return; - this._handleTable.Free(handle); - } - - public IRenderHandleOwner TryGetHandleOwner(RENDERHANDLE handle) => this._handleTable.GetOwner(handle, true); - - public IRenderHandleOwner TryGetProxyOwner(RENDERHANDLE handle) - { - IRenderHandleOwner renderHandleOwner = (IRenderHandleOwner) null; - if (this._groupProxies != null) - { - RENDERGROUP group = this._handleTable.GetGroup(handle); - if (group != RENDERGROUP.NULL) - renderHandleOwner = this.GetGroupProxy(group); - } - return renderHandleOwner; - } - - public IRenderHandleOwner GetHandleOwner(RENDERHANDLE handle) => this._handleTable.GetOwner(handle); - - public void ValidateHandle(RENDERHANDLE handle) => this._handleTable.Validate(handle); - - public void ValidateHandleOrNull(RENDERHANDLE handle) - { - if (!(handle != RENDERHANDLE.NULL)) - return; - this._handleTable.Validate(handle); - } - - public RENDERGROUP AllocHandleGroup() => this.AllocHandleGroup(true); - - public void AllocHandleGroupWithId(RENDERGROUP idGroup) => this._handleTable.AllocGroupWithId(idGroup); - - private RENDERGROUP AllocHandleGroup(bool failIfNotConnected) - { - RENDERGROUP handle = this._handleTable.AllocGroup(); - if (this._channel != null) - Microsoft.Iris.Render.Protocols.Splash.Messaging.RemoteContext.SendCreateGroup(this._protocolMessaging, (int) RENDERGROUP.ToUInt32(handle), this._session.LocalContext); - else if (failIfNotConnected) - Debug2.Throw(false, "Not connected to renderer"); - return handle; - } - - public void FreeHandleGroup(RENDERGROUP group) - { - if (this.Session.IsOwningThread()) - { - if (this._handleTable == null) - return; - if (this._channel != null) - { - this.AddPendingGroupDelete(group); - Microsoft.Iris.Render.Protocols.Splash.Messaging.RemoteContext.SendDestroyGroup(this._protocolMessaging, (int) RENDERGROUP.ToUInt32(group)); - } - else - this._handleTable.FreeGroup(group); - } - else - this.Session.DeferredInvoke((Delegate) this._deferredGroupReleaseWorker, (object) group, DeferredInvokePriority.High); - } - - public void RegisterGroupProxy(RENDERGROUP group, IRenderHandleOwner proxy) - { - if (this._groupProxies == null) - this._groupProxies = new Map(); - this._groupProxies[group] = new WeakReference((object) proxy); - } - - public void RevokeGroupProxy(RENDERGROUP group) - { - if (this._groupProxies == null) - return; - this._groupProxies[group] = (WeakReference) null; - } - - public IRenderHandleOwner GetGroupProxy(RENDERGROUP group) - { - IRenderHandleOwner renderHandleOwner = (IRenderHandleOwner) null; - if (this._groupProxies != null) - { - WeakReference groupProxy = this._groupProxies[group]; - if (groupProxy != null) - renderHandleOwner = groupProxy.Target as IRenderHandleOwner; - } - return renderHandleOwner; - } - - public MessageHeap AllocHeap() - { - this.Session.AssertOwningThread(); - return (MessageHeap) this._spareHeapCache.Pop(); - } - - public void ReleaseHeap(MessageHeap heap) - { - if (this.Session.IsOwningThread()) - this.DeferredHeapReleaseWorker((object) heap); - else if (this.Session.OwningThread != null) - this.Session.DeferredInvoke((Delegate) this._deferredHeapReleaseWorker, (object) heap, DeferredInvokePriority.High); - else - heap.Dispose(); - } - - private unsafe void StoreMessageEntry(Message* pMethodMsg) - { - MessageHeap.Block block = this._currentMessageHeap.LookupBlock((void*) pMethodMsg); - Debug2.Throw((IntPtr) block.data != IntPtr.Zero, "message should be in current message heap"); - uint num = (uint) ((ulong) ((sbyte*) pMethodMsg - (sbyte*) block.data) - (ulong) sizeof (MessageBatchEntry)); - if ((IntPtr) this._lastBatchEntry != IntPtr.Zero && (int) this._lastBatchBlockId == (int) block.id) - this._lastBatchEntry->uOffsetNextEntry = num; - else - ((MessageBatchHeader*) block.data)->uOffsetFirstEntry = num; - this._lastBatchEntry = (MessageBatchEntry*) ((IntPtr) block.data + (int) num); - this._lastBatchBlockId = block.id; - ++this._uBatchedMessages; - BatchCallback populateCallback = this._batchPopulateCallback; - if (populateCallback == null) - return; - this._batchPopulateCallback = (BatchCallback) null; - populateCallback(); - } - - private unsafe void SendCurrentBatch(BatchCallback deliveryCallback) - { - try - { - if ((IntPtr) this._lastBatchEntry != IntPtr.Zero) - { - uint nextBatchId = this._nextBatchId; - ++this._nextBatchId; - try - { - LocalRenderPortCallback.AutoSendOnBatchProcessed(this._protocolMessaging, RENDERHANDLE.NULL, nextBatchId); - RenderPort.BatchSendInfo info = this.AllocBatchSendInfo(); - info.batchID = nextBatchId; - info.heap = this._currentMessageHeap; - info.pendingDeletes = this._pendingBatchDeletes; - info.pendingGroupDeletes = this._pendingBatchGroupDeletes; - info.deliveryCallback = deliveryCallback; - this.EnqueuePendingBatch(info); - RENDERHANDLE renderhandle = RENDERHANDLE.NULL; - int blockCount = this._currentMessageHeap.BlockCount; - uint num = 0; - MessageHeap.Enumerator enumerator = this._currentMessageHeap.GetEnumerator(); - while (enumerator.MoveNext()) + Debug2.Validate(session != null, typeof(ArgumentNullException), nameof(session)); + Debug2.Validate(channel != null, typeof(ArgumentNullException), nameof(channel)); + Debug2.Validate(idRemoteContext != ContextID.NULL, typeof(ArgumentNullException), nameof(idRemoteContext)); + this._deferredObjectReleaseWorker = new DeferredHandler(this.DeferredObjectReleaseWorker); + this._deferredGroupReleaseWorker = new DeferredHandler(this.DeferredGroupReleaseWorker); + this._deferredHeapReleaseWorker = new DeferredHandler(this.DeferredHeapReleaseWorker); + this._deferredTrafficUpdate = new DeferredHandler(this.DeferredTrafficUpdate); + this._activeHeaps = new Map(); + this._spareHeapCache = new ObjectCache(new ObjectCache.Callback(this.HeapCacheCallback), 10, false); + this._individualMessageMode = true; + this._layoutOfRenderHandles = layout; + this._handleTable = new HandleTable(this, this._layoutOfRenderHandles); + this._defaultGroupId = this.AllocHandleGroup(false); + this._rootHandle = this.AllocHandle((IRenderHandleOwner)this); + if (idGroup != RENDERGROUP.NULL) { - MessageHeap.Block current = enumerator.Current; - MessageBatchHeader* data = (MessageBatchHeader*) current.data; - RENDERHANDLE idRemoteBuffer = RENDERHANDLE.NULL; - --blockCount; - if (blockCount > 0) - idRemoteBuffer = this.AllocHandle((IRenderHandleOwner) this); - data->idPredicateBuffer = renderhandle; - if (this.ForeignByteOrder) - RenderPort.SwapBatchListByteOrder(data); - num += current.size; - this.SendBatchBuffer(current.data, current.size, idRemoteBuffer); - renderhandle = idRemoteBuffer; + this.AllocHandleGroupWithId(idGroup); + this._defaultGroupId = idGroup; } - this._currentMessageHeap = (MessageHeap) null; - this._pendingBatchDeletes = (RENDERHANDLE[]) null; - this._pendingBatchDeleteSlot = 0U; - this._pendingBatchGroupDeletes = (RENDERGROUP[]) null; - this._pendingBatchGroupDeleteSlot = 0U; - } - finally - { + this._channel = channel; + this._session = session; + this._foreignByteOrder = foreignByteOrder; + this._idRemoteContext = idRemoteContext; + this._protocolMessaging = ProtocolSplashMessaging.Bind(this); + } + + public void Connect() + { + Debug2.Throw(this._handleTable != null && this._channel != null, "must be valid to connect"); + Debug2.Throw(!this._channel.IsConnected, "already connected"); + this._channel.Connect(this._idRemoteContext, this._rootHandle, this._layoutOfRenderHandles); + foreach (ProtocolInstance protocol in this._protocols) + protocol.OnConnect(); + } + + internal void PingConnection() => LocalRenderPortCallback.AutoSendOnPingReply(this._protocolMessaging, RENDERHANDLE.NULL); + + internal event EventHandler PingReply; + + public void Dispose() + { + this.PingReply = (EventHandler)null; + this.DisposeObjectMaps(); + if (this._channel != null) + { + this._channel.Dispose(); + this._channel = (IChannel)null; + } + if (this._spareHeapCache == null) + return; if (this._currentMessageHeap != null) + this.ReleaseHeap(this._currentMessageHeap); + this._currentMessageHeap = (MessageHeap)null; + this._spareHeapCache.Dispose(); + this._spareHeapCache = (ObjectCache)null; + } + + public void DisposeObjectMaps() + { + if (this._handleTable == null) + return; + this._handleTable.Dispose(); + this._handleTable = (HandleTable)null; + } + + public MessagingSession Session => this._session; + + public ContextID RemoteContext => this._idRemoteContext; + + public bool ForeignByteOrder => this._foreignByteOrder; + + public bool AlwaysBigEndian => this._foreignByteOrder; + + internal uint DefaultGroupID => RENDERGROUP.ToUInt32(this._defaultGroupId); + + RENDERHANDLE IRenderHandleOwner.RenderHandle => RENDERHANDLE.NULL; + + void IRenderHandleOwner.OnDisconnect() + { + } + + internal ProtocolSplashMessaging MessagingProtocol => this._protocolMessaging; + + public ProtocolInstance LookUpProtocol(string name) + { + ProtocolInstance protocolInstance = (ProtocolInstance)null; + foreach (ProtocolInstance protocol in this._protocols) { - this.DequeuePendingBatch(nextBatchId, true); - this.ReleaseHeap(this._currentMessageHeap); - this._currentMessageHeap = (MessageHeap) null; + if (protocol.Name == name) + protocolInstance = protocol; } - } + return protocolInstance; } - else + + internal void BindProtocol(ProtocolInstance protocol) { - if (this._currentMessageHeap != null) - { - this.ReleaseHeap(this._currentMessageHeap); - this._currentMessageHeap = (MessageHeap) null; - } - if (deliveryCallback == null) - return; - deliveryCallback(); + Debug2.Validate(this.LookUpProtocol(protocol.Name) == null, typeof(InvalidOperationException), (object)nameof(protocol), (object)"protocol already bound"); + this._protocols.Add((object)protocol); + if (this._channel == null || !this._channel.IsConnected) + return; + protocol.OnConnect(); } - } - finally - { - this._currentMessageHeap = (MessageHeap) null; - this._batchPopulateCallback = (BatchCallback) null; - this._lastBatchEntry = (MessageBatchEntry*) null; - this._lastBatchBlockId = 0U; - this._uBatchedMessages = 0U; - } - } - private static unsafe void SwapBatchListByteOrder(MessageBatchHeader* pHeader) - { - byte* pMem1 = (byte*) pHeader; - uint num = pHeader->uOffsetFirstEntry; - MarshalHelper.SwapByteOrder(pMem1, ref RenderPort.s_ByteOrder_MessageBatchHeader, typeof (MessageBatchHeader), 0, 0); - while (num != 0U) - { - byte* pMem2 = pMem1 + (int) num; - num = ((MessageBatchEntry*) pMem2)->uOffsetNextEntry; - MarshalHelper.SwapByteOrder(pMem2, ref RenderPort.s_ByteOrder_MessageBatchEntry, typeof (MessageBatchEntry), 0, 0); - } - } - - private void DeferredObjectReleaseWorker(object args) => this.FreeHandle((RENDERHANDLE) args); - - private void DeferredGroupReleaseWorker(object args) => this.FreeHandleGroup((RENDERGROUP) args); - - private void DeferredHeapReleaseWorker(object args) => this._spareHeapCache.Push((object) (MessageHeap) args); - - private object HeapCacheCallback(ObjectCache.Operation operation, object data) - { - this.Session.AssertOwningThread(); - MessageHeap key = data as MessageHeap; - switch (operation) - { - case ObjectCache.Operation.Alloc: - key = new MessageHeap(8U * Win32Api.GetSystemPageSize(), (uint) sizeof (MessageBatchHeader), (uint) sizeof (MessageBatchEntry)); - this._activeHeaps[key] = key; - break; - case ObjectCache.Operation.Free: - this._activeHeaps.Remove(key); - key.Dispose(); - key = (MessageHeap) null; - break; - case ObjectCache.Operation.Freeze: - Debug2.Validate(key != null, typeof (ArgumentNullException), nameof (data)); - key.Reset(); - break; - } - return (object) key; - } - - internal unsafe void ProcessMessageBuffer(EngineApi.BufferInfo* pBufferInfo, void* pvBufferData) - { - if (this.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) pvBufferData, ref RenderPort.s_ByteOrder_CallbackMessage, typeof (CallbackMessage), 0, 0); - CallbackMessage* message = (CallbackMessage*) pvBufferData; - this.DispatchCallbackMessage(RENDERHANDLE.ToUInt32(message->idObjectSubject), message); - } - - internal RENDERHANDLE RegisterCallback(PortCallback callback, out uint idCallback) - { - idCallback = (uint) this._callbackHandlers.Add((object) callback); - return RENDERHANDLE.FromUInt32(idCallback + 2U); - } - - private unsafe void DispatchCallbackMessage(uint idCallback, CallbackMessage* message) - { - idCallback -= 2U; - if (idCallback >= (uint) this._callbackHandlers.Count) - return; - PortCallback callbackHandler = (PortCallback) this._callbackHandlers[(int) idCallback]; - if (callbackHandler == null) - return; - IRenderHandleOwner owner = (IRenderHandleOwner) this; - if (message->hTarget != RENDERHANDLE.NULL) - { - if (this._handleTable == null) - return; - owner = this.TryGetHandleOwner(message->hTarget); - if (owner == null) - return; - } - callbackHandler(this, owner, message); - } - - void IRenderPortCallback.OnPingReply(RENDERHANDLE target) - { - if (this.PingReply == null) - return; - this.PingReply((object) this, EventArgs.Empty); - } - - void IRenderPortCallback.OnBatchProcessed( - RENDERHANDLE target, - uint uBatchCompleted) - { - RenderPort.BatchSendInfo info = this.DequeuePendingBatch(uBatchCompleted, false); - if (info == null) - return; - this.ProcessPendingDeletes(info.pendingDeletes); - this.ProcessPendingGroupDeletes(info.pendingGroupDeletes); - this.ReleaseHeap(info.heap); - if (info.deliveryCallback != null) - info.deliveryCallback(); - this.FreeBatchSendInfo(info); - } - - private void AddPendingDelete(RENDERHANDLE handle) - { - uint num1 = 0; - if (this._pendingBatchDeletes != null) - num1 = (uint) this._pendingBatchDeletes.Length; - if (this._pendingBatchDeleteSlot >= num1) - { - uint num2 = 2U * num1; - if (num2 == 0U) - num2 = 16U; - RENDERHANDLE[] renderhandleArray = new RENDERHANDLE[(IntPtr) num2]; - if (num1 > 0U) - Array.Copy((Array) this._pendingBatchDeletes, (Array) renderhandleArray, this._pendingBatchDeletes.Length); - this._pendingBatchDeletes = renderhandleArray; - } - this._pendingBatchDeletes[(IntPtr) this._pendingBatchDeleteSlot] = handle; - ++this._pendingBatchDeleteSlot; - } - - private void ProcessPendingDeletes(RENDERHANDLE[] deleteList) - { - if (deleteList == null || this._handleTable == null) - return; - foreach (RENDERHANDLE delete in deleteList) - { - if (delete != RENDERHANDLE.NULL) - this._handleTable.Free(delete); - } - } - - private void AddPendingGroupDelete(RENDERGROUP group) - { - uint num1 = 0; - if (this._pendingBatchGroupDeletes != null) - num1 = (uint) this._pendingBatchGroupDeletes.Length; - if (this._pendingBatchGroupDeleteSlot >= num1) - { - uint num2 = 2U * num1; - if (num2 == 0U) - num2 = 16U; - RENDERGROUP[] rendergroupArray = new RENDERGROUP[(IntPtr) num2]; - if (num1 > 0U) - Array.Copy((Array) this._pendingBatchGroupDeletes, (Array) rendergroupArray, this._pendingBatchGroupDeletes.Length); - this._pendingBatchGroupDeletes = rendergroupArray; - } - this._pendingBatchGroupDeletes[(IntPtr) this._pendingBatchGroupDeleteSlot] = group; - ++this._pendingBatchGroupDeleteSlot; - } - - private void ProcessPendingGroupDeletes(RENDERGROUP[] deleteList) - { - if (deleteList == null || this._handleTable == null) - return; - foreach (RENDERGROUP delete in deleteList) - { - if (delete != RENDERGROUP.NULL) - this._handleTable.FreeGroup(delete); - } - } - - private RenderPort.BatchSendInfo AllocBatchSendInfo() - { - RenderPort.BatchSendInfo batchSendInfo; - if (this._freeBatchSendInfos != null) - { - batchSendInfo = this._freeBatchSendInfos; - this._freeBatchSendInfos = batchSendInfo.next; - batchSendInfo.next = (RenderPort.BatchSendInfo) null; - --this._numFreeBatchSendInfos; - } - else - batchSendInfo = new RenderPort.BatchSendInfo(); - return batchSendInfo; - } - - private void FreeBatchSendInfo(RenderPort.BatchSendInfo info) - { - info.Reset(); - if (this._numFreeBatchSendInfos >= 25U) - return; - info.next = this._freeBatchSendInfos; - this._freeBatchSendInfos = info; - ++this._numFreeBatchSendInfos; - } - - private void EnqueuePendingBatch(RenderPort.BatchSendInfo info) - { - if (this._sentBatchesTail == null) - { - this._sentBatchesHead = info; - this._sentBatchesTail = info; - } - else - { - this._sentBatchesTail.next = info; - this._sentBatchesTail = info; - } - } - - private RenderPort.BatchSendInfo DequeuePendingBatch(uint batchID, bool fFreeInfo) - { - RenderPort.BatchSendInfo batchSendInfo = (RenderPort.BatchSendInfo) null; - RenderPort.BatchSendInfo info; - for (info = this._sentBatchesHead; info != null && (int) info.batchID != (int) batchID; info = info.next) - batchSendInfo = info; - if (info != null) - { - if (this._sentBatchesTail == info) - this._sentBatchesTail = batchSendInfo; - if (batchSendInfo == null) - this._sentBatchesHead = info.next; - else - batchSendInfo.next = info.next; - info.next = (RenderPort.BatchSendInfo) null; - if (fFreeInfo) + internal RENDERHANDLE InitRemoteClass(string className) { - this.FreeBatchSendInfo(info); - info = (RenderPort.BatchSendInfo) null; + if (className.Equals("Splash::Messaging::Broker")) + return this._rootHandle; + RENDERHANDLE idObjectClass = this.AllocHandle((IRenderHandleOwner)this); + RemoteBroker.SendCreateClass(this._protocolMessaging, className, idObjectClass); + return idObjectClass; + } + + internal unsafe void CreateRemoteObject( + RENDERHANDLE classCreate, + RENDERHANDLE hNewObject, + Message* pmsgConstructor) + { + RemoteBroker.SendCreateObject(this._protocolMessaging, classCreate, hNewObject, pmsgConstructor); + } + + internal unsafe void SendLocalCallbackMessage(Message* pmsgCallback) => Microsoft.Iris.Render.Protocols.Splash.Messaging.RemoteContext.SendForwardMessage(this._protocolMessaging, this._session.LocalContext, pmsgCallback); + + internal void LinkContext(ContextID idContextExisting, ContextID idContextAlias) => RemoteContextRelay.SendLinkContext(this._protocolMessaging, idContextExisting, idContextAlias); + + internal void UnlinkContext(ContextID idContextExisting, ContextID idContextAlias) => RemoteContextRelay.SendUnlinkContext(this._protocolMessaging, idContextExisting, idContextAlias); + + public void BeginMessageBatch(BatchCallback populateCallback) + { + this.Session.AssertOwningThread(); + Debug2.Throw(this._individualMessageMode, "Already in batch mode"); + this._batchPopulateCallback = populateCallback; + this._individualMessageMode = false; + } + + public void EndMessageBatch(BatchCallback deliveryCallback) + { + this.Session.AssertOwningThread(); + Debug2.Throw(!this._individualMessageMode, "Must be collecting a batch to end"); + this.SendCurrentBatch(deliveryCallback); + this._individualMessageMode = true; + } + + public unsafe void SendDataBuffer(void* pvData, uint cbSize, RENDERHANDLE idRemoteBuffer) + { + Debug2.Validate(idRemoteBuffer != RENDERHANDLE.NULL, typeof(ArgumentNullException), nameof(idRemoteBuffer)); + this.UpdateTraffic(0U, cbSize); + EngineApi.IFC(EngineApi.SpBufferOpen(&new EngineApi.BufferInfo() + { + idContextSrc = this._session.LocalContext, + idContextDest = this._idRemoteContext, + idBuffer = idRemoteBuffer, + nFlags = (EngineApi.BufferFlags)0, + cbSizeBuffer = cbSize + }, pvData)); + } + + public unsafe void SendBatchBuffer(void* pvData, uint cbSize, RENDERHANDLE idRemoteBuffer) + { + int num = idRemoteBuffer != RENDERHANDLE.NULL ? 1 : 0; + this.UpdateTraffic(cbSize, 0U); + EngineApi.IFC(EngineApi.SpBufferOpen(&new EngineApi.BufferInfo() + { + idContextSrc = this._session.LocalContext, + idContextDest = this._idRemoteContext, + idBuffer = idRemoteBuffer, + nFlags = EngineApi.BufferFlags.IsBatch, + cbSizeBuffer = cbSize + }, pvData)); + } + + public unsafe void SendMessageBuffer(Message* pmsg) + { + this.UpdateTraffic(pmsg->cbSize, 0U); + uint src = pmsg->cbSize; + if (this.ForeignByteOrder) + src = Memory.ConvertEndian(src); + EngineApi.IFC(EngineApi.SpBufferOpen(&new EngineApi.BufferInfo() + { + idContextSrc = this._session.LocalContext, + idContextDest = this._idRemoteContext, + idBuffer = RENDERHANDLE.NULL, + nFlags = EngineApi.BufferFlags.CopyData, + cbSizeBuffer = src + }, (void*)pmsg)); + } + + private void UpdateTraffic(uint uControl, uint uData) + { + this._uRecentControlTraffic += uControl; + this._uRecentDataTraffic += uData; + this._dtRecentTrafficTime = DateTime.UtcNow; + if (Debug2.IsCategoryEnabled(DebugCategory.Protocol, 1)) + { + if (this._fPendingTrafficSummary || !this.Session.IsConnected) + return; + this.Session.DeferredInvoke((Delegate)this._deferredTrafficUpdate, (object)null, DeferredInvokePriority.Idle, RenderPort.s_timeTrafficWindow); + this._fPendingTrafficSummary = true; + } + else + this.TrafficUpdateWorker(); + } + + private void DeferredTrafficUpdate(object obj) + { + if (!this._fPendingTrafficSummary) + return; + if (DateTime.UtcNow - this._dtRecentTrafficTime < RenderPort.s_timeTrafficWindow) + { + this.Session.DeferredInvoke((Delegate)this._deferredTrafficUpdate, (object)null, DeferredInvokePriority.Idle, this._dtRecentTrafficTime + RenderPort.s_timeTrafficWindow - DateTime.UtcNow); + } + else + { + this._fPendingTrafficSummary = false; + this.TrafficUpdateWorker(); + } + } + + private void TrafficUpdateWorker() + { + this._ulOverallControlTraffic += (ulong)this._uRecentControlTraffic; + this._ulOverallDataTraffic += (ulong)this._uRecentDataTraffic; + this._ulOverallTotalTraffic += (ulong)(this._uRecentControlTraffic + this._uRecentDataTraffic); + Debug2.IsCategoryEnabled(DebugCategory.Protocol, 1); + this._uRecentControlTraffic = 0U; + this._uRecentDataTraffic = 0U; + } + + public unsafe void* AllocMessageBuffer(uint size) + { + this.Session.AssertOwningThread(); + if (this._currentMessageHeap == null) + this._currentMessageHeap = this.AllocHeap(); + return this._currentMessageHeap.Alloc(size); + } + + public unsafe void SendRemoteMessage(Message* pmsg) + { + this.Session.AssertOwningThread(); + Debug2.Throw(this._channel != null, "Not connected to renderer"); + if (this._individualMessageMode) + { + this.SendMessageBuffer(pmsg); + if (this._currentMessageHeap == null) + return; + this._currentMessageHeap.Reset(); + } + else + this.StoreMessageEntry(pmsg); + } + + public RENDERHANDLE AllocHandle(IRenderHandleOwner owner) + { + Debug2.Throw(this._handleTable != null, "Render port has already shut down"); + Debug2.Validate(owner != null, typeof(ArgumentNullException), nameof(owner)); + return this._handleTable.Alloc(this._defaultGroupId, owner); + } + + public void RegisterKnownHandle(IRenderHandleOwner owner, RENDERHANDLE handle) + { + Debug2.Throw(this._handleTable != null, "Render port has already shut down"); + Debug2.Validate(owner != null, typeof(ArgumentNullException), nameof(owner)); + this._handleTable.AllocWithId(owner, handle, true); + } + + public void FreeHandle(RENDERHANDLE handle) + { + if (this.Session.IsOwningThread()) + { + if (this._handleTable == null) + return; + if (this._channel != null && this._handleTable.GetGroup(handle) == this._defaultGroupId) + { + this._handleTable.SetOwner(handle, (IRenderHandleOwner)null); + this.AddPendingDelete(handle); + RemoteBroker.SendDestroyObject(this._protocolMessaging, handle); + } + else + this._handleTable.Free(handle); + } + else + this.Session.DeferredInvoke((Delegate)this._deferredObjectReleaseWorker, (object)handle, DeferredInvokePriority.High); + } + + public void CancelAllocHandle(RENDERHANDLE handle) + { + if (this._handleTable == null) + return; + this._handleTable.Free(handle); + } + + public IRenderHandleOwner TryGetHandleOwner(RENDERHANDLE handle) => this._handleTable.GetOwner(handle, true); + + public IRenderHandleOwner TryGetProxyOwner(RENDERHANDLE handle) + { + IRenderHandleOwner renderHandleOwner = (IRenderHandleOwner)null; + if (this._groupProxies != null) + { + RENDERGROUP group = this._handleTable.GetGroup(handle); + if (group != RENDERGROUP.NULL) + renderHandleOwner = this.GetGroupProxy(group); + } + return renderHandleOwner; + } + + public IRenderHandleOwner GetHandleOwner(RENDERHANDLE handle) => this._handleTable.GetOwner(handle); + + public void ValidateHandle(RENDERHANDLE handle) => this._handleTable.Validate(handle); + + public void ValidateHandleOrNull(RENDERHANDLE handle) + { + if (!(handle != RENDERHANDLE.NULL)) + return; + this._handleTable.Validate(handle); + } + + public RENDERGROUP AllocHandleGroup() => this.AllocHandleGroup(true); + + public void AllocHandleGroupWithId(RENDERGROUP idGroup) => this._handleTable.AllocGroupWithId(idGroup); + + private RENDERGROUP AllocHandleGroup(bool failIfNotConnected) + { + RENDERGROUP handle = this._handleTable.AllocGroup(); + if (this._channel != null) + Microsoft.Iris.Render.Protocols.Splash.Messaging.RemoteContext.SendCreateGroup(this._protocolMessaging, (int)RENDERGROUP.ToUInt32(handle), this._session.LocalContext); + else if (failIfNotConnected) + Debug2.Throw(false, "Not connected to renderer"); + return handle; + } + + public void FreeHandleGroup(RENDERGROUP group) + { + if (this.Session.IsOwningThread()) + { + if (this._handleTable == null) + return; + if (this._channel != null) + { + this.AddPendingGroupDelete(group); + Microsoft.Iris.Render.Protocols.Splash.Messaging.RemoteContext.SendDestroyGroup(this._protocolMessaging, (int)RENDERGROUP.ToUInt32(group)); + } + else + this._handleTable.FreeGroup(group); + } + else + this.Session.DeferredInvoke((Delegate)this._deferredGroupReleaseWorker, (object)group, DeferredInvokePriority.High); + } + + public void RegisterGroupProxy(RENDERGROUP group, IRenderHandleOwner proxy) + { + if (this._groupProxies == null) + this._groupProxies = new Map(); + this._groupProxies[group] = new WeakReference((object)proxy); + } + + public void RevokeGroupProxy(RENDERGROUP group) + { + if (this._groupProxies == null) + return; + this._groupProxies[group] = (WeakReference)null; + } + + public IRenderHandleOwner GetGroupProxy(RENDERGROUP group) + { + IRenderHandleOwner renderHandleOwner = (IRenderHandleOwner)null; + if (this._groupProxies != null) + { + WeakReference groupProxy = this._groupProxies[group]; + if (groupProxy != null) + renderHandleOwner = groupProxy.Target as IRenderHandleOwner; + } + return renderHandleOwner; + } + + public MessageHeap AllocHeap() + { + this.Session.AssertOwningThread(); + return (MessageHeap)this._spareHeapCache.Pop(); + } + + public void ReleaseHeap(MessageHeap heap) + { + if (this.Session.IsOwningThread()) + this.DeferredHeapReleaseWorker((object)heap); + else if (this.Session.OwningThread != null) + this.Session.DeferredInvoke((Delegate)this._deferredHeapReleaseWorker, (object)heap, DeferredInvokePriority.High); + else + heap.Dispose(); + } + + private unsafe void StoreMessageEntry(Message* pMethodMsg) + { + MessageHeap.Block block = this._currentMessageHeap.LookupBlock((void*)pMethodMsg); + Debug2.Throw((IntPtr)block.data != IntPtr.Zero, "message should be in current message heap"); + uint num = (uint)((ulong)((sbyte*)pMethodMsg - (sbyte*)block.data) - (ulong)sizeof(MessageBatchEntry)); + if ((IntPtr)this._lastBatchEntry != IntPtr.Zero && (int)this._lastBatchBlockId == (int)block.id) + this._lastBatchEntry->uOffsetNextEntry = num; + else + ((MessageBatchHeader*)block.data)->uOffsetFirstEntry = num; + this._lastBatchEntry = (MessageBatchEntry*)((IntPtr)block.data + (int)num); + this._lastBatchBlockId = block.id; + ++this._uBatchedMessages; + BatchCallback populateCallback = this._batchPopulateCallback; + if (populateCallback == null) + return; + this._batchPopulateCallback = (BatchCallback)null; + populateCallback(); + } + + private unsafe void SendCurrentBatch(BatchCallback deliveryCallback) + { + try + { + if ((IntPtr)this._lastBatchEntry != IntPtr.Zero) + { + uint nextBatchId = this._nextBatchId; + ++this._nextBatchId; + try + { + LocalRenderPortCallback.AutoSendOnBatchProcessed(this._protocolMessaging, RENDERHANDLE.NULL, nextBatchId); + RenderPort.BatchSendInfo info = this.AllocBatchSendInfo(); + info.batchID = nextBatchId; + info.heap = this._currentMessageHeap; + info.pendingDeletes = this._pendingBatchDeletes; + info.pendingGroupDeletes = this._pendingBatchGroupDeletes; + info.deliveryCallback = deliveryCallback; + this.EnqueuePendingBatch(info); + RENDERHANDLE renderhandle = RENDERHANDLE.NULL; + int blockCount = this._currentMessageHeap.BlockCount; + uint num = 0; + MessageHeap.Enumerator enumerator = this._currentMessageHeap.GetEnumerator(); + while (enumerator.MoveNext()) + { + MessageHeap.Block current = enumerator.Current; + MessageBatchHeader* data = (MessageBatchHeader*)current.data; + RENDERHANDLE idRemoteBuffer = RENDERHANDLE.NULL; + --blockCount; + if (blockCount > 0) + idRemoteBuffer = this.AllocHandle((IRenderHandleOwner)this); + data->idPredicateBuffer = renderhandle; + if (this.ForeignByteOrder) + RenderPort.SwapBatchListByteOrder(data); + num += current.size; + this.SendBatchBuffer(current.data, current.size, idRemoteBuffer); + renderhandle = idRemoteBuffer; + } + this._currentMessageHeap = (MessageHeap)null; + this._pendingBatchDeletes = (RENDERHANDLE[])null; + this._pendingBatchDeleteSlot = 0U; + this._pendingBatchGroupDeletes = (RENDERGROUP[])null; + this._pendingBatchGroupDeleteSlot = 0U; + } + finally + { + if (this._currentMessageHeap != null) + { + this.DequeuePendingBatch(nextBatchId, true); + this.ReleaseHeap(this._currentMessageHeap); + this._currentMessageHeap = (MessageHeap)null; + } + } + } + else + { + if (this._currentMessageHeap != null) + { + this.ReleaseHeap(this._currentMessageHeap); + this._currentMessageHeap = (MessageHeap)null; + } + if (deliveryCallback == null) + return; + deliveryCallback(); + } + } + finally + { + this._currentMessageHeap = (MessageHeap)null; + this._batchPopulateCallback = (BatchCallback)null; + this._lastBatchEntry = (MessageBatchEntry*)null; + this._lastBatchBlockId = 0U; + this._uBatchedMessages = 0U; + } + } + + private static unsafe void SwapBatchListByteOrder(MessageBatchHeader* pHeader) + { + byte* pMem1 = (byte*)pHeader; + uint num = pHeader->uOffsetFirstEntry; + MarshalHelper.SwapByteOrder(pMem1, ref RenderPort.s_ByteOrder_MessageBatchHeader, typeof(MessageBatchHeader), 0, 0); + while (num != 0U) + { + byte* pMem2 = pMem1 + (int)num; + num = ((MessageBatchEntry*)pMem2)->uOffsetNextEntry; + MarshalHelper.SwapByteOrder(pMem2, ref RenderPort.s_ByteOrder_MessageBatchEntry, typeof(MessageBatchEntry), 0, 0); + } + } + + private void DeferredObjectReleaseWorker(object args) => this.FreeHandle((RENDERHANDLE)args); + + private void DeferredGroupReleaseWorker(object args) => this.FreeHandleGroup((RENDERGROUP)args); + + private void DeferredHeapReleaseWorker(object args) => this._spareHeapCache.Push((object)(MessageHeap)args); + + private object HeapCacheCallback(ObjectCache.Operation operation, object data) + { + this.Session.AssertOwningThread(); + MessageHeap key = data as MessageHeap; + switch (operation) + { + case ObjectCache.Operation.Alloc: + key = new MessageHeap(8U * Win32Api.GetSystemPageSize(), (uint)sizeof(MessageBatchHeader), (uint)sizeof(MessageBatchEntry)); + this._activeHeaps[key] = key; + break; + case ObjectCache.Operation.Free: + this._activeHeaps.Remove(key); + key.Dispose(); + key = (MessageHeap)null; + break; + case ObjectCache.Operation.Freeze: + Debug2.Validate(key != null, typeof(ArgumentNullException), nameof(data)); + key.Reset(); + break; + } + return (object)key; + } + + internal unsafe void ProcessMessageBuffer(EngineApi.BufferInfo* pBufferInfo, void* pvBufferData) + { + if (this.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)pvBufferData, ref RenderPort.s_ByteOrder_CallbackMessage, typeof(CallbackMessage), 0, 0); + CallbackMessage* message = (CallbackMessage*)pvBufferData; + this.DispatchCallbackMessage(RENDERHANDLE.ToUInt32(message->idObjectSubject), message); + } + + internal RENDERHANDLE RegisterCallback(PortCallback callback, out uint idCallback) + { + idCallback = (uint)this._callbackHandlers.Add((object)callback); + return RENDERHANDLE.FromUInt32(idCallback + 2U); + } + + private unsafe void DispatchCallbackMessage(uint idCallback, CallbackMessage* message) + { + idCallback -= 2U; + if (idCallback >= (uint)this._callbackHandlers.Count) + return; + PortCallback callbackHandler = (PortCallback)this._callbackHandlers[(int)idCallback]; + if (callbackHandler == null) + return; + IRenderHandleOwner owner = (IRenderHandleOwner)this; + if (message->hTarget != RENDERHANDLE.NULL) + { + if (this._handleTable == null) + return; + owner = this.TryGetHandleOwner(message->hTarget); + if (owner == null) + return; + } + callbackHandler(this, owner, message); + } + + void IRenderPortCallback.OnPingReply(RENDERHANDLE target) + { + if (this.PingReply == null) + return; + this.PingReply((object)this, EventArgs.Empty); + } + + void IRenderPortCallback.OnBatchProcessed( + RENDERHANDLE target, + uint uBatchCompleted) + { + RenderPort.BatchSendInfo info = this.DequeuePendingBatch(uBatchCompleted, false); + if (info == null) + return; + this.ProcessPendingDeletes(info.pendingDeletes); + this.ProcessPendingGroupDeletes(info.pendingGroupDeletes); + this.ReleaseHeap(info.heap); + if (info.deliveryCallback != null) + info.deliveryCallback(); + this.FreeBatchSendInfo(info); + } + + private void AddPendingDelete(RENDERHANDLE handle) + { + uint num1 = 0; + if (this._pendingBatchDeletes != null) + num1 = (uint)this._pendingBatchDeletes.Length; + if (this._pendingBatchDeleteSlot >= num1) + { + uint num2 = 2U * num1; + if (num2 == 0U) + num2 = 16U; + RENDERHANDLE[] renderhandleArray = new RENDERHANDLE[(IntPtr)num2]; + if (num1 > 0U) + Array.Copy((Array)this._pendingBatchDeletes, (Array)renderhandleArray, this._pendingBatchDeletes.Length); + this._pendingBatchDeletes = renderhandleArray; + } + this._pendingBatchDeletes[(IntPtr)this._pendingBatchDeleteSlot] = handle; + ++this._pendingBatchDeleteSlot; + } + + private void ProcessPendingDeletes(RENDERHANDLE[] deleteList) + { + if (deleteList == null || this._handleTable == null) + return; + foreach (RENDERHANDLE delete in deleteList) + { + if (delete != RENDERHANDLE.NULL) + this._handleTable.Free(delete); + } + } + + private void AddPendingGroupDelete(RENDERGROUP group) + { + uint num1 = 0; + if (this._pendingBatchGroupDeletes != null) + num1 = (uint)this._pendingBatchGroupDeletes.Length; + if (this._pendingBatchGroupDeleteSlot >= num1) + { + uint num2 = 2U * num1; + if (num2 == 0U) + num2 = 16U; + RENDERGROUP[] rendergroupArray = new RENDERGROUP[(IntPtr)num2]; + if (num1 > 0U) + Array.Copy((Array)this._pendingBatchGroupDeletes, (Array)rendergroupArray, this._pendingBatchGroupDeletes.Length); + this._pendingBatchGroupDeletes = rendergroupArray; + } + this._pendingBatchGroupDeletes[(IntPtr)this._pendingBatchGroupDeleteSlot] = group; + ++this._pendingBatchGroupDeleteSlot; + } + + private void ProcessPendingGroupDeletes(RENDERGROUP[] deleteList) + { + if (deleteList == null || this._handleTable == null) + return; + foreach (RENDERGROUP delete in deleteList) + { + if (delete != RENDERGROUP.NULL) + this._handleTable.FreeGroup(delete); + } + } + + private RenderPort.BatchSendInfo AllocBatchSendInfo() + { + RenderPort.BatchSendInfo batchSendInfo; + if (this._freeBatchSendInfos != null) + { + batchSendInfo = this._freeBatchSendInfos; + this._freeBatchSendInfos = batchSendInfo.next; + batchSendInfo.next = (RenderPort.BatchSendInfo)null; + --this._numFreeBatchSendInfos; + } + else + batchSendInfo = new RenderPort.BatchSendInfo(); + return batchSendInfo; + } + + private void FreeBatchSendInfo(RenderPort.BatchSendInfo info) + { + info.Reset(); + if (this._numFreeBatchSendInfos >= 25U) + return; + info.next = this._freeBatchSendInfos; + this._freeBatchSendInfos = info; + ++this._numFreeBatchSendInfos; + } + + private void EnqueuePendingBatch(RenderPort.BatchSendInfo info) + { + if (this._sentBatchesTail == null) + { + this._sentBatchesHead = info; + this._sentBatchesTail = info; + } + else + { + this._sentBatchesTail.next = info; + this._sentBatchesTail = info; + } + } + + private RenderPort.BatchSendInfo DequeuePendingBatch(uint batchID, bool fFreeInfo) + { + RenderPort.BatchSendInfo batchSendInfo = (RenderPort.BatchSendInfo)null; + RenderPort.BatchSendInfo info; + for (info = this._sentBatchesHead; info != null && (int)info.batchID != (int)batchID; info = info.next) + batchSendInfo = info; + if (info != null) + { + if (this._sentBatchesTail == info) + this._sentBatchesTail = batchSendInfo; + if (batchSendInfo == null) + this._sentBatchesHead = info.next; + else + batchSendInfo.next = info.next; + info.next = (RenderPort.BatchSendInfo)null; + if (fFreeInfo) + { + this.FreeBatchSendInfo(info); + info = (RenderPort.BatchSendInfo)null; + } + } + return info; + } + + public static object SyncLock => RenderPort.s_SyncLock; + + private class BatchSendInfo + { + public uint batchID; + public MessageHeap heap; + public RENDERHANDLE[] pendingDeletes; + public RENDERGROUP[] pendingGroupDeletes; + public BatchCallback deliveryCallback; + public RenderPort.BatchSendInfo next; + + public void Reset() + { + this.batchID = 0U; + this.heap = (MessageHeap)null; + this.pendingDeletes = (RENDERHANDLE[])null; + this.pendingGroupDeletes = (RENDERGROUP[])null; + this.deliveryCallback = (BatchCallback)null; + this.next = (RenderPort.BatchSendInfo)null; + } } - } - return info; } - - public static object SyncLock => RenderPort.s_SyncLock; - - private class BatchSendInfo - { - public uint batchID; - public MessageHeap heap; - public RENDERHANDLE[] pendingDeletes; - public RENDERGROUP[] pendingGroupDeletes; - public BatchCallback deliveryCallback; - public RenderPort.BatchSendInfo next; - - public void Reset() - { - this.batchID = 0U; - this.heap = (MessageHeap) null; - this.pendingDeletes = (RENDERHANDLE[]) null; - this.pendingGroupDeletes = (RENDERGROUP[]) null; - this.deliveryCallback = (BatchCallback) null; - this.next = (RenderPort.BatchSendInfo) null; - } - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ShutdownReason.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ShutdownReason.cs index b31f485..801f816 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ShutdownReason.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/ShutdownReason.cs @@ -6,13 +6,13 @@ namespace Microsoft.Iris.Render.Protocol { - internal enum ShutdownReason - { - NoReason, - SelfShutdown, - PeerShutdown, - TransportClosed, - TransportFailure, - GenericFailure, - } + internal enum ShutdownReason + { + NoReason, + SelfShutdown, + PeerShutdown, + TransportClosed, + TransportFailure, + GenericFailure, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/TimeoutHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/TimeoutHandler.cs index a00a4b3..f8954c3 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/TimeoutHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/TimeoutHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render.Protocol { - internal delegate void TimeoutHandler(); + internal delegate void TimeoutHandler(); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/TransportProtocol.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/TransportProtocol.cs index 11fc86c..6da2ad6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/TransportProtocol.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocol/TransportProtocol.cs @@ -6,14 +6,14 @@ namespace Microsoft.Iris.Render.Protocol { - internal enum TransportProtocol - { - None = 0, - Min = 1, - VC = 1, - TCP = 2, - UDP = 3, - Max = 4, - PIPE = 4, - } + internal enum TransportProtocol + { + None = 0, + Min = 1, + VC = 1, + TCP = 2, + UDP = 3, + Max = 4, + PIPE = 4, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/IFormWindowCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/IFormWindowCallback.cs index 49eb71d..3167940 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/IFormWindowCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/IFormWindowCallback.cs @@ -9,38 +9,38 @@ using System; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop { - internal interface IFormWindowCallback - { - void OnRendererSuspended(RENDERHANDLE target, bool fEnabled); + internal interface IFormWindowCallback + { + void OnRendererSuspended(RENDERHANDLE target, bool fEnabled); - void OnNativeScreensave(RENDERHANDLE target, bool fStartScreensave); + void OnNativeScreensave(RENDERHANDLE target, bool fStartScreensave); - void OnShellShutdownHook(RENDERHANDLE target, ushort uIdMsg); + void OnShellShutdownHook(RENDERHANDLE target, ushort uIdMsg); - void OnSetFocus(RENDERHANDLE target, bool focused, HWND hwndFocusChange); + void OnSetFocus(RENDERHANDLE target, bool focused, HWND hwndFocusChange); - void OnDropComplete(RENDERHANDLE target); + void OnDropComplete(RENDERHANDLE target); - void OnPartialDrop(RENDERHANDLE target, string file); + void OnPartialDrop(RENDERHANDLE target, string file); - unsafe void OnStateChange(RENDERHANDLE target, Message* stateInfo); + unsafe void OnStateChange(RENDERHANDLE target, Message* stateInfo); - void OnTerminalSessionChange(RENDERHANDLE target, IntPtr wParam, IntPtr lParam); + void OnTerminalSessionChange(RENDERHANDLE target, IntPtr wParam, IntPtr lParam); - void OnPrivateSysCommand(RENDERHANDLE target, IntPtr wParam, IntPtr lParam); + void OnPrivateSysCommand(RENDERHANDLE target, IntPtr wParam, IntPtr lParam); - void OnMouseIdle(RENDERHANDLE target, bool fNewIdle); + void OnMouseIdle(RENDERHANDLE target, bool fNewIdle); - void OnCloseRequested(RENDERHANDLE target); + void OnCloseRequested(RENDERHANDLE target); - void OnLoad(RENDERHANDLE target); + void OnLoad(RENDERHANDLE target); - void OnWindowDestroyed( - RENDERHANDLE target, - uint nFinalShow, - Rectangle rcLastPosition, - Point ptFinalMaxPosition); + void OnWindowDestroyed( + RENDERHANDLE target, + uint nFinalShow, + Rectangle rcLastPosition, + Point ptFinalMaxPosition); - void OnWindowCreated(RENDERHANDLE target, HWND m_hWnd); - } + void OnWindowCreated(RENDERHANDLE target, HWND m_hWnd); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/IInputCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/IInputCallback.cs index 93e203a..3e469b0 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/IInputCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/IInputCallback.cs @@ -8,8 +8,8 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop { - internal interface IInputCallback - { - unsafe void OnInput(RENDERHANDLE target, Message* inputInfo); - } + internal interface IInputCallback + { + unsafe void OnInput(RENDERHANDLE target, Message* inputInfo); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/LocalFormWindowCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/LocalFormWindowCallback.cs index c1dd68e..6b916fb 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/LocalFormWindowCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/LocalFormWindowCallback.cs @@ -11,410 +11,410 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop { - internal class LocalFormWindowCallback : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_OnRendererSuspended; - private static ushort[] s_priv_ByteOrder_Msg1_OnNativeScreensave; - private static ushort[] s_priv_ByteOrder_Msg2_OnShellShutdownHook; - private static ushort[] s_priv_ByteOrder_Msg4_OnDropComplete; - private static ushort[] s_priv_ByteOrder_Msg5_OnPartialDrop; - private static ushort[] s_priv_ByteOrder_Msg6_OnStateChange; - private static ushort[] s_priv_ByteOrder_Msg7_OnTerminalSessionChange; - private static ushort[] s_priv_ByteOrder_Msg8_OnPrivateSysCommand; - private static ushort[] s_priv_ByteOrder_Msg9_OnMouseIdle; - private static ushort[] s_priv_ByteOrder_Msg10_OnCloseRequested; - private static ushort[] s_priv_ByteOrder_Msg11_OnLoad; - private static ushort[] s_priv_ByteOrder_Msg12_OnWindowDestroyed; - - protected LocalFormWindowCallback() + internal class LocalFormWindowCallback : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_OnRendererSuspended; + private static ushort[] s_priv_ByteOrder_Msg1_OnNativeScreensave; + private static ushort[] s_priv_ByteOrder_Msg2_OnShellShutdownHook; + private static ushort[] s_priv_ByteOrder_Msg4_OnDropComplete; + private static ushort[] s_priv_ByteOrder_Msg5_OnPartialDrop; + private static ushort[] s_priv_ByteOrder_Msg6_OnStateChange; + private static ushort[] s_priv_ByteOrder_Msg7_OnTerminalSessionChange; + private static ushort[] s_priv_ByteOrder_Msg8_OnPrivateSysCommand; + private static ushort[] s_priv_ByteOrder_Msg9_OnMouseIdle; + private static ushort[] s_priv_ByteOrder_Msg10_OnCloseRequested; + private static ushort[] s_priv_ByteOrder_Msg11_OnLoad; + private static ushort[] s_priv_ByteOrder_Msg12_OnWindowDestroyed; + + protected LocalFormWindowCallback() + { + } + + internal static LocalFormWindowCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalFormWindowCallback(port, callbackInstance); + } + + protected LocalFormWindowCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalFormWindowCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalFormWindowCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is IFormWindowCallback _priv_target)) + return; + switch (message->nMsg) + { + case 0: + LocalFormWindowCallback.Dispatch_OnRendererSuspended(port, _priv_target, (LocalFormWindowCallback.Msg0_OnRendererSuspended*)message); + break; + case 1: + LocalFormWindowCallback.Dispatch_OnNativeScreensave(port, _priv_target, (LocalFormWindowCallback.Msg1_OnNativeScreensave*)message); + break; + case 2: + LocalFormWindowCallback.Dispatch_OnShellShutdownHook(port, _priv_target, (LocalFormWindowCallback.Msg2_OnShellShutdownHook*)message); + break; + case 3: + LocalFormWindowCallback.Dispatch_OnSetFocus(port, _priv_target, (LocalFormWindowCallback.Msg3_OnSetFocus*)message); + break; + case 4: + LocalFormWindowCallback.Dispatch_OnDropComplete(port, _priv_target, (LocalFormWindowCallback.Msg4_OnDropComplete*)message); + break; + case 5: + LocalFormWindowCallback.Dispatch_OnPartialDrop(port, _priv_target, (LocalFormWindowCallback.Msg5_OnPartialDrop*)message); + break; + case 6: + LocalFormWindowCallback.Dispatch_OnStateChange(port, _priv_target, (LocalFormWindowCallback.Msg6_OnStateChange*)message); + break; + case 7: + LocalFormWindowCallback.Dispatch_OnTerminalSessionChange(port, _priv_target, (LocalFormWindowCallback.Msg7_OnTerminalSessionChange*)message); + break; + case 8: + LocalFormWindowCallback.Dispatch_OnPrivateSysCommand(port, _priv_target, (LocalFormWindowCallback.Msg8_OnPrivateSysCommand*)message); + break; + case 9: + LocalFormWindowCallback.Dispatch_OnMouseIdle(port, _priv_target, (LocalFormWindowCallback.Msg9_OnMouseIdle*)message); + break; + case 10: + LocalFormWindowCallback.Dispatch_OnCloseRequested(port, _priv_target, (LocalFormWindowCallback.Msg10_OnCloseRequested*)message); + break; + case 11: + LocalFormWindowCallback.Dispatch_OnLoad(port, _priv_target, (LocalFormWindowCallback.Msg11_OnLoad*)message); + break; + case 12: + LocalFormWindowCallback.Dispatch_OnWindowDestroyed(port, _priv_target, (LocalFormWindowCallback.Msg12_OnWindowDestroyed*)message); + break; + case 13: + LocalFormWindowCallback.Dispatch_OnWindowCreated(port, _priv_target, (LocalFormWindowCallback.Msg13_OnWindowCreated*)message); + break; + } + } + + private static unsafe void Dispatch_OnRendererSuspended( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg0_OnRendererSuspended* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg0_OnRendererSuspended, typeof(LocalFormWindowCallback.Msg0_OnRendererSuspended), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + bool fEnabled = _priv_pmsg->fEnabled != 0U; + _priv_target.OnRendererSuspended(target, fEnabled); + } + + private static unsafe void Dispatch_OnNativeScreensave( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg1_OnNativeScreensave* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg1_OnNativeScreensave, typeof(LocalFormWindowCallback.Msg1_OnNativeScreensave), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + bool fStartScreensave = _priv_pmsg->fStartScreensave != 0U; + _priv_target.OnNativeScreensave(target, fStartScreensave); + } + + private static unsafe void Dispatch_OnShellShutdownHook( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg2_OnShellShutdownHook* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg2_OnShellShutdownHook, typeof(LocalFormWindowCallback.Msg2_OnShellShutdownHook), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + ushort uIdMsg = _priv_pmsg->uIdMsg; + _priv_target.OnShellShutdownHook(target, uIdMsg); + } + + private static unsafe void Dispatch_OnSetFocus( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg3_OnSetFocus* _priv_pmsg) + { + RENDERHANDLE target = _priv_pmsg->target; + bool focused = _priv_pmsg->focused != 0U; + HWND hwndFocusChange = _priv_pmsg->hwndFocusChange; + _priv_target.OnSetFocus(target, focused, hwndFocusChange); + } + + private static unsafe void Dispatch_OnDropComplete( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg4_OnDropComplete* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg4_OnDropComplete, typeof(LocalFormWindowCallback.Msg4_OnDropComplete), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnDropComplete(target); + } + + private static unsafe void Dispatch_OnPartialDrop( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg5_OnPartialDrop* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg5_OnPartialDrop, typeof(LocalFormWindowCallback.Msg5_OnPartialDrop), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + string file; + MarshalHelper.Decode(_priv_port, (Message*)_priv_pmsg, _priv_pmsg->file, out file); + _priv_target.OnPartialDrop(target, file); + } + + private static unsafe void Dispatch_OnStateChange( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg6_OnStateChange* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg6_OnStateChange, typeof(LocalFormWindowCallback.Msg6_OnStateChange), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + Message* pmsgInner; + MarshalHelper.Decode(_priv_port, (Message*)_priv_pmsg, _priv_pmsg->stateInfo, out pmsgInner); + _priv_target.OnStateChange(target, pmsgInner); + } + + private static unsafe void Dispatch_OnTerminalSessionChange( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg7_OnTerminalSessionChange* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg7_OnTerminalSessionChange, typeof(LocalFormWindowCallback.Msg7_OnTerminalSessionChange), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + IntPtr wParam = _priv_pmsg->wParam; + IntPtr lParam = _priv_pmsg->lParam; + _priv_target.OnTerminalSessionChange(target, wParam, lParam); + } + + private static unsafe void Dispatch_OnPrivateSysCommand( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg8_OnPrivateSysCommand* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg8_OnPrivateSysCommand, typeof(LocalFormWindowCallback.Msg8_OnPrivateSysCommand), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + IntPtr wParam = _priv_pmsg->wParam; + IntPtr lParam = _priv_pmsg->lParam; + _priv_target.OnPrivateSysCommand(target, wParam, lParam); + } + + private static unsafe void Dispatch_OnMouseIdle( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg9_OnMouseIdle* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg9_OnMouseIdle, typeof(LocalFormWindowCallback.Msg9_OnMouseIdle), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + bool fNewIdle = _priv_pmsg->fNewIdle != 0U; + _priv_target.OnMouseIdle(target, fNewIdle); + } + + private static unsafe void Dispatch_OnCloseRequested( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg10_OnCloseRequested* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg10_OnCloseRequested, typeof(LocalFormWindowCallback.Msg10_OnCloseRequested), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnCloseRequested(target); + } + + private static unsafe void Dispatch_OnLoad( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg11_OnLoad* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg11_OnLoad, typeof(LocalFormWindowCallback.Msg11_OnLoad), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnLoad(target); + } + + private static unsafe void Dispatch_OnWindowDestroyed( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg12_OnWindowDestroyed* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg12_OnWindowDestroyed, typeof(LocalFormWindowCallback.Msg12_OnWindowDestroyed), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + uint nFinalShow = _priv_pmsg->nFinalShow; + Rectangle rcLastPosition = _priv_pmsg->rcLastPosition; + Point finalMaxPosition = _priv_pmsg->ptFinalMaxPosition; + _priv_target.OnWindowDestroyed(target, nFinalShow, rcLastPosition, finalMaxPosition); + } + + private static unsafe void Dispatch_OnWindowCreated( + RenderPort _priv_port, + IFormWindowCallback _priv_target, + LocalFormWindowCallback.Msg13_OnWindowCreated* _priv_pmsg) + { + RENDERHANDLE target = _priv_pmsg->target; + HWND hWnd = _priv_pmsg->m_hWnd; + _priv_target.OnWindowCreated(target, hWnd); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_OnRendererSuspended + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint fEnabled; + } + + [ComVisible(false)] + private struct Msg1_OnNativeScreensave + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint fStartScreensave; + } + + [ComVisible(false)] + private struct Msg2_OnShellShutdownHook + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public ushort uIdMsg; + } + + [ComVisible(false)] + private struct Msg3_OnSetFocus + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint focused; + public HWND hwndFocusChange; + } + + [ComVisible(false)] + private struct Msg4_OnDropComplete + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } + + [ComVisible(false)] + private struct Msg5_OnPartialDrop + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public BLOBREF file; + } + + [ComVisible(false)] + private struct Msg6_OnStateChange + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public BLOBREF stateInfo; + } + + [ComVisible(false)] + private struct Msg7_OnTerminalSessionChange + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public IntPtr wParam; + public IntPtr lParam; + } + + [ComVisible(false)] + private struct Msg8_OnPrivateSysCommand + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public IntPtr wParam; + public IntPtr lParam; + } + + [ComVisible(false)] + private struct Msg9_OnMouseIdle + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint fNewIdle; + } + + [ComVisible(false)] + private struct Msg10_OnCloseRequested + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } + + [ComVisible(false)] + private struct Msg11_OnLoad + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } + + [ComVisible(false)] + private struct Msg12_OnWindowDestroyed + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint nFinalShow; + public Rectangle rcLastPosition; + public Point ptFinalMaxPosition; + } + + [ComVisible(false)] + private struct Msg13_OnWindowCreated + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public HWND m_hWnd; + } } - - internal static LocalFormWindowCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalFormWindowCallback(port, callbackInstance); - } - - protected LocalFormWindowCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalFormWindowCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalFormWindowCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is IFormWindowCallback _priv_target)) - return; - switch (message->nMsg) - { - case 0: - LocalFormWindowCallback.Dispatch_OnRendererSuspended(port, _priv_target, (LocalFormWindowCallback.Msg0_OnRendererSuspended*) message); - break; - case 1: - LocalFormWindowCallback.Dispatch_OnNativeScreensave(port, _priv_target, (LocalFormWindowCallback.Msg1_OnNativeScreensave*) message); - break; - case 2: - LocalFormWindowCallback.Dispatch_OnShellShutdownHook(port, _priv_target, (LocalFormWindowCallback.Msg2_OnShellShutdownHook*) message); - break; - case 3: - LocalFormWindowCallback.Dispatch_OnSetFocus(port, _priv_target, (LocalFormWindowCallback.Msg3_OnSetFocus*) message); - break; - case 4: - LocalFormWindowCallback.Dispatch_OnDropComplete(port, _priv_target, (LocalFormWindowCallback.Msg4_OnDropComplete*) message); - break; - case 5: - LocalFormWindowCallback.Dispatch_OnPartialDrop(port, _priv_target, (LocalFormWindowCallback.Msg5_OnPartialDrop*) message); - break; - case 6: - LocalFormWindowCallback.Dispatch_OnStateChange(port, _priv_target, (LocalFormWindowCallback.Msg6_OnStateChange*) message); - break; - case 7: - LocalFormWindowCallback.Dispatch_OnTerminalSessionChange(port, _priv_target, (LocalFormWindowCallback.Msg7_OnTerminalSessionChange*) message); - break; - case 8: - LocalFormWindowCallback.Dispatch_OnPrivateSysCommand(port, _priv_target, (LocalFormWindowCallback.Msg8_OnPrivateSysCommand*) message); - break; - case 9: - LocalFormWindowCallback.Dispatch_OnMouseIdle(port, _priv_target, (LocalFormWindowCallback.Msg9_OnMouseIdle*) message); - break; - case 10: - LocalFormWindowCallback.Dispatch_OnCloseRequested(port, _priv_target, (LocalFormWindowCallback.Msg10_OnCloseRequested*) message); - break; - case 11: - LocalFormWindowCallback.Dispatch_OnLoad(port, _priv_target, (LocalFormWindowCallback.Msg11_OnLoad*) message); - break; - case 12: - LocalFormWindowCallback.Dispatch_OnWindowDestroyed(port, _priv_target, (LocalFormWindowCallback.Msg12_OnWindowDestroyed*) message); - break; - case 13: - LocalFormWindowCallback.Dispatch_OnWindowCreated(port, _priv_target, (LocalFormWindowCallback.Msg13_OnWindowCreated*) message); - break; - } - } - - private static unsafe void Dispatch_OnRendererSuspended( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg0_OnRendererSuspended* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg0_OnRendererSuspended, typeof (LocalFormWindowCallback.Msg0_OnRendererSuspended), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - bool fEnabled = _priv_pmsg->fEnabled != 0U; - _priv_target.OnRendererSuspended(target, fEnabled); - } - - private static unsafe void Dispatch_OnNativeScreensave( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg1_OnNativeScreensave* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg1_OnNativeScreensave, typeof (LocalFormWindowCallback.Msg1_OnNativeScreensave), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - bool fStartScreensave = _priv_pmsg->fStartScreensave != 0U; - _priv_target.OnNativeScreensave(target, fStartScreensave); - } - - private static unsafe void Dispatch_OnShellShutdownHook( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg2_OnShellShutdownHook* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg2_OnShellShutdownHook, typeof (LocalFormWindowCallback.Msg2_OnShellShutdownHook), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - ushort uIdMsg = _priv_pmsg->uIdMsg; - _priv_target.OnShellShutdownHook(target, uIdMsg); - } - - private static unsafe void Dispatch_OnSetFocus( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg3_OnSetFocus* _priv_pmsg) - { - RENDERHANDLE target = _priv_pmsg->target; - bool focused = _priv_pmsg->focused != 0U; - HWND hwndFocusChange = _priv_pmsg->hwndFocusChange; - _priv_target.OnSetFocus(target, focused, hwndFocusChange); - } - - private static unsafe void Dispatch_OnDropComplete( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg4_OnDropComplete* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg4_OnDropComplete, typeof (LocalFormWindowCallback.Msg4_OnDropComplete), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnDropComplete(target); - } - - private static unsafe void Dispatch_OnPartialDrop( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg5_OnPartialDrop* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg5_OnPartialDrop, typeof (LocalFormWindowCallback.Msg5_OnPartialDrop), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - string file; - MarshalHelper.Decode(_priv_port, (Message*) _priv_pmsg, _priv_pmsg->file, out file); - _priv_target.OnPartialDrop(target, file); - } - - private static unsafe void Dispatch_OnStateChange( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg6_OnStateChange* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg6_OnStateChange, typeof (LocalFormWindowCallback.Msg6_OnStateChange), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - Message* pmsgInner; - MarshalHelper.Decode(_priv_port, (Message*) _priv_pmsg, _priv_pmsg->stateInfo, out pmsgInner); - _priv_target.OnStateChange(target, pmsgInner); - } - - private static unsafe void Dispatch_OnTerminalSessionChange( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg7_OnTerminalSessionChange* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg7_OnTerminalSessionChange, typeof (LocalFormWindowCallback.Msg7_OnTerminalSessionChange), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - IntPtr wParam = _priv_pmsg->wParam; - IntPtr lParam = _priv_pmsg->lParam; - _priv_target.OnTerminalSessionChange(target, wParam, lParam); - } - - private static unsafe void Dispatch_OnPrivateSysCommand( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg8_OnPrivateSysCommand* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg8_OnPrivateSysCommand, typeof (LocalFormWindowCallback.Msg8_OnPrivateSysCommand), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - IntPtr wParam = _priv_pmsg->wParam; - IntPtr lParam = _priv_pmsg->lParam; - _priv_target.OnPrivateSysCommand(target, wParam, lParam); - } - - private static unsafe void Dispatch_OnMouseIdle( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg9_OnMouseIdle* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg9_OnMouseIdle, typeof (LocalFormWindowCallback.Msg9_OnMouseIdle), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - bool fNewIdle = _priv_pmsg->fNewIdle != 0U; - _priv_target.OnMouseIdle(target, fNewIdle); - } - - private static unsafe void Dispatch_OnCloseRequested( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg10_OnCloseRequested* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg10_OnCloseRequested, typeof (LocalFormWindowCallback.Msg10_OnCloseRequested), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnCloseRequested(target); - } - - private static unsafe void Dispatch_OnLoad( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg11_OnLoad* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg11_OnLoad, typeof (LocalFormWindowCallback.Msg11_OnLoad), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnLoad(target); - } - - private static unsafe void Dispatch_OnWindowDestroyed( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg12_OnWindowDestroyed* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalFormWindowCallback.s_priv_ByteOrder_Msg12_OnWindowDestroyed, typeof (LocalFormWindowCallback.Msg12_OnWindowDestroyed), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - uint nFinalShow = _priv_pmsg->nFinalShow; - Rectangle rcLastPosition = _priv_pmsg->rcLastPosition; - Point finalMaxPosition = _priv_pmsg->ptFinalMaxPosition; - _priv_target.OnWindowDestroyed(target, nFinalShow, rcLastPosition, finalMaxPosition); - } - - private static unsafe void Dispatch_OnWindowCreated( - RenderPort _priv_port, - IFormWindowCallback _priv_target, - LocalFormWindowCallback.Msg13_OnWindowCreated* _priv_pmsg) - { - RENDERHANDLE target = _priv_pmsg->target; - HWND hWnd = _priv_pmsg->m_hWnd; - _priv_target.OnWindowCreated(target, hWnd); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_OnRendererSuspended - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint fEnabled; - } - - [ComVisible(false)] - private struct Msg1_OnNativeScreensave - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint fStartScreensave; - } - - [ComVisible(false)] - private struct Msg2_OnShellShutdownHook - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public ushort uIdMsg; - } - - [ComVisible(false)] - private struct Msg3_OnSetFocus - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint focused; - public HWND hwndFocusChange; - } - - [ComVisible(false)] - private struct Msg4_OnDropComplete - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - - [ComVisible(false)] - private struct Msg5_OnPartialDrop - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public BLOBREF file; - } - - [ComVisible(false)] - private struct Msg6_OnStateChange - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public BLOBREF stateInfo; - } - - [ComVisible(false)] - private struct Msg7_OnTerminalSessionChange - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public IntPtr wParam; - public IntPtr lParam; - } - - [ComVisible(false)] - private struct Msg8_OnPrivateSysCommand - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public IntPtr wParam; - public IntPtr lParam; - } - - [ComVisible(false)] - private struct Msg9_OnMouseIdle - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint fNewIdle; - } - - [ComVisible(false)] - private struct Msg10_OnCloseRequested - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - - [ComVisible(false)] - private struct Msg11_OnLoad - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - - [ComVisible(false)] - private struct Msg12_OnWindowDestroyed - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint nFinalShow; - public Rectangle rcLastPosition; - public Point ptFinalMaxPosition; - } - - [ComVisible(false)] - private struct Msg13_OnWindowCreated - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public HWND m_hWnd; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/LocalInputCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/LocalInputCallback.cs index ed7f92b..1dc57ef 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/LocalInputCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/LocalInputCallback.cs @@ -10,68 +10,68 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop { - internal class LocalInputCallback : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_OnInput; - - protected LocalInputCallback() + internal class LocalInputCallback : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_OnInput; + + protected LocalInputCallback() + { + } + + internal static LocalInputCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalInputCallback(port, callbackInstance); + } + + protected LocalInputCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalInputCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalInputCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is IInputCallback _priv_target) || message->nMsg != 0U) + return; + LocalInputCallback.Dispatch_OnInput(port, _priv_target, (LocalInputCallback.Msg0_OnInput*)message); + } + + private static unsafe void Dispatch_OnInput( + RenderPort _priv_port, + IInputCallback _priv_target, + LocalInputCallback.Msg0_OnInput* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalInputCallback.s_priv_ByteOrder_Msg0_OnInput, typeof(LocalInputCallback.Msg0_OnInput), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + Message* pmsgInner; + MarshalHelper.Decode(_priv_port, (Message*)_priv_pmsg, _priv_pmsg->inputInfo, out pmsgInner); + _priv_target.OnInput(target, pmsgInner); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_OnInput + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public BLOBREF inputInfo; + } } - - internal static LocalInputCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalInputCallback(port, callbackInstance); - } - - protected LocalInputCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalInputCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalInputCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is IInputCallback _priv_target) || message->nMsg != 0U) - return; - LocalInputCallback.Dispatch_OnInput(port, _priv_target, (LocalInputCallback.Msg0_OnInput*) message); - } - - private static unsafe void Dispatch_OnInput( - RenderPort _priv_port, - IInputCallback _priv_target, - LocalInputCallback.Msg0_OnInput* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalInputCallback.s_priv_ByteOrder_Msg0_OnInput, typeof (LocalInputCallback.Msg0_OnInput), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - Message* pmsgInner; - MarshalHelper.Decode(_priv_port, (Message*) _priv_pmsg, _priv_pmsg->inputInfo, out pmsgInner); - _priv_target.OnInput(target, pmsgInner); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_OnInput - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public BLOBREF inputInfo; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/IDesktopManagerCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/IDesktopManagerCallback.cs index 0bb6f08..fc4643b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/IDesktopManagerCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/IDesktopManagerCallback.cs @@ -9,18 +9,18 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop.Nt { - internal interface IDesktopManagerCallback - { - void OnEndDisplayModes(RENDERHANDLE target); + internal interface IDesktopManagerCallback + { + void OnEndDisplayModes(RENDERHANDLE target); - void OnDisplayMode(RENDERHANDLE target, RenderDisplayMode mode, bool fSupported); + void OnDisplayMode(RENDERHANDLE target, RenderDisplayMode mode, bool fSupported); - void OnBeginDisplayModes(RENDERHANDLE target); + void OnBeginDisplayModes(RENDERHANDLE target); - void OnEndEnumMonitorInfo(RENDERHANDLE target); + void OnEndEnumMonitorInfo(RENDERHANDLE target); - unsafe void OnMonitorInfo(RENDERHANDLE target, Message* info); + unsafe void OnMonitorInfo(RENDERHANDLE target, Message* info); - void OnBeginEnumMonitorInfo(RENDERHANDLE target); - } + void OnBeginEnumMonitorInfo(RENDERHANDLE target); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/IHwndHostWindowCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/IHwndHostWindowCallback.cs index a4befe9..85df788 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/IHwndHostWindowCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/IHwndHostWindowCallback.cs @@ -8,8 +8,8 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop.Nt { - internal interface IHwndHostWindowCallback - { - void OnHandleChanged(RENDERHANDLE target, HWND m_hWnd); - } + internal interface IHwndHostWindowCallback + { + void OnHandleChanged(RENDERHANDLE target, HWND m_hWnd); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/LocalDesktopManagerCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/LocalDesktopManagerCallback.cs index ad7c980..96222b1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/LocalDesktopManagerCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/LocalDesktopManagerCallback.cs @@ -11,197 +11,197 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop.Nt { - internal class LocalDesktopManagerCallback : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_OnEndDisplayModes; - private static ushort[] s_priv_ByteOrder_Msg1_OnDisplayMode; - private static ushort[] s_priv_ByteOrder_Msg2_OnBeginDisplayModes; - private static ushort[] s_priv_ByteOrder_Msg3_OnEndEnumMonitorInfo; - private static ushort[] s_priv_ByteOrder_Msg4_OnMonitorInfo; - private static ushort[] s_priv_ByteOrder_Msg5_OnBeginEnumMonitorInfo; - - protected LocalDesktopManagerCallback() + internal class LocalDesktopManagerCallback : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_OnEndDisplayModes; + private static ushort[] s_priv_ByteOrder_Msg1_OnDisplayMode; + private static ushort[] s_priv_ByteOrder_Msg2_OnBeginDisplayModes; + private static ushort[] s_priv_ByteOrder_Msg3_OnEndEnumMonitorInfo; + private static ushort[] s_priv_ByteOrder_Msg4_OnMonitorInfo; + private static ushort[] s_priv_ByteOrder_Msg5_OnBeginEnumMonitorInfo; + + protected LocalDesktopManagerCallback() + { + } + + internal static LocalDesktopManagerCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalDesktopManagerCallback(port, callbackInstance); + } + + protected LocalDesktopManagerCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalDesktopManagerCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalDesktopManagerCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is IDesktopManagerCallback _priv_target)) + return; + switch (message->nMsg) + { + case 0: + LocalDesktopManagerCallback.Dispatch_OnEndDisplayModes(port, _priv_target, (LocalDesktopManagerCallback.Msg0_OnEndDisplayModes*)message); + break; + case 1: + LocalDesktopManagerCallback.Dispatch_OnDisplayMode(port, _priv_target, (LocalDesktopManagerCallback.Msg1_OnDisplayMode*)message); + break; + case 2: + LocalDesktopManagerCallback.Dispatch_OnBeginDisplayModes(port, _priv_target, (LocalDesktopManagerCallback.Msg2_OnBeginDisplayModes*)message); + break; + case 3: + LocalDesktopManagerCallback.Dispatch_OnEndEnumMonitorInfo(port, _priv_target, (LocalDesktopManagerCallback.Msg3_OnEndEnumMonitorInfo*)message); + break; + case 4: + LocalDesktopManagerCallback.Dispatch_OnMonitorInfo(port, _priv_target, (LocalDesktopManagerCallback.Msg4_OnMonitorInfo*)message); + break; + case 5: + LocalDesktopManagerCallback.Dispatch_OnBeginEnumMonitorInfo(port, _priv_target, (LocalDesktopManagerCallback.Msg5_OnBeginEnumMonitorInfo*)message); + break; + } + } + + private static unsafe void Dispatch_OnEndDisplayModes( + RenderPort _priv_port, + IDesktopManagerCallback _priv_target, + LocalDesktopManagerCallback.Msg0_OnEndDisplayModes* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg0_OnEndDisplayModes, typeof(LocalDesktopManagerCallback.Msg0_OnEndDisplayModes), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnEndDisplayModes(target); + } + + private static unsafe void Dispatch_OnDisplayMode( + RenderPort _priv_port, + IDesktopManagerCallback _priv_target, + LocalDesktopManagerCallback.Msg1_OnDisplayMode* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg1_OnDisplayMode, typeof(LocalDesktopManagerCallback.Msg1_OnDisplayMode), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + RenderDisplayMode mode = _priv_pmsg->mode; + bool fSupported = _priv_pmsg->fSupported != 0U; + _priv_target.OnDisplayMode(target, mode, fSupported); + } + + private static unsafe void Dispatch_OnBeginDisplayModes( + RenderPort _priv_port, + IDesktopManagerCallback _priv_target, + LocalDesktopManagerCallback.Msg2_OnBeginDisplayModes* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg2_OnBeginDisplayModes, typeof(LocalDesktopManagerCallback.Msg2_OnBeginDisplayModes), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnBeginDisplayModes(target); + } + + private static unsafe void Dispatch_OnEndEnumMonitorInfo( + RenderPort _priv_port, + IDesktopManagerCallback _priv_target, + LocalDesktopManagerCallback.Msg3_OnEndEnumMonitorInfo* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg3_OnEndEnumMonitorInfo, typeof(LocalDesktopManagerCallback.Msg3_OnEndEnumMonitorInfo), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnEndEnumMonitorInfo(target); + } + + private static unsafe void Dispatch_OnMonitorInfo( + RenderPort _priv_port, + IDesktopManagerCallback _priv_target, + LocalDesktopManagerCallback.Msg4_OnMonitorInfo* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg4_OnMonitorInfo, typeof(LocalDesktopManagerCallback.Msg4_OnMonitorInfo), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + Message* pmsgInner; + MarshalHelper.Decode(_priv_port, (Message*)_priv_pmsg, _priv_pmsg->info, out pmsgInner); + _priv_target.OnMonitorInfo(target, pmsgInner); + } + + private static unsafe void Dispatch_OnBeginEnumMonitorInfo( + RenderPort _priv_port, + IDesktopManagerCallback _priv_target, + LocalDesktopManagerCallback.Msg5_OnBeginEnumMonitorInfo* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg5_OnBeginEnumMonitorInfo, typeof(LocalDesktopManagerCallback.Msg5_OnBeginEnumMonitorInfo), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnBeginEnumMonitorInfo(target); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_OnEndDisplayModes + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } + + [ComVisible(false)] + private struct Msg1_OnDisplayMode + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public RenderDisplayMode mode; + public uint fSupported; + } + + [ComVisible(false)] + private struct Msg2_OnBeginDisplayModes + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } + + [ComVisible(false)] + private struct Msg3_OnEndEnumMonitorInfo + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } + + [ComVisible(false)] + private struct Msg4_OnMonitorInfo + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public BLOBREF info; + } + + [ComVisible(false)] + private struct Msg5_OnBeginEnumMonitorInfo + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } } - - internal static LocalDesktopManagerCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalDesktopManagerCallback(port, callbackInstance); - } - - protected LocalDesktopManagerCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalDesktopManagerCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalDesktopManagerCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is IDesktopManagerCallback _priv_target)) - return; - switch (message->nMsg) - { - case 0: - LocalDesktopManagerCallback.Dispatch_OnEndDisplayModes(port, _priv_target, (LocalDesktopManagerCallback.Msg0_OnEndDisplayModes*) message); - break; - case 1: - LocalDesktopManagerCallback.Dispatch_OnDisplayMode(port, _priv_target, (LocalDesktopManagerCallback.Msg1_OnDisplayMode*) message); - break; - case 2: - LocalDesktopManagerCallback.Dispatch_OnBeginDisplayModes(port, _priv_target, (LocalDesktopManagerCallback.Msg2_OnBeginDisplayModes*) message); - break; - case 3: - LocalDesktopManagerCallback.Dispatch_OnEndEnumMonitorInfo(port, _priv_target, (LocalDesktopManagerCallback.Msg3_OnEndEnumMonitorInfo*) message); - break; - case 4: - LocalDesktopManagerCallback.Dispatch_OnMonitorInfo(port, _priv_target, (LocalDesktopManagerCallback.Msg4_OnMonitorInfo*) message); - break; - case 5: - LocalDesktopManagerCallback.Dispatch_OnBeginEnumMonitorInfo(port, _priv_target, (LocalDesktopManagerCallback.Msg5_OnBeginEnumMonitorInfo*) message); - break; - } - } - - private static unsafe void Dispatch_OnEndDisplayModes( - RenderPort _priv_port, - IDesktopManagerCallback _priv_target, - LocalDesktopManagerCallback.Msg0_OnEndDisplayModes* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg0_OnEndDisplayModes, typeof (LocalDesktopManagerCallback.Msg0_OnEndDisplayModes), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnEndDisplayModes(target); - } - - private static unsafe void Dispatch_OnDisplayMode( - RenderPort _priv_port, - IDesktopManagerCallback _priv_target, - LocalDesktopManagerCallback.Msg1_OnDisplayMode* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg1_OnDisplayMode, typeof (LocalDesktopManagerCallback.Msg1_OnDisplayMode), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - RenderDisplayMode mode = _priv_pmsg->mode; - bool fSupported = _priv_pmsg->fSupported != 0U; - _priv_target.OnDisplayMode(target, mode, fSupported); - } - - private static unsafe void Dispatch_OnBeginDisplayModes( - RenderPort _priv_port, - IDesktopManagerCallback _priv_target, - LocalDesktopManagerCallback.Msg2_OnBeginDisplayModes* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg2_OnBeginDisplayModes, typeof (LocalDesktopManagerCallback.Msg2_OnBeginDisplayModes), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnBeginDisplayModes(target); - } - - private static unsafe void Dispatch_OnEndEnumMonitorInfo( - RenderPort _priv_port, - IDesktopManagerCallback _priv_target, - LocalDesktopManagerCallback.Msg3_OnEndEnumMonitorInfo* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg3_OnEndEnumMonitorInfo, typeof (LocalDesktopManagerCallback.Msg3_OnEndEnumMonitorInfo), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnEndEnumMonitorInfo(target); - } - - private static unsafe void Dispatch_OnMonitorInfo( - RenderPort _priv_port, - IDesktopManagerCallback _priv_target, - LocalDesktopManagerCallback.Msg4_OnMonitorInfo* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg4_OnMonitorInfo, typeof (LocalDesktopManagerCallback.Msg4_OnMonitorInfo), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - Message* pmsgInner; - MarshalHelper.Decode(_priv_port, (Message*) _priv_pmsg, _priv_pmsg->info, out pmsgInner); - _priv_target.OnMonitorInfo(target, pmsgInner); - } - - private static unsafe void Dispatch_OnBeginEnumMonitorInfo( - RenderPort _priv_port, - IDesktopManagerCallback _priv_target, - LocalDesktopManagerCallback.Msg5_OnBeginEnumMonitorInfo* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDesktopManagerCallback.s_priv_ByteOrder_Msg5_OnBeginEnumMonitorInfo, typeof (LocalDesktopManagerCallback.Msg5_OnBeginEnumMonitorInfo), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnBeginEnumMonitorInfo(target); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_OnEndDisplayModes - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - - [ComVisible(false)] - private struct Msg1_OnDisplayMode - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public RenderDisplayMode mode; - public uint fSupported; - } - - [ComVisible(false)] - private struct Msg2_OnBeginDisplayModes - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - - [ComVisible(false)] - private struct Msg3_OnEndEnumMonitorInfo - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - - [ComVisible(false)] - private struct Msg4_OnMonitorInfo - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public BLOBREF info; - } - - [ComVisible(false)] - private struct Msg5_OnBeginEnumMonitorInfo - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/LocalHwndHostWindowCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/LocalHwndHostWindowCallback.cs index c07c355..a23d798 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/LocalHwndHostWindowCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/LocalHwndHostWindowCallback.cs @@ -10,63 +10,63 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop.Nt { - internal class LocalHwndHostWindowCallback : RemoteObject - { - protected LocalHwndHostWindowCallback() + internal class LocalHwndHostWindowCallback : RemoteObject { + protected LocalHwndHostWindowCallback() + { + } + + internal static LocalHwndHostWindowCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalHwndHostWindowCallback(port, callbackInstance); + } + + protected LocalHwndHostWindowCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalHwndHostWindowCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalHwndHostWindowCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is IHwndHostWindowCallback _priv_target) || message->nMsg != 0U) + return; + LocalHwndHostWindowCallback.Dispatch_OnHandleChanged(port, _priv_target, (LocalHwndHostWindowCallback.Msg0_OnHandleChanged*)message); + } + + private static unsafe void Dispatch_OnHandleChanged( + RenderPort _priv_port, + IHwndHostWindowCallback _priv_target, + LocalHwndHostWindowCallback.Msg0_OnHandleChanged* _priv_pmsg) + { + RENDERHANDLE target = _priv_pmsg->target; + HWND hWnd = _priv_pmsg->m_hWnd; + _priv_target.OnHandleChanged(target, hWnd); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_OnHandleChanged + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public HWND m_hWnd; + } } - - internal static LocalHwndHostWindowCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalHwndHostWindowCallback(port, callbackInstance); - } - - protected LocalHwndHostWindowCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalHwndHostWindowCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalHwndHostWindowCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is IHwndHostWindowCallback _priv_target) || message->nMsg != 0U) - return; - LocalHwndHostWindowCallback.Dispatch_OnHandleChanged(port, _priv_target, (LocalHwndHostWindowCallback.Msg0_OnHandleChanged*) message); - } - - private static unsafe void Dispatch_OnHandleChanged( - RenderPort _priv_port, - IHwndHostWindowCallback _priv_target, - LocalHwndHostWindowCallback.Msg0_OnHandleChanged* _priv_pmsg) - { - RENDERHANDLE target = _priv_pmsg->target; - HWND hWnd = _priv_pmsg->m_hWnd; - _priv_target.OnHandleChanged(target, hWnd); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_OnHandleChanged - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public HWND m_hWnd; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/ProtocolSplashDesktopNt.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/ProtocolSplashDesktopNt.cs index a1df995..40b4756 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/ProtocolSplashDesktopNt.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/ProtocolSplashDesktopNt.cs @@ -10,80 +10,80 @@ using System; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop.Nt { - internal sealed class ProtocolSplashDesktopNt : ProtocolInstance - { - private RENDERHANDLE _priv_remoteClass_FormWindow; - private RENDERHANDLE _priv_remoteClass_HwndHostWindow; - private RENDERHANDLE _priv_remoteClass_DesktopManager; - private RENDERHANDLE _priv_callbackInstance_HwndHostWindowCallback; - private RENDERHANDLE _priv_callbackInstance_DesktopManagerCallback; - - public static ProtocolSplashDesktopNt Bind(RenderPort port) + internal sealed class ProtocolSplashDesktopNt : ProtocolInstance { - Debug2.Validate(port != null, typeof (ArgumentNullException), nameof (port)); - ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Desktop::Nt"); - if (protocolInstance != null) - { - ProtocolSplashDesktopNt protocolSplashDesktopNt = protocolInstance as ProtocolSplashDesktopNt; - Debug2.Validate(protocolSplashDesktopNt != null, typeof (InvalidOperationException), "protocol name collision"); - return protocolSplashDesktopNt; - } - ProtocolSplashDesktopNt protocolSplashDesktopNt1 = new ProtocolSplashDesktopNt(port); - port.BindProtocol((ProtocolInstance) protocolSplashDesktopNt1); - return protocolSplashDesktopNt1; + private RENDERHANDLE _priv_remoteClass_FormWindow; + private RENDERHANDLE _priv_remoteClass_HwndHostWindow; + private RENDERHANDLE _priv_remoteClass_DesktopManager; + private RENDERHANDLE _priv_callbackInstance_HwndHostWindowCallback; + private RENDERHANDLE _priv_callbackInstance_DesktopManagerCallback; + + public static ProtocolSplashDesktopNt Bind(RenderPort port) + { + Debug2.Validate(port != null, typeof(ArgumentNullException), nameof(port)); + ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Desktop::Nt"); + if (protocolInstance != null) + { + ProtocolSplashDesktopNt protocolSplashDesktopNt = protocolInstance as ProtocolSplashDesktopNt; + Debug2.Validate(protocolSplashDesktopNt != null, typeof(InvalidOperationException), "protocol name collision"); + return protocolSplashDesktopNt; + } + ProtocolSplashDesktopNt protocolSplashDesktopNt1 = new ProtocolSplashDesktopNt(port); + port.BindProtocol((ProtocolInstance)protocolSplashDesktopNt1); + return protocolSplashDesktopNt1; + } + + public LocalHwndHostWindowCallback LocalHwndHostWindowCallbackHandle => LocalHwndHostWindowCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_HwndHostWindowCallback); + + public LocalDesktopManagerCallback LocalDesktopManagerCallbackHandle => LocalDesktopManagerCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_DesktopManagerCallback); + + private ProtocolSplashDesktopNt(RenderPort port) + : base(port, "Splash::Desktop::Nt") + { + } + + protected override void Init() + { + RenderPort port = this.Port; + this._priv_remoteClass_FormWindow = port.InitRemoteClass("Splash::Desktop::Nt::FormWindow"); + this._priv_remoteClass_HwndHostWindow = port.InitRemoteClass("Splash::Desktop::Nt::HwndHostWindow"); + this._priv_remoteClass_DesktopManager = port.InitRemoteClass("Splash::Desktop::Nt::DesktopManager"); + this._priv_callbackInstance_HwndHostWindowCallback = LocalHwndHostWindowCallback.BindCallback(port); + this._priv_callbackInstance_DesktopManagerCallback = LocalDesktopManagerCallback.BindCallback(port); + } + + internal RENDERHANDLE FormWindow_ClassHandle => this._priv_remoteClass_FormWindow; + + internal RENDERHANDLE HwndHostWindow_ClassHandle => this._priv_remoteClass_HwndHostWindow; + + internal RENDERHANDLE DesktopManager_ClassHandle => this._priv_remoteClass_DesktopManager; + + internal RENDERHANDLE HwndHostWindowCallback_CallbackInstance => this._priv_callbackInstance_HwndHostWindowCallback; + + internal RENDERHANDLE DesktopManagerCallback_CallbackInstance => this._priv_callbackInstance_DesktopManagerCallback; + + internal RemoteFormWindow BuildRemoteFormWindow( + IRenderHandleOwner _priv_owner, + RemoteDesktopManager manager, + LocalFormWindowCallback cb) + { + return RemoteFormWindow.Create(this, _priv_owner, manager, cb); + } + + internal RemoteHwndHostWindow BuildRemoteHwndHostWindow( + IRenderHandleOwner _priv_owner, + RemoteFormWindow winParent, + LocalHwndHostWindowCallback cb) + { + return RemoteHwndHostWindow.Create(this, _priv_owner, winParent, cb); + } + + internal RemoteDesktopManager BuildRemoteDesktopManager( + IRenderHandleOwner _priv_owner, + LocalDesktopManagerCallback cb, + bool fEnumDisplayModes) + { + return RemoteDesktopManager.Create(this, _priv_owner, cb, fEnumDisplayModes); + } } - - public LocalHwndHostWindowCallback LocalHwndHostWindowCallbackHandle => LocalHwndHostWindowCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_HwndHostWindowCallback); - - public LocalDesktopManagerCallback LocalDesktopManagerCallbackHandle => LocalDesktopManagerCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_DesktopManagerCallback); - - private ProtocolSplashDesktopNt(RenderPort port) - : base(port, "Splash::Desktop::Nt") - { - } - - protected override void Init() - { - RenderPort port = this.Port; - this._priv_remoteClass_FormWindow = port.InitRemoteClass("Splash::Desktop::Nt::FormWindow"); - this._priv_remoteClass_HwndHostWindow = port.InitRemoteClass("Splash::Desktop::Nt::HwndHostWindow"); - this._priv_remoteClass_DesktopManager = port.InitRemoteClass("Splash::Desktop::Nt::DesktopManager"); - this._priv_callbackInstance_HwndHostWindowCallback = LocalHwndHostWindowCallback.BindCallback(port); - this._priv_callbackInstance_DesktopManagerCallback = LocalDesktopManagerCallback.BindCallback(port); - } - - internal RENDERHANDLE FormWindow_ClassHandle => this._priv_remoteClass_FormWindow; - - internal RENDERHANDLE HwndHostWindow_ClassHandle => this._priv_remoteClass_HwndHostWindow; - - internal RENDERHANDLE DesktopManager_ClassHandle => this._priv_remoteClass_DesktopManager; - - internal RENDERHANDLE HwndHostWindowCallback_CallbackInstance => this._priv_callbackInstance_HwndHostWindowCallback; - - internal RENDERHANDLE DesktopManagerCallback_CallbackInstance => this._priv_callbackInstance_DesktopManagerCallback; - - internal RemoteFormWindow BuildRemoteFormWindow( - IRenderHandleOwner _priv_owner, - RemoteDesktopManager manager, - LocalFormWindowCallback cb) - { - return RemoteFormWindow.Create(this, _priv_owner, manager, cb); - } - - internal RemoteHwndHostWindow BuildRemoteHwndHostWindow( - IRenderHandleOwner _priv_owner, - RemoteFormWindow winParent, - LocalHwndHostWindowCallback cb) - { - return RemoteHwndHostWindow.Create(this, _priv_owner, winParent, cb); - } - - internal RemoteDesktopManager BuildRemoteDesktopManager( - IRenderHandleOwner _priv_owner, - LocalDesktopManagerCallback cb, - bool fEnumDisplayModes) - { - return RemoteDesktopManager.Create(this, _priv_owner, cb, fEnumDisplayModes); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteDesktopManager.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteDesktopManager.cs index 7452014..321cc0b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteDesktopManager.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteDesktopManager.cs @@ -11,158 +11,158 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop.Nt { - internal class RemoteDesktopManager : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg2_Create; - private static ushort[] s_priv_ByteOrder_Msg0_RebuildMonitorCache; - private static ushort[] s_priv_ByteOrder_Msg1_ChangeFullScreenMode; - - protected RemoteDesktopManager() + internal class RemoteDesktopManager : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg2_Create; + private static ushort[] s_priv_ByteOrder_Msg0_RebuildMonitorCache; + private static ushort[] s_priv_ByteOrder_Msg1_ChangeFullScreenMode; + + protected RemoteDesktopManager() + { + } + + public static unsafe RemoteDesktopManager Create( + ProtocolSplashDesktopNt _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + LocalDesktopManagerCallback cb, + bool fEnumDisplayModes) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE managerClassHandle = _priv_protocolInstance.DesktopManager_ClassHandle; + RemoteDesktopManager remoteDesktopManager = new RemoteDesktopManager(port, _priv_owner); + uint num = (uint)sizeof(RemoteDesktopManager.Msg2_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteDesktopManager.Msg2_Create* msg2CreatePtr = (RemoteDesktopManager.Msg2_Create*)pMem; + msg2CreatePtr->_priv_size = num; + msg2CreatePtr->_priv_msgid = 2U; + msg2CreatePtr->_priv_objcb = cb.RenderHandle; + msg2CreatePtr->_priv_ctxcb = port.Session.LocalContext; + msg2CreatePtr->fEnumDisplayModes = fEnumDisplayModes ? uint.MaxValue : 0U; + msg2CreatePtr->_priv_idObjectSubject = remoteDesktopManager.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteDesktopManager.s_priv_ByteOrder_Msg2_Create, typeof(RemoteDesktopManager.Msg2_Create), 0, 0); + port.CreateRemoteObject(managerClassHandle, remoteDesktopManager.m_renderHandle, (Message*)msg2CreatePtr); + return remoteDesktopManager; + } + + public unsafe void BuildRebuildMonitorCache( + 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(RemoteDesktopManager.Msg0_RebuildMonitorCache); + RemoteDesktopManager.Msg0_RebuildMonitorCache* rebuildMonitorCachePtr = (RemoteDesktopManager.Msg0_RebuildMonitorCache*)_priv_portUse.AllocMessageBuffer(size); + rebuildMonitorCachePtr->_priv_size = size; + rebuildMonitorCachePtr->_priv_msgid = 0U; + rebuildMonitorCachePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)rebuildMonitorCachePtr, ref RemoteDesktopManager.s_priv_ByteOrder_Msg0_RebuildMonitorCache, typeof(RemoteDesktopManager.Msg0_RebuildMonitorCache), 0, 0); + _priv_pmsgUse = (Message*)rebuildMonitorCachePtr; + } + + public unsafe void SendRebuildMonitorCache() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRebuildMonitorCache(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildChangeFullScreenMode( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint idDisplay, + RenderDisplayMode mode, + bool fTvMode) + { + 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(RemoteDesktopManager.Msg1_ChangeFullScreenMode); + RemoteDesktopManager.Msg1_ChangeFullScreenMode* changeFullScreenModePtr = (RemoteDesktopManager.Msg1_ChangeFullScreenMode*)_priv_portUse.AllocMessageBuffer(size); + changeFullScreenModePtr->_priv_size = size; + changeFullScreenModePtr->_priv_msgid = 1U; + changeFullScreenModePtr->idDisplay = idDisplay; + changeFullScreenModePtr->mode = mode; + changeFullScreenModePtr->fTvMode = fTvMode ? uint.MaxValue : 0U; + changeFullScreenModePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)changeFullScreenModePtr, ref RemoteDesktopManager.s_priv_ByteOrder_Msg1_ChangeFullScreenMode, typeof(RemoteDesktopManager.Msg1_ChangeFullScreenMode), 0, 0); + _priv_pmsgUse = (Message*)changeFullScreenModePtr; + } + + public unsafe void SendChangeFullScreenMode( + uint idDisplay, + RenderDisplayMode mode, + bool fTvMode) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildChangeFullScreenMode(out _priv_portUse, out _priv_pmsgUse, idDisplay, mode, fTvMode); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteDesktopManager CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteDesktopManager(port, handle, true); + } + + public static RemoteDesktopManager CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteDesktopManager(port, handle, false); + } + + protected RemoteDesktopManager(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteDesktopManager(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteDesktopManager && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg2_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + public uint fEnumDisplayModes; + } + + [ComVisible(false)] + private struct Msg0_RebuildMonitorCache + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg1_ChangeFullScreenMode + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint idDisplay; + public RenderDisplayMode mode; + public uint fTvMode; + } } - - public static unsafe RemoteDesktopManager Create( - ProtocolSplashDesktopNt _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - LocalDesktopManagerCallback cb, - bool fEnumDisplayModes) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE managerClassHandle = _priv_protocolInstance.DesktopManager_ClassHandle; - RemoteDesktopManager remoteDesktopManager = new RemoteDesktopManager(port, _priv_owner); - uint num = (uint) sizeof (RemoteDesktopManager.Msg2_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteDesktopManager.Msg2_Create* msg2CreatePtr = (RemoteDesktopManager.Msg2_Create*) pMem; - msg2CreatePtr->_priv_size = num; - msg2CreatePtr->_priv_msgid = 2U; - msg2CreatePtr->_priv_objcb = cb.RenderHandle; - msg2CreatePtr->_priv_ctxcb = port.Session.LocalContext; - msg2CreatePtr->fEnumDisplayModes = fEnumDisplayModes ? uint.MaxValue : 0U; - msg2CreatePtr->_priv_idObjectSubject = remoteDesktopManager.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteDesktopManager.s_priv_ByteOrder_Msg2_Create, typeof (RemoteDesktopManager.Msg2_Create), 0, 0); - port.CreateRemoteObject(managerClassHandle, remoteDesktopManager.m_renderHandle, (Message*) msg2CreatePtr); - return remoteDesktopManager; - } - - public unsafe void BuildRebuildMonitorCache( - 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 (RemoteDesktopManager.Msg0_RebuildMonitorCache); - RemoteDesktopManager.Msg0_RebuildMonitorCache* rebuildMonitorCachePtr = (RemoteDesktopManager.Msg0_RebuildMonitorCache*) _priv_portUse.AllocMessageBuffer(size); - rebuildMonitorCachePtr->_priv_size = size; - rebuildMonitorCachePtr->_priv_msgid = 0U; - rebuildMonitorCachePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) rebuildMonitorCachePtr, ref RemoteDesktopManager.s_priv_ByteOrder_Msg0_RebuildMonitorCache, typeof (RemoteDesktopManager.Msg0_RebuildMonitorCache), 0, 0); - _priv_pmsgUse = (Message*) rebuildMonitorCachePtr; - } - - public unsafe void SendRebuildMonitorCache() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRebuildMonitorCache(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildChangeFullScreenMode( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint idDisplay, - RenderDisplayMode mode, - bool fTvMode) - { - 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 (RemoteDesktopManager.Msg1_ChangeFullScreenMode); - RemoteDesktopManager.Msg1_ChangeFullScreenMode* changeFullScreenModePtr = (RemoteDesktopManager.Msg1_ChangeFullScreenMode*) _priv_portUse.AllocMessageBuffer(size); - changeFullScreenModePtr->_priv_size = size; - changeFullScreenModePtr->_priv_msgid = 1U; - changeFullScreenModePtr->idDisplay = idDisplay; - changeFullScreenModePtr->mode = mode; - changeFullScreenModePtr->fTvMode = fTvMode ? uint.MaxValue : 0U; - changeFullScreenModePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) changeFullScreenModePtr, ref RemoteDesktopManager.s_priv_ByteOrder_Msg1_ChangeFullScreenMode, typeof (RemoteDesktopManager.Msg1_ChangeFullScreenMode), 0, 0); - _priv_pmsgUse = (Message*) changeFullScreenModePtr; - } - - public unsafe void SendChangeFullScreenMode( - uint idDisplay, - RenderDisplayMode mode, - bool fTvMode) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildChangeFullScreenMode(out _priv_portUse, out _priv_pmsgUse, idDisplay, mode, fTvMode); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteDesktopManager CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteDesktopManager(port, handle, true); - } - - public static RemoteDesktopManager CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteDesktopManager(port, handle, false); - } - - protected RemoteDesktopManager(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteDesktopManager(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteDesktopManager && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg2_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - public uint fEnumDisplayModes; - } - - [ComVisible(false)] - private struct Msg0_RebuildMonitorCache - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg1_ChangeFullScreenMode - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint idDisplay; - public RenderDisplayMode mode; - public uint fTvMode; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteFormWindow.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteFormWindow.cs index e6db4b5..0c8d038 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteFormWindow.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteFormWindow.cs @@ -9,78 +9,78 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop.Nt { - internal class RemoteFormWindow : RemoteFormWindowBase - { - private static ushort[] s_priv_ByteOrder_Msg41_Create; - - protected RemoteFormWindow() + internal class RemoteFormWindow : RemoteFormWindowBase { + private static ushort[] s_priv_ByteOrder_Msg41_Create; + + protected RemoteFormWindow() + { + } + + public static unsafe RemoteFormWindow Create( + ProtocolSplashDesktopNt _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + RemoteDesktopManager manager, + LocalFormWindowCallback cb) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE windowClassHandle = _priv_protocolInstance.FormWindow_ClassHandle; + RemoteFormWindow remoteFormWindow = new RemoteFormWindow(port, _priv_owner); + uint num = (uint)sizeof(RemoteFormWindow.Msg41_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteFormWindow.Msg41_Create* msg41CreatePtr = (RemoteFormWindow.Msg41_Create*)pMem; + msg41CreatePtr->_priv_size = num; + msg41CreatePtr->_priv_msgid = 41U; + msg41CreatePtr->manager = manager != null ? manager.RenderHandle : RENDERHANDLE.NULL; + msg41CreatePtr->_priv_objcb = cb.RenderHandle; + msg41CreatePtr->_priv_ctxcb = port.Session.LocalContext; + msg41CreatePtr->_priv_idObjectSubject = remoteFormWindow.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteFormWindow.s_priv_ByteOrder_Msg41_Create, typeof(RemoteFormWindow.Msg41_Create), 0, 0); + port.CreateRemoteObject(windowClassHandle, remoteFormWindow.m_renderHandle, (Message*)msg41CreatePtr); + return remoteFormWindow; + } + + public static RemoteFormWindow CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteFormWindow(port, handle, true); + } + + public static RemoteFormWindow CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteFormWindow(port, handle, false); + } + + protected RemoteFormWindow(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteFormWindow(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteFormWindow && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg41_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE manager; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + } } - - public static unsafe RemoteFormWindow Create( - ProtocolSplashDesktopNt _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - RemoteDesktopManager manager, - LocalFormWindowCallback cb) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE windowClassHandle = _priv_protocolInstance.FormWindow_ClassHandle; - RemoteFormWindow remoteFormWindow = new RemoteFormWindow(port, _priv_owner); - uint num = (uint) sizeof (RemoteFormWindow.Msg41_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteFormWindow.Msg41_Create* msg41CreatePtr = (RemoteFormWindow.Msg41_Create*) pMem; - msg41CreatePtr->_priv_size = num; - msg41CreatePtr->_priv_msgid = 41U; - msg41CreatePtr->manager = manager != null ? manager.RenderHandle : RENDERHANDLE.NULL; - msg41CreatePtr->_priv_objcb = cb.RenderHandle; - msg41CreatePtr->_priv_ctxcb = port.Session.LocalContext; - msg41CreatePtr->_priv_idObjectSubject = remoteFormWindow.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteFormWindow.s_priv_ByteOrder_Msg41_Create, typeof (RemoteFormWindow.Msg41_Create), 0, 0); - port.CreateRemoteObject(windowClassHandle, remoteFormWindow.m_renderHandle, (Message*) msg41CreatePtr); - return remoteFormWindow; - } - - public static RemoteFormWindow CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteFormWindow(port, handle, true); - } - - public static RemoteFormWindow CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteFormWindow(port, handle, false); - } - - protected RemoteFormWindow(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteFormWindow(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteFormWindow && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg41_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE manager; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteHwndHostWindow.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteHwndHostWindow.cs index 2a9a3f2..8564e2c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteHwndHostWindow.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Nt/RemoteHwndHostWindow.cs @@ -10,226 +10,226 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop.Nt { - internal class RemoteHwndHostWindow : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg4_Create; - private static ushort[] s_priv_ByteOrder_Msg0_SetVisible; - private static ushort[] s_priv_ByteOrder_Msg1_SetSize; - private static ushort[] s_priv_ByteOrder_Msg2_SetPosition; - private static ushort[] s_priv_ByteOrder_Msg3_SetBackgroundColor; - - protected RemoteHwndHostWindow() + internal class RemoteHwndHostWindow : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg4_Create; + private static ushort[] s_priv_ByteOrder_Msg0_SetVisible; + private static ushort[] s_priv_ByteOrder_Msg1_SetSize; + private static ushort[] s_priv_ByteOrder_Msg2_SetPosition; + private static ushort[] s_priv_ByteOrder_Msg3_SetBackgroundColor; + + protected RemoteHwndHostWindow() + { + } + + public static unsafe RemoteHwndHostWindow Create( + ProtocolSplashDesktopNt _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + RemoteFormWindow winParent, + LocalHwndHostWindowCallback cb) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE windowClassHandle = _priv_protocolInstance.HwndHostWindow_ClassHandle; + RemoteHwndHostWindow remoteHwndHostWindow = new RemoteHwndHostWindow(port, _priv_owner); + uint num = (uint)sizeof(RemoteHwndHostWindow.Msg4_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteHwndHostWindow.Msg4_Create* msg4CreatePtr = (RemoteHwndHostWindow.Msg4_Create*)pMem; + msg4CreatePtr->_priv_size = num; + msg4CreatePtr->_priv_msgid = 4U; + msg4CreatePtr->winParent = winParent != null ? winParent.RenderHandle : RENDERHANDLE.NULL; + msg4CreatePtr->_priv_objcb = cb.RenderHandle; + msg4CreatePtr->_priv_ctxcb = port.Session.LocalContext; + msg4CreatePtr->_priv_idObjectSubject = remoteHwndHostWindow.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteHwndHostWindow.s_priv_ByteOrder_Msg4_Create, typeof(RemoteHwndHostWindow.Msg4_Create), 0, 0); + port.CreateRemoteObject(windowClassHandle, remoteHwndHostWindow.m_renderHandle, (Message*)msg4CreatePtr); + return remoteHwndHostWindow; + } + + public unsafe void BuildSetVisible( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fVisible) + { + 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(RemoteHwndHostWindow.Msg0_SetVisible); + RemoteHwndHostWindow.Msg0_SetVisible* msg0SetVisiblePtr = (RemoteHwndHostWindow.Msg0_SetVisible*)_priv_portUse.AllocMessageBuffer(size); + msg0SetVisiblePtr->_priv_size = size; + msg0SetVisiblePtr->_priv_msgid = 0U; + msg0SetVisiblePtr->fVisible = fVisible ? uint.MaxValue : 0U; + msg0SetVisiblePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0SetVisiblePtr, ref RemoteHwndHostWindow.s_priv_ByteOrder_Msg0_SetVisible, typeof(RemoteHwndHostWindow.Msg0_SetVisible), 0, 0); + _priv_pmsgUse = (Message*)msg0SetVisiblePtr; + } + + public unsafe void SendSetVisible(bool fVisible) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetVisible(out _priv_portUse, out _priv_pmsgUse, fVisible); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetSize( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Size sizeWindowPxl) + { + 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(RemoteHwndHostWindow.Msg1_SetSize); + RemoteHwndHostWindow.Msg1_SetSize* msg1SetSizePtr = (RemoteHwndHostWindow.Msg1_SetSize*)_priv_portUse.AllocMessageBuffer(size); + msg1SetSizePtr->_priv_size = size; + msg1SetSizePtr->_priv_msgid = 1U; + msg1SetSizePtr->sizeWindowPxl = sizeWindowPxl; + msg1SetSizePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1SetSizePtr, ref RemoteHwndHostWindow.s_priv_ByteOrder_Msg1_SetSize, typeof(RemoteHwndHostWindow.Msg1_SetSize), 0, 0); + _priv_pmsgUse = (Message*)msg1SetSizePtr; + } + + public unsafe void SendSetSize(Size sizeWindowPxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetSize(out _priv_portUse, out _priv_pmsgUse, sizeWindowPxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetPosition( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Point ptClientPxl) + { + 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(RemoteHwndHostWindow.Msg2_SetPosition); + RemoteHwndHostWindow.Msg2_SetPosition* msg2SetPositionPtr = (RemoteHwndHostWindow.Msg2_SetPosition*)_priv_portUse.AllocMessageBuffer(size); + msg2SetPositionPtr->_priv_size = size; + msg2SetPositionPtr->_priv_msgid = 2U; + msg2SetPositionPtr->ptClientPxl = ptClientPxl; + msg2SetPositionPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg2SetPositionPtr, ref RemoteHwndHostWindow.s_priv_ByteOrder_Msg2_SetPosition, typeof(RemoteHwndHostWindow.Msg2_SetPosition), 0, 0); + _priv_pmsgUse = (Message*)msg2SetPositionPtr; + } + + public unsafe void SendSetPosition(Point ptClientPxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetPosition(out _priv_portUse, out _priv_pmsgUse, ptClientPxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetBackgroundColor( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ColorF clrBackground) + { + 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(RemoteHwndHostWindow.Msg3_SetBackgroundColor); + RemoteHwndHostWindow.Msg3_SetBackgroundColor* setBackgroundColorPtr = (RemoteHwndHostWindow.Msg3_SetBackgroundColor*)_priv_portUse.AllocMessageBuffer(size); + setBackgroundColorPtr->_priv_size = size; + setBackgroundColorPtr->_priv_msgid = 3U; + setBackgroundColorPtr->clrBackground = clrBackground; + setBackgroundColorPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setBackgroundColorPtr, ref RemoteHwndHostWindow.s_priv_ByteOrder_Msg3_SetBackgroundColor, typeof(RemoteHwndHostWindow.Msg3_SetBackgroundColor), 0, 0); + _priv_pmsgUse = (Message*)setBackgroundColorPtr; + } + + public unsafe void SendSetBackgroundColor(ColorF clrBackground) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetBackgroundColor(out _priv_portUse, out _priv_pmsgUse, clrBackground); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteHwndHostWindow CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteHwndHostWindow(port, handle, true); + } + + public static RemoteHwndHostWindow CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteHwndHostWindow(port, handle, false); + } + + protected RemoteHwndHostWindow(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteHwndHostWindow(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteHwndHostWindow && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg4_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE winParent; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + } + + [ComVisible(false)] + private struct Msg0_SetVisible + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fVisible; + } + + [ComVisible(false)] + private struct Msg1_SetSize + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Size sizeWindowPxl; + } + + [ComVisible(false)] + private struct Msg2_SetPosition + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Point ptClientPxl; + } + + [ComVisible(false)] + private struct Msg3_SetBackgroundColor + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public ColorF clrBackground; + } } - - public static unsafe RemoteHwndHostWindow Create( - ProtocolSplashDesktopNt _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - RemoteFormWindow winParent, - LocalHwndHostWindowCallback cb) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE windowClassHandle = _priv_protocolInstance.HwndHostWindow_ClassHandle; - RemoteHwndHostWindow remoteHwndHostWindow = new RemoteHwndHostWindow(port, _priv_owner); - uint num = (uint) sizeof (RemoteHwndHostWindow.Msg4_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteHwndHostWindow.Msg4_Create* msg4CreatePtr = (RemoteHwndHostWindow.Msg4_Create*) pMem; - msg4CreatePtr->_priv_size = num; - msg4CreatePtr->_priv_msgid = 4U; - msg4CreatePtr->winParent = winParent != null ? winParent.RenderHandle : RENDERHANDLE.NULL; - msg4CreatePtr->_priv_objcb = cb.RenderHandle; - msg4CreatePtr->_priv_ctxcb = port.Session.LocalContext; - msg4CreatePtr->_priv_idObjectSubject = remoteHwndHostWindow.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteHwndHostWindow.s_priv_ByteOrder_Msg4_Create, typeof (RemoteHwndHostWindow.Msg4_Create), 0, 0); - port.CreateRemoteObject(windowClassHandle, remoteHwndHostWindow.m_renderHandle, (Message*) msg4CreatePtr); - return remoteHwndHostWindow; - } - - public unsafe void BuildSetVisible( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fVisible) - { - 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 (RemoteHwndHostWindow.Msg0_SetVisible); - RemoteHwndHostWindow.Msg0_SetVisible* msg0SetVisiblePtr = (RemoteHwndHostWindow.Msg0_SetVisible*) _priv_portUse.AllocMessageBuffer(size); - msg0SetVisiblePtr->_priv_size = size; - msg0SetVisiblePtr->_priv_msgid = 0U; - msg0SetVisiblePtr->fVisible = fVisible ? uint.MaxValue : 0U; - msg0SetVisiblePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0SetVisiblePtr, ref RemoteHwndHostWindow.s_priv_ByteOrder_Msg0_SetVisible, typeof (RemoteHwndHostWindow.Msg0_SetVisible), 0, 0); - _priv_pmsgUse = (Message*) msg0SetVisiblePtr; - } - - public unsafe void SendSetVisible(bool fVisible) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetVisible(out _priv_portUse, out _priv_pmsgUse, fVisible); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetSize( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Size sizeWindowPxl) - { - 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 (RemoteHwndHostWindow.Msg1_SetSize); - RemoteHwndHostWindow.Msg1_SetSize* msg1SetSizePtr = (RemoteHwndHostWindow.Msg1_SetSize*) _priv_portUse.AllocMessageBuffer(size); - msg1SetSizePtr->_priv_size = size; - msg1SetSizePtr->_priv_msgid = 1U; - msg1SetSizePtr->sizeWindowPxl = sizeWindowPxl; - msg1SetSizePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1SetSizePtr, ref RemoteHwndHostWindow.s_priv_ByteOrder_Msg1_SetSize, typeof (RemoteHwndHostWindow.Msg1_SetSize), 0, 0); - _priv_pmsgUse = (Message*) msg1SetSizePtr; - } - - public unsafe void SendSetSize(Size sizeWindowPxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetSize(out _priv_portUse, out _priv_pmsgUse, sizeWindowPxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetPosition( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Point ptClientPxl) - { - 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 (RemoteHwndHostWindow.Msg2_SetPosition); - RemoteHwndHostWindow.Msg2_SetPosition* msg2SetPositionPtr = (RemoteHwndHostWindow.Msg2_SetPosition*) _priv_portUse.AllocMessageBuffer(size); - msg2SetPositionPtr->_priv_size = size; - msg2SetPositionPtr->_priv_msgid = 2U; - msg2SetPositionPtr->ptClientPxl = ptClientPxl; - msg2SetPositionPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg2SetPositionPtr, ref RemoteHwndHostWindow.s_priv_ByteOrder_Msg2_SetPosition, typeof (RemoteHwndHostWindow.Msg2_SetPosition), 0, 0); - _priv_pmsgUse = (Message*) msg2SetPositionPtr; - } - - public unsafe void SendSetPosition(Point ptClientPxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetPosition(out _priv_portUse, out _priv_pmsgUse, ptClientPxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetBackgroundColor( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ColorF clrBackground) - { - 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 (RemoteHwndHostWindow.Msg3_SetBackgroundColor); - RemoteHwndHostWindow.Msg3_SetBackgroundColor* setBackgroundColorPtr = (RemoteHwndHostWindow.Msg3_SetBackgroundColor*) _priv_portUse.AllocMessageBuffer(size); - setBackgroundColorPtr->_priv_size = size; - setBackgroundColorPtr->_priv_msgid = 3U; - setBackgroundColorPtr->clrBackground = clrBackground; - setBackgroundColorPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setBackgroundColorPtr, ref RemoteHwndHostWindow.s_priv_ByteOrder_Msg3_SetBackgroundColor, typeof (RemoteHwndHostWindow.Msg3_SetBackgroundColor), 0, 0); - _priv_pmsgUse = (Message*) setBackgroundColorPtr; - } - - public unsafe void SendSetBackgroundColor(ColorF clrBackground) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetBackgroundColor(out _priv_portUse, out _priv_pmsgUse, clrBackground); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteHwndHostWindow CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteHwndHostWindow(port, handle, true); - } - - public static RemoteHwndHostWindow CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteHwndHostWindow(port, handle, false); - } - - protected RemoteHwndHostWindow(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteHwndHostWindow(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteHwndHostWindow && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg4_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE winParent; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - } - - [ComVisible(false)] - private struct Msg0_SetVisible - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fVisible; - } - - [ComVisible(false)] - private struct Msg1_SetSize - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Size sizeWindowPxl; - } - - [ComVisible(false)] - private struct Msg2_SetPosition - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Point ptClientPxl; - } - - [ComVisible(false)] - private struct Msg3_SetBackgroundColor - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public ColorF clrBackground; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/ProtocolSplashDesktop.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/ProtocolSplashDesktop.cs index 79fe8ab..fec5f5f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/ProtocolSplashDesktop.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/ProtocolSplashDesktop.cs @@ -10,59 +10,59 @@ using System; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop { - internal sealed class ProtocolSplashDesktop : ProtocolInstance - { - private RENDERHANDLE _priv_remoteClass_InputRouter; - private RENDERHANDLE _priv_remoteClass_FormWindowBase; - private RENDERHANDLE _priv_callbackInstance_InputCallback; - private RENDERHANDLE _priv_callbackInstance_FormWindowCallback; - - public static ProtocolSplashDesktop Bind(RenderPort port) + internal sealed class ProtocolSplashDesktop : ProtocolInstance { - Debug2.Validate(port != null, typeof (ArgumentNullException), nameof (port)); - ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Desktop"); - if (protocolInstance != null) - { - ProtocolSplashDesktop protocolSplashDesktop = protocolInstance as ProtocolSplashDesktop; - Debug2.Validate(protocolSplashDesktop != null, typeof (InvalidOperationException), "protocol name collision"); - return protocolSplashDesktop; - } - ProtocolSplashDesktop protocolSplashDesktop1 = new ProtocolSplashDesktop(port); - port.BindProtocol((ProtocolInstance) protocolSplashDesktop1); - return protocolSplashDesktop1; + private RENDERHANDLE _priv_remoteClass_InputRouter; + private RENDERHANDLE _priv_remoteClass_FormWindowBase; + private RENDERHANDLE _priv_callbackInstance_InputCallback; + private RENDERHANDLE _priv_callbackInstance_FormWindowCallback; + + public static ProtocolSplashDesktop Bind(RenderPort port) + { + Debug2.Validate(port != null, typeof(ArgumentNullException), nameof(port)); + ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Desktop"); + if (protocolInstance != null) + { + ProtocolSplashDesktop protocolSplashDesktop = protocolInstance as ProtocolSplashDesktop; + Debug2.Validate(protocolSplashDesktop != null, typeof(InvalidOperationException), "protocol name collision"); + return protocolSplashDesktop; + } + ProtocolSplashDesktop protocolSplashDesktop1 = new ProtocolSplashDesktop(port); + port.BindProtocol((ProtocolInstance)protocolSplashDesktop1); + return protocolSplashDesktop1; + } + + public LocalInputCallback LocalInputCallbackHandle => LocalInputCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_InputCallback); + + public LocalFormWindowCallback LocalFormWindowCallbackHandle => LocalFormWindowCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_FormWindowCallback); + + private ProtocolSplashDesktop(RenderPort port) + : base(port, "Splash::Desktop") + { + } + + protected override void Init() + { + RenderPort port = this.Port; + this._priv_remoteClass_InputRouter = port.InitRemoteClass("Splash::Desktop::InputRouter"); + this._priv_remoteClass_FormWindowBase = port.InitRemoteClass("Splash::Desktop::FormWindowBase"); + this._priv_callbackInstance_InputCallback = LocalInputCallback.BindCallback(port); + this._priv_callbackInstance_FormWindowCallback = LocalFormWindowCallback.BindCallback(port); + } + + internal RENDERHANDLE InputRouter_ClassHandle => this._priv_remoteClass_InputRouter; + + internal RENDERHANDLE FormWindowBase_ClassHandle => this._priv_remoteClass_FormWindowBase; + + internal RENDERHANDLE InputCallback_CallbackInstance => this._priv_callbackInstance_InputCallback; + + internal RENDERHANDLE FormWindowCallback_CallbackInstance => this._priv_callbackInstance_FormWindowCallback; + + internal RemoteInputRouter BuildRemoteInputRouter( + IRenderHandleOwner _priv_owner, + LocalInputCallback ic) + { + return RemoteInputRouter.Create(this, _priv_owner, ic); + } } - - public LocalInputCallback LocalInputCallbackHandle => LocalInputCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_InputCallback); - - public LocalFormWindowCallback LocalFormWindowCallbackHandle => LocalFormWindowCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_FormWindowCallback); - - private ProtocolSplashDesktop(RenderPort port) - : base(port, "Splash::Desktop") - { - } - - protected override void Init() - { - RenderPort port = this.Port; - this._priv_remoteClass_InputRouter = port.InitRemoteClass("Splash::Desktop::InputRouter"); - this._priv_remoteClass_FormWindowBase = port.InitRemoteClass("Splash::Desktop::FormWindowBase"); - this._priv_callbackInstance_InputCallback = LocalInputCallback.BindCallback(port); - this._priv_callbackInstance_FormWindowCallback = LocalFormWindowCallback.BindCallback(port); - } - - internal RENDERHANDLE InputRouter_ClassHandle => this._priv_remoteClass_InputRouter; - - internal RENDERHANDLE FormWindowBase_ClassHandle => this._priv_remoteClass_FormWindowBase; - - internal RENDERHANDLE InputCallback_CallbackInstance => this._priv_callbackInstance_InputCallback; - - internal RENDERHANDLE FormWindowCallback_CallbackInstance => this._priv_callbackInstance_FormWindowCallback; - - internal RemoteInputRouter BuildRemoteInputRouter( - IRenderHandleOwner _priv_owner, - LocalInputCallback ic) - { - return RemoteInputRouter.Create(this, _priv_owner, ic); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteFormWindowBase.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteFormWindowBase.cs index c515ca6..b4f3398 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteFormWindowBase.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteFormWindowBase.cs @@ -11,1302 +11,1302 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop { - internal class RemoteFormWindowBase : RemoteWindow - { - private static ushort[] s_priv_ByteOrder_Msg7_SetEdgeImageParts; - private static ushort[] s_priv_ByteOrder_Msg8_SetInitialPlacement; - private static ushort[] s_priv_ByteOrder_Msg9_RefreshHitTarget; - private static ushort[] s_priv_ByteOrder_Msg10_ExitInternalDrag; - private static ushort[] s_priv_ByteOrder_Msg11_EnterInternalDrag; - private static ushort[] s_priv_ByteOrder_Msg12_SetDragDropResult; - private static ushort[] s_priv_ByteOrder_Msg13_EnableExternalDragDrop; - private static ushort[] s_priv_ByteOrder_Msg14_SetIcon; - private static ushort[] s_priv_ByteOrder_Msg15_SetMaxResizeWidth; - private static ushort[] s_priv_ByteOrder_Msg16_SetMinResizeWidth; - private static ushort[] s_priv_ByteOrder_Msg17_BringToTop; - private static ushort[] s_priv_ByteOrder_Msg18_EnableShellShutdownHook; - private static ushort[] s_priv_ByteOrder_Msg19_UpdateForegroundLockState; - private static ushort[] s_priv_ByteOrder_Msg21_SetHitMasks; - private static ushort[] s_priv_ByteOrder_Msg22_SetCapture; - private static ushort[] s_priv_ByteOrder_Msg23_SetText; - private static ushort[] s_priv_ByteOrder_Msg24_Destroy; - private static ushort[] s_priv_ByteOrder_Msg25_SetForeground; - private static ushort[] s_priv_ByteOrder_Msg26_TakeFocus; - private static ushort[] s_priv_ByteOrder_Msg27_ForceMouseIdle; - private static ushort[] s_priv_ByteOrder_Msg28_TemporarilyExitExclusiveMode; - private static ushort[] s_priv_ByteOrder_Msg29_Restore; - private static ushort[] s_priv_ByteOrder_Msg30_SetMode; - private static ushort[] s_priv_ByteOrder_Msg31_SetVisible; - private static ushort[] s_priv_ByteOrder_Msg32_SetPosition; - private static ushort[] s_priv_ByteOrder_Msg33_SetSize; - private static ushort[] s_priv_ByteOrder_Msg34_SetCursors; - private static ushort[] s_priv_ByteOrder_Msg35_SetStyles; - private static ushort[] s_priv_ByteOrder_Msg36_SetMouseIdleOptions; - private static ushort[] s_priv_ByteOrder_Msg37_SetOptions; - private static ushort[] s_priv_ByteOrder_Msg38_CreateRootContainer; - - protected RemoteFormWindowBase() - { - } - - public unsafe void BuildSetEdgeImageParts( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fActiveEdges, - string sModuleName, - string sResourceIdLeft, - string sResourceIdTop, - string sResourceIdRight, - string sResourceIdBottom, - Inset insetSplits) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteFormWindowBase.Msg7_SetEdgeImageParts)); - BLOBREF blobref1 = blobInfo.Add(sModuleName); - BLOBREF blobref2 = blobInfo.Add(sResourceIdLeft); - BLOBREF blobref3 = blobInfo.Add(sResourceIdTop); - BLOBREF blobref4 = blobInfo.Add(sResourceIdRight); - BLOBREF blobref5 = blobInfo.Add(sResourceIdBottom); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteFormWindowBase.Msg7_SetEdgeImageParts* setEdgeImagePartsPtr = (RemoteFormWindowBase.Msg7_SetEdgeImageParts*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - setEdgeImagePartsPtr->_priv_size = adjustedTotalSize; - setEdgeImagePartsPtr->_priv_msgid = 7U; - setEdgeImagePartsPtr->fActiveEdges = fActiveEdges ? uint.MaxValue : 0U; - setEdgeImagePartsPtr->sModuleName = blobref1; - setEdgeImagePartsPtr->sResourceIdLeft = blobref2; - setEdgeImagePartsPtr->sResourceIdTop = blobref3; - setEdgeImagePartsPtr->sResourceIdRight = blobref4; - setEdgeImagePartsPtr->sResourceIdBottom = blobref5; - setEdgeImagePartsPtr->insetSplits = insetSplits; - blobInfo.Attach((Message*) setEdgeImagePartsPtr); - setEdgeImagePartsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setEdgeImagePartsPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg7_SetEdgeImageParts, typeof (RemoteFormWindowBase.Msg7_SetEdgeImageParts), 0, 0); - _priv_pmsgUse = (Message*) setEdgeImagePartsPtr; - } - - public unsafe void SendSetEdgeImageParts( - bool fActiveEdges, - string sModuleName, - string sResourceIdLeft, - string sResourceIdTop, - string sResourceIdRight, - string sResourceIdBottom, - Inset insetSplits) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetEdgeImageParts(out _priv_portUse, out _priv_pmsgUse, fActiveEdges, sModuleName, sResourceIdLeft, sResourceIdTop, sResourceIdRight, sResourceIdBottom, insetSplits); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetInitialPlacement( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint nShowState, - Rectangle rcNormalPosition, - Point ptMaxPosition) - { - 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 (RemoteFormWindowBase.Msg8_SetInitialPlacement); - RemoteFormWindowBase.Msg8_SetInitialPlacement* initialPlacementPtr = (RemoteFormWindowBase.Msg8_SetInitialPlacement*) _priv_portUse.AllocMessageBuffer(size); - initialPlacementPtr->_priv_size = size; - initialPlacementPtr->_priv_msgid = 8U; - initialPlacementPtr->nShowState = nShowState; - initialPlacementPtr->rcNormalPosition = rcNormalPosition; - initialPlacementPtr->ptMaxPosition = ptMaxPosition; - initialPlacementPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) initialPlacementPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg8_SetInitialPlacement, typeof (RemoteFormWindowBase.Msg8_SetInitialPlacement), 0, 0); - _priv_pmsgUse = (Message*) initialPlacementPtr; - } - - public unsafe void SendSetInitialPlacement( - uint nShowState, - Rectangle rcNormalPosition, - Point ptMaxPosition) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetInitialPlacement(out _priv_portUse, out _priv_pmsgUse, nShowState, rcNormalPosition, ptMaxPosition); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRefreshHitTarget( - 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 (RemoteFormWindowBase.Msg9_RefreshHitTarget); - RemoteFormWindowBase.Msg9_RefreshHitTarget* refreshHitTargetPtr = (RemoteFormWindowBase.Msg9_RefreshHitTarget*) _priv_portUse.AllocMessageBuffer(size); - refreshHitTargetPtr->_priv_size = size; - refreshHitTargetPtr->_priv_msgid = 9U; - refreshHitTargetPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) refreshHitTargetPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg9_RefreshHitTarget, typeof (RemoteFormWindowBase.Msg9_RefreshHitTarget), 0, 0); - _priv_pmsgUse = (Message*) refreshHitTargetPtr; - } - - public unsafe void SendRefreshHitTarget() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRefreshHitTarget(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildExitInternalDrag( - 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 (RemoteFormWindowBase.Msg10_ExitInternalDrag); - RemoteFormWindowBase.Msg10_ExitInternalDrag* exitInternalDragPtr = (RemoteFormWindowBase.Msg10_ExitInternalDrag*) _priv_portUse.AllocMessageBuffer(size); - exitInternalDragPtr->_priv_size = size; - exitInternalDragPtr->_priv_msgid = 10U; - exitInternalDragPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) exitInternalDragPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg10_ExitInternalDrag, typeof (RemoteFormWindowBase.Msg10_ExitInternalDrag), 0, 0); - _priv_pmsgUse = (Message*) exitInternalDragPtr; - } - - public unsafe void SendExitInternalDrag() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildExitInternalDrag(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildEnterInternalDrag( - 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 (RemoteFormWindowBase.Msg11_EnterInternalDrag); - RemoteFormWindowBase.Msg11_EnterInternalDrag* enterInternalDragPtr = (RemoteFormWindowBase.Msg11_EnterInternalDrag*) _priv_portUse.AllocMessageBuffer(size); - enterInternalDragPtr->_priv_size = size; - enterInternalDragPtr->_priv_msgid = 11U; - enterInternalDragPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) enterInternalDragPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg11_EnterInternalDrag, typeof (RemoteFormWindowBase.Msg11_EnterInternalDrag), 0, 0); - _priv_pmsgUse = (Message*) enterInternalDragPtr; - } - - public unsafe void SendEnterInternalDrag() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildEnterInternalDrag(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetDragDropResult( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint nDragOverResult, - uint nDragDropResult) - { - 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 (RemoteFormWindowBase.Msg12_SetDragDropResult); - RemoteFormWindowBase.Msg12_SetDragDropResult* setDragDropResultPtr = (RemoteFormWindowBase.Msg12_SetDragDropResult*) _priv_portUse.AllocMessageBuffer(size); - setDragDropResultPtr->_priv_size = size; - setDragDropResultPtr->_priv_msgid = 12U; - setDragDropResultPtr->nDragOverResult = nDragOverResult; - setDragDropResultPtr->nDragDropResult = nDragDropResult; - setDragDropResultPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setDragDropResultPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg12_SetDragDropResult, typeof (RemoteFormWindowBase.Msg12_SetDragDropResult), 0, 0); - _priv_pmsgUse = (Message*) setDragDropResultPtr; - } - - public unsafe void SendSetDragDropResult(uint nDragOverResult, uint nDragDropResult) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetDragDropResult(out _priv_portUse, out _priv_pmsgUse, nDragOverResult, nDragDropResult); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildEnableExternalDragDrop( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fEnable) - { - 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 (RemoteFormWindowBase.Msg13_EnableExternalDragDrop); - RemoteFormWindowBase.Msg13_EnableExternalDragDrop* externalDragDropPtr = (RemoteFormWindowBase.Msg13_EnableExternalDragDrop*) _priv_portUse.AllocMessageBuffer(size); - externalDragDropPtr->_priv_size = size; - externalDragDropPtr->_priv_msgid = 13U; - externalDragDropPtr->fEnable = fEnable ? uint.MaxValue : 0U; - externalDragDropPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) externalDragDropPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg13_EnableExternalDragDrop, typeof (RemoteFormWindowBase.Msg13_EnableExternalDragDrop), 0, 0); - _priv_pmsgUse = (Message*) externalDragDropPtr; - } - - public unsafe void SendEnableExternalDragDrop(bool fEnable) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildEnableExternalDragDrop(out _priv_portUse, out _priv_pmsgUse, fEnable); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetIcon( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string sModule, - uint nResourceID, - uint nOptions) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteFormWindowBase.Msg14_SetIcon)); - BLOBREF blobref = blobInfo.Add(sModule); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteFormWindowBase.Msg14_SetIcon* msg14SetIconPtr = (RemoteFormWindowBase.Msg14_SetIcon*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg14SetIconPtr->_priv_size = adjustedTotalSize; - msg14SetIconPtr->_priv_msgid = 14U; - msg14SetIconPtr->sModule = blobref; - msg14SetIconPtr->nResourceID = nResourceID; - msg14SetIconPtr->nOptions = nOptions; - blobInfo.Attach((Message*) msg14SetIconPtr); - msg14SetIconPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg14SetIconPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg14_SetIcon, typeof (RemoteFormWindowBase.Msg14_SetIcon), 0, 0); - _priv_pmsgUse = (Message*) msg14SetIconPtr; - } - - public unsafe void SendSetIcon(string sModule, uint nResourceID, uint nOptions) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetIcon(out _priv_portUse, out _priv_pmsgUse, sModule, nResourceID, nOptions); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetMaxResizeWidth( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nMaxResizeWidth) - { - 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 (RemoteFormWindowBase.Msg15_SetMaxResizeWidth); - RemoteFormWindowBase.Msg15_SetMaxResizeWidth* setMaxResizeWidthPtr = (RemoteFormWindowBase.Msg15_SetMaxResizeWidth*) _priv_portUse.AllocMessageBuffer(size); - setMaxResizeWidthPtr->_priv_size = size; - setMaxResizeWidthPtr->_priv_msgid = 15U; - setMaxResizeWidthPtr->nMaxResizeWidth = nMaxResizeWidth; - setMaxResizeWidthPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setMaxResizeWidthPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg15_SetMaxResizeWidth, typeof (RemoteFormWindowBase.Msg15_SetMaxResizeWidth), 0, 0); - _priv_pmsgUse = (Message*) setMaxResizeWidthPtr; - } - - public unsafe void SendSetMaxResizeWidth(int nMaxResizeWidth) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetMaxResizeWidth(out _priv_portUse, out _priv_pmsgUse, nMaxResizeWidth); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetMinResizeWidth( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nMinResizeWidth) - { - 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 (RemoteFormWindowBase.Msg16_SetMinResizeWidth); - RemoteFormWindowBase.Msg16_SetMinResizeWidth* setMinResizeWidthPtr = (RemoteFormWindowBase.Msg16_SetMinResizeWidth*) _priv_portUse.AllocMessageBuffer(size); - setMinResizeWidthPtr->_priv_size = size; - setMinResizeWidthPtr->_priv_msgid = 16U; - setMinResizeWidthPtr->nMinResizeWidth = nMinResizeWidth; - setMinResizeWidthPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setMinResizeWidthPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg16_SetMinResizeWidth, typeof (RemoteFormWindowBase.Msg16_SetMinResizeWidth), 0, 0); - _priv_pmsgUse = (Message*) setMinResizeWidthPtr; - } - - public unsafe void SendSetMinResizeWidth(int nMinResizeWidth) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetMinResizeWidth(out _priv_portUse, out _priv_pmsgUse, nMinResizeWidth); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildBringToTop(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 (RemoteFormWindowBase.Msg17_BringToTop); - RemoteFormWindowBase.Msg17_BringToTop* msg17BringToTopPtr = (RemoteFormWindowBase.Msg17_BringToTop*) _priv_portUse.AllocMessageBuffer(size); - msg17BringToTopPtr->_priv_size = size; - msg17BringToTopPtr->_priv_msgid = 17U; - msg17BringToTopPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg17BringToTopPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg17_BringToTop, typeof (RemoteFormWindowBase.Msg17_BringToTop), 0, 0); - _priv_pmsgUse = (Message*) msg17BringToTopPtr; - } - - public unsafe void SendBringToTop() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildBringToTop(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildEnableShellShutdownHook( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string messageToHook, - ushort uIdMsg) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteFormWindowBase.Msg18_EnableShellShutdownHook)); - BLOBREF blobref = blobInfo.Add(messageToHook); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteFormWindowBase.Msg18_EnableShellShutdownHook* shellShutdownHookPtr = (RemoteFormWindowBase.Msg18_EnableShellShutdownHook*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - shellShutdownHookPtr->_priv_size = adjustedTotalSize; - shellShutdownHookPtr->_priv_msgid = 18U; - shellShutdownHookPtr->messageToHook = blobref; - shellShutdownHookPtr->uIdMsg = uIdMsg; - blobInfo.Attach((Message*) shellShutdownHookPtr); - shellShutdownHookPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) shellShutdownHookPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg18_EnableShellShutdownHook, typeof (RemoteFormWindowBase.Msg18_EnableShellShutdownHook), 0, 0); - _priv_pmsgUse = (Message*) shellShutdownHookPtr; - } - - public unsafe void SendEnableShellShutdownHook(string messageToHook, ushort uIdMsg) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildEnableShellShutdownHook(out _priv_portUse, out _priv_pmsgUse, messageToHook, uIdMsg); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildUpdateForegroundLockState( - 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 (RemoteFormWindowBase.Msg19_UpdateForegroundLockState); - RemoteFormWindowBase.Msg19_UpdateForegroundLockState* foregroundLockStatePtr = (RemoteFormWindowBase.Msg19_UpdateForegroundLockState*) _priv_portUse.AllocMessageBuffer(size); - foregroundLockStatePtr->_priv_size = size; - foregroundLockStatePtr->_priv_msgid = 19U; - foregroundLockStatePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) foregroundLockStatePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg19_UpdateForegroundLockState, typeof (RemoteFormWindowBase.Msg19_UpdateForegroundLockState), 0, 0); - _priv_pmsgUse = (Message*) foregroundLockStatePtr; - } - - public unsafe void SendUpdateForegroundLockState() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildUpdateForegroundLockState(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void INPROC_BuildSetAppNotifyWindow( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - HWND hwndAppNotify) - { - 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 (RemoteFormWindowBase.Msg20_SetAppNotifyWindow); - RemoteFormWindowBase.Msg20_SetAppNotifyWindow* setAppNotifyWindowPtr = (RemoteFormWindowBase.Msg20_SetAppNotifyWindow*) _priv_portUse.AllocMessageBuffer(size); - setAppNotifyWindowPtr->_priv_size = size; - setAppNotifyWindowPtr->_priv_msgid = 20U; - setAppNotifyWindowPtr->hwndAppNotify = hwndAppNotify; - setAppNotifyWindowPtr->_priv_idObjectSubject = this.m_renderHandle; - _priv_pmsgUse = (Message*) setAppNotifyWindowPtr; - } - - public unsafe void INPROC_SendSetAppNotifyWindow(HWND hwndAppNotify) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.INPROC_BuildSetAppNotifyWindow(out _priv_portUse, out _priv_pmsgUse, hwndAppNotify); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetHitMasks( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint uMaskTraverse, - uint uMaskHit, - uint uMaskResult, - uint uMaskClip) - { - 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 (RemoteFormWindowBase.Msg21_SetHitMasks); - RemoteFormWindowBase.Msg21_SetHitMasks* msg21SetHitMasksPtr = (RemoteFormWindowBase.Msg21_SetHitMasks*) _priv_portUse.AllocMessageBuffer(size); - msg21SetHitMasksPtr->_priv_size = size; - msg21SetHitMasksPtr->_priv_msgid = 21U; - msg21SetHitMasksPtr->uMaskTraverse = uMaskTraverse; - msg21SetHitMasksPtr->uMaskHit = uMaskHit; - msg21SetHitMasksPtr->uMaskResult = uMaskResult; - msg21SetHitMasksPtr->uMaskClip = uMaskClip; - msg21SetHitMasksPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg21SetHitMasksPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg21_SetHitMasks, typeof (RemoteFormWindowBase.Msg21_SetHitMasks), 0, 0); - _priv_pmsgUse = (Message*) msg21SetHitMasksPtr; - } - - public unsafe void SendSetHitMasks( - uint uMaskTraverse, - uint uMaskHit, - uint uMaskResult, - uint uMaskClip) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetHitMasks(out _priv_portUse, out _priv_pmsgUse, uMaskTraverse, uMaskHit, uMaskResult, uMaskClip); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetCapture( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteVisual hVisual, - bool fState) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - if (hVisual != null) - _priv_portUse.ValidateHandleOrNull(hVisual.RenderHandle); - uint size = (uint) sizeof (RemoteFormWindowBase.Msg22_SetCapture); - RemoteFormWindowBase.Msg22_SetCapture* msg22SetCapturePtr = (RemoteFormWindowBase.Msg22_SetCapture*) _priv_portUse.AllocMessageBuffer(size); - msg22SetCapturePtr->_priv_size = size; - msg22SetCapturePtr->_priv_msgid = 22U; - msg22SetCapturePtr->hVisual = hVisual != null ? hVisual.RenderHandle : RENDERHANDLE.NULL; - msg22SetCapturePtr->fState = fState ? uint.MaxValue : 0U; - msg22SetCapturePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg22SetCapturePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg22_SetCapture, typeof (RemoteFormWindowBase.Msg22_SetCapture), 0, 0); - _priv_pmsgUse = (Message*) msg22SetCapturePtr; - } - - public unsafe void SendSetCapture(RemoteVisual hVisual, bool fState) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetCapture(out _priv_portUse, out _priv_pmsgUse, hVisual, fState); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetText( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string text) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteFormWindowBase.Msg23_SetText)); - BLOBREF blobref = blobInfo.Add(text); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteFormWindowBase.Msg23_SetText* msg23SetTextPtr = (RemoteFormWindowBase.Msg23_SetText*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg23SetTextPtr->_priv_size = adjustedTotalSize; - msg23SetTextPtr->_priv_msgid = 23U; - msg23SetTextPtr->text = blobref; - blobInfo.Attach((Message*) msg23SetTextPtr); - msg23SetTextPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg23SetTextPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg23_SetText, typeof (RemoteFormWindowBase.Msg23_SetText), 0, 0); - _priv_pmsgUse = (Message*) msg23SetTextPtr; - } - - public unsafe void SendSetText(string text) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetText(out _priv_portUse, out _priv_pmsgUse, text); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildDestroy(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 (RemoteFormWindowBase.Msg24_Destroy); - RemoteFormWindowBase.Msg24_Destroy* msg24DestroyPtr = (RemoteFormWindowBase.Msg24_Destroy*) _priv_portUse.AllocMessageBuffer(size); - msg24DestroyPtr->_priv_size = size; - msg24DestroyPtr->_priv_msgid = 24U; - msg24DestroyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg24DestroyPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg24_Destroy, typeof (RemoteFormWindowBase.Msg24_Destroy), 0, 0); - _priv_pmsgUse = (Message*) msg24DestroyPtr; - } - - public unsafe void SendDestroy() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildDestroy(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetForeground( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fForce) - { - 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 (RemoteFormWindowBase.Msg25_SetForeground); - RemoteFormWindowBase.Msg25_SetForeground* msg25SetForegroundPtr = (RemoteFormWindowBase.Msg25_SetForeground*) _priv_portUse.AllocMessageBuffer(size); - msg25SetForegroundPtr->_priv_size = size; - msg25SetForegroundPtr->_priv_msgid = 25U; - msg25SetForegroundPtr->fForce = fForce ? uint.MaxValue : 0U; - msg25SetForegroundPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg25SetForegroundPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg25_SetForeground, typeof (RemoteFormWindowBase.Msg25_SetForeground), 0, 0); - _priv_pmsgUse = (Message*) msg25SetForegroundPtr; - } - - public unsafe void SendSetForeground(bool fForce) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetForeground(out _priv_portUse, out _priv_pmsgUse, fForce); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildTakeFocus(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 (RemoteFormWindowBase.Msg26_TakeFocus); - RemoteFormWindowBase.Msg26_TakeFocus* msg26TakeFocusPtr = (RemoteFormWindowBase.Msg26_TakeFocus*) _priv_portUse.AllocMessageBuffer(size); - msg26TakeFocusPtr->_priv_size = size; - msg26TakeFocusPtr->_priv_msgid = 26U; - msg26TakeFocusPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg26TakeFocusPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg26_TakeFocus, typeof (RemoteFormWindowBase.Msg26_TakeFocus), 0, 0); - _priv_pmsgUse = (Message*) msg26TakeFocusPtr; - } - - public unsafe void SendTakeFocus() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildTakeFocus(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildForceMouseIdle( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fIdle) - { - 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 (RemoteFormWindowBase.Msg27_ForceMouseIdle); - RemoteFormWindowBase.Msg27_ForceMouseIdle* msg27ForceMouseIdlePtr = (RemoteFormWindowBase.Msg27_ForceMouseIdle*) _priv_portUse.AllocMessageBuffer(size); - msg27ForceMouseIdlePtr->_priv_size = size; - msg27ForceMouseIdlePtr->_priv_msgid = 27U; - msg27ForceMouseIdlePtr->fIdle = fIdle ? uint.MaxValue : 0U; - msg27ForceMouseIdlePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg27ForceMouseIdlePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg27_ForceMouseIdle, typeof (RemoteFormWindowBase.Msg27_ForceMouseIdle), 0, 0); - _priv_pmsgUse = (Message*) msg27ForceMouseIdlePtr; - } - - public unsafe void SendForceMouseIdle(bool fIdle) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildForceMouseIdle(out _priv_portUse, out _priv_pmsgUse, fIdle); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildTemporarilyExitExclusiveMode( - 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 (RemoteFormWindowBase.Msg28_TemporarilyExitExclusiveMode); - RemoteFormWindowBase.Msg28_TemporarilyExitExclusiveMode* exitExclusiveModePtr = (RemoteFormWindowBase.Msg28_TemporarilyExitExclusiveMode*) _priv_portUse.AllocMessageBuffer(size); - exitExclusiveModePtr->_priv_size = size; - exitExclusiveModePtr->_priv_msgid = 28U; - exitExclusiveModePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) exitExclusiveModePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg28_TemporarilyExitExclusiveMode, typeof (RemoteFormWindowBase.Msg28_TemporarilyExitExclusiveMode), 0, 0); - _priv_pmsgUse = (Message*) exitExclusiveModePtr; - } - - public unsafe void SendTemporarilyExitExclusiveMode() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildTemporarilyExitExclusiveMode(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRestore(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 (RemoteFormWindowBase.Msg29_Restore); - RemoteFormWindowBase.Msg29_Restore* msg29RestorePtr = (RemoteFormWindowBase.Msg29_Restore*) _priv_portUse.AllocMessageBuffer(size); - msg29RestorePtr->_priv_size = size; - msg29RestorePtr->_priv_msgid = 29U; - msg29RestorePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg29RestorePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg29_Restore, typeof (RemoteFormWindowBase.Msg29_Restore), 0, 0); - _priv_pmsgUse = (Message*) msg29RestorePtr; - } - - public unsafe void SendRestore() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRestore(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetMode( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint uMode) - { - 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 (RemoteFormWindowBase.Msg30_SetMode); - RemoteFormWindowBase.Msg30_SetMode* msg30SetModePtr = (RemoteFormWindowBase.Msg30_SetMode*) _priv_portUse.AllocMessageBuffer(size); - msg30SetModePtr->_priv_size = size; - msg30SetModePtr->_priv_msgid = 30U; - msg30SetModePtr->uMode = uMode; - msg30SetModePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg30SetModePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg30_SetMode, typeof (RemoteFormWindowBase.Msg30_SetMode), 0, 0); - _priv_pmsgUse = (Message*) msg30SetModePtr; - } - - public unsafe void SendSetMode(uint uMode) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetMode(out _priv_portUse, out _priv_pmsgUse, uMode); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetVisible( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fVisible) - { - 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 (RemoteFormWindowBase.Msg31_SetVisible); - RemoteFormWindowBase.Msg31_SetVisible* msg31SetVisiblePtr = (RemoteFormWindowBase.Msg31_SetVisible*) _priv_portUse.AllocMessageBuffer(size); - msg31SetVisiblePtr->_priv_size = size; - msg31SetVisiblePtr->_priv_msgid = 31U; - msg31SetVisiblePtr->fVisible = fVisible ? uint.MaxValue : 0U; - msg31SetVisiblePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg31SetVisiblePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg31_SetVisible, typeof (RemoteFormWindowBase.Msg31_SetVisible), 0, 0); - _priv_pmsgUse = (Message*) msg31SetVisiblePtr; - } - - public unsafe void SendSetVisible(bool fVisible) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetVisible(out _priv_portUse, out _priv_pmsgUse, fVisible); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetPosition( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Point ptScreenPxl) - { - 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 (RemoteFormWindowBase.Msg32_SetPosition); - RemoteFormWindowBase.Msg32_SetPosition* msg32SetPositionPtr = (RemoteFormWindowBase.Msg32_SetPosition*) _priv_portUse.AllocMessageBuffer(size); - msg32SetPositionPtr->_priv_size = size; - msg32SetPositionPtr->_priv_msgid = 32U; - msg32SetPositionPtr->ptScreenPxl = ptScreenPxl; - msg32SetPositionPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg32SetPositionPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg32_SetPosition, typeof (RemoteFormWindowBase.Msg32_SetPosition), 0, 0); - _priv_pmsgUse = (Message*) msg32SetPositionPtr; - } - - public unsafe void SendSetPosition(Point ptScreenPxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetPosition(out _priv_portUse, out _priv_pmsgUse, ptScreenPxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetSize( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Size sizeClientPxl) - { - 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 (RemoteFormWindowBase.Msg33_SetSize); - RemoteFormWindowBase.Msg33_SetSize* msg33SetSizePtr = (RemoteFormWindowBase.Msg33_SetSize*) _priv_portUse.AllocMessageBuffer(size); - msg33SetSizePtr->_priv_size = size; - msg33SetSizePtr->_priv_msgid = 33U; - msg33SetSizePtr->sizeClientPxl = sizeClientPxl; - msg33SetSizePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg33SetSizePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg33_SetSize, typeof (RemoteFormWindowBase.Msg33_SetSize), 0, 0); - _priv_pmsgUse = (Message*) msg33SetSizePtr; - } - - public unsafe void SendSetSize(Size sizeClientPxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetSize(out _priv_portUse, out _priv_pmsgUse, sizeClientPxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetCursors( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idCursorNormal, - int idCursorIdle) - { - 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 (RemoteFormWindowBase.Msg34_SetCursors); - RemoteFormWindowBase.Msg34_SetCursors* msg34SetCursorsPtr = (RemoteFormWindowBase.Msg34_SetCursors*) _priv_portUse.AllocMessageBuffer(size); - msg34SetCursorsPtr->_priv_size = size; - msg34SetCursorsPtr->_priv_msgid = 34U; - msg34SetCursorsPtr->idCursorNormal = idCursorNormal; - msg34SetCursorsPtr->idCursorIdle = idCursorIdle; - msg34SetCursorsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg34SetCursorsPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg34_SetCursors, typeof (RemoteFormWindowBase.Msg34_SetCursors), 0, 0); - _priv_pmsgUse = (Message*) msg34SetCursorsPtr; - } - - public unsafe void SendSetCursors(int idCursorNormal, int idCursorIdle) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetCursors(out _priv_portUse, out _priv_pmsgUse, idCursorNormal, idCursorIdle); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetStyles( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint uRst, - uint uRstEx, - uint uMin, - uint uMinEx, - uint uMax, - uint uMaxEx, - uint uFul, - uint uFulEx) - { - 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 (RemoteFormWindowBase.Msg35_SetStyles); - RemoteFormWindowBase.Msg35_SetStyles* msg35SetStylesPtr = (RemoteFormWindowBase.Msg35_SetStyles*) _priv_portUse.AllocMessageBuffer(size); - msg35SetStylesPtr->_priv_size = size; - msg35SetStylesPtr->_priv_msgid = 35U; - msg35SetStylesPtr->uRst = uRst; - msg35SetStylesPtr->uRstEx = uRstEx; - msg35SetStylesPtr->uMin = uMin; - msg35SetStylesPtr->uMinEx = uMinEx; - msg35SetStylesPtr->uMax = uMax; - msg35SetStylesPtr->uMaxEx = uMaxEx; - msg35SetStylesPtr->uFul = uFul; - msg35SetStylesPtr->uFulEx = uFulEx; - msg35SetStylesPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg35SetStylesPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg35_SetStyles, typeof (RemoteFormWindowBase.Msg35_SetStyles), 0, 0); - _priv_pmsgUse = (Message*) msg35SetStylesPtr; - } - - public unsafe void SendSetStyles( - uint uRst, - uint uRstEx, - uint uMin, - uint uMinEx, - uint uMax, - uint uMaxEx, - uint uFul, - uint uFulEx) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetStyles(out _priv_portUse, out _priv_pmsgUse, uRst, uRstEx, uMin, uMinEx, uMax, uMaxEx, uFul, uFulEx); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetMouseIdleOptions( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Size szMouseIdleTolerance, - uint dwMouseIdleTimeout) - { - 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 (RemoteFormWindowBase.Msg36_SetMouseIdleOptions); - RemoteFormWindowBase.Msg36_SetMouseIdleOptions* mouseIdleOptionsPtr = (RemoteFormWindowBase.Msg36_SetMouseIdleOptions*) _priv_portUse.AllocMessageBuffer(size); - mouseIdleOptionsPtr->_priv_size = size; - mouseIdleOptionsPtr->_priv_msgid = 36U; - mouseIdleOptionsPtr->szMouseIdleTolerance = szMouseIdleTolerance; - mouseIdleOptionsPtr->dwMouseIdleTimeout = dwMouseIdleTimeout; - mouseIdleOptionsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) mouseIdleOptionsPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg36_SetMouseIdleOptions, typeof (RemoteFormWindowBase.Msg36_SetMouseIdleOptions), 0, 0); - _priv_pmsgUse = (Message*) mouseIdleOptionsPtr; - } - - public unsafe void SendSetMouseIdleOptions(Size szMouseIdleTolerance, uint dwMouseIdleTimeout) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetMouseIdleOptions(out _priv_portUse, out _priv_pmsgUse, szMouseIdleTolerance, dwMouseIdleTimeout); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetOptions( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint uOptionsMask, - uint uOptionsValue) - { - 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 (RemoteFormWindowBase.Msg37_SetOptions); - RemoteFormWindowBase.Msg37_SetOptions* msg37SetOptionsPtr = (RemoteFormWindowBase.Msg37_SetOptions*) _priv_portUse.AllocMessageBuffer(size); - msg37SetOptionsPtr->_priv_size = size; - msg37SetOptionsPtr->_priv_msgid = 37U; - msg37SetOptionsPtr->uOptionsMask = uOptionsMask; - msg37SetOptionsPtr->uOptionsValue = uOptionsValue; - msg37SetOptionsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg37SetOptionsPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg37_SetOptions, typeof (RemoteFormWindowBase.Msg37_SetOptions), 0, 0); - _priv_pmsgUse = (Message*) msg37SetOptionsPtr; - } - - public unsafe void SendSetOptions(uint uOptionsMask, uint uOptionsValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetOptions(out _priv_portUse, out _priv_pmsgUse, uOptionsMask, uOptionsValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildCreateRootContainer( - 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 (RemoteFormWindowBase.Msg38_CreateRootContainer); - RemoteFormWindowBase.Msg38_CreateRootContainer* createRootContainerPtr = (RemoteFormWindowBase.Msg38_CreateRootContainer*) _priv_portUse.AllocMessageBuffer(size); - createRootContainerPtr->_priv_size = size; - createRootContainerPtr->_priv_msgid = 38U; - createRootContainerPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) createRootContainerPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg38_CreateRootContainer, typeof (RemoteFormWindowBase.Msg38_CreateRootContainer), 0, 0); - _priv_pmsgUse = (Message*) createRootContainerPtr; - } - - public unsafe void SendCreateRootContainer() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildCreateRootContainer(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteFormWindowBase CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteFormWindowBase(port, handle, true); - } - - public static RemoteFormWindowBase CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteFormWindowBase(port, handle, false); - } - - protected RemoteFormWindowBase(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteFormWindowBase(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteFormWindowBase && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg7_SetEdgeImageParts - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fActiveEdges; - public BLOBREF sModuleName; - public BLOBREF sResourceIdLeft; - public BLOBREF sResourceIdTop; - public BLOBREF sResourceIdRight; - public BLOBREF sResourceIdBottom; - public Inset insetSplits; - } - - [ComVisible(false)] - private struct Msg8_SetInitialPlacement - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint nShowState; - public Rectangle rcNormalPosition; - public Point ptMaxPosition; - } - - [ComVisible(false)] - private struct Msg9_RefreshHitTarget - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg10_ExitInternalDrag - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg11_EnterInternalDrag - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg12_SetDragDropResult - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint nDragOverResult; - public uint nDragDropResult; - } - - [ComVisible(false)] - private struct Msg13_EnableExternalDragDrop - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fEnable; - } - - [ComVisible(false)] - private struct Msg14_SetIcon - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF sModule; - public uint nResourceID; - public uint nOptions; - } - - [ComVisible(false)] - private struct Msg15_SetMaxResizeWidth - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nMaxResizeWidth; - } - - [ComVisible(false)] - private struct Msg16_SetMinResizeWidth - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nMinResizeWidth; - } - - [ComVisible(false)] - private struct Msg17_BringToTop - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg18_EnableShellShutdownHook - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF messageToHook; - public ushort uIdMsg; - } - - [ComVisible(false)] - private struct Msg19_UpdateForegroundLockState - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg20_SetAppNotifyWindow - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public HWND hwndAppNotify; - } - - [ComVisible(false)] - private struct Msg21_SetHitMasks - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint uMaskTraverse; - public uint uMaskHit; - public uint uMaskResult; - public uint uMaskClip; - } - - [ComVisible(false)] - private struct Msg22_SetCapture - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE hVisual; - public uint fState; - } - - [ComVisible(false)] - private struct Msg23_SetText - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF text; - } - - [ComVisible(false)] - private struct Msg24_Destroy - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg25_SetForeground - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fForce; - } - - [ComVisible(false)] - private struct Msg26_TakeFocus - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg27_ForceMouseIdle - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fIdle; - } - - [ComVisible(false)] - private struct Msg28_TemporarilyExitExclusiveMode - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg29_Restore - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg30_SetMode - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint uMode; - } - - [ComVisible(false)] - private struct Msg31_SetVisible - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fVisible; - } - - [ComVisible(false)] - private struct Msg32_SetPosition - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Point ptScreenPxl; - } - - [ComVisible(false)] - private struct Msg33_SetSize - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Size sizeClientPxl; - } - - [ComVisible(false)] - private struct Msg34_SetCursors - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idCursorNormal; - public int idCursorIdle; - } - - [ComVisible(false)] - private struct Msg35_SetStyles - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint uRst; - public uint uRstEx; - public uint uMin; - public uint uMinEx; - public uint uMax; - public uint uMaxEx; - public uint uFul; - public uint uFulEx; - } - - [ComVisible(false)] - private struct Msg36_SetMouseIdleOptions - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Size szMouseIdleTolerance; - public uint dwMouseIdleTimeout; - } - - [ComVisible(false)] - private struct Msg37_SetOptions - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint uOptionsMask; - public uint uOptionsValue; - } - - [ComVisible(false)] - private struct Msg38_CreateRootContainer - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; + internal class RemoteFormWindowBase : RemoteWindow + { + private static ushort[] s_priv_ByteOrder_Msg7_SetEdgeImageParts; + private static ushort[] s_priv_ByteOrder_Msg8_SetInitialPlacement; + private static ushort[] s_priv_ByteOrder_Msg9_RefreshHitTarget; + private static ushort[] s_priv_ByteOrder_Msg10_ExitInternalDrag; + private static ushort[] s_priv_ByteOrder_Msg11_EnterInternalDrag; + private static ushort[] s_priv_ByteOrder_Msg12_SetDragDropResult; + private static ushort[] s_priv_ByteOrder_Msg13_EnableExternalDragDrop; + private static ushort[] s_priv_ByteOrder_Msg14_SetIcon; + private static ushort[] s_priv_ByteOrder_Msg15_SetMaxResizeWidth; + private static ushort[] s_priv_ByteOrder_Msg16_SetMinResizeWidth; + private static ushort[] s_priv_ByteOrder_Msg17_BringToTop; + private static ushort[] s_priv_ByteOrder_Msg18_EnableShellShutdownHook; + private static ushort[] s_priv_ByteOrder_Msg19_UpdateForegroundLockState; + private static ushort[] s_priv_ByteOrder_Msg21_SetHitMasks; + private static ushort[] s_priv_ByteOrder_Msg22_SetCapture; + private static ushort[] s_priv_ByteOrder_Msg23_SetText; + private static ushort[] s_priv_ByteOrder_Msg24_Destroy; + private static ushort[] s_priv_ByteOrder_Msg25_SetForeground; + private static ushort[] s_priv_ByteOrder_Msg26_TakeFocus; + private static ushort[] s_priv_ByteOrder_Msg27_ForceMouseIdle; + private static ushort[] s_priv_ByteOrder_Msg28_TemporarilyExitExclusiveMode; + private static ushort[] s_priv_ByteOrder_Msg29_Restore; + private static ushort[] s_priv_ByteOrder_Msg30_SetMode; + private static ushort[] s_priv_ByteOrder_Msg31_SetVisible; + private static ushort[] s_priv_ByteOrder_Msg32_SetPosition; + private static ushort[] s_priv_ByteOrder_Msg33_SetSize; + private static ushort[] s_priv_ByteOrder_Msg34_SetCursors; + private static ushort[] s_priv_ByteOrder_Msg35_SetStyles; + private static ushort[] s_priv_ByteOrder_Msg36_SetMouseIdleOptions; + private static ushort[] s_priv_ByteOrder_Msg37_SetOptions; + private static ushort[] s_priv_ByteOrder_Msg38_CreateRootContainer; + + protected RemoteFormWindowBase() + { + } + + public unsafe void BuildSetEdgeImageParts( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fActiveEdges, + string sModuleName, + string sResourceIdLeft, + string sResourceIdTop, + string sResourceIdRight, + string sResourceIdBottom, + Inset insetSplits) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteFormWindowBase.Msg7_SetEdgeImageParts)); + BLOBREF blobref1 = blobInfo.Add(sModuleName); + BLOBREF blobref2 = blobInfo.Add(sResourceIdLeft); + BLOBREF blobref3 = blobInfo.Add(sResourceIdTop); + BLOBREF blobref4 = blobInfo.Add(sResourceIdRight); + BLOBREF blobref5 = blobInfo.Add(sResourceIdBottom); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteFormWindowBase.Msg7_SetEdgeImageParts* setEdgeImagePartsPtr = (RemoteFormWindowBase.Msg7_SetEdgeImageParts*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + setEdgeImagePartsPtr->_priv_size = adjustedTotalSize; + setEdgeImagePartsPtr->_priv_msgid = 7U; + setEdgeImagePartsPtr->fActiveEdges = fActiveEdges ? uint.MaxValue : 0U; + setEdgeImagePartsPtr->sModuleName = blobref1; + setEdgeImagePartsPtr->sResourceIdLeft = blobref2; + setEdgeImagePartsPtr->sResourceIdTop = blobref3; + setEdgeImagePartsPtr->sResourceIdRight = blobref4; + setEdgeImagePartsPtr->sResourceIdBottom = blobref5; + setEdgeImagePartsPtr->insetSplits = insetSplits; + blobInfo.Attach((Message*)setEdgeImagePartsPtr); + setEdgeImagePartsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setEdgeImagePartsPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg7_SetEdgeImageParts, typeof(RemoteFormWindowBase.Msg7_SetEdgeImageParts), 0, 0); + _priv_pmsgUse = (Message*)setEdgeImagePartsPtr; + } + + public unsafe void SendSetEdgeImageParts( + bool fActiveEdges, + string sModuleName, + string sResourceIdLeft, + string sResourceIdTop, + string sResourceIdRight, + string sResourceIdBottom, + Inset insetSplits) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetEdgeImageParts(out _priv_portUse, out _priv_pmsgUse, fActiveEdges, sModuleName, sResourceIdLeft, sResourceIdTop, sResourceIdRight, sResourceIdBottom, insetSplits); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetInitialPlacement( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint nShowState, + Rectangle rcNormalPosition, + Point ptMaxPosition) + { + 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(RemoteFormWindowBase.Msg8_SetInitialPlacement); + RemoteFormWindowBase.Msg8_SetInitialPlacement* initialPlacementPtr = (RemoteFormWindowBase.Msg8_SetInitialPlacement*)_priv_portUse.AllocMessageBuffer(size); + initialPlacementPtr->_priv_size = size; + initialPlacementPtr->_priv_msgid = 8U; + initialPlacementPtr->nShowState = nShowState; + initialPlacementPtr->rcNormalPosition = rcNormalPosition; + initialPlacementPtr->ptMaxPosition = ptMaxPosition; + initialPlacementPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)initialPlacementPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg8_SetInitialPlacement, typeof(RemoteFormWindowBase.Msg8_SetInitialPlacement), 0, 0); + _priv_pmsgUse = (Message*)initialPlacementPtr; + } + + public unsafe void SendSetInitialPlacement( + uint nShowState, + Rectangle rcNormalPosition, + Point ptMaxPosition) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetInitialPlacement(out _priv_portUse, out _priv_pmsgUse, nShowState, rcNormalPosition, ptMaxPosition); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRefreshHitTarget( + 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(RemoteFormWindowBase.Msg9_RefreshHitTarget); + RemoteFormWindowBase.Msg9_RefreshHitTarget* refreshHitTargetPtr = (RemoteFormWindowBase.Msg9_RefreshHitTarget*)_priv_portUse.AllocMessageBuffer(size); + refreshHitTargetPtr->_priv_size = size; + refreshHitTargetPtr->_priv_msgid = 9U; + refreshHitTargetPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)refreshHitTargetPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg9_RefreshHitTarget, typeof(RemoteFormWindowBase.Msg9_RefreshHitTarget), 0, 0); + _priv_pmsgUse = (Message*)refreshHitTargetPtr; + } + + public unsafe void SendRefreshHitTarget() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRefreshHitTarget(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildExitInternalDrag( + 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(RemoteFormWindowBase.Msg10_ExitInternalDrag); + RemoteFormWindowBase.Msg10_ExitInternalDrag* exitInternalDragPtr = (RemoteFormWindowBase.Msg10_ExitInternalDrag*)_priv_portUse.AllocMessageBuffer(size); + exitInternalDragPtr->_priv_size = size; + exitInternalDragPtr->_priv_msgid = 10U; + exitInternalDragPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)exitInternalDragPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg10_ExitInternalDrag, typeof(RemoteFormWindowBase.Msg10_ExitInternalDrag), 0, 0); + _priv_pmsgUse = (Message*)exitInternalDragPtr; + } + + public unsafe void SendExitInternalDrag() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildExitInternalDrag(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildEnterInternalDrag( + 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(RemoteFormWindowBase.Msg11_EnterInternalDrag); + RemoteFormWindowBase.Msg11_EnterInternalDrag* enterInternalDragPtr = (RemoteFormWindowBase.Msg11_EnterInternalDrag*)_priv_portUse.AllocMessageBuffer(size); + enterInternalDragPtr->_priv_size = size; + enterInternalDragPtr->_priv_msgid = 11U; + enterInternalDragPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)enterInternalDragPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg11_EnterInternalDrag, typeof(RemoteFormWindowBase.Msg11_EnterInternalDrag), 0, 0); + _priv_pmsgUse = (Message*)enterInternalDragPtr; + } + + public unsafe void SendEnterInternalDrag() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildEnterInternalDrag(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetDragDropResult( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint nDragOverResult, + uint nDragDropResult) + { + 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(RemoteFormWindowBase.Msg12_SetDragDropResult); + RemoteFormWindowBase.Msg12_SetDragDropResult* setDragDropResultPtr = (RemoteFormWindowBase.Msg12_SetDragDropResult*)_priv_portUse.AllocMessageBuffer(size); + setDragDropResultPtr->_priv_size = size; + setDragDropResultPtr->_priv_msgid = 12U; + setDragDropResultPtr->nDragOverResult = nDragOverResult; + setDragDropResultPtr->nDragDropResult = nDragDropResult; + setDragDropResultPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setDragDropResultPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg12_SetDragDropResult, typeof(RemoteFormWindowBase.Msg12_SetDragDropResult), 0, 0); + _priv_pmsgUse = (Message*)setDragDropResultPtr; + } + + public unsafe void SendSetDragDropResult(uint nDragOverResult, uint nDragDropResult) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetDragDropResult(out _priv_portUse, out _priv_pmsgUse, nDragOverResult, nDragDropResult); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildEnableExternalDragDrop( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fEnable) + { + 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(RemoteFormWindowBase.Msg13_EnableExternalDragDrop); + RemoteFormWindowBase.Msg13_EnableExternalDragDrop* externalDragDropPtr = (RemoteFormWindowBase.Msg13_EnableExternalDragDrop*)_priv_portUse.AllocMessageBuffer(size); + externalDragDropPtr->_priv_size = size; + externalDragDropPtr->_priv_msgid = 13U; + externalDragDropPtr->fEnable = fEnable ? uint.MaxValue : 0U; + externalDragDropPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)externalDragDropPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg13_EnableExternalDragDrop, typeof(RemoteFormWindowBase.Msg13_EnableExternalDragDrop), 0, 0); + _priv_pmsgUse = (Message*)externalDragDropPtr; + } + + public unsafe void SendEnableExternalDragDrop(bool fEnable) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildEnableExternalDragDrop(out _priv_portUse, out _priv_pmsgUse, fEnable); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetIcon( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string sModule, + uint nResourceID, + uint nOptions) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteFormWindowBase.Msg14_SetIcon)); + BLOBREF blobref = blobInfo.Add(sModule); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteFormWindowBase.Msg14_SetIcon* msg14SetIconPtr = (RemoteFormWindowBase.Msg14_SetIcon*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg14SetIconPtr->_priv_size = adjustedTotalSize; + msg14SetIconPtr->_priv_msgid = 14U; + msg14SetIconPtr->sModule = blobref; + msg14SetIconPtr->nResourceID = nResourceID; + msg14SetIconPtr->nOptions = nOptions; + blobInfo.Attach((Message*)msg14SetIconPtr); + msg14SetIconPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg14SetIconPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg14_SetIcon, typeof(RemoteFormWindowBase.Msg14_SetIcon), 0, 0); + _priv_pmsgUse = (Message*)msg14SetIconPtr; + } + + public unsafe void SendSetIcon(string sModule, uint nResourceID, uint nOptions) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetIcon(out _priv_portUse, out _priv_pmsgUse, sModule, nResourceID, nOptions); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetMaxResizeWidth( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nMaxResizeWidth) + { + 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(RemoteFormWindowBase.Msg15_SetMaxResizeWidth); + RemoteFormWindowBase.Msg15_SetMaxResizeWidth* setMaxResizeWidthPtr = (RemoteFormWindowBase.Msg15_SetMaxResizeWidth*)_priv_portUse.AllocMessageBuffer(size); + setMaxResizeWidthPtr->_priv_size = size; + setMaxResizeWidthPtr->_priv_msgid = 15U; + setMaxResizeWidthPtr->nMaxResizeWidth = nMaxResizeWidth; + setMaxResizeWidthPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setMaxResizeWidthPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg15_SetMaxResizeWidth, typeof(RemoteFormWindowBase.Msg15_SetMaxResizeWidth), 0, 0); + _priv_pmsgUse = (Message*)setMaxResizeWidthPtr; + } + + public unsafe void SendSetMaxResizeWidth(int nMaxResizeWidth) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetMaxResizeWidth(out _priv_portUse, out _priv_pmsgUse, nMaxResizeWidth); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetMinResizeWidth( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nMinResizeWidth) + { + 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(RemoteFormWindowBase.Msg16_SetMinResizeWidth); + RemoteFormWindowBase.Msg16_SetMinResizeWidth* setMinResizeWidthPtr = (RemoteFormWindowBase.Msg16_SetMinResizeWidth*)_priv_portUse.AllocMessageBuffer(size); + setMinResizeWidthPtr->_priv_size = size; + setMinResizeWidthPtr->_priv_msgid = 16U; + setMinResizeWidthPtr->nMinResizeWidth = nMinResizeWidth; + setMinResizeWidthPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setMinResizeWidthPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg16_SetMinResizeWidth, typeof(RemoteFormWindowBase.Msg16_SetMinResizeWidth), 0, 0); + _priv_pmsgUse = (Message*)setMinResizeWidthPtr; + } + + public unsafe void SendSetMinResizeWidth(int nMinResizeWidth) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetMinResizeWidth(out _priv_portUse, out _priv_pmsgUse, nMinResizeWidth); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildBringToTop(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(RemoteFormWindowBase.Msg17_BringToTop); + RemoteFormWindowBase.Msg17_BringToTop* msg17BringToTopPtr = (RemoteFormWindowBase.Msg17_BringToTop*)_priv_portUse.AllocMessageBuffer(size); + msg17BringToTopPtr->_priv_size = size; + msg17BringToTopPtr->_priv_msgid = 17U; + msg17BringToTopPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg17BringToTopPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg17_BringToTop, typeof(RemoteFormWindowBase.Msg17_BringToTop), 0, 0); + _priv_pmsgUse = (Message*)msg17BringToTopPtr; + } + + public unsafe void SendBringToTop() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildBringToTop(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildEnableShellShutdownHook( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string messageToHook, + ushort uIdMsg) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteFormWindowBase.Msg18_EnableShellShutdownHook)); + BLOBREF blobref = blobInfo.Add(messageToHook); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteFormWindowBase.Msg18_EnableShellShutdownHook* shellShutdownHookPtr = (RemoteFormWindowBase.Msg18_EnableShellShutdownHook*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + shellShutdownHookPtr->_priv_size = adjustedTotalSize; + shellShutdownHookPtr->_priv_msgid = 18U; + shellShutdownHookPtr->messageToHook = blobref; + shellShutdownHookPtr->uIdMsg = uIdMsg; + blobInfo.Attach((Message*)shellShutdownHookPtr); + shellShutdownHookPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)shellShutdownHookPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg18_EnableShellShutdownHook, typeof(RemoteFormWindowBase.Msg18_EnableShellShutdownHook), 0, 0); + _priv_pmsgUse = (Message*)shellShutdownHookPtr; + } + + public unsafe void SendEnableShellShutdownHook(string messageToHook, ushort uIdMsg) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildEnableShellShutdownHook(out _priv_portUse, out _priv_pmsgUse, messageToHook, uIdMsg); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildUpdateForegroundLockState( + 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(RemoteFormWindowBase.Msg19_UpdateForegroundLockState); + RemoteFormWindowBase.Msg19_UpdateForegroundLockState* foregroundLockStatePtr = (RemoteFormWindowBase.Msg19_UpdateForegroundLockState*)_priv_portUse.AllocMessageBuffer(size); + foregroundLockStatePtr->_priv_size = size; + foregroundLockStatePtr->_priv_msgid = 19U; + foregroundLockStatePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)foregroundLockStatePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg19_UpdateForegroundLockState, typeof(RemoteFormWindowBase.Msg19_UpdateForegroundLockState), 0, 0); + _priv_pmsgUse = (Message*)foregroundLockStatePtr; + } + + public unsafe void SendUpdateForegroundLockState() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildUpdateForegroundLockState(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void INPROC_BuildSetAppNotifyWindow( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + HWND hwndAppNotify) + { + 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(RemoteFormWindowBase.Msg20_SetAppNotifyWindow); + RemoteFormWindowBase.Msg20_SetAppNotifyWindow* setAppNotifyWindowPtr = (RemoteFormWindowBase.Msg20_SetAppNotifyWindow*)_priv_portUse.AllocMessageBuffer(size); + setAppNotifyWindowPtr->_priv_size = size; + setAppNotifyWindowPtr->_priv_msgid = 20U; + setAppNotifyWindowPtr->hwndAppNotify = hwndAppNotify; + setAppNotifyWindowPtr->_priv_idObjectSubject = this.m_renderHandle; + _priv_pmsgUse = (Message*)setAppNotifyWindowPtr; + } + + public unsafe void INPROC_SendSetAppNotifyWindow(HWND hwndAppNotify) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.INPROC_BuildSetAppNotifyWindow(out _priv_portUse, out _priv_pmsgUse, hwndAppNotify); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetHitMasks( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint uMaskTraverse, + uint uMaskHit, + uint uMaskResult, + uint uMaskClip) + { + 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(RemoteFormWindowBase.Msg21_SetHitMasks); + RemoteFormWindowBase.Msg21_SetHitMasks* msg21SetHitMasksPtr = (RemoteFormWindowBase.Msg21_SetHitMasks*)_priv_portUse.AllocMessageBuffer(size); + msg21SetHitMasksPtr->_priv_size = size; + msg21SetHitMasksPtr->_priv_msgid = 21U; + msg21SetHitMasksPtr->uMaskTraverse = uMaskTraverse; + msg21SetHitMasksPtr->uMaskHit = uMaskHit; + msg21SetHitMasksPtr->uMaskResult = uMaskResult; + msg21SetHitMasksPtr->uMaskClip = uMaskClip; + msg21SetHitMasksPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg21SetHitMasksPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg21_SetHitMasks, typeof(RemoteFormWindowBase.Msg21_SetHitMasks), 0, 0); + _priv_pmsgUse = (Message*)msg21SetHitMasksPtr; + } + + public unsafe void SendSetHitMasks( + uint uMaskTraverse, + uint uMaskHit, + uint uMaskResult, + uint uMaskClip) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetHitMasks(out _priv_portUse, out _priv_pmsgUse, uMaskTraverse, uMaskHit, uMaskResult, uMaskClip); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetCapture( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteVisual hVisual, + bool fState) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + if (hVisual != null) + _priv_portUse.ValidateHandleOrNull(hVisual.RenderHandle); + uint size = (uint)sizeof(RemoteFormWindowBase.Msg22_SetCapture); + RemoteFormWindowBase.Msg22_SetCapture* msg22SetCapturePtr = (RemoteFormWindowBase.Msg22_SetCapture*)_priv_portUse.AllocMessageBuffer(size); + msg22SetCapturePtr->_priv_size = size; + msg22SetCapturePtr->_priv_msgid = 22U; + msg22SetCapturePtr->hVisual = hVisual != null ? hVisual.RenderHandle : RENDERHANDLE.NULL; + msg22SetCapturePtr->fState = fState ? uint.MaxValue : 0U; + msg22SetCapturePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg22SetCapturePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg22_SetCapture, typeof(RemoteFormWindowBase.Msg22_SetCapture), 0, 0); + _priv_pmsgUse = (Message*)msg22SetCapturePtr; + } + + public unsafe void SendSetCapture(RemoteVisual hVisual, bool fState) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetCapture(out _priv_portUse, out _priv_pmsgUse, hVisual, fState); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetText( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string text) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteFormWindowBase.Msg23_SetText)); + BLOBREF blobref = blobInfo.Add(text); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteFormWindowBase.Msg23_SetText* msg23SetTextPtr = (RemoteFormWindowBase.Msg23_SetText*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg23SetTextPtr->_priv_size = adjustedTotalSize; + msg23SetTextPtr->_priv_msgid = 23U; + msg23SetTextPtr->text = blobref; + blobInfo.Attach((Message*)msg23SetTextPtr); + msg23SetTextPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg23SetTextPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg23_SetText, typeof(RemoteFormWindowBase.Msg23_SetText), 0, 0); + _priv_pmsgUse = (Message*)msg23SetTextPtr; + } + + public unsafe void SendSetText(string text) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetText(out _priv_portUse, out _priv_pmsgUse, text); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildDestroy(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(RemoteFormWindowBase.Msg24_Destroy); + RemoteFormWindowBase.Msg24_Destroy* msg24DestroyPtr = (RemoteFormWindowBase.Msg24_Destroy*)_priv_portUse.AllocMessageBuffer(size); + msg24DestroyPtr->_priv_size = size; + msg24DestroyPtr->_priv_msgid = 24U; + msg24DestroyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg24DestroyPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg24_Destroy, typeof(RemoteFormWindowBase.Msg24_Destroy), 0, 0); + _priv_pmsgUse = (Message*)msg24DestroyPtr; + } + + public unsafe void SendDestroy() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildDestroy(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetForeground( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fForce) + { + 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(RemoteFormWindowBase.Msg25_SetForeground); + RemoteFormWindowBase.Msg25_SetForeground* msg25SetForegroundPtr = (RemoteFormWindowBase.Msg25_SetForeground*)_priv_portUse.AllocMessageBuffer(size); + msg25SetForegroundPtr->_priv_size = size; + msg25SetForegroundPtr->_priv_msgid = 25U; + msg25SetForegroundPtr->fForce = fForce ? uint.MaxValue : 0U; + msg25SetForegroundPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg25SetForegroundPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg25_SetForeground, typeof(RemoteFormWindowBase.Msg25_SetForeground), 0, 0); + _priv_pmsgUse = (Message*)msg25SetForegroundPtr; + } + + public unsafe void SendSetForeground(bool fForce) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetForeground(out _priv_portUse, out _priv_pmsgUse, fForce); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildTakeFocus(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(RemoteFormWindowBase.Msg26_TakeFocus); + RemoteFormWindowBase.Msg26_TakeFocus* msg26TakeFocusPtr = (RemoteFormWindowBase.Msg26_TakeFocus*)_priv_portUse.AllocMessageBuffer(size); + msg26TakeFocusPtr->_priv_size = size; + msg26TakeFocusPtr->_priv_msgid = 26U; + msg26TakeFocusPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg26TakeFocusPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg26_TakeFocus, typeof(RemoteFormWindowBase.Msg26_TakeFocus), 0, 0); + _priv_pmsgUse = (Message*)msg26TakeFocusPtr; + } + + public unsafe void SendTakeFocus() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildTakeFocus(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildForceMouseIdle( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fIdle) + { + 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(RemoteFormWindowBase.Msg27_ForceMouseIdle); + RemoteFormWindowBase.Msg27_ForceMouseIdle* msg27ForceMouseIdlePtr = (RemoteFormWindowBase.Msg27_ForceMouseIdle*)_priv_portUse.AllocMessageBuffer(size); + msg27ForceMouseIdlePtr->_priv_size = size; + msg27ForceMouseIdlePtr->_priv_msgid = 27U; + msg27ForceMouseIdlePtr->fIdle = fIdle ? uint.MaxValue : 0U; + msg27ForceMouseIdlePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg27ForceMouseIdlePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg27_ForceMouseIdle, typeof(RemoteFormWindowBase.Msg27_ForceMouseIdle), 0, 0); + _priv_pmsgUse = (Message*)msg27ForceMouseIdlePtr; + } + + public unsafe void SendForceMouseIdle(bool fIdle) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildForceMouseIdle(out _priv_portUse, out _priv_pmsgUse, fIdle); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildTemporarilyExitExclusiveMode( + 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(RemoteFormWindowBase.Msg28_TemporarilyExitExclusiveMode); + RemoteFormWindowBase.Msg28_TemporarilyExitExclusiveMode* exitExclusiveModePtr = (RemoteFormWindowBase.Msg28_TemporarilyExitExclusiveMode*)_priv_portUse.AllocMessageBuffer(size); + exitExclusiveModePtr->_priv_size = size; + exitExclusiveModePtr->_priv_msgid = 28U; + exitExclusiveModePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)exitExclusiveModePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg28_TemporarilyExitExclusiveMode, typeof(RemoteFormWindowBase.Msg28_TemporarilyExitExclusiveMode), 0, 0); + _priv_pmsgUse = (Message*)exitExclusiveModePtr; + } + + public unsafe void SendTemporarilyExitExclusiveMode() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildTemporarilyExitExclusiveMode(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRestore(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(RemoteFormWindowBase.Msg29_Restore); + RemoteFormWindowBase.Msg29_Restore* msg29RestorePtr = (RemoteFormWindowBase.Msg29_Restore*)_priv_portUse.AllocMessageBuffer(size); + msg29RestorePtr->_priv_size = size; + msg29RestorePtr->_priv_msgid = 29U; + msg29RestorePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg29RestorePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg29_Restore, typeof(RemoteFormWindowBase.Msg29_Restore), 0, 0); + _priv_pmsgUse = (Message*)msg29RestorePtr; + } + + public unsafe void SendRestore() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRestore(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetMode( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint uMode) + { + 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(RemoteFormWindowBase.Msg30_SetMode); + RemoteFormWindowBase.Msg30_SetMode* msg30SetModePtr = (RemoteFormWindowBase.Msg30_SetMode*)_priv_portUse.AllocMessageBuffer(size); + msg30SetModePtr->_priv_size = size; + msg30SetModePtr->_priv_msgid = 30U; + msg30SetModePtr->uMode = uMode; + msg30SetModePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg30SetModePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg30_SetMode, typeof(RemoteFormWindowBase.Msg30_SetMode), 0, 0); + _priv_pmsgUse = (Message*)msg30SetModePtr; + } + + public unsafe void SendSetMode(uint uMode) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetMode(out _priv_portUse, out _priv_pmsgUse, uMode); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetVisible( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fVisible) + { + 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(RemoteFormWindowBase.Msg31_SetVisible); + RemoteFormWindowBase.Msg31_SetVisible* msg31SetVisiblePtr = (RemoteFormWindowBase.Msg31_SetVisible*)_priv_portUse.AllocMessageBuffer(size); + msg31SetVisiblePtr->_priv_size = size; + msg31SetVisiblePtr->_priv_msgid = 31U; + msg31SetVisiblePtr->fVisible = fVisible ? uint.MaxValue : 0U; + msg31SetVisiblePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg31SetVisiblePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg31_SetVisible, typeof(RemoteFormWindowBase.Msg31_SetVisible), 0, 0); + _priv_pmsgUse = (Message*)msg31SetVisiblePtr; + } + + public unsafe void SendSetVisible(bool fVisible) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetVisible(out _priv_portUse, out _priv_pmsgUse, fVisible); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetPosition( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Point ptScreenPxl) + { + 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(RemoteFormWindowBase.Msg32_SetPosition); + RemoteFormWindowBase.Msg32_SetPosition* msg32SetPositionPtr = (RemoteFormWindowBase.Msg32_SetPosition*)_priv_portUse.AllocMessageBuffer(size); + msg32SetPositionPtr->_priv_size = size; + msg32SetPositionPtr->_priv_msgid = 32U; + msg32SetPositionPtr->ptScreenPxl = ptScreenPxl; + msg32SetPositionPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg32SetPositionPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg32_SetPosition, typeof(RemoteFormWindowBase.Msg32_SetPosition), 0, 0); + _priv_pmsgUse = (Message*)msg32SetPositionPtr; + } + + public unsafe void SendSetPosition(Point ptScreenPxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetPosition(out _priv_portUse, out _priv_pmsgUse, ptScreenPxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetSize( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Size sizeClientPxl) + { + 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(RemoteFormWindowBase.Msg33_SetSize); + RemoteFormWindowBase.Msg33_SetSize* msg33SetSizePtr = (RemoteFormWindowBase.Msg33_SetSize*)_priv_portUse.AllocMessageBuffer(size); + msg33SetSizePtr->_priv_size = size; + msg33SetSizePtr->_priv_msgid = 33U; + msg33SetSizePtr->sizeClientPxl = sizeClientPxl; + msg33SetSizePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg33SetSizePtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg33_SetSize, typeof(RemoteFormWindowBase.Msg33_SetSize), 0, 0); + _priv_pmsgUse = (Message*)msg33SetSizePtr; + } + + public unsafe void SendSetSize(Size sizeClientPxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetSize(out _priv_portUse, out _priv_pmsgUse, sizeClientPxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetCursors( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idCursorNormal, + int idCursorIdle) + { + 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(RemoteFormWindowBase.Msg34_SetCursors); + RemoteFormWindowBase.Msg34_SetCursors* msg34SetCursorsPtr = (RemoteFormWindowBase.Msg34_SetCursors*)_priv_portUse.AllocMessageBuffer(size); + msg34SetCursorsPtr->_priv_size = size; + msg34SetCursorsPtr->_priv_msgid = 34U; + msg34SetCursorsPtr->idCursorNormal = idCursorNormal; + msg34SetCursorsPtr->idCursorIdle = idCursorIdle; + msg34SetCursorsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg34SetCursorsPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg34_SetCursors, typeof(RemoteFormWindowBase.Msg34_SetCursors), 0, 0); + _priv_pmsgUse = (Message*)msg34SetCursorsPtr; + } + + public unsafe void SendSetCursors(int idCursorNormal, int idCursorIdle) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetCursors(out _priv_portUse, out _priv_pmsgUse, idCursorNormal, idCursorIdle); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetStyles( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint uRst, + uint uRstEx, + uint uMin, + uint uMinEx, + uint uMax, + uint uMaxEx, + uint uFul, + uint uFulEx) + { + 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(RemoteFormWindowBase.Msg35_SetStyles); + RemoteFormWindowBase.Msg35_SetStyles* msg35SetStylesPtr = (RemoteFormWindowBase.Msg35_SetStyles*)_priv_portUse.AllocMessageBuffer(size); + msg35SetStylesPtr->_priv_size = size; + msg35SetStylesPtr->_priv_msgid = 35U; + msg35SetStylesPtr->uRst = uRst; + msg35SetStylesPtr->uRstEx = uRstEx; + msg35SetStylesPtr->uMin = uMin; + msg35SetStylesPtr->uMinEx = uMinEx; + msg35SetStylesPtr->uMax = uMax; + msg35SetStylesPtr->uMaxEx = uMaxEx; + msg35SetStylesPtr->uFul = uFul; + msg35SetStylesPtr->uFulEx = uFulEx; + msg35SetStylesPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg35SetStylesPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg35_SetStyles, typeof(RemoteFormWindowBase.Msg35_SetStyles), 0, 0); + _priv_pmsgUse = (Message*)msg35SetStylesPtr; + } + + public unsafe void SendSetStyles( + uint uRst, + uint uRstEx, + uint uMin, + uint uMinEx, + uint uMax, + uint uMaxEx, + uint uFul, + uint uFulEx) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetStyles(out _priv_portUse, out _priv_pmsgUse, uRst, uRstEx, uMin, uMinEx, uMax, uMaxEx, uFul, uFulEx); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetMouseIdleOptions( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Size szMouseIdleTolerance, + uint dwMouseIdleTimeout) + { + 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(RemoteFormWindowBase.Msg36_SetMouseIdleOptions); + RemoteFormWindowBase.Msg36_SetMouseIdleOptions* mouseIdleOptionsPtr = (RemoteFormWindowBase.Msg36_SetMouseIdleOptions*)_priv_portUse.AllocMessageBuffer(size); + mouseIdleOptionsPtr->_priv_size = size; + mouseIdleOptionsPtr->_priv_msgid = 36U; + mouseIdleOptionsPtr->szMouseIdleTolerance = szMouseIdleTolerance; + mouseIdleOptionsPtr->dwMouseIdleTimeout = dwMouseIdleTimeout; + mouseIdleOptionsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)mouseIdleOptionsPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg36_SetMouseIdleOptions, typeof(RemoteFormWindowBase.Msg36_SetMouseIdleOptions), 0, 0); + _priv_pmsgUse = (Message*)mouseIdleOptionsPtr; + } + + public unsafe void SendSetMouseIdleOptions(Size szMouseIdleTolerance, uint dwMouseIdleTimeout) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetMouseIdleOptions(out _priv_portUse, out _priv_pmsgUse, szMouseIdleTolerance, dwMouseIdleTimeout); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetOptions( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint uOptionsMask, + uint uOptionsValue) + { + 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(RemoteFormWindowBase.Msg37_SetOptions); + RemoteFormWindowBase.Msg37_SetOptions* msg37SetOptionsPtr = (RemoteFormWindowBase.Msg37_SetOptions*)_priv_portUse.AllocMessageBuffer(size); + msg37SetOptionsPtr->_priv_size = size; + msg37SetOptionsPtr->_priv_msgid = 37U; + msg37SetOptionsPtr->uOptionsMask = uOptionsMask; + msg37SetOptionsPtr->uOptionsValue = uOptionsValue; + msg37SetOptionsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg37SetOptionsPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg37_SetOptions, typeof(RemoteFormWindowBase.Msg37_SetOptions), 0, 0); + _priv_pmsgUse = (Message*)msg37SetOptionsPtr; + } + + public unsafe void SendSetOptions(uint uOptionsMask, uint uOptionsValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetOptions(out _priv_portUse, out _priv_pmsgUse, uOptionsMask, uOptionsValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildCreateRootContainer( + 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(RemoteFormWindowBase.Msg38_CreateRootContainer); + RemoteFormWindowBase.Msg38_CreateRootContainer* createRootContainerPtr = (RemoteFormWindowBase.Msg38_CreateRootContainer*)_priv_portUse.AllocMessageBuffer(size); + createRootContainerPtr->_priv_size = size; + createRootContainerPtr->_priv_msgid = 38U; + createRootContainerPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)createRootContainerPtr, ref RemoteFormWindowBase.s_priv_ByteOrder_Msg38_CreateRootContainer, typeof(RemoteFormWindowBase.Msg38_CreateRootContainer), 0, 0); + _priv_pmsgUse = (Message*)createRootContainerPtr; + } + + public unsafe void SendCreateRootContainer() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildCreateRootContainer(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteFormWindowBase CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteFormWindowBase(port, handle, true); + } + + public static RemoteFormWindowBase CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteFormWindowBase(port, handle, false); + } + + protected RemoteFormWindowBase(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteFormWindowBase(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteFormWindowBase && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg7_SetEdgeImageParts + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fActiveEdges; + public BLOBREF sModuleName; + public BLOBREF sResourceIdLeft; + public BLOBREF sResourceIdTop; + public BLOBREF sResourceIdRight; + public BLOBREF sResourceIdBottom; + public Inset insetSplits; + } + + [ComVisible(false)] + private struct Msg8_SetInitialPlacement + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint nShowState; + public Rectangle rcNormalPosition; + public Point ptMaxPosition; + } + + [ComVisible(false)] + private struct Msg9_RefreshHitTarget + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg10_ExitInternalDrag + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg11_EnterInternalDrag + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg12_SetDragDropResult + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint nDragOverResult; + public uint nDragDropResult; + } + + [ComVisible(false)] + private struct Msg13_EnableExternalDragDrop + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fEnable; + } + + [ComVisible(false)] + private struct Msg14_SetIcon + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF sModule; + public uint nResourceID; + public uint nOptions; + } + + [ComVisible(false)] + private struct Msg15_SetMaxResizeWidth + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nMaxResizeWidth; + } + + [ComVisible(false)] + private struct Msg16_SetMinResizeWidth + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nMinResizeWidth; + } + + [ComVisible(false)] + private struct Msg17_BringToTop + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg18_EnableShellShutdownHook + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF messageToHook; + public ushort uIdMsg; + } + + [ComVisible(false)] + private struct Msg19_UpdateForegroundLockState + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg20_SetAppNotifyWindow + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public HWND hwndAppNotify; + } + + [ComVisible(false)] + private struct Msg21_SetHitMasks + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint uMaskTraverse; + public uint uMaskHit; + public uint uMaskResult; + public uint uMaskClip; + } + + [ComVisible(false)] + private struct Msg22_SetCapture + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE hVisual; + public uint fState; + } + + [ComVisible(false)] + private struct Msg23_SetText + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF text; + } + + [ComVisible(false)] + private struct Msg24_Destroy + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg25_SetForeground + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fForce; + } + + [ComVisible(false)] + private struct Msg26_TakeFocus + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg27_ForceMouseIdle + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fIdle; + } + + [ComVisible(false)] + private struct Msg28_TemporarilyExitExclusiveMode + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg29_Restore + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg30_SetMode + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint uMode; + } + + [ComVisible(false)] + private struct Msg31_SetVisible + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fVisible; + } + + [ComVisible(false)] + private struct Msg32_SetPosition + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Point ptScreenPxl; + } + + [ComVisible(false)] + private struct Msg33_SetSize + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Size sizeClientPxl; + } + + [ComVisible(false)] + private struct Msg34_SetCursors + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idCursorNormal; + public int idCursorIdle; + } + + [ComVisible(false)] + private struct Msg35_SetStyles + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint uRst; + public uint uRstEx; + public uint uMin; + public uint uMinEx; + public uint uMax; + public uint uMaxEx; + public uint uFul; + public uint uFulEx; + } + + [ComVisible(false)] + private struct Msg36_SetMouseIdleOptions + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Size szMouseIdleTolerance; + public uint dwMouseIdleTimeout; + } + + [ComVisible(false)] + private struct Msg37_SetOptions + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint uOptionsMask; + public uint uOptionsValue; + } + + [ComVisible(false)] + private struct Msg38_CreateRootContainer + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteInputRouter.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteInputRouter.cs index 776a887..e026c03 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteInputRouter.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/RemoteInputRouter.cs @@ -10,149 +10,149 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop { - internal class RemoteInputRouter : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg2_Create; - private static ushort[] s_priv_ByteOrder_Msg0_UnRegisterWithInputSource; - private static ushort[] s_priv_ByteOrder_Msg1_RegisterWithInputSource; - - protected RemoteInputRouter() + internal class RemoteInputRouter : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg2_Create; + private static ushort[] s_priv_ByteOrder_Msg0_UnRegisterWithInputSource; + private static ushort[] s_priv_ByteOrder_Msg1_RegisterWithInputSource; + + protected RemoteInputRouter() + { + } + + public static unsafe RemoteInputRouter Create( + ProtocolSplashDesktop _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + LocalInputCallback ic) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE routerClassHandle = _priv_protocolInstance.InputRouter_ClassHandle; + RemoteInputRouter remoteInputRouter = new RemoteInputRouter(port, _priv_owner); + uint num = (uint)sizeof(RemoteInputRouter.Msg2_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteInputRouter.Msg2_Create* msg2CreatePtr = (RemoteInputRouter.Msg2_Create*)pMem; + msg2CreatePtr->_priv_size = num; + msg2CreatePtr->_priv_msgid = 2U; + msg2CreatePtr->_priv_objic = ic.RenderHandle; + msg2CreatePtr->_priv_ctxic = port.Session.LocalContext; + msg2CreatePtr->_priv_idObjectSubject = remoteInputRouter.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteInputRouter.s_priv_ByteOrder_Msg2_Create, typeof(RemoteInputRouter.Msg2_Create), 0, 0); + port.CreateRemoteObject(routerClassHandle, remoteInputRouter.m_renderHandle, (Message*)msg2CreatePtr); + return remoteInputRouter; + } + + public unsafe void BuildUnRegisterWithInputSource( + 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(RemoteInputRouter.Msg0_UnRegisterWithInputSource); + RemoteInputRouter.Msg0_UnRegisterWithInputSource* registerWithInputSourcePtr = (RemoteInputRouter.Msg0_UnRegisterWithInputSource*)_priv_portUse.AllocMessageBuffer(size); + registerWithInputSourcePtr->_priv_size = size; + registerWithInputSourcePtr->_priv_msgid = 0U; + registerWithInputSourcePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)registerWithInputSourcePtr, ref RemoteInputRouter.s_priv_ByteOrder_Msg0_UnRegisterWithInputSource, typeof(RemoteInputRouter.Msg0_UnRegisterWithInputSource), 0, 0); + _priv_pmsgUse = (Message*)registerWithInputSourcePtr; + } + + public unsafe void SendUnRegisterWithInputSource() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildUnRegisterWithInputSource(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRegisterWithInputSource( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint idGroup, + RENDERHANDLE idSource) + { + 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(RemoteInputRouter.Msg1_RegisterWithInputSource); + RemoteInputRouter.Msg1_RegisterWithInputSource* registerWithInputSourcePtr = (RemoteInputRouter.Msg1_RegisterWithInputSource*)_priv_portUse.AllocMessageBuffer(size); + registerWithInputSourcePtr->_priv_size = size; + registerWithInputSourcePtr->_priv_msgid = 1U; + registerWithInputSourcePtr->idGroup = idGroup; + registerWithInputSourcePtr->idSource = idSource; + registerWithInputSourcePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)registerWithInputSourcePtr, ref RemoteInputRouter.s_priv_ByteOrder_Msg1_RegisterWithInputSource, typeof(RemoteInputRouter.Msg1_RegisterWithInputSource), 0, 0); + _priv_pmsgUse = (Message*)registerWithInputSourcePtr; + } + + public unsafe void SendRegisterWithInputSource(uint idGroup, RENDERHANDLE idSource) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRegisterWithInputSource(out _priv_portUse, out _priv_pmsgUse, idGroup, idSource); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteInputRouter CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteInputRouter(port, handle, true); + } + + public static RemoteInputRouter CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteInputRouter(port, handle, false); + } + + protected RemoteInputRouter(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteInputRouter(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteInputRouter && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg2_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE _priv_objic; + public ContextID _priv_ctxic; + } + + [ComVisible(false)] + private struct Msg0_UnRegisterWithInputSource + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg1_RegisterWithInputSource + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint idGroup; + public RENDERHANDLE idSource; + } } - - public static unsafe RemoteInputRouter Create( - ProtocolSplashDesktop _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - LocalInputCallback ic) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE routerClassHandle = _priv_protocolInstance.InputRouter_ClassHandle; - RemoteInputRouter remoteInputRouter = new RemoteInputRouter(port, _priv_owner); - uint num = (uint) sizeof (RemoteInputRouter.Msg2_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteInputRouter.Msg2_Create* msg2CreatePtr = (RemoteInputRouter.Msg2_Create*) pMem; - msg2CreatePtr->_priv_size = num; - msg2CreatePtr->_priv_msgid = 2U; - msg2CreatePtr->_priv_objic = ic.RenderHandle; - msg2CreatePtr->_priv_ctxic = port.Session.LocalContext; - msg2CreatePtr->_priv_idObjectSubject = remoteInputRouter.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteInputRouter.s_priv_ByteOrder_Msg2_Create, typeof (RemoteInputRouter.Msg2_Create), 0, 0); - port.CreateRemoteObject(routerClassHandle, remoteInputRouter.m_renderHandle, (Message*) msg2CreatePtr); - return remoteInputRouter; - } - - public unsafe void BuildUnRegisterWithInputSource( - 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 (RemoteInputRouter.Msg0_UnRegisterWithInputSource); - RemoteInputRouter.Msg0_UnRegisterWithInputSource* registerWithInputSourcePtr = (RemoteInputRouter.Msg0_UnRegisterWithInputSource*) _priv_portUse.AllocMessageBuffer(size); - registerWithInputSourcePtr->_priv_size = size; - registerWithInputSourcePtr->_priv_msgid = 0U; - registerWithInputSourcePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) registerWithInputSourcePtr, ref RemoteInputRouter.s_priv_ByteOrder_Msg0_UnRegisterWithInputSource, typeof (RemoteInputRouter.Msg0_UnRegisterWithInputSource), 0, 0); - _priv_pmsgUse = (Message*) registerWithInputSourcePtr; - } - - public unsafe void SendUnRegisterWithInputSource() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildUnRegisterWithInputSource(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRegisterWithInputSource( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint idGroup, - RENDERHANDLE idSource) - { - 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 (RemoteInputRouter.Msg1_RegisterWithInputSource); - RemoteInputRouter.Msg1_RegisterWithInputSource* registerWithInputSourcePtr = (RemoteInputRouter.Msg1_RegisterWithInputSource*) _priv_portUse.AllocMessageBuffer(size); - registerWithInputSourcePtr->_priv_size = size; - registerWithInputSourcePtr->_priv_msgid = 1U; - registerWithInputSourcePtr->idGroup = idGroup; - registerWithInputSourcePtr->idSource = idSource; - registerWithInputSourcePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) registerWithInputSourcePtr, ref RemoteInputRouter.s_priv_ByteOrder_Msg1_RegisterWithInputSource, typeof (RemoteInputRouter.Msg1_RegisterWithInputSource), 0, 0); - _priv_pmsgUse = (Message*) registerWithInputSourcePtr; - } - - public unsafe void SendRegisterWithInputSource(uint idGroup, RENDERHANDLE idSource) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRegisterWithInputSource(out _priv_portUse, out _priv_pmsgUse, idGroup, idSource); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteInputRouter CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteInputRouter(port, handle, true); - } - - public static RemoteInputRouter CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteInputRouter(port, handle, false); - } - - protected RemoteInputRouter(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteInputRouter(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteInputRouter && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg2_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE _priv_objic; - public ContextID _priv_ctxic; - } - - [ComVisible(false)] - private struct Msg0_UnRegisterWithInputSource - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg1_RegisterWithInputSource - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint idGroup; - public RENDERHANDLE idSource; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Xenon/ProtocolSplashDesktopXenon.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Xenon/ProtocolSplashDesktopXenon.cs index 0164ca1..c4fcd72 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Xenon/ProtocolSplashDesktopXenon.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Xenon/ProtocolSplashDesktopXenon.cs @@ -10,39 +10,39 @@ using System; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop.Xenon { - internal sealed class ProtocolSplashDesktopXenon : ProtocolInstance - { - private RENDERHANDLE _priv_remoteClass_FormWindow; - - public static ProtocolSplashDesktopXenon Bind(RenderPort port) + internal sealed class ProtocolSplashDesktopXenon : ProtocolInstance { - Debug2.Validate(port != null, typeof (ArgumentNullException), nameof (port)); - ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Desktop::Xenon"); - if (protocolInstance != null) - { - ProtocolSplashDesktopXenon splashDesktopXenon = protocolInstance as ProtocolSplashDesktopXenon; - Debug2.Validate(splashDesktopXenon != null, typeof (InvalidOperationException), "protocol name collision"); - return splashDesktopXenon; - } - ProtocolSplashDesktopXenon splashDesktopXenon1 = new ProtocolSplashDesktopXenon(port); - port.BindProtocol((ProtocolInstance) splashDesktopXenon1); - return splashDesktopXenon1; + private RENDERHANDLE _priv_remoteClass_FormWindow; + + public static ProtocolSplashDesktopXenon Bind(RenderPort port) + { + Debug2.Validate(port != null, typeof(ArgumentNullException), nameof(port)); + ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Desktop::Xenon"); + if (protocolInstance != null) + { + ProtocolSplashDesktopXenon splashDesktopXenon = protocolInstance as ProtocolSplashDesktopXenon; + Debug2.Validate(splashDesktopXenon != null, typeof(InvalidOperationException), "protocol name collision"); + return splashDesktopXenon; + } + ProtocolSplashDesktopXenon splashDesktopXenon1 = new ProtocolSplashDesktopXenon(port); + port.BindProtocol((ProtocolInstance)splashDesktopXenon1); + return splashDesktopXenon1; + } + + private ProtocolSplashDesktopXenon(RenderPort port) + : base(port, "Splash::Desktop::Xenon") + { + } + + protected override void Init() => this._priv_remoteClass_FormWindow = this.Port.InitRemoteClass("Splash::Desktop::Xenon::FormWindow"); + + internal RENDERHANDLE FormWindow_ClassHandle => this._priv_remoteClass_FormWindow; + + internal RemoteFormWindow BuildRemoteFormWindow( + IRenderHandleOwner _priv_owner, + LocalFormWindowCallback cb) + { + return RemoteFormWindow.Create(this, _priv_owner, cb); + } } - - private ProtocolSplashDesktopXenon(RenderPort port) - : base(port, "Splash::Desktop::Xenon") - { - } - - protected override void Init() => this._priv_remoteClass_FormWindow = this.Port.InitRemoteClass("Splash::Desktop::Xenon::FormWindow"); - - internal RENDERHANDLE FormWindow_ClassHandle => this._priv_remoteClass_FormWindow; - - internal RemoteFormWindow BuildRemoteFormWindow( - IRenderHandleOwner _priv_owner, - LocalFormWindowCallback cb) - { - return RemoteFormWindow.Create(this, _priv_owner, cb); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Xenon/RemoteFormWindow.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Xenon/RemoteFormWindow.cs index d55e2e3..8bb6067 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Xenon/RemoteFormWindow.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Desktop/Xenon/RemoteFormWindow.cs @@ -9,75 +9,75 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Desktop.Xenon { - internal class RemoteFormWindow : RemoteFormWindowBase - { - private static ushort[] s_priv_ByteOrder_Msg41_Create; - - protected RemoteFormWindow() + internal class RemoteFormWindow : RemoteFormWindowBase { + private static ushort[] s_priv_ByteOrder_Msg41_Create; + + protected RemoteFormWindow() + { + } + + public static unsafe RemoteFormWindow Create( + ProtocolSplashDesktopXenon _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + LocalFormWindowCallback cb) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE windowClassHandle = _priv_protocolInstance.FormWindow_ClassHandle; + RemoteFormWindow remoteFormWindow = new RemoteFormWindow(port, _priv_owner); + uint num = (uint)sizeof(RemoteFormWindow.Msg41_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteFormWindow.Msg41_Create* msg41CreatePtr = (RemoteFormWindow.Msg41_Create*)pMem; + msg41CreatePtr->_priv_size = num; + msg41CreatePtr->_priv_msgid = 41U; + msg41CreatePtr->_priv_objcb = cb.RenderHandle; + msg41CreatePtr->_priv_ctxcb = port.Session.LocalContext; + msg41CreatePtr->_priv_idObjectSubject = remoteFormWindow.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteFormWindow.s_priv_ByteOrder_Msg41_Create, typeof(RemoteFormWindow.Msg41_Create), 0, 0); + port.CreateRemoteObject(windowClassHandle, remoteFormWindow.m_renderHandle, (Message*)msg41CreatePtr); + return remoteFormWindow; + } + + public static RemoteFormWindow CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteFormWindow(port, handle, true); + } + + public static RemoteFormWindow CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteFormWindow(port, handle, false); + } + + protected RemoteFormWindow(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteFormWindow(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteFormWindow && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg41_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + } } - - public static unsafe RemoteFormWindow Create( - ProtocolSplashDesktopXenon _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - LocalFormWindowCallback cb) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE windowClassHandle = _priv_protocolInstance.FormWindow_ClassHandle; - RemoteFormWindow remoteFormWindow = new RemoteFormWindow(port, _priv_owner); - uint num = (uint) sizeof (RemoteFormWindow.Msg41_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteFormWindow.Msg41_Create* msg41CreatePtr = (RemoteFormWindow.Msg41_Create*) pMem; - msg41CreatePtr->_priv_size = num; - msg41CreatePtr->_priv_msgid = 41U; - msg41CreatePtr->_priv_objcb = cb.RenderHandle; - msg41CreatePtr->_priv_ctxcb = port.Session.LocalContext; - msg41CreatePtr->_priv_idObjectSubject = remoteFormWindow.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteFormWindow.s_priv_ByteOrder_Msg41_Create, typeof (RemoteFormWindow.Msg41_Create), 0, 0); - port.CreateRemoteObject(windowClassHandle, remoteFormWindow.m_renderHandle, (Message*) msg41CreatePtr); - return remoteFormWindow; - } - - public static RemoteFormWindow CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteFormWindow(port, handle, true); - } - - public static RemoteFormWindow CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteFormWindow(port, handle, false); - } - - protected RemoteFormWindow(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteFormWindow(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteFormWindow && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg41_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/IDataBufferCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/IDataBufferCallback.cs index 3e65951..aba243f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/IDataBufferCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/IDataBufferCallback.cs @@ -8,8 +8,8 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Protocols.Splash.Messaging { - internal interface IDataBufferCallback - { - void OnComplete(RENDERHANDLE target); - } + internal interface IDataBufferCallback + { + void OnComplete(RENDERHANDLE target); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/IRenderPortCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/IRenderPortCallback.cs index 2a51c26..277a536 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/IRenderPortCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/IRenderPortCallback.cs @@ -8,10 +8,10 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Protocols.Splash.Messaging { - internal interface IRenderPortCallback - { - void OnBatchProcessed(RENDERHANDLE target, uint uBatchCompleted); + internal interface IRenderPortCallback + { + void OnBatchProcessed(RENDERHANDLE target, uint uBatchCompleted); - void OnPingReply(RENDERHANDLE target); - } + void OnPingReply(RENDERHANDLE target); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/LocalDataBufferCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/LocalDataBufferCallback.cs index 5875f46..55aa6f7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/LocalDataBufferCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/LocalDataBufferCallback.cs @@ -10,65 +10,65 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Messaging { - internal class LocalDataBufferCallback : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_OnComplete; - - protected LocalDataBufferCallback() + internal class LocalDataBufferCallback : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_OnComplete; + + protected LocalDataBufferCallback() + { + } + + internal static LocalDataBufferCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalDataBufferCallback(port, callbackInstance); + } + + protected LocalDataBufferCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalDataBufferCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalDataBufferCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is IDataBufferCallback _priv_target) || message->nMsg != 0U) + return; + LocalDataBufferCallback.Dispatch_OnComplete(port, _priv_target, (LocalDataBufferCallback.Msg0_OnComplete*)message); + } + + private static unsafe void Dispatch_OnComplete( + RenderPort _priv_port, + IDataBufferCallback _priv_target, + LocalDataBufferCallback.Msg0_OnComplete* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDataBufferCallback.s_priv_ByteOrder_Msg0_OnComplete, typeof(LocalDataBufferCallback.Msg0_OnComplete), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnComplete(target); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_OnComplete + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } } - - internal static LocalDataBufferCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalDataBufferCallback(port, callbackInstance); - } - - protected LocalDataBufferCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalDataBufferCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalDataBufferCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is IDataBufferCallback _priv_target) || message->nMsg != 0U) - return; - LocalDataBufferCallback.Dispatch_OnComplete(port, _priv_target, (LocalDataBufferCallback.Msg0_OnComplete*) message); - } - - private static unsafe void Dispatch_OnComplete( - RenderPort _priv_port, - IDataBufferCallback _priv_target, - LocalDataBufferCallback.Msg0_OnComplete* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDataBufferCallback.s_priv_ByteOrder_Msg0_OnComplete, typeof (LocalDataBufferCallback.Msg0_OnComplete), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnComplete(target); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_OnComplete - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/LocalRenderPortCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/LocalRenderPortCallback.cs index 2df2748..005030c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/LocalRenderPortCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/LocalRenderPortCallback.cs @@ -10,136 +10,136 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Messaging { - internal class LocalRenderPortCallback : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_OnBatchProcessed; - private static ushort[] s_priv_ByteOrder_Msg1_OnPingReply; - - protected LocalRenderPortCallback() + internal class LocalRenderPortCallback : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_OnBatchProcessed; + private static ushort[] s_priv_ByteOrder_Msg1_OnPingReply; + + protected LocalRenderPortCallback() + { + } + + public static unsafe void AutoSendOnBatchProcessed( + ProtocolSplashMessaging _priv_protocolInstance, + RENDERHANDLE target, + uint uBatchCompleted) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE callbackInstance = _priv_protocolInstance.RenderPortCallback_CallbackInstance; + uint num = (uint)sizeof(LocalRenderPortCallback.Msg0_OnBatchProcessed); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + LocalRenderPortCallback.Msg0_OnBatchProcessed* onBatchProcessedPtr = (LocalRenderPortCallback.Msg0_OnBatchProcessed*)pMem; + onBatchProcessedPtr->_priv_size = num; + onBatchProcessedPtr->_priv_msgid = 0U; + onBatchProcessedPtr->target = target; + onBatchProcessedPtr->uBatchCompleted = uBatchCompleted; + onBatchProcessedPtr->_priv_idObjectSubject = callbackInstance; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref LocalRenderPortCallback.s_priv_ByteOrder_Msg0_OnBatchProcessed, typeof(LocalRenderPortCallback.Msg0_OnBatchProcessed), 0, 0); + port.SendLocalCallbackMessage((Message*)onBatchProcessedPtr); + } + + public static unsafe void AutoSendOnPingReply( + ProtocolSplashMessaging _priv_protocolInstance, + RENDERHANDLE target) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE callbackInstance = _priv_protocolInstance.RenderPortCallback_CallbackInstance; + uint num = (uint)sizeof(LocalRenderPortCallback.Msg1_OnPingReply); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + LocalRenderPortCallback.Msg1_OnPingReply* msg1OnPingReplyPtr = (LocalRenderPortCallback.Msg1_OnPingReply*)pMem; + msg1OnPingReplyPtr->_priv_size = num; + msg1OnPingReplyPtr->_priv_msgid = 1U; + msg1OnPingReplyPtr->target = target; + msg1OnPingReplyPtr->_priv_idObjectSubject = callbackInstance; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref LocalRenderPortCallback.s_priv_ByteOrder_Msg1_OnPingReply, typeof(LocalRenderPortCallback.Msg1_OnPingReply), 0, 0); + port.SendLocalCallbackMessage((Message*)msg1OnPingReplyPtr); + } + + internal static LocalRenderPortCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalRenderPortCallback(port, callbackInstance); + } + + protected LocalRenderPortCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalRenderPortCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalRenderPortCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is IRenderPortCallback _priv_target)) + return; + switch (message->nMsg) + { + case 0: + LocalRenderPortCallback.Dispatch_OnBatchProcessed(port, _priv_target, (LocalRenderPortCallback.Msg0_OnBatchProcessed*)message); + break; + case 1: + LocalRenderPortCallback.Dispatch_OnPingReply(port, _priv_target, (LocalRenderPortCallback.Msg1_OnPingReply*)message); + break; + } + } + + private static unsafe void Dispatch_OnBatchProcessed( + RenderPort _priv_port, + IRenderPortCallback _priv_target, + LocalRenderPortCallback.Msg0_OnBatchProcessed* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalRenderPortCallback.s_priv_ByteOrder_Msg0_OnBatchProcessed, typeof(LocalRenderPortCallback.Msg0_OnBatchProcessed), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + uint uBatchCompleted = _priv_pmsg->uBatchCompleted; + _priv_target.OnBatchProcessed(target, uBatchCompleted); + } + + private static unsafe void Dispatch_OnPingReply( + RenderPort _priv_port, + IRenderPortCallback _priv_target, + LocalRenderPortCallback.Msg1_OnPingReply* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalRenderPortCallback.s_priv_ByteOrder_Msg1_OnPingReply, typeof(LocalRenderPortCallback.Msg1_OnPingReply), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnPingReply(target); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_OnBatchProcessed + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint uBatchCompleted; + } + + [ComVisible(false)] + private struct Msg1_OnPingReply + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } } - - public static unsafe void AutoSendOnBatchProcessed( - ProtocolSplashMessaging _priv_protocolInstance, - RENDERHANDLE target, - uint uBatchCompleted) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE callbackInstance = _priv_protocolInstance.RenderPortCallback_CallbackInstance; - uint num = (uint) sizeof (LocalRenderPortCallback.Msg0_OnBatchProcessed); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - LocalRenderPortCallback.Msg0_OnBatchProcessed* onBatchProcessedPtr = (LocalRenderPortCallback.Msg0_OnBatchProcessed*) pMem; - onBatchProcessedPtr->_priv_size = num; - onBatchProcessedPtr->_priv_msgid = 0U; - onBatchProcessedPtr->target = target; - onBatchProcessedPtr->uBatchCompleted = uBatchCompleted; - onBatchProcessedPtr->_priv_idObjectSubject = callbackInstance; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref LocalRenderPortCallback.s_priv_ByteOrder_Msg0_OnBatchProcessed, typeof (LocalRenderPortCallback.Msg0_OnBatchProcessed), 0, 0); - port.SendLocalCallbackMessage((Message*) onBatchProcessedPtr); - } - - public static unsafe void AutoSendOnPingReply( - ProtocolSplashMessaging _priv_protocolInstance, - RENDERHANDLE target) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE callbackInstance = _priv_protocolInstance.RenderPortCallback_CallbackInstance; - uint num = (uint) sizeof (LocalRenderPortCallback.Msg1_OnPingReply); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - LocalRenderPortCallback.Msg1_OnPingReply* msg1OnPingReplyPtr = (LocalRenderPortCallback.Msg1_OnPingReply*) pMem; - msg1OnPingReplyPtr->_priv_size = num; - msg1OnPingReplyPtr->_priv_msgid = 1U; - msg1OnPingReplyPtr->target = target; - msg1OnPingReplyPtr->_priv_idObjectSubject = callbackInstance; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref LocalRenderPortCallback.s_priv_ByteOrder_Msg1_OnPingReply, typeof (LocalRenderPortCallback.Msg1_OnPingReply), 0, 0); - port.SendLocalCallbackMessage((Message*) msg1OnPingReplyPtr); - } - - internal static LocalRenderPortCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalRenderPortCallback(port, callbackInstance); - } - - protected LocalRenderPortCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalRenderPortCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalRenderPortCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is IRenderPortCallback _priv_target)) - return; - switch (message->nMsg) - { - case 0: - LocalRenderPortCallback.Dispatch_OnBatchProcessed(port, _priv_target, (LocalRenderPortCallback.Msg0_OnBatchProcessed*) message); - break; - case 1: - LocalRenderPortCallback.Dispatch_OnPingReply(port, _priv_target, (LocalRenderPortCallback.Msg1_OnPingReply*) message); - break; - } - } - - private static unsafe void Dispatch_OnBatchProcessed( - RenderPort _priv_port, - IRenderPortCallback _priv_target, - LocalRenderPortCallback.Msg0_OnBatchProcessed* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalRenderPortCallback.s_priv_ByteOrder_Msg0_OnBatchProcessed, typeof (LocalRenderPortCallback.Msg0_OnBatchProcessed), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - uint uBatchCompleted = _priv_pmsg->uBatchCompleted; - _priv_target.OnBatchProcessed(target, uBatchCompleted); - } - - private static unsafe void Dispatch_OnPingReply( - RenderPort _priv_port, - IRenderPortCallback _priv_target, - LocalRenderPortCallback.Msg1_OnPingReply* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalRenderPortCallback.s_priv_ByteOrder_Msg1_OnPingReply, typeof (LocalRenderPortCallback.Msg1_OnPingReply), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnPingReply(target); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_OnBatchProcessed - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint uBatchCompleted; - } - - [ComVisible(false)] - private struct Msg1_OnPingReply - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/ProtocolSplashMessaging.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/ProtocolSplashMessaging.cs index becb4bf..6598db6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/ProtocolSplashMessaging.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/ProtocolSplashMessaging.cs @@ -10,69 +10,69 @@ using System; namespace Microsoft.Iris.Render.Protocols.Splash.Messaging { - internal sealed class ProtocolSplashMessaging : ProtocolInstance - { - private RENDERHANDLE _priv_remoteClass_Broker; - private RENDERHANDLE _priv_remoteClass_Context; - private RENDERHANDLE _priv_remoteClass_DataBuffer; - private RENDERHANDLE _priv_remoteClass_ContextRelay; - private RENDERHANDLE _priv_callbackInstance_RenderPortCallback; - private RENDERHANDLE _priv_callbackInstance_DataBufferCallback; - - public static ProtocolSplashMessaging Bind(RenderPort port) + internal sealed class ProtocolSplashMessaging : ProtocolInstance { - Debug2.Validate(port != null, typeof (ArgumentNullException), nameof (port)); - ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Messaging"); - if (protocolInstance != null) - { - ProtocolSplashMessaging protocolSplashMessaging = protocolInstance as ProtocolSplashMessaging; - Debug2.Validate(protocolSplashMessaging != null, typeof (InvalidOperationException), "protocol name collision"); - return protocolSplashMessaging; - } - ProtocolSplashMessaging protocolSplashMessaging1 = new ProtocolSplashMessaging(port); - port.BindProtocol((ProtocolInstance) protocolSplashMessaging1); - return protocolSplashMessaging1; + private RENDERHANDLE _priv_remoteClass_Broker; + private RENDERHANDLE _priv_remoteClass_Context; + private RENDERHANDLE _priv_remoteClass_DataBuffer; + private RENDERHANDLE _priv_remoteClass_ContextRelay; + private RENDERHANDLE _priv_callbackInstance_RenderPortCallback; + private RENDERHANDLE _priv_callbackInstance_DataBufferCallback; + + public static ProtocolSplashMessaging Bind(RenderPort port) + { + Debug2.Validate(port != null, typeof(ArgumentNullException), nameof(port)); + ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Messaging"); + if (protocolInstance != null) + { + ProtocolSplashMessaging protocolSplashMessaging = protocolInstance as ProtocolSplashMessaging; + Debug2.Validate(protocolSplashMessaging != null, typeof(InvalidOperationException), "protocol name collision"); + return protocolSplashMessaging; + } + ProtocolSplashMessaging protocolSplashMessaging1 = new ProtocolSplashMessaging(port); + port.BindProtocol((ProtocolInstance)protocolSplashMessaging1); + return protocolSplashMessaging1; + } + + public LocalRenderPortCallback LocalRenderPortCallbackHandle => LocalRenderPortCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_RenderPortCallback); + + public LocalDataBufferCallback LocalDataBufferCallbackHandle => LocalDataBufferCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_DataBufferCallback); + + private ProtocolSplashMessaging(RenderPort port) + : base(port, "Splash::Messaging") + { + } + + protected override void Init() + { + RenderPort port = this.Port; + this._priv_remoteClass_Broker = port.InitRemoteClass("Splash::Messaging::Broker"); + this._priv_remoteClass_Context = port.InitRemoteClass("Splash::Messaging::Context"); + this._priv_remoteClass_DataBuffer = port.InitRemoteClass("Splash::Messaging::DataBuffer"); + this._priv_remoteClass_ContextRelay = port.InitRemoteClass("Splash::Messaging::ContextRelay"); + this._priv_callbackInstance_RenderPortCallback = LocalRenderPortCallback.BindCallback(port); + this._priv_callbackInstance_DataBufferCallback = LocalDataBufferCallback.BindCallback(port); + } + + internal RENDERHANDLE Broker_ClassHandle => this._priv_remoteClass_Broker; + + internal RENDERHANDLE Context_ClassHandle => this._priv_remoteClass_Context; + + internal RENDERHANDLE DataBuffer_ClassHandle => this._priv_remoteClass_DataBuffer; + + internal RENDERHANDLE ContextRelay_ClassHandle => this._priv_remoteClass_ContextRelay; + + internal RENDERHANDLE RenderPortCallback_CallbackInstance => this._priv_callbackInstance_RenderPortCallback; + + internal RENDERHANDLE DataBufferCallback_CallbackInstance => this._priv_callbackInstance_DataBufferCallback; + + internal RemoteContextRelay BuildRemoteContextRelay( + IRenderHandleOwner _priv_owner, + TransportProtocol protocol, + string stServer, + string stSession) + { + return RemoteContextRelay.Create(this, _priv_owner, protocol, stServer, stSession); + } } - - public LocalRenderPortCallback LocalRenderPortCallbackHandle => LocalRenderPortCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_RenderPortCallback); - - public LocalDataBufferCallback LocalDataBufferCallbackHandle => LocalDataBufferCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_DataBufferCallback); - - private ProtocolSplashMessaging(RenderPort port) - : base(port, "Splash::Messaging") - { - } - - protected override void Init() - { - RenderPort port = this.Port; - this._priv_remoteClass_Broker = port.InitRemoteClass("Splash::Messaging::Broker"); - this._priv_remoteClass_Context = port.InitRemoteClass("Splash::Messaging::Context"); - this._priv_remoteClass_DataBuffer = port.InitRemoteClass("Splash::Messaging::DataBuffer"); - this._priv_remoteClass_ContextRelay = port.InitRemoteClass("Splash::Messaging::ContextRelay"); - this._priv_callbackInstance_RenderPortCallback = LocalRenderPortCallback.BindCallback(port); - this._priv_callbackInstance_DataBufferCallback = LocalDataBufferCallback.BindCallback(port); - } - - internal RENDERHANDLE Broker_ClassHandle => this._priv_remoteClass_Broker; - - internal RENDERHANDLE Context_ClassHandle => this._priv_remoteClass_Context; - - internal RENDERHANDLE DataBuffer_ClassHandle => this._priv_remoteClass_DataBuffer; - - internal RENDERHANDLE ContextRelay_ClassHandle => this._priv_remoteClass_ContextRelay; - - internal RENDERHANDLE RenderPortCallback_CallbackInstance => this._priv_callbackInstance_RenderPortCallback; - - internal RENDERHANDLE DataBufferCallback_CallbackInstance => this._priv_callbackInstance_DataBufferCallback; - - internal RemoteContextRelay BuildRemoteContextRelay( - IRenderHandleOwner _priv_owner, - TransportProtocol protocol, - string stServer, - string stSession) - { - return RemoteContextRelay.Create(this, _priv_owner, protocol, stServer, stSession); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteBroker.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteBroker.cs index 0e45e5e..6f4289f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteBroker.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteBroker.cs @@ -9,177 +9,177 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Messaging { - internal class RemoteBroker : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_DestroyObject; - private static ushort[] s_priv_ByteOrder_Msg1_CreateObject; - private static ushort[] s_priv_ByteOrder_Msg2_CreateClass; - - protected RemoteBroker() + internal class RemoteBroker : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_DestroyObject; + private static ushort[] s_priv_ByteOrder_Msg1_CreateObject; + private static ushort[] s_priv_ByteOrder_Msg2_CreateClass; + + protected RemoteBroker() + { + } + + public static unsafe void BuildDestroyObject( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashMessaging _priv_protocolInstance, + RENDERHANDLE idObject) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE brokerClassHandle = _priv_protocolInstance.Broker_ClassHandle; + _priv_portUse.ValidateHandle(brokerClassHandle); + uint size = (uint)sizeof(RemoteBroker.Msg0_DestroyObject); + RemoteBroker.Msg0_DestroyObject* msg0DestroyObjectPtr = (RemoteBroker.Msg0_DestroyObject*)_priv_portUse.AllocMessageBuffer(size); + msg0DestroyObjectPtr->_priv_size = size; + msg0DestroyObjectPtr->_priv_msgid = 0U; + msg0DestroyObjectPtr->idObject = idObject; + msg0DestroyObjectPtr->_priv_idObjectSubject = brokerClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0DestroyObjectPtr, ref RemoteBroker.s_priv_ByteOrder_Msg0_DestroyObject, typeof(RemoteBroker.Msg0_DestroyObject), 0, 0); + _priv_pmsgUse = (Message*)msg0DestroyObjectPtr; + } + + public static unsafe void SendDestroyObject( + ProtocolSplashMessaging _priv_protocolInstance, + RENDERHANDLE idObject) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteBroker.BuildDestroyObject(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idObject); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static unsafe void BuildCreateObject( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashMessaging _priv_protocolInstance, + RENDERHANDLE idObjectClass, + RENDERHANDLE idObjectNew, + Message* msgConstruction) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE brokerClassHandle = _priv_protocolInstance.Broker_ClassHandle; + _priv_portUse.ValidateHandle(brokerClassHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteBroker.Msg1_CreateObject)); + BLOBREF blobref = blobInfo.Add(msgConstruction); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteBroker.Msg1_CreateObject* msg1CreateObjectPtr = (RemoteBroker.Msg1_CreateObject*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg1CreateObjectPtr->_priv_size = adjustedTotalSize; + msg1CreateObjectPtr->_priv_msgid = 1U; + msg1CreateObjectPtr->idObjectClass = idObjectClass; + msg1CreateObjectPtr->idObjectNew = idObjectNew; + msg1CreateObjectPtr->msgConstruction = blobref; + blobInfo.Attach((Message*)msg1CreateObjectPtr); + msg1CreateObjectPtr->_priv_idObjectSubject = brokerClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1CreateObjectPtr, ref RemoteBroker.s_priv_ByteOrder_Msg1_CreateObject, typeof(RemoteBroker.Msg1_CreateObject), 0, 0); + _priv_pmsgUse = (Message*)msg1CreateObjectPtr; + } + + public static unsafe void SendCreateObject( + ProtocolSplashMessaging _priv_protocolInstance, + RENDERHANDLE idObjectClass, + RENDERHANDLE idObjectNew, + Message* msgConstruction) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteBroker.BuildCreateObject(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idObjectClass, idObjectNew, msgConstruction); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static unsafe void BuildCreateClass( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashMessaging _priv_protocolInstance, + string stClassName, + RENDERHANDLE idObjectClass) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE brokerClassHandle = _priv_protocolInstance.Broker_ClassHandle; + _priv_portUse.ValidateHandle(brokerClassHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteBroker.Msg2_CreateClass)); + BLOBREF blobref = blobInfo.Add(stClassName); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteBroker.Msg2_CreateClass* msg2CreateClassPtr = (RemoteBroker.Msg2_CreateClass*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg2CreateClassPtr->_priv_size = adjustedTotalSize; + msg2CreateClassPtr->_priv_msgid = 2U; + msg2CreateClassPtr->stClassName = blobref; + msg2CreateClassPtr->idObjectClass = idObjectClass; + blobInfo.Attach((Message*)msg2CreateClassPtr); + msg2CreateClassPtr->_priv_idObjectSubject = brokerClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg2CreateClassPtr, ref RemoteBroker.s_priv_ByteOrder_Msg2_CreateClass, typeof(RemoteBroker.Msg2_CreateClass), 0, 0); + _priv_pmsgUse = (Message*)msg2CreateClassPtr; + } + + public static unsafe void SendCreateClass( + ProtocolSplashMessaging _priv_protocolInstance, + string stClassName, + RENDERHANDLE idObjectClass) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteBroker.BuildCreateClass(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, stClassName, idObjectClass); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteBroker CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteBroker(port, handle, true); + + public static RemoteBroker CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteBroker(port, handle, false); + } + + protected RemoteBroker(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteBroker(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteBroker && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_DestroyObject + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE idObject; + } + + [ComVisible(false)] + private struct Msg1_CreateObject + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE idObjectClass; + public RENDERHANDLE idObjectNew; + public BLOBREF msgConstruction; + } + + [ComVisible(false)] + private struct Msg2_CreateClass + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stClassName; + public RENDERHANDLE idObjectClass; + } } - - public static unsafe void BuildDestroyObject( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashMessaging _priv_protocolInstance, - RENDERHANDLE idObject) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE brokerClassHandle = _priv_protocolInstance.Broker_ClassHandle; - _priv_portUse.ValidateHandle(brokerClassHandle); - uint size = (uint) sizeof (RemoteBroker.Msg0_DestroyObject); - RemoteBroker.Msg0_DestroyObject* msg0DestroyObjectPtr = (RemoteBroker.Msg0_DestroyObject*) _priv_portUse.AllocMessageBuffer(size); - msg0DestroyObjectPtr->_priv_size = size; - msg0DestroyObjectPtr->_priv_msgid = 0U; - msg0DestroyObjectPtr->idObject = idObject; - msg0DestroyObjectPtr->_priv_idObjectSubject = brokerClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0DestroyObjectPtr, ref RemoteBroker.s_priv_ByteOrder_Msg0_DestroyObject, typeof (RemoteBroker.Msg0_DestroyObject), 0, 0); - _priv_pmsgUse = (Message*) msg0DestroyObjectPtr; - } - - public static unsafe void SendDestroyObject( - ProtocolSplashMessaging _priv_protocolInstance, - RENDERHANDLE idObject) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteBroker.BuildDestroyObject(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idObject); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static unsafe void BuildCreateObject( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashMessaging _priv_protocolInstance, - RENDERHANDLE idObjectClass, - RENDERHANDLE idObjectNew, - Message* msgConstruction) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE brokerClassHandle = _priv_protocolInstance.Broker_ClassHandle; - _priv_portUse.ValidateHandle(brokerClassHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteBroker.Msg1_CreateObject)); - BLOBREF blobref = blobInfo.Add(msgConstruction); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteBroker.Msg1_CreateObject* msg1CreateObjectPtr = (RemoteBroker.Msg1_CreateObject*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg1CreateObjectPtr->_priv_size = adjustedTotalSize; - msg1CreateObjectPtr->_priv_msgid = 1U; - msg1CreateObjectPtr->idObjectClass = idObjectClass; - msg1CreateObjectPtr->idObjectNew = idObjectNew; - msg1CreateObjectPtr->msgConstruction = blobref; - blobInfo.Attach((Message*) msg1CreateObjectPtr); - msg1CreateObjectPtr->_priv_idObjectSubject = brokerClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1CreateObjectPtr, ref RemoteBroker.s_priv_ByteOrder_Msg1_CreateObject, typeof (RemoteBroker.Msg1_CreateObject), 0, 0); - _priv_pmsgUse = (Message*) msg1CreateObjectPtr; - } - - public static unsafe void SendCreateObject( - ProtocolSplashMessaging _priv_protocolInstance, - RENDERHANDLE idObjectClass, - RENDERHANDLE idObjectNew, - Message* msgConstruction) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteBroker.BuildCreateObject(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idObjectClass, idObjectNew, msgConstruction); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static unsafe void BuildCreateClass( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashMessaging _priv_protocolInstance, - string stClassName, - RENDERHANDLE idObjectClass) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE brokerClassHandle = _priv_protocolInstance.Broker_ClassHandle; - _priv_portUse.ValidateHandle(brokerClassHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteBroker.Msg2_CreateClass)); - BLOBREF blobref = blobInfo.Add(stClassName); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteBroker.Msg2_CreateClass* msg2CreateClassPtr = (RemoteBroker.Msg2_CreateClass*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg2CreateClassPtr->_priv_size = adjustedTotalSize; - msg2CreateClassPtr->_priv_msgid = 2U; - msg2CreateClassPtr->stClassName = blobref; - msg2CreateClassPtr->idObjectClass = idObjectClass; - blobInfo.Attach((Message*) msg2CreateClassPtr); - msg2CreateClassPtr->_priv_idObjectSubject = brokerClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg2CreateClassPtr, ref RemoteBroker.s_priv_ByteOrder_Msg2_CreateClass, typeof (RemoteBroker.Msg2_CreateClass), 0, 0); - _priv_pmsgUse = (Message*) msg2CreateClassPtr; - } - - public static unsafe void SendCreateClass( - ProtocolSplashMessaging _priv_protocolInstance, - string stClassName, - RENDERHANDLE idObjectClass) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteBroker.BuildCreateClass(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, stClassName, idObjectClass); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteBroker CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteBroker(port, handle, true); - - public static RemoteBroker CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteBroker(port, handle, false); - } - - protected RemoteBroker(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteBroker(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteBroker && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_DestroyObject - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE idObject; - } - - [ComVisible(false)] - private struct Msg1_CreateObject - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE idObjectClass; - public RENDERHANDLE idObjectNew; - public BLOBREF msgConstruction; - } - - [ComVisible(false)] - private struct Msg2_CreateClass - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stClassName; - public RENDERHANDLE idObjectClass; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteContext.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteContext.cs index 31fc89b..4e70182 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteContext.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteContext.cs @@ -10,211 +10,211 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Messaging { - internal class RemoteContext : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_ReleaseObject; - private static ushort[] s_priv_ByteOrder_Msg2_ForwardMessage; - private static ushort[] s_priv_ByteOrder_Msg3_DestroyGroup; - private static ushort[] s_priv_ByteOrder_Msg4_CreateGroup; - - protected RemoteContext() + internal class RemoteContext : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_ReleaseObject; + private static ushort[] s_priv_ByteOrder_Msg2_ForwardMessage; + private static ushort[] s_priv_ByteOrder_Msg3_DestroyGroup; + private static ushort[] s_priv_ByteOrder_Msg4_CreateGroup; + + protected RemoteContext() + { + } + + public static unsafe void BuildReleaseObject( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashMessaging _priv_protocolInstance, + IntPtr punkObj) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE contextClassHandle = _priv_protocolInstance.Context_ClassHandle; + _priv_portUse.ValidateHandle(contextClassHandle); + uint size = (uint)sizeof(RemoteContext.Msg0_ReleaseObject); + RemoteContext.Msg0_ReleaseObject* msg0ReleaseObjectPtr = (RemoteContext.Msg0_ReleaseObject*)_priv_portUse.AllocMessageBuffer(size); + msg0ReleaseObjectPtr->_priv_size = size; + msg0ReleaseObjectPtr->_priv_msgid = 0U; + msg0ReleaseObjectPtr->punkObj = punkObj; + msg0ReleaseObjectPtr->_priv_idObjectSubject = contextClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0ReleaseObjectPtr, ref RemoteContext.s_priv_ByteOrder_Msg0_ReleaseObject, typeof(RemoteContext.Msg0_ReleaseObject), 0, 0); + _priv_pmsgUse = (Message*)msg0ReleaseObjectPtr; + } + + public static unsafe void SendReleaseObject( + ProtocolSplashMessaging _priv_protocolInstance, + IntPtr punkObj) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteContext.BuildReleaseObject(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, punkObj); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static unsafe void BuildForwardMessage( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashMessaging _priv_protocolInstance, + ContextID idContextDest, + Message* msgReturn) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE contextClassHandle = _priv_protocolInstance.Context_ClassHandle; + _priv_portUse.ValidateHandle(contextClassHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteContext.Msg2_ForwardMessage)); + BLOBREF blobref = blobInfo.Add(msgReturn); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteContext.Msg2_ForwardMessage* msg2ForwardMessagePtr = (RemoteContext.Msg2_ForwardMessage*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg2ForwardMessagePtr->_priv_size = adjustedTotalSize; + msg2ForwardMessagePtr->_priv_msgid = 2U; + msg2ForwardMessagePtr->idContextDest = idContextDest; + msg2ForwardMessagePtr->msgReturn = blobref; + blobInfo.Attach((Message*)msg2ForwardMessagePtr); + msg2ForwardMessagePtr->_priv_idObjectSubject = contextClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg2ForwardMessagePtr, ref RemoteContext.s_priv_ByteOrder_Msg2_ForwardMessage, typeof(RemoteContext.Msg2_ForwardMessage), 0, 0); + _priv_pmsgUse = (Message*)msg2ForwardMessagePtr; + } + + public static unsafe void SendForwardMessage( + ProtocolSplashMessaging _priv_protocolInstance, + ContextID idContextDest, + Message* msgReturn) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteContext.BuildForwardMessage(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idContextDest, msgReturn); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static unsafe void BuildDestroyGroup( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashMessaging _priv_protocolInstance, + int idxGroup) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE contextClassHandle = _priv_protocolInstance.Context_ClassHandle; + _priv_portUse.ValidateHandle(contextClassHandle); + uint size = (uint)sizeof(RemoteContext.Msg3_DestroyGroup); + RemoteContext.Msg3_DestroyGroup* msg3DestroyGroupPtr = (RemoteContext.Msg3_DestroyGroup*)_priv_portUse.AllocMessageBuffer(size); + msg3DestroyGroupPtr->_priv_size = size; + msg3DestroyGroupPtr->_priv_msgid = 3U; + msg3DestroyGroupPtr->idxGroup = idxGroup; + msg3DestroyGroupPtr->_priv_idObjectSubject = contextClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg3DestroyGroupPtr, ref RemoteContext.s_priv_ByteOrder_Msg3_DestroyGroup, typeof(RemoteContext.Msg3_DestroyGroup), 0, 0); + _priv_pmsgUse = (Message*)msg3DestroyGroupPtr; + } + + public static unsafe void SendDestroyGroup( + ProtocolSplashMessaging _priv_protocolInstance, + int idxGroup) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteContext.BuildDestroyGroup(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idxGroup); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static unsafe void BuildCreateGroup( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashMessaging _priv_protocolInstance, + int idxGroup, + ContextID idContextOwner) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE contextClassHandle = _priv_protocolInstance.Context_ClassHandle; + _priv_portUse.ValidateHandle(contextClassHandle); + uint size = (uint)sizeof(RemoteContext.Msg4_CreateGroup); + RemoteContext.Msg4_CreateGroup* msg4CreateGroupPtr = (RemoteContext.Msg4_CreateGroup*)_priv_portUse.AllocMessageBuffer(size); + msg4CreateGroupPtr->_priv_size = size; + msg4CreateGroupPtr->_priv_msgid = 4U; + msg4CreateGroupPtr->idxGroup = idxGroup; + msg4CreateGroupPtr->idContextOwner = idContextOwner; + msg4CreateGroupPtr->_priv_idObjectSubject = contextClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4CreateGroupPtr, ref RemoteContext.s_priv_ByteOrder_Msg4_CreateGroup, typeof(RemoteContext.Msg4_CreateGroup), 0, 0); + _priv_pmsgUse = (Message*)msg4CreateGroupPtr; + } + + public static unsafe void SendCreateGroup( + ProtocolSplashMessaging _priv_protocolInstance, + int idxGroup, + ContextID idContextOwner) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteContext.BuildCreateGroup(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idxGroup, idContextOwner); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteContext CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteContext(port, handle, true); + + public static RemoteContext CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteContext(port, handle, false); + } + + protected RemoteContext(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteContext(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteContext && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_ReleaseObject + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public IntPtr punkObj; + } + + [ComVisible(false)] + private struct Msg2_ForwardMessage + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public ContextID idContextDest; + public BLOBREF msgReturn; + } + + [ComVisible(false)] + private struct Msg3_DestroyGroup + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxGroup; + } + + [ComVisible(false)] + private struct Msg4_CreateGroup + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxGroup; + public ContextID idContextOwner; + } } - - public static unsafe void BuildReleaseObject( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashMessaging _priv_protocolInstance, - IntPtr punkObj) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE contextClassHandle = _priv_protocolInstance.Context_ClassHandle; - _priv_portUse.ValidateHandle(contextClassHandle); - uint size = (uint) sizeof (RemoteContext.Msg0_ReleaseObject); - RemoteContext.Msg0_ReleaseObject* msg0ReleaseObjectPtr = (RemoteContext.Msg0_ReleaseObject*) _priv_portUse.AllocMessageBuffer(size); - msg0ReleaseObjectPtr->_priv_size = size; - msg0ReleaseObjectPtr->_priv_msgid = 0U; - msg0ReleaseObjectPtr->punkObj = punkObj; - msg0ReleaseObjectPtr->_priv_idObjectSubject = contextClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0ReleaseObjectPtr, ref RemoteContext.s_priv_ByteOrder_Msg0_ReleaseObject, typeof (RemoteContext.Msg0_ReleaseObject), 0, 0); - _priv_pmsgUse = (Message*) msg0ReleaseObjectPtr; - } - - public static unsafe void SendReleaseObject( - ProtocolSplashMessaging _priv_protocolInstance, - IntPtr punkObj) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteContext.BuildReleaseObject(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, punkObj); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static unsafe void BuildForwardMessage( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashMessaging _priv_protocolInstance, - ContextID idContextDest, - Message* msgReturn) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE contextClassHandle = _priv_protocolInstance.Context_ClassHandle; - _priv_portUse.ValidateHandle(contextClassHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteContext.Msg2_ForwardMessage)); - BLOBREF blobref = blobInfo.Add(msgReturn); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteContext.Msg2_ForwardMessage* msg2ForwardMessagePtr = (RemoteContext.Msg2_ForwardMessage*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg2ForwardMessagePtr->_priv_size = adjustedTotalSize; - msg2ForwardMessagePtr->_priv_msgid = 2U; - msg2ForwardMessagePtr->idContextDest = idContextDest; - msg2ForwardMessagePtr->msgReturn = blobref; - blobInfo.Attach((Message*) msg2ForwardMessagePtr); - msg2ForwardMessagePtr->_priv_idObjectSubject = contextClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg2ForwardMessagePtr, ref RemoteContext.s_priv_ByteOrder_Msg2_ForwardMessage, typeof (RemoteContext.Msg2_ForwardMessage), 0, 0); - _priv_pmsgUse = (Message*) msg2ForwardMessagePtr; - } - - public static unsafe void SendForwardMessage( - ProtocolSplashMessaging _priv_protocolInstance, - ContextID idContextDest, - Message* msgReturn) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteContext.BuildForwardMessage(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idContextDest, msgReturn); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static unsafe void BuildDestroyGroup( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashMessaging _priv_protocolInstance, - int idxGroup) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE contextClassHandle = _priv_protocolInstance.Context_ClassHandle; - _priv_portUse.ValidateHandle(contextClassHandle); - uint size = (uint) sizeof (RemoteContext.Msg3_DestroyGroup); - RemoteContext.Msg3_DestroyGroup* msg3DestroyGroupPtr = (RemoteContext.Msg3_DestroyGroup*) _priv_portUse.AllocMessageBuffer(size); - msg3DestroyGroupPtr->_priv_size = size; - msg3DestroyGroupPtr->_priv_msgid = 3U; - msg3DestroyGroupPtr->idxGroup = idxGroup; - msg3DestroyGroupPtr->_priv_idObjectSubject = contextClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg3DestroyGroupPtr, ref RemoteContext.s_priv_ByteOrder_Msg3_DestroyGroup, typeof (RemoteContext.Msg3_DestroyGroup), 0, 0); - _priv_pmsgUse = (Message*) msg3DestroyGroupPtr; - } - - public static unsafe void SendDestroyGroup( - ProtocolSplashMessaging _priv_protocolInstance, - int idxGroup) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteContext.BuildDestroyGroup(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idxGroup); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static unsafe void BuildCreateGroup( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashMessaging _priv_protocolInstance, - int idxGroup, - ContextID idContextOwner) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE contextClassHandle = _priv_protocolInstance.Context_ClassHandle; - _priv_portUse.ValidateHandle(contextClassHandle); - uint size = (uint) sizeof (RemoteContext.Msg4_CreateGroup); - RemoteContext.Msg4_CreateGroup* msg4CreateGroupPtr = (RemoteContext.Msg4_CreateGroup*) _priv_portUse.AllocMessageBuffer(size); - msg4CreateGroupPtr->_priv_size = size; - msg4CreateGroupPtr->_priv_msgid = 4U; - msg4CreateGroupPtr->idxGroup = idxGroup; - msg4CreateGroupPtr->idContextOwner = idContextOwner; - msg4CreateGroupPtr->_priv_idObjectSubject = contextClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4CreateGroupPtr, ref RemoteContext.s_priv_ByteOrder_Msg4_CreateGroup, typeof (RemoteContext.Msg4_CreateGroup), 0, 0); - _priv_pmsgUse = (Message*) msg4CreateGroupPtr; - } - - public static unsafe void SendCreateGroup( - ProtocolSplashMessaging _priv_protocolInstance, - int idxGroup, - ContextID idContextOwner) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteContext.BuildCreateGroup(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idxGroup, idContextOwner); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteContext CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteContext(port, handle, true); - - public static RemoteContext CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteContext(port, handle, false); - } - - protected RemoteContext(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteContext(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteContext && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_ReleaseObject - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public IntPtr punkObj; - } - - [ComVisible(false)] - private struct Msg2_ForwardMessage - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public ContextID idContextDest; - public BLOBREF msgReturn; - } - - [ComVisible(false)] - private struct Msg3_DestroyGroup - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxGroup; - } - - [ComVisible(false)] - private struct Msg4_CreateGroup - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxGroup; - public ContextID idContextOwner; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteContextRelay.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteContextRelay.cs index 4f93fd5..b4e0054 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteContextRelay.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteContextRelay.cs @@ -9,173 +9,173 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Messaging { - internal class RemoteContextRelay : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg2_Create; - private static ushort[] s_priv_ByteOrder_Msg0_UnlinkContext; - private static ushort[] s_priv_ByteOrder_Msg1_LinkContext; - - protected RemoteContextRelay() + internal class RemoteContextRelay : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg2_Create; + private static ushort[] s_priv_ByteOrder_Msg0_UnlinkContext; + private static ushort[] s_priv_ByteOrder_Msg1_LinkContext; + + protected RemoteContextRelay() + { + } + + public static unsafe RemoteContextRelay Create( + ProtocolSplashMessaging _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + TransportProtocol protocol, + string stServer, + string stSession) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE relayClassHandle = _priv_protocolInstance.ContextRelay_ClassHandle; + RemoteContextRelay remoteContextRelay = new RemoteContextRelay(port, _priv_owner); + BlobInfo blobInfo = new BlobInfo(port, (uint)sizeof(RemoteContextRelay.Msg2_Create)); + BLOBREF blobref1 = blobInfo.Add(stServer); + BLOBREF blobref2 = blobInfo.Add(stSession); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)adjustedTotalSize); + RemoteContextRelay.Msg2_Create* msg2CreatePtr = (RemoteContextRelay.Msg2_Create*)pMem; + msg2CreatePtr->_priv_size = adjustedTotalSize; + msg2CreatePtr->_priv_msgid = 2U; + msg2CreatePtr->protocol = protocol; + msg2CreatePtr->stServer = blobref1; + msg2CreatePtr->stSession = blobref2; + blobInfo.Attach((Message*)msg2CreatePtr); + msg2CreatePtr->_priv_idObjectSubject = remoteContextRelay.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteContextRelay.s_priv_ByteOrder_Msg2_Create, typeof(RemoteContextRelay.Msg2_Create), 0, 0); + port.CreateRemoteObject(relayClassHandle, remoteContextRelay.m_renderHandle, (Message*)msg2CreatePtr); + return remoteContextRelay; + } + + public static unsafe void BuildUnlinkContext( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashMessaging _priv_protocolInstance, + ContextID idContextExisting, + ContextID idContextAlias) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE relayClassHandle = _priv_protocolInstance.ContextRelay_ClassHandle; + _priv_portUse.ValidateHandle(relayClassHandle); + uint size = (uint)sizeof(RemoteContextRelay.Msg0_UnlinkContext); + RemoteContextRelay.Msg0_UnlinkContext* msg0UnlinkContextPtr = (RemoteContextRelay.Msg0_UnlinkContext*)_priv_portUse.AllocMessageBuffer(size); + msg0UnlinkContextPtr->_priv_size = size; + msg0UnlinkContextPtr->_priv_msgid = 0U; + msg0UnlinkContextPtr->idContextExisting = idContextExisting; + msg0UnlinkContextPtr->idContextAlias = idContextAlias; + msg0UnlinkContextPtr->_priv_idObjectSubject = relayClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0UnlinkContextPtr, ref RemoteContextRelay.s_priv_ByteOrder_Msg0_UnlinkContext, typeof(RemoteContextRelay.Msg0_UnlinkContext), 0, 0); + _priv_pmsgUse = (Message*)msg0UnlinkContextPtr; + } + + public static unsafe void SendUnlinkContext( + ProtocolSplashMessaging _priv_protocolInstance, + ContextID idContextExisting, + ContextID idContextAlias) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteContextRelay.BuildUnlinkContext(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idContextExisting, idContextAlias); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static unsafe void BuildLinkContext( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashMessaging _priv_protocolInstance, + ContextID idContextExisting, + ContextID idContextAlias) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE relayClassHandle = _priv_protocolInstance.ContextRelay_ClassHandle; + _priv_portUse.ValidateHandle(relayClassHandle); + uint size = (uint)sizeof(RemoteContextRelay.Msg1_LinkContext); + RemoteContextRelay.Msg1_LinkContext* msg1LinkContextPtr = (RemoteContextRelay.Msg1_LinkContext*)_priv_portUse.AllocMessageBuffer(size); + msg1LinkContextPtr->_priv_size = size; + msg1LinkContextPtr->_priv_msgid = 1U; + msg1LinkContextPtr->idContextExisting = idContextExisting; + msg1LinkContextPtr->idContextAlias = idContextAlias; + msg1LinkContextPtr->_priv_idObjectSubject = relayClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1LinkContextPtr, ref RemoteContextRelay.s_priv_ByteOrder_Msg1_LinkContext, typeof(RemoteContextRelay.Msg1_LinkContext), 0, 0); + _priv_pmsgUse = (Message*)msg1LinkContextPtr; + } + + public static unsafe void SendLinkContext( + ProtocolSplashMessaging _priv_protocolInstance, + ContextID idContextExisting, + ContextID idContextAlias) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteContextRelay.BuildLinkContext(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idContextExisting, idContextAlias); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteContextRelay CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteContextRelay(port, handle, true); + } + + public static RemoteContextRelay CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteContextRelay(port, handle, false); + } + + protected RemoteContextRelay(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteContextRelay(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteContextRelay && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg2_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public TransportProtocol protocol; + public BLOBREF stServer; + public BLOBREF stSession; + } + + [ComVisible(false)] + private struct Msg0_UnlinkContext + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public ContextID idContextExisting; + public ContextID idContextAlias; + } + + [ComVisible(false)] + private struct Msg1_LinkContext + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public ContextID idContextExisting; + public ContextID idContextAlias; + } } - - public static unsafe RemoteContextRelay Create( - ProtocolSplashMessaging _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - TransportProtocol protocol, - string stServer, - string stSession) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE relayClassHandle = _priv_protocolInstance.ContextRelay_ClassHandle; - RemoteContextRelay remoteContextRelay = new RemoteContextRelay(port, _priv_owner); - BlobInfo blobInfo = new BlobInfo(port, (uint) sizeof (RemoteContextRelay.Msg2_Create)); - BLOBREF blobref1 = blobInfo.Add(stServer); - BLOBREF blobref2 = blobInfo.Add(stSession); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) adjustedTotalSize); - RemoteContextRelay.Msg2_Create* msg2CreatePtr = (RemoteContextRelay.Msg2_Create*) pMem; - msg2CreatePtr->_priv_size = adjustedTotalSize; - msg2CreatePtr->_priv_msgid = 2U; - msg2CreatePtr->protocol = protocol; - msg2CreatePtr->stServer = blobref1; - msg2CreatePtr->stSession = blobref2; - blobInfo.Attach((Message*) msg2CreatePtr); - msg2CreatePtr->_priv_idObjectSubject = remoteContextRelay.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteContextRelay.s_priv_ByteOrder_Msg2_Create, typeof (RemoteContextRelay.Msg2_Create), 0, 0); - port.CreateRemoteObject(relayClassHandle, remoteContextRelay.m_renderHandle, (Message*) msg2CreatePtr); - return remoteContextRelay; - } - - public static unsafe void BuildUnlinkContext( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashMessaging _priv_protocolInstance, - ContextID idContextExisting, - ContextID idContextAlias) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE relayClassHandle = _priv_protocolInstance.ContextRelay_ClassHandle; - _priv_portUse.ValidateHandle(relayClassHandle); - uint size = (uint) sizeof (RemoteContextRelay.Msg0_UnlinkContext); - RemoteContextRelay.Msg0_UnlinkContext* msg0UnlinkContextPtr = (RemoteContextRelay.Msg0_UnlinkContext*) _priv_portUse.AllocMessageBuffer(size); - msg0UnlinkContextPtr->_priv_size = size; - msg0UnlinkContextPtr->_priv_msgid = 0U; - msg0UnlinkContextPtr->idContextExisting = idContextExisting; - msg0UnlinkContextPtr->idContextAlias = idContextAlias; - msg0UnlinkContextPtr->_priv_idObjectSubject = relayClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0UnlinkContextPtr, ref RemoteContextRelay.s_priv_ByteOrder_Msg0_UnlinkContext, typeof (RemoteContextRelay.Msg0_UnlinkContext), 0, 0); - _priv_pmsgUse = (Message*) msg0UnlinkContextPtr; - } - - public static unsafe void SendUnlinkContext( - ProtocolSplashMessaging _priv_protocolInstance, - ContextID idContextExisting, - ContextID idContextAlias) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteContextRelay.BuildUnlinkContext(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idContextExisting, idContextAlias); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static unsafe void BuildLinkContext( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashMessaging _priv_protocolInstance, - ContextID idContextExisting, - ContextID idContextAlias) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE relayClassHandle = _priv_protocolInstance.ContextRelay_ClassHandle; - _priv_portUse.ValidateHandle(relayClassHandle); - uint size = (uint) sizeof (RemoteContextRelay.Msg1_LinkContext); - RemoteContextRelay.Msg1_LinkContext* msg1LinkContextPtr = (RemoteContextRelay.Msg1_LinkContext*) _priv_portUse.AllocMessageBuffer(size); - msg1LinkContextPtr->_priv_size = size; - msg1LinkContextPtr->_priv_msgid = 1U; - msg1LinkContextPtr->idContextExisting = idContextExisting; - msg1LinkContextPtr->idContextAlias = idContextAlias; - msg1LinkContextPtr->_priv_idObjectSubject = relayClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1LinkContextPtr, ref RemoteContextRelay.s_priv_ByteOrder_Msg1_LinkContext, typeof (RemoteContextRelay.Msg1_LinkContext), 0, 0); - _priv_pmsgUse = (Message*) msg1LinkContextPtr; - } - - public static unsafe void SendLinkContext( - ProtocolSplashMessaging _priv_protocolInstance, - ContextID idContextExisting, - ContextID idContextAlias) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteContextRelay.BuildLinkContext(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, idContextExisting, idContextAlias); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteContextRelay CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteContextRelay(port, handle, true); - } - - public static RemoteContextRelay CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteContextRelay(port, handle, false); - } - - protected RemoteContextRelay(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteContextRelay(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteContextRelay && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg2_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public TransportProtocol protocol; - public BLOBREF stServer; - public BLOBREF stSession; - } - - [ComVisible(false)] - private struct Msg0_UnlinkContext - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public ContextID idContextExisting; - public ContextID idContextAlias; - } - - [ComVisible(false)] - private struct Msg1_LinkContext - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public ContextID idContextExisting; - public ContextID idContextAlias; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteDataBuffer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteDataBuffer.cs index 66d13c8..37807dd 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteDataBuffer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Messaging/RemoteDataBuffer.cs @@ -10,80 +10,80 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Messaging { - internal class RemoteDataBuffer : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_RegisterOwner; - - protected RemoteDataBuffer() + internal class RemoteDataBuffer : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_RegisterOwner; + + protected RemoteDataBuffer() + { + } + + public unsafe void BuildRegisterOwner( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + LocalDataBufferCallback cb) + { + 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(RemoteDataBuffer.Msg0_RegisterOwner); + RemoteDataBuffer.Msg0_RegisterOwner* msg0RegisterOwnerPtr = (RemoteDataBuffer.Msg0_RegisterOwner*)_priv_portUse.AllocMessageBuffer(size); + msg0RegisterOwnerPtr->_priv_size = size; + msg0RegisterOwnerPtr->_priv_msgid = 0U; + msg0RegisterOwnerPtr->_priv_objcb = cb.RenderHandle; + msg0RegisterOwnerPtr->_priv_ctxcb = _priv_portUse.Session.LocalContext; + msg0RegisterOwnerPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0RegisterOwnerPtr, ref RemoteDataBuffer.s_priv_ByteOrder_Msg0_RegisterOwner, typeof(RemoteDataBuffer.Msg0_RegisterOwner), 0, 0); + _priv_pmsgUse = (Message*)msg0RegisterOwnerPtr; + } + + public unsafe void SendRegisterOwner(LocalDataBufferCallback cb) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRegisterOwner(out _priv_portUse, out _priv_pmsgUse, cb); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteDataBuffer CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteDataBuffer(port, handle, true); + } + + public static RemoteDataBuffer CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteDataBuffer(port, handle, false); + } + + protected RemoteDataBuffer(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteDataBuffer(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteDataBuffer && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_RegisterOwner + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + } } - - public unsafe void BuildRegisterOwner( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - LocalDataBufferCallback cb) - { - 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 (RemoteDataBuffer.Msg0_RegisterOwner); - RemoteDataBuffer.Msg0_RegisterOwner* msg0RegisterOwnerPtr = (RemoteDataBuffer.Msg0_RegisterOwner*) _priv_portUse.AllocMessageBuffer(size); - msg0RegisterOwnerPtr->_priv_size = size; - msg0RegisterOwnerPtr->_priv_msgid = 0U; - msg0RegisterOwnerPtr->_priv_objcb = cb.RenderHandle; - msg0RegisterOwnerPtr->_priv_ctxcb = _priv_portUse.Session.LocalContext; - msg0RegisterOwnerPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0RegisterOwnerPtr, ref RemoteDataBuffer.s_priv_ByteOrder_Msg0_RegisterOwner, typeof (RemoteDataBuffer.Msg0_RegisterOwner), 0, 0); - _priv_pmsgUse = (Message*) msg0RegisterOwnerPtr; - } - - public unsafe void SendRegisterOwner(LocalDataBufferCallback cb) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRegisterOwner(out _priv_portUse, out _priv_pmsgUse, cb); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteDataBuffer CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteDataBuffer(port, handle, true); - } - - public static RemoteDataBuffer CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteDataBuffer(port, handle, false); - } - - protected RemoteDataBuffer(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteDataBuffer(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteDataBuffer && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_RegisterOwner - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IAnimationCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IAnimationCallback.cs index 159a70a..fc4b4eb 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IAnimationCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IAnimationCallback.cs @@ -8,8 +8,8 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal interface IAnimationCallback - { - void AsyncNotify(RENDERHANDLE target, int nCookie); - } + internal interface IAnimationCallback + { + void AsyncNotify(RENDERHANDLE target, int nCookie); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IDeviceCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IDeviceCallback.cs index 8ee71c0..3afa41f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IDeviceCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IDeviceCallback.cs @@ -9,19 +9,19 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal interface IDeviceCallback - { - void OnBackBufferCaptured(RENDERHANDLE target); + internal interface IDeviceCallback + { + void OnBackBufferCaptured(RENDERHANDLE target); - void OnSurfacePoolAllocation( - RENDERHANDLE target, - RENDERHANDLE idSurfacePool, - SurfacePoolAllocationResult nResult); + void OnSurfacePoolAllocation( + RENDERHANDLE target, + RENDERHANDLE idSurfacePool, + SurfacePoolAllocationResult nResult); - void OnVsaBlock(RENDERHANDLE target, bool fInBlock); + void OnVsaBlock(RENDERHANDLE target, bool fInBlock); - void OnLostDevice(RENDERHANDLE target, uint cRenderGeneration, bool fLost); + void OnLostDevice(RENDERHANDLE target, uint cRenderGeneration, bool fLost); - void OnCreated(RENDERHANDLE target, bool fAllowDynamicPool); - } + void OnCreated(RENDERHANDLE target, bool fAllowDynamicPool); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IRenderCapsCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IRenderCapsCallback.cs index 32e6dbf..ef0f7f7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IRenderCapsCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IRenderCapsCallback.cs @@ -9,14 +9,14 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal interface IRenderCapsCallback - { - void OnSoundCaps(RENDERHANDLE target, uint nCookie, Microsoft.Iris.Render.Internal.SoundCaps capsInfo); + internal interface IRenderCapsCallback + { + void OnSoundCaps(RENDERHANDLE target, uint nCookie, Microsoft.Iris.Render.Internal.SoundCaps capsInfo); - void OnGraphicsCaps(RENDERHANDLE target, uint nCookie, GraphicsCaps capsInfo); + void OnGraphicsCaps(RENDERHANDLE target, uint nCookie, GraphicsCaps capsInfo); - void OnEndCapsCheck(RENDERHANDLE target, uint nCookie); + void OnEndCapsCheck(RENDERHANDLE target, uint nCookie); - void OnBeginCapsCheck(RENDERHANDLE target, uint nCookie); - } + void OnBeginCapsCheck(RENDERHANDLE target, uint nCookie); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/ISoundBufferCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/ISoundBufferCallback.cs index 7d15231..c3213ac 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/ISoundBufferCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/ISoundBufferCallback.cs @@ -8,10 +8,10 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal interface ISoundBufferCallback - { - void OnSoundBufferReady(RENDERHANDLE idTarget); + internal interface ISoundBufferCallback + { + void OnSoundBufferReady(RENDERHANDLE idTarget); - void OnSoundBufferLost(RENDERHANDLE idTarget); - } + void OnSoundBufferLost(RENDERHANDLE idTarget); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IVideoPoolCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IVideoPoolCallback.cs index d1ea362..1738896 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IVideoPoolCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/IVideoPoolCallback.cs @@ -8,16 +8,16 @@ using Microsoft.Iris.Render.Protocol; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal interface IVideoPoolCallback - { - void OnInvalidate(RENDERHANDLE target); + internal interface IVideoPoolCallback + { + void OnInvalidate(RENDERHANDLE target); - void OnInputChanged( - RENDERHANDLE target, - Size sizeTargetPxl, - Size sizeAspectRatioPxl, - uint nFrameRateNumerator, - uint nFrameRateDenominator, - SurfaceFormat nFormat); - } + void OnInputChanged( + RENDERHANDLE target, + Size sizeTargetPxl, + Size sizeAspectRatioPxl, + uint nFrameRateNumerator, + uint nFrameRateDenominator, + SurfaceFormat nFormat); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalAnimationCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalAnimationCallback.cs index 5f3dcf1..01ebf21 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalAnimationCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalAnimationCallback.cs @@ -10,67 +10,67 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class LocalAnimationCallback : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_AsyncNotify; - - protected LocalAnimationCallback() + internal class LocalAnimationCallback : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_AsyncNotify; + + protected LocalAnimationCallback() + { + } + + internal static LocalAnimationCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalAnimationCallback(port, callbackInstance); + } + + protected LocalAnimationCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalAnimationCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalAnimationCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is IAnimationCallback _priv_target) || message->nMsg != 0U) + return; + LocalAnimationCallback.Dispatch_AsyncNotify(port, _priv_target, (LocalAnimationCallback.Msg0_AsyncNotify*)message); + } + + private static unsafe void Dispatch_AsyncNotify( + RenderPort _priv_port, + IAnimationCallback _priv_target, + LocalAnimationCallback.Msg0_AsyncNotify* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalAnimationCallback.s_priv_ByteOrder_Msg0_AsyncNotify, typeof(LocalAnimationCallback.Msg0_AsyncNotify), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + int nCookie = _priv_pmsg->nCookie; + _priv_target.AsyncNotify(target, nCookie); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_AsyncNotify + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public int nCookie; + } } - - internal static LocalAnimationCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalAnimationCallback(port, callbackInstance); - } - - protected LocalAnimationCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalAnimationCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalAnimationCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is IAnimationCallback _priv_target) || message->nMsg != 0U) - return; - LocalAnimationCallback.Dispatch_AsyncNotify(port, _priv_target, (LocalAnimationCallback.Msg0_AsyncNotify*) message); - } - - private static unsafe void Dispatch_AsyncNotify( - RenderPort _priv_port, - IAnimationCallback _priv_target, - LocalAnimationCallback.Msg0_AsyncNotify* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalAnimationCallback.s_priv_ByteOrder_Msg0_AsyncNotify, typeof (LocalAnimationCallback.Msg0_AsyncNotify), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - int nCookie = _priv_pmsg->nCookie; - _priv_target.AsyncNotify(target, nCookie); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_AsyncNotify - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public int nCookie; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalDeviceCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalDeviceCallback.cs index a394bcf..ac98a48 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalDeviceCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalDeviceCallback.cs @@ -11,178 +11,178 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class LocalDeviceCallback : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_OnBackBufferCaptured; - private static ushort[] s_priv_ByteOrder_Msg1_OnSurfacePoolAllocation; - private static ushort[] s_priv_ByteOrder_Msg2_OnVsaBlock; - private static ushort[] s_priv_ByteOrder_Msg3_OnLostDevice; - private static ushort[] s_priv_ByteOrder_Msg4_OnCreated; - - protected LocalDeviceCallback() + internal class LocalDeviceCallback : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_OnBackBufferCaptured; + private static ushort[] s_priv_ByteOrder_Msg1_OnSurfacePoolAllocation; + private static ushort[] s_priv_ByteOrder_Msg2_OnVsaBlock; + private static ushort[] s_priv_ByteOrder_Msg3_OnLostDevice; + private static ushort[] s_priv_ByteOrder_Msg4_OnCreated; + + protected LocalDeviceCallback() + { + } + + internal static LocalDeviceCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalDeviceCallback(port, callbackInstance); + } + + protected LocalDeviceCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalDeviceCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalDeviceCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is IDeviceCallback _priv_target)) + return; + switch (message->nMsg) + { + case 0: + LocalDeviceCallback.Dispatch_OnBackBufferCaptured(port, _priv_target, (LocalDeviceCallback.Msg0_OnBackBufferCaptured*)message); + break; + case 1: + LocalDeviceCallback.Dispatch_OnSurfacePoolAllocation(port, _priv_target, (LocalDeviceCallback.Msg1_OnSurfacePoolAllocation*)message); + break; + case 2: + LocalDeviceCallback.Dispatch_OnVsaBlock(port, _priv_target, (LocalDeviceCallback.Msg2_OnVsaBlock*)message); + break; + case 3: + LocalDeviceCallback.Dispatch_OnLostDevice(port, _priv_target, (LocalDeviceCallback.Msg3_OnLostDevice*)message); + break; + case 4: + LocalDeviceCallback.Dispatch_OnCreated(port, _priv_target, (LocalDeviceCallback.Msg4_OnCreated*)message); + break; + } + } + + private static unsafe void Dispatch_OnBackBufferCaptured( + RenderPort _priv_port, + IDeviceCallback _priv_target, + LocalDeviceCallback.Msg0_OnBackBufferCaptured* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDeviceCallback.s_priv_ByteOrder_Msg0_OnBackBufferCaptured, typeof(LocalDeviceCallback.Msg0_OnBackBufferCaptured), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnBackBufferCaptured(target); + } + + private static unsafe void Dispatch_OnSurfacePoolAllocation( + RenderPort _priv_port, + IDeviceCallback _priv_target, + LocalDeviceCallback.Msg1_OnSurfacePoolAllocation* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDeviceCallback.s_priv_ByteOrder_Msg1_OnSurfacePoolAllocation, typeof(LocalDeviceCallback.Msg1_OnSurfacePoolAllocation), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + RENDERHANDLE idSurfacePool = _priv_pmsg->idSurfacePool; + SurfacePoolAllocationResult nResult = _priv_pmsg->nResult; + _priv_target.OnSurfacePoolAllocation(target, idSurfacePool, nResult); + } + + private static unsafe void Dispatch_OnVsaBlock( + RenderPort _priv_port, + IDeviceCallback _priv_target, + LocalDeviceCallback.Msg2_OnVsaBlock* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDeviceCallback.s_priv_ByteOrder_Msg2_OnVsaBlock, typeof(LocalDeviceCallback.Msg2_OnVsaBlock), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + bool fInBlock = _priv_pmsg->fInBlock != 0U; + _priv_target.OnVsaBlock(target, fInBlock); + } + + private static unsafe void Dispatch_OnLostDevice( + RenderPort _priv_port, + IDeviceCallback _priv_target, + LocalDeviceCallback.Msg3_OnLostDevice* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDeviceCallback.s_priv_ByteOrder_Msg3_OnLostDevice, typeof(LocalDeviceCallback.Msg3_OnLostDevice), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + uint renderGeneration = _priv_pmsg->cRenderGeneration; + bool fLost = _priv_pmsg->fLost != 0U; + _priv_target.OnLostDevice(target, renderGeneration, fLost); + } + + private static unsafe void Dispatch_OnCreated( + RenderPort _priv_port, + IDeviceCallback _priv_target, + LocalDeviceCallback.Msg4_OnCreated* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalDeviceCallback.s_priv_ByteOrder_Msg4_OnCreated, typeof(LocalDeviceCallback.Msg4_OnCreated), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + bool fAllowDynamicPool = _priv_pmsg->fAllowDynamicPool != 0U; + _priv_target.OnCreated(target, fAllowDynamicPool); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_OnBackBufferCaptured + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } + + [ComVisible(false)] + private struct Msg1_OnSurfacePoolAllocation + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public RENDERHANDLE idSurfacePool; + public SurfacePoolAllocationResult nResult; + } + + [ComVisible(false)] + private struct Msg2_OnVsaBlock + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint fInBlock; + } + + [ComVisible(false)] + private struct Msg3_OnLostDevice + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint cRenderGeneration; + public uint fLost; + } + + [ComVisible(false)] + private struct Msg4_OnCreated + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint fAllowDynamicPool; + } } - - internal static LocalDeviceCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalDeviceCallback(port, callbackInstance); - } - - protected LocalDeviceCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalDeviceCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalDeviceCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is IDeviceCallback _priv_target)) - return; - switch (message->nMsg) - { - case 0: - LocalDeviceCallback.Dispatch_OnBackBufferCaptured(port, _priv_target, (LocalDeviceCallback.Msg0_OnBackBufferCaptured*) message); - break; - case 1: - LocalDeviceCallback.Dispatch_OnSurfacePoolAllocation(port, _priv_target, (LocalDeviceCallback.Msg1_OnSurfacePoolAllocation*) message); - break; - case 2: - LocalDeviceCallback.Dispatch_OnVsaBlock(port, _priv_target, (LocalDeviceCallback.Msg2_OnVsaBlock*) message); - break; - case 3: - LocalDeviceCallback.Dispatch_OnLostDevice(port, _priv_target, (LocalDeviceCallback.Msg3_OnLostDevice*) message); - break; - case 4: - LocalDeviceCallback.Dispatch_OnCreated(port, _priv_target, (LocalDeviceCallback.Msg4_OnCreated*) message); - break; - } - } - - private static unsafe void Dispatch_OnBackBufferCaptured( - RenderPort _priv_port, - IDeviceCallback _priv_target, - LocalDeviceCallback.Msg0_OnBackBufferCaptured* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDeviceCallback.s_priv_ByteOrder_Msg0_OnBackBufferCaptured, typeof (LocalDeviceCallback.Msg0_OnBackBufferCaptured), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnBackBufferCaptured(target); - } - - private static unsafe void Dispatch_OnSurfacePoolAllocation( - RenderPort _priv_port, - IDeviceCallback _priv_target, - LocalDeviceCallback.Msg1_OnSurfacePoolAllocation* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDeviceCallback.s_priv_ByteOrder_Msg1_OnSurfacePoolAllocation, typeof (LocalDeviceCallback.Msg1_OnSurfacePoolAllocation), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - RENDERHANDLE idSurfacePool = _priv_pmsg->idSurfacePool; - SurfacePoolAllocationResult nResult = _priv_pmsg->nResult; - _priv_target.OnSurfacePoolAllocation(target, idSurfacePool, nResult); - } - - private static unsafe void Dispatch_OnVsaBlock( - RenderPort _priv_port, - IDeviceCallback _priv_target, - LocalDeviceCallback.Msg2_OnVsaBlock* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDeviceCallback.s_priv_ByteOrder_Msg2_OnVsaBlock, typeof (LocalDeviceCallback.Msg2_OnVsaBlock), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - bool fInBlock = _priv_pmsg->fInBlock != 0U; - _priv_target.OnVsaBlock(target, fInBlock); - } - - private static unsafe void Dispatch_OnLostDevice( - RenderPort _priv_port, - IDeviceCallback _priv_target, - LocalDeviceCallback.Msg3_OnLostDevice* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDeviceCallback.s_priv_ByteOrder_Msg3_OnLostDevice, typeof (LocalDeviceCallback.Msg3_OnLostDevice), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - uint renderGeneration = _priv_pmsg->cRenderGeneration; - bool fLost = _priv_pmsg->fLost != 0U; - _priv_target.OnLostDevice(target, renderGeneration, fLost); - } - - private static unsafe void Dispatch_OnCreated( - RenderPort _priv_port, - IDeviceCallback _priv_target, - LocalDeviceCallback.Msg4_OnCreated* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalDeviceCallback.s_priv_ByteOrder_Msg4_OnCreated, typeof (LocalDeviceCallback.Msg4_OnCreated), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - bool fAllowDynamicPool = _priv_pmsg->fAllowDynamicPool != 0U; - _priv_target.OnCreated(target, fAllowDynamicPool); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_OnBackBufferCaptured - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - - [ComVisible(false)] - private struct Msg1_OnSurfacePoolAllocation - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public RENDERHANDLE idSurfacePool; - public SurfacePoolAllocationResult nResult; - } - - [ComVisible(false)] - private struct Msg2_OnVsaBlock - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint fInBlock; - } - - [ComVisible(false)] - private struct Msg3_OnLostDevice - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint cRenderGeneration; - public uint fLost; - } - - [ComVisible(false)] - private struct Msg4_OnCreated - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint fAllowDynamicPool; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalRenderCapsCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalRenderCapsCallback.cs index b4f3f9d..61c5305 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalRenderCapsCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalRenderCapsCallback.cs @@ -11,154 +11,154 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class LocalRenderCapsCallback : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_OnSoundCaps; - private static ushort[] s_priv_ByteOrder_Msg1_OnGraphicsCaps; - private static ushort[] s_priv_ByteOrder_Msg2_OnEndCapsCheck; - private static ushort[] s_priv_ByteOrder_Msg3_OnBeginCapsCheck; - - protected LocalRenderCapsCallback() + internal class LocalRenderCapsCallback : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_OnSoundCaps; + private static ushort[] s_priv_ByteOrder_Msg1_OnGraphicsCaps; + private static ushort[] s_priv_ByteOrder_Msg2_OnEndCapsCheck; + private static ushort[] s_priv_ByteOrder_Msg3_OnBeginCapsCheck; + + protected LocalRenderCapsCallback() + { + } + + internal static LocalRenderCapsCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalRenderCapsCallback(port, callbackInstance); + } + + protected LocalRenderCapsCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalRenderCapsCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalRenderCapsCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is IRenderCapsCallback _priv_target)) + return; + switch (message->nMsg) + { + case 0: + LocalRenderCapsCallback.Dispatch_OnSoundCaps(port, _priv_target, (LocalRenderCapsCallback.Msg0_OnSoundCaps*)message); + break; + case 1: + LocalRenderCapsCallback.Dispatch_OnGraphicsCaps(port, _priv_target, (LocalRenderCapsCallback.Msg1_OnGraphicsCaps*)message); + break; + case 2: + LocalRenderCapsCallback.Dispatch_OnEndCapsCheck(port, _priv_target, (LocalRenderCapsCallback.Msg2_OnEndCapsCheck*)message); + break; + case 3: + LocalRenderCapsCallback.Dispatch_OnBeginCapsCheck(port, _priv_target, (LocalRenderCapsCallback.Msg3_OnBeginCapsCheck*)message); + break; + } + } + + private static unsafe void Dispatch_OnSoundCaps( + RenderPort _priv_port, + IRenderCapsCallback _priv_target, + LocalRenderCapsCallback.Msg0_OnSoundCaps* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalRenderCapsCallback.s_priv_ByteOrder_Msg0_OnSoundCaps, typeof(LocalRenderCapsCallback.Msg0_OnSoundCaps), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + uint nCookie = _priv_pmsg->nCookie; + Microsoft.Iris.Render.Internal.SoundCaps capsInfo = _priv_pmsg->capsInfo; + _priv_target.OnSoundCaps(target, nCookie, capsInfo); + } + + private static unsafe void Dispatch_OnGraphicsCaps( + RenderPort _priv_port, + IRenderCapsCallback _priv_target, + LocalRenderCapsCallback.Msg1_OnGraphicsCaps* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalRenderCapsCallback.s_priv_ByteOrder_Msg1_OnGraphicsCaps, typeof(LocalRenderCapsCallback.Msg1_OnGraphicsCaps), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + uint nCookie = _priv_pmsg->nCookie; + GraphicsCaps capsInfo = _priv_pmsg->capsInfo; + _priv_target.OnGraphicsCaps(target, nCookie, capsInfo); + } + + private static unsafe void Dispatch_OnEndCapsCheck( + RenderPort _priv_port, + IRenderCapsCallback _priv_target, + LocalRenderCapsCallback.Msg2_OnEndCapsCheck* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalRenderCapsCallback.s_priv_ByteOrder_Msg2_OnEndCapsCheck, typeof(LocalRenderCapsCallback.Msg2_OnEndCapsCheck), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + uint nCookie = _priv_pmsg->nCookie; + _priv_target.OnEndCapsCheck(target, nCookie); + } + + private static unsafe void Dispatch_OnBeginCapsCheck( + RenderPort _priv_port, + IRenderCapsCallback _priv_target, + LocalRenderCapsCallback.Msg3_OnBeginCapsCheck* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalRenderCapsCallback.s_priv_ByteOrder_Msg3_OnBeginCapsCheck, typeof(LocalRenderCapsCallback.Msg3_OnBeginCapsCheck), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + uint nCookie = _priv_pmsg->nCookie; + _priv_target.OnBeginCapsCheck(target, nCookie); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_OnSoundCaps + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint nCookie; + public Microsoft.Iris.Render.Internal.SoundCaps capsInfo; + } + + [ComVisible(false)] + private struct Msg1_OnGraphicsCaps + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint nCookie; + public GraphicsCaps capsInfo; + } + + [ComVisible(false)] + private struct Msg2_OnEndCapsCheck + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint nCookie; + } + + [ComVisible(false)] + private struct Msg3_OnBeginCapsCheck + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public uint nCookie; + } } - - internal static LocalRenderCapsCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalRenderCapsCallback(port, callbackInstance); - } - - protected LocalRenderCapsCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalRenderCapsCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalRenderCapsCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is IRenderCapsCallback _priv_target)) - return; - switch (message->nMsg) - { - case 0: - LocalRenderCapsCallback.Dispatch_OnSoundCaps(port, _priv_target, (LocalRenderCapsCallback.Msg0_OnSoundCaps*) message); - break; - case 1: - LocalRenderCapsCallback.Dispatch_OnGraphicsCaps(port, _priv_target, (LocalRenderCapsCallback.Msg1_OnGraphicsCaps*) message); - break; - case 2: - LocalRenderCapsCallback.Dispatch_OnEndCapsCheck(port, _priv_target, (LocalRenderCapsCallback.Msg2_OnEndCapsCheck*) message); - break; - case 3: - LocalRenderCapsCallback.Dispatch_OnBeginCapsCheck(port, _priv_target, (LocalRenderCapsCallback.Msg3_OnBeginCapsCheck*) message); - break; - } - } - - private static unsafe void Dispatch_OnSoundCaps( - RenderPort _priv_port, - IRenderCapsCallback _priv_target, - LocalRenderCapsCallback.Msg0_OnSoundCaps* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalRenderCapsCallback.s_priv_ByteOrder_Msg0_OnSoundCaps, typeof (LocalRenderCapsCallback.Msg0_OnSoundCaps), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - uint nCookie = _priv_pmsg->nCookie; - Microsoft.Iris.Render.Internal.SoundCaps capsInfo = _priv_pmsg->capsInfo; - _priv_target.OnSoundCaps(target, nCookie, capsInfo); - } - - private static unsafe void Dispatch_OnGraphicsCaps( - RenderPort _priv_port, - IRenderCapsCallback _priv_target, - LocalRenderCapsCallback.Msg1_OnGraphicsCaps* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalRenderCapsCallback.s_priv_ByteOrder_Msg1_OnGraphicsCaps, typeof (LocalRenderCapsCallback.Msg1_OnGraphicsCaps), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - uint nCookie = _priv_pmsg->nCookie; - GraphicsCaps capsInfo = _priv_pmsg->capsInfo; - _priv_target.OnGraphicsCaps(target, nCookie, capsInfo); - } - - private static unsafe void Dispatch_OnEndCapsCheck( - RenderPort _priv_port, - IRenderCapsCallback _priv_target, - LocalRenderCapsCallback.Msg2_OnEndCapsCheck* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalRenderCapsCallback.s_priv_ByteOrder_Msg2_OnEndCapsCheck, typeof (LocalRenderCapsCallback.Msg2_OnEndCapsCheck), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - uint nCookie = _priv_pmsg->nCookie; - _priv_target.OnEndCapsCheck(target, nCookie); - } - - private static unsafe void Dispatch_OnBeginCapsCheck( - RenderPort _priv_port, - IRenderCapsCallback _priv_target, - LocalRenderCapsCallback.Msg3_OnBeginCapsCheck* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalRenderCapsCallback.s_priv_ByteOrder_Msg3_OnBeginCapsCheck, typeof (LocalRenderCapsCallback.Msg3_OnBeginCapsCheck), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - uint nCookie = _priv_pmsg->nCookie; - _priv_target.OnBeginCapsCheck(target, nCookie); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_OnSoundCaps - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint nCookie; - public Microsoft.Iris.Render.Internal.SoundCaps capsInfo; - } - - [ComVisible(false)] - private struct Msg1_OnGraphicsCaps - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint nCookie; - public GraphicsCaps capsInfo; - } - - [ComVisible(false)] - private struct Msg2_OnEndCapsCheck - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint nCookie; - } - - [ComVisible(false)] - private struct Msg3_OnBeginCapsCheck - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public uint nCookie; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalSoundBufferCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalSoundBufferCallback.cs index c916d7c..7b057f3 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalSoundBufferCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalSoundBufferCallback.cs @@ -10,94 +10,94 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class LocalSoundBufferCallback : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_OnSoundBufferReady; - private static ushort[] s_priv_ByteOrder_Msg1_OnSoundBufferLost; - - protected LocalSoundBufferCallback() + internal class LocalSoundBufferCallback : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_OnSoundBufferReady; + private static ushort[] s_priv_ByteOrder_Msg1_OnSoundBufferLost; + + protected LocalSoundBufferCallback() + { + } + + internal static LocalSoundBufferCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalSoundBufferCallback(port, callbackInstance); + } + + protected LocalSoundBufferCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalSoundBufferCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalSoundBufferCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is ISoundBufferCallback _priv_target)) + return; + switch (message->nMsg) + { + case 0: + LocalSoundBufferCallback.Dispatch_OnSoundBufferReady(port, _priv_target, (LocalSoundBufferCallback.Msg0_OnSoundBufferReady*)message); + break; + case 1: + LocalSoundBufferCallback.Dispatch_OnSoundBufferLost(port, _priv_target, (LocalSoundBufferCallback.Msg1_OnSoundBufferLost*)message); + break; + } + } + + private static unsafe void Dispatch_OnSoundBufferReady( + RenderPort _priv_port, + ISoundBufferCallback _priv_target, + LocalSoundBufferCallback.Msg0_OnSoundBufferReady* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalSoundBufferCallback.s_priv_ByteOrder_Msg0_OnSoundBufferReady, typeof(LocalSoundBufferCallback.Msg0_OnSoundBufferReady), sizeof(CallbackMessage), 0); + RENDERHANDLE idTarget = _priv_pmsg->idTarget; + _priv_target.OnSoundBufferReady(idTarget); + } + + private static unsafe void Dispatch_OnSoundBufferLost( + RenderPort _priv_port, + ISoundBufferCallback _priv_target, + LocalSoundBufferCallback.Msg1_OnSoundBufferLost* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalSoundBufferCallback.s_priv_ByteOrder_Msg1_OnSoundBufferLost, typeof(LocalSoundBufferCallback.Msg1_OnSoundBufferLost), sizeof(CallbackMessage), 0); + RENDERHANDLE idTarget = _priv_pmsg->idTarget; + _priv_target.OnSoundBufferLost(idTarget); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_OnSoundBufferReady + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE idTarget; + } + + [ComVisible(false)] + private struct Msg1_OnSoundBufferLost + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE idTarget; + } } - - internal static LocalSoundBufferCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalSoundBufferCallback(port, callbackInstance); - } - - protected LocalSoundBufferCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalSoundBufferCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalSoundBufferCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is ISoundBufferCallback _priv_target)) - return; - switch (message->nMsg) - { - case 0: - LocalSoundBufferCallback.Dispatch_OnSoundBufferReady(port, _priv_target, (LocalSoundBufferCallback.Msg0_OnSoundBufferReady*) message); - break; - case 1: - LocalSoundBufferCallback.Dispatch_OnSoundBufferLost(port, _priv_target, (LocalSoundBufferCallback.Msg1_OnSoundBufferLost*) message); - break; - } - } - - private static unsafe void Dispatch_OnSoundBufferReady( - RenderPort _priv_port, - ISoundBufferCallback _priv_target, - LocalSoundBufferCallback.Msg0_OnSoundBufferReady* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalSoundBufferCallback.s_priv_ByteOrder_Msg0_OnSoundBufferReady, typeof (LocalSoundBufferCallback.Msg0_OnSoundBufferReady), sizeof (CallbackMessage), 0); - RENDERHANDLE idTarget = _priv_pmsg->idTarget; - _priv_target.OnSoundBufferReady(idTarget); - } - - private static unsafe void Dispatch_OnSoundBufferLost( - RenderPort _priv_port, - ISoundBufferCallback _priv_target, - LocalSoundBufferCallback.Msg1_OnSoundBufferLost* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalSoundBufferCallback.s_priv_ByteOrder_Msg1_OnSoundBufferLost, typeof (LocalSoundBufferCallback.Msg1_OnSoundBufferLost), sizeof (CallbackMessage), 0); - RENDERHANDLE idTarget = _priv_pmsg->idTarget; - _priv_target.OnSoundBufferLost(idTarget); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_OnSoundBufferReady - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE idTarget; - } - - [ComVisible(false)] - private struct Msg1_OnSoundBufferLost - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE idTarget; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalVideoPoolCallback.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalVideoPoolCallback.cs index b530193..6225e6f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalVideoPoolCallback.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/LocalVideoPoolCallback.cs @@ -10,104 +10,104 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class LocalVideoPoolCallback : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_OnInvalidate; - private static ushort[] s_priv_ByteOrder_Msg1_OnInputChanged; - - protected LocalVideoPoolCallback() + internal class LocalVideoPoolCallback : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_OnInvalidate; + private static ushort[] s_priv_ByteOrder_Msg1_OnInputChanged; + + protected LocalVideoPoolCallback() + { + } + + internal static LocalVideoPoolCallback CreateCallbackImpl( + RenderPort port, + RENDERHANDLE callbackInstance) + { + return new LocalVideoPoolCallback(port, callbackInstance); + } + + protected LocalVideoPoolCallback(RenderPort port, RENDERHANDLE handle) + : base(port, handle, false) + { + } + + public override bool Equals(object other) => other is LocalVideoPoolCallback && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalVideoPoolCallback.DispatchCallback), out uint _); + + private static unsafe void DispatchCallback( + RenderPort port, + IRenderHandleOwner owner, + CallbackMessage* message) + { + if (!(owner is IVideoPoolCallback _priv_target)) + return; + switch (message->nMsg) + { + case 0: + LocalVideoPoolCallback.Dispatch_OnInvalidate(port, _priv_target, (LocalVideoPoolCallback.Msg0_OnInvalidate*)message); + break; + case 1: + LocalVideoPoolCallback.Dispatch_OnInputChanged(port, _priv_target, (LocalVideoPoolCallback.Msg1_OnInputChanged*)message); + break; + } + } + + private static unsafe void Dispatch_OnInvalidate( + RenderPort _priv_port, + IVideoPoolCallback _priv_target, + LocalVideoPoolCallback.Msg0_OnInvalidate* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalVideoPoolCallback.s_priv_ByteOrder_Msg0_OnInvalidate, typeof(LocalVideoPoolCallback.Msg0_OnInvalidate), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + _priv_target.OnInvalidate(target); + } + + private static unsafe void Dispatch_OnInputChanged( + RenderPort _priv_port, + IVideoPoolCallback _priv_target, + LocalVideoPoolCallback.Msg1_OnInputChanged* _priv_pmsg) + { + if (_priv_port.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)_priv_pmsg, ref LocalVideoPoolCallback.s_priv_ByteOrder_Msg1_OnInputChanged, typeof(LocalVideoPoolCallback.Msg1_OnInputChanged), sizeof(CallbackMessage), 0); + RENDERHANDLE target = _priv_pmsg->target; + Size sizeTargetPxl = _priv_pmsg->sizeTargetPxl; + Size sizeAspectRatioPxl = _priv_pmsg->sizeAspectRatioPxl; + uint frameRateNumerator = _priv_pmsg->nFrameRateNumerator; + uint frameRateDenominator = _priv_pmsg->nFrameRateDenominator; + SurfaceFormat nFormat = _priv_pmsg->nFormat; + _priv_target.OnInputChanged(target, sizeTargetPxl, sizeAspectRatioPxl, frameRateNumerator, frameRateDenominator, nFormat); + } + + [Conditional("DEBUG")] + private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) + { + } + + [ComVisible(false)] + private struct Msg0_OnInvalidate + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + } + + [ComVisible(false)] + private struct Msg1_OnInputChanged + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE target; + public Size sizeTargetPxl; + public Size sizeAspectRatioPxl; + public uint nFrameRateNumerator; + public uint nFrameRateDenominator; + public SurfaceFormat nFormat; + } } - - internal static LocalVideoPoolCallback CreateCallbackImpl( - RenderPort port, - RENDERHANDLE callbackInstance) - { - return new LocalVideoPoolCallback(port, callbackInstance); - } - - protected LocalVideoPoolCallback(RenderPort port, RENDERHANDLE handle) - : base(port, handle, false) - { - } - - public override bool Equals(object other) => other is LocalVideoPoolCallback && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - internal static RENDERHANDLE BindCallback(RenderPort port) => port.RegisterCallback(new PortCallback(LocalVideoPoolCallback.DispatchCallback), out uint _); - - private static unsafe void DispatchCallback( - RenderPort port, - IRenderHandleOwner owner, - CallbackMessage* message) - { - if (!(owner is IVideoPoolCallback _priv_target)) - return; - switch (message->nMsg) - { - case 0: - LocalVideoPoolCallback.Dispatch_OnInvalidate(port, _priv_target, (LocalVideoPoolCallback.Msg0_OnInvalidate*) message); - break; - case 1: - LocalVideoPoolCallback.Dispatch_OnInputChanged(port, _priv_target, (LocalVideoPoolCallback.Msg1_OnInputChanged*) message); - break; - } - } - - private static unsafe void Dispatch_OnInvalidate( - RenderPort _priv_port, - IVideoPoolCallback _priv_target, - LocalVideoPoolCallback.Msg0_OnInvalidate* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalVideoPoolCallback.s_priv_ByteOrder_Msg0_OnInvalidate, typeof (LocalVideoPoolCallback.Msg0_OnInvalidate), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - _priv_target.OnInvalidate(target); - } - - private static unsafe void Dispatch_OnInputChanged( - RenderPort _priv_port, - IVideoPoolCallback _priv_target, - LocalVideoPoolCallback.Msg1_OnInputChanged* _priv_pmsg) - { - if (_priv_port.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) _priv_pmsg, ref LocalVideoPoolCallback.s_priv_ByteOrder_Msg1_OnInputChanged, typeof (LocalVideoPoolCallback.Msg1_OnInputChanged), sizeof (CallbackMessage), 0); - RENDERHANDLE target = _priv_pmsg->target; - Size sizeTargetPxl = _priv_pmsg->sizeTargetPxl; - Size sizeAspectRatioPxl = _priv_pmsg->sizeAspectRatioPxl; - uint frameRateNumerator = _priv_pmsg->nFrameRateNumerator; - uint frameRateDenominator = _priv_pmsg->nFrameRateDenominator; - SurfaceFormat nFormat = _priv_pmsg->nFormat; - _priv_target.OnInputChanged(target, sizeTargetPxl, sizeAspectRatioPxl, frameRateNumerator, frameRateDenominator, nFormat); - } - - [Conditional("DEBUG")] - private static unsafe void OnInvalidCallback(CallbackMessage* message, string category) - { - } - - [ComVisible(false)] - private struct Msg0_OnInvalidate - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - } - - [ComVisible(false)] - private struct Msg1_OnInputChanged - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE target; - public Size sizeTargetPxl; - public Size sizeAspectRatioPxl; - public uint nFrameRateNumerator; - public uint nFrameRateDenominator; - public SurfaceFormat nFormat; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/ProtocolSplashRenderingNt.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/ProtocolSplashRenderingNt.cs index 38dfa36..ce9c235 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/ProtocolSplashRenderingNt.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/ProtocolSplashRenderingNt.cs @@ -10,85 +10,85 @@ using System; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering.Nt { - internal sealed class ProtocolSplashRenderingNt : ProtocolInstance - { - private RENDERHANDLE _priv_remoteClass_GdiDevice; - private RENDERHANDLE _priv_remoteClass_NtDevice; - private RENDERHANDLE _priv_remoteClass_GdiEffect; - private RENDERHANDLE _priv_remoteClass_GdiSprite; - private RENDERHANDLE _priv_remoteClass_WinSoundDevice; - private RENDERHANDLE _priv_remoteClass_Ds8SoundDevice; - - public static ProtocolSplashRenderingNt Bind(RenderPort port) + internal sealed class ProtocolSplashRenderingNt : ProtocolInstance { - Debug2.Validate(port != null, typeof (ArgumentNullException), nameof (port)); - ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Rendering::Nt"); - if (protocolInstance != null) - { - ProtocolSplashRenderingNt splashRenderingNt = protocolInstance as ProtocolSplashRenderingNt; - Debug2.Validate(splashRenderingNt != null, typeof (InvalidOperationException), "protocol name collision"); - return splashRenderingNt; - } - ProtocolSplashRenderingNt splashRenderingNt1 = new ProtocolSplashRenderingNt(port); - port.BindProtocol((ProtocolInstance) splashRenderingNt1); - return splashRenderingNt1; + private RENDERHANDLE _priv_remoteClass_GdiDevice; + private RENDERHANDLE _priv_remoteClass_NtDevice; + private RENDERHANDLE _priv_remoteClass_GdiEffect; + private RENDERHANDLE _priv_remoteClass_GdiSprite; + private RENDERHANDLE _priv_remoteClass_WinSoundDevice; + private RENDERHANDLE _priv_remoteClass_Ds8SoundDevice; + + public static ProtocolSplashRenderingNt Bind(RenderPort port) + { + Debug2.Validate(port != null, typeof(ArgumentNullException), nameof(port)); + ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Rendering::Nt"); + if (protocolInstance != null) + { + ProtocolSplashRenderingNt splashRenderingNt = protocolInstance as ProtocolSplashRenderingNt; + Debug2.Validate(splashRenderingNt != null, typeof(InvalidOperationException), "protocol name collision"); + return splashRenderingNt; + } + ProtocolSplashRenderingNt splashRenderingNt1 = new ProtocolSplashRenderingNt(port); + port.BindProtocol((ProtocolInstance)splashRenderingNt1); + return splashRenderingNt1; + } + + private ProtocolSplashRenderingNt(RenderPort port) + : base(port, "Splash::Rendering::Nt") + { + } + + protected override void Init() + { + RenderPort port = this.Port; + this._priv_remoteClass_GdiDevice = port.InitRemoteClass("Splash::Rendering::Nt::GdiDevice"); + this._priv_remoteClass_NtDevice = port.InitRemoteClass("Splash::Rendering::Nt::NtDevice"); + this._priv_remoteClass_GdiEffect = port.InitRemoteClass("Splash::Rendering::Nt::GdiEffect"); + this._priv_remoteClass_GdiSprite = port.InitRemoteClass("Splash::Rendering::Nt::GdiSprite"); + this._priv_remoteClass_WinSoundDevice = port.InitRemoteClass("Splash::Rendering::Nt::WinSoundDevice"); + this._priv_remoteClass_Ds8SoundDevice = port.InitRemoteClass("Splash::Rendering::Nt::Ds8SoundDevice"); + } + + internal RENDERHANDLE GdiDevice_ClassHandle => this._priv_remoteClass_GdiDevice; + + internal RENDERHANDLE NtDevice_ClassHandle => this._priv_remoteClass_NtDevice; + + internal RENDERHANDLE GdiEffect_ClassHandle => this._priv_remoteClass_GdiEffect; + + internal RENDERHANDLE GdiSprite_ClassHandle => this._priv_remoteClass_GdiSprite; + + internal RENDERHANDLE WinSoundDevice_ClassHandle => this._priv_remoteClass_WinSoundDevice; + + internal RENDERHANDLE Ds8SoundDevice_ClassHandle => this._priv_remoteClass_Ds8SoundDevice; + + internal RemoteGdiDevice BuildRemoteGdiDevice( + IRenderHandleOwner _priv_owner, + LocalDeviceCallback cb) + { + return RemoteGdiDevice.Create(this, _priv_owner, cb); + } + + internal RemoteNtDevice BuildRemoteNtDevice( + IRenderHandleOwner _priv_owner, + LocalDeviceCallback cb) + { + return RemoteNtDevice.Create(this, _priv_owner, cb); + } + + internal RemoteGdiSprite BuildRemoteGdiSprite(IRenderHandleOwner _priv_owner) => RemoteGdiSprite.Create(this, _priv_owner); + + internal RemoteWinSoundDevice BuildRemoteWinSoundDevice( + IRenderHandleOwner _priv_owner) + { + return RemoteWinSoundDevice.Create(this, _priv_owner); + } + + internal RemoteDs8SoundDevice INPROC_BuildRemoteDs8SoundDevice( + IRenderHandleOwner _priv_owner, + HWND hwnd) + { + return RemoteDs8SoundDevice.INPROC_Create(this, _priv_owner, hwnd); + } } - - private ProtocolSplashRenderingNt(RenderPort port) - : base(port, "Splash::Rendering::Nt") - { - } - - protected override void Init() - { - RenderPort port = this.Port; - this._priv_remoteClass_GdiDevice = port.InitRemoteClass("Splash::Rendering::Nt::GdiDevice"); - this._priv_remoteClass_NtDevice = port.InitRemoteClass("Splash::Rendering::Nt::NtDevice"); - this._priv_remoteClass_GdiEffect = port.InitRemoteClass("Splash::Rendering::Nt::GdiEffect"); - this._priv_remoteClass_GdiSprite = port.InitRemoteClass("Splash::Rendering::Nt::GdiSprite"); - this._priv_remoteClass_WinSoundDevice = port.InitRemoteClass("Splash::Rendering::Nt::WinSoundDevice"); - this._priv_remoteClass_Ds8SoundDevice = port.InitRemoteClass("Splash::Rendering::Nt::Ds8SoundDevice"); - } - - internal RENDERHANDLE GdiDevice_ClassHandle => this._priv_remoteClass_GdiDevice; - - internal RENDERHANDLE NtDevice_ClassHandle => this._priv_remoteClass_NtDevice; - - internal RENDERHANDLE GdiEffect_ClassHandle => this._priv_remoteClass_GdiEffect; - - internal RENDERHANDLE GdiSprite_ClassHandle => this._priv_remoteClass_GdiSprite; - - internal RENDERHANDLE WinSoundDevice_ClassHandle => this._priv_remoteClass_WinSoundDevice; - - internal RENDERHANDLE Ds8SoundDevice_ClassHandle => this._priv_remoteClass_Ds8SoundDevice; - - internal RemoteGdiDevice BuildRemoteGdiDevice( - IRenderHandleOwner _priv_owner, - LocalDeviceCallback cb) - { - return RemoteGdiDevice.Create(this, _priv_owner, cb); - } - - internal RemoteNtDevice BuildRemoteNtDevice( - IRenderHandleOwner _priv_owner, - LocalDeviceCallback cb) - { - return RemoteNtDevice.Create(this, _priv_owner, cb); - } - - internal RemoteGdiSprite BuildRemoteGdiSprite(IRenderHandleOwner _priv_owner) => RemoteGdiSprite.Create(this, _priv_owner); - - internal RemoteWinSoundDevice BuildRemoteWinSoundDevice( - IRenderHandleOwner _priv_owner) - { - return RemoteWinSoundDevice.Create(this, _priv_owner); - } - - internal RemoteDs8SoundDevice INPROC_BuildRemoteDs8SoundDevice( - IRenderHandleOwner _priv_owner, - HWND hwnd) - { - return RemoteDs8SoundDevice.INPROC_Create(this, _priv_owner, hwnd); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteDs8SoundDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteDs8SoundDevice.cs index 5be82fd..9fae3b7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteDs8SoundDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteDs8SoundDevice.cs @@ -9,68 +9,68 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering.Nt { - internal class RemoteDs8SoundDevice : RemoteSoundDevice - { - protected RemoteDs8SoundDevice() + internal class RemoteDs8SoundDevice : RemoteSoundDevice { + protected RemoteDs8SoundDevice() + { + } + + public static unsafe RemoteDs8SoundDevice INPROC_Create( + ProtocolSplashRenderingNt _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + HWND hwnd) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE deviceClassHandle = _priv_protocolInstance.Ds8SoundDevice_ClassHandle; + RemoteDs8SoundDevice remoteDs8SoundDevice = new RemoteDs8SoundDevice(port, _priv_owner); + uint num = (uint)sizeof(RemoteDs8SoundDevice.Msg4_Create); + // ISSUE: untyped stack allocation + RemoteDs8SoundDevice.Msg4_Create* msg4CreatePtr = (RemoteDs8SoundDevice.Msg4_Create*)__untypedstackalloc(1 * (int)num); + msg4CreatePtr->_priv_size = num; + msg4CreatePtr->_priv_msgid = 4U; + msg4CreatePtr->hwnd = hwnd; + msg4CreatePtr->_priv_idObjectSubject = remoteDs8SoundDevice.m_renderHandle; + port.CreateRemoteObject(deviceClassHandle, remoteDs8SoundDevice.m_renderHandle, (Message*)msg4CreatePtr); + return remoteDs8SoundDevice; + } + + public static RemoteDs8SoundDevice CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteDs8SoundDevice(port, handle, true); + } + + public static RemoteDs8SoundDevice CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteDs8SoundDevice(port, handle, false); + } + + protected RemoteDs8SoundDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteDs8SoundDevice(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteDs8SoundDevice && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg4_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public HWND hwnd; + } } - - public static unsafe RemoteDs8SoundDevice INPROC_Create( - ProtocolSplashRenderingNt _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - HWND hwnd) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE deviceClassHandle = _priv_protocolInstance.Ds8SoundDevice_ClassHandle; - RemoteDs8SoundDevice remoteDs8SoundDevice = new RemoteDs8SoundDevice(port, _priv_owner); - uint num = (uint) sizeof (RemoteDs8SoundDevice.Msg4_Create); - // ISSUE: untyped stack allocation - RemoteDs8SoundDevice.Msg4_Create* msg4CreatePtr = (RemoteDs8SoundDevice.Msg4_Create*) __untypedstackalloc(1 * (int) num); - msg4CreatePtr->_priv_size = num; - msg4CreatePtr->_priv_msgid = 4U; - msg4CreatePtr->hwnd = hwnd; - msg4CreatePtr->_priv_idObjectSubject = remoteDs8SoundDevice.m_renderHandle; - port.CreateRemoteObject(deviceClassHandle, remoteDs8SoundDevice.m_renderHandle, (Message*) msg4CreatePtr); - return remoteDs8SoundDevice; - } - - public static RemoteDs8SoundDevice CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteDs8SoundDevice(port, handle, true); - } - - public static RemoteDs8SoundDevice CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteDs8SoundDevice(port, handle, false); - } - - protected RemoteDs8SoundDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteDs8SoundDevice(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteDs8SoundDevice && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg4_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public HWND hwnd; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiDevice.cs index 7a646d5..ed514c0 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiDevice.cs @@ -11,371 +11,371 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering.Nt { - internal class RemoteGdiDevice : RemoteDevice - { - private static ushort[] s_priv_ByteOrder_Msg23_Create; - private static ushort[] s_priv_ByteOrder_Msg8_SecureDesktopMode; - private static ushort[] s_priv_ByteOrder_Msg9_SetZoomMode; - private static ushort[] s_priv_ByteOrder_Msg11_SetEnableAlphaTracking; - private static ushort[] s_priv_ByteOrder_Msg13_SetBackgroundColor; - private static ushort[] s_priv_ByteOrder_Msg15_SetUseSystemMemoryBitmaps; - private static ushort[] s_priv_ByteOrder_Msg17_SetEnableBackBuffer; - private static ushort[] s_priv_ByteOrder_Msg19_SetAllowAnimations; - private static ushort[] s_priv_ByteOrder_Msg21_SetAllowAlpha; - - protected RemoteGdiDevice() + internal class RemoteGdiDevice : RemoteDevice { + private static ushort[] s_priv_ByteOrder_Msg23_Create; + private static ushort[] s_priv_ByteOrder_Msg8_SecureDesktopMode; + private static ushort[] s_priv_ByteOrder_Msg9_SetZoomMode; + private static ushort[] s_priv_ByteOrder_Msg11_SetEnableAlphaTracking; + private static ushort[] s_priv_ByteOrder_Msg13_SetBackgroundColor; + private static ushort[] s_priv_ByteOrder_Msg15_SetUseSystemMemoryBitmaps; + private static ushort[] s_priv_ByteOrder_Msg17_SetEnableBackBuffer; + private static ushort[] s_priv_ByteOrder_Msg19_SetAllowAnimations; + private static ushort[] s_priv_ByteOrder_Msg21_SetAllowAlpha; + + protected RemoteGdiDevice() + { + } + + public static unsafe RemoteGdiDevice Create( + ProtocolSplashRenderingNt _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + LocalDeviceCallback cb) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE deviceClassHandle = _priv_protocolInstance.GdiDevice_ClassHandle; + RemoteGdiDevice remoteGdiDevice = new RemoteGdiDevice(port, _priv_owner); + uint num = (uint)sizeof(RemoteGdiDevice.Msg23_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteGdiDevice.Msg23_Create* msg23CreatePtr = (RemoteGdiDevice.Msg23_Create*)pMem; + msg23CreatePtr->_priv_size = num; + msg23CreatePtr->_priv_msgid = 23U; + msg23CreatePtr->_priv_objcb = cb.RenderHandle; + msg23CreatePtr->_priv_ctxcb = port.Session.LocalContext; + msg23CreatePtr->_priv_idObjectSubject = remoteGdiDevice.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteGdiDevice.s_priv_ByteOrder_Msg23_Create, typeof(RemoteGdiDevice.Msg23_Create), 0, 0); + port.CreateRemoteObject(deviceClassHandle, remoteGdiDevice.m_renderHandle, (Message*)msg23CreatePtr); + return remoteGdiDevice; + } + + public unsafe void BuildSecureDesktopMode( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fEnabled) + { + 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(RemoteGdiDevice.Msg8_SecureDesktopMode); + RemoteGdiDevice.Msg8_SecureDesktopMode* secureDesktopModePtr = (RemoteGdiDevice.Msg8_SecureDesktopMode*)_priv_portUse.AllocMessageBuffer(size); + secureDesktopModePtr->_priv_size = size; + secureDesktopModePtr->_priv_msgid = 8U; + secureDesktopModePtr->fEnabled = fEnabled ? uint.MaxValue : 0U; + secureDesktopModePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)secureDesktopModePtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg8_SecureDesktopMode, typeof(RemoteGdiDevice.Msg8_SecureDesktopMode), 0, 0); + _priv_pmsgUse = (Message*)secureDesktopModePtr; + } + + public unsafe void SendSecureDesktopMode(bool fEnabled) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSecureDesktopMode(out _priv_portUse, out _priv_pmsgUse, fEnabled); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetZoomMode( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + VideoZoomMode vzmZoomMode) + { + 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(RemoteGdiDevice.Msg9_SetZoomMode); + RemoteGdiDevice.Msg9_SetZoomMode* msg9SetZoomModePtr = (RemoteGdiDevice.Msg9_SetZoomMode*)_priv_portUse.AllocMessageBuffer(size); + msg9SetZoomModePtr->_priv_size = size; + msg9SetZoomModePtr->_priv_msgid = 9U; + msg9SetZoomModePtr->vzmZoomMode = vzmZoomMode; + msg9SetZoomModePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg9SetZoomModePtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg9_SetZoomMode, typeof(RemoteGdiDevice.Msg9_SetZoomMode), 0, 0); + _priv_pmsgUse = (Message*)msg9SetZoomModePtr; + } + + public unsafe void SendSetZoomMode(VideoZoomMode vzmZoomMode) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetZoomMode(out _priv_portUse, out _priv_pmsgUse, vzmZoomMode); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetEnableAlphaTracking( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fEnableAlphaTracking) + { + 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(RemoteGdiDevice.Msg11_SetEnableAlphaTracking); + RemoteGdiDevice.Msg11_SetEnableAlphaTracking* enableAlphaTrackingPtr = (RemoteGdiDevice.Msg11_SetEnableAlphaTracking*)_priv_portUse.AllocMessageBuffer(size); + enableAlphaTrackingPtr->_priv_size = size; + enableAlphaTrackingPtr->_priv_msgid = 11U; + enableAlphaTrackingPtr->fEnableAlphaTracking = fEnableAlphaTracking ? uint.MaxValue : 0U; + enableAlphaTrackingPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)enableAlphaTrackingPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg11_SetEnableAlphaTracking, typeof(RemoteGdiDevice.Msg11_SetEnableAlphaTracking), 0, 0); + _priv_pmsgUse = (Message*)enableAlphaTrackingPtr; + } + + public unsafe void SendSetEnableAlphaTracking(bool fEnableAlphaTracking) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetEnableAlphaTracking(out _priv_portUse, out _priv_pmsgUse, fEnableAlphaTracking); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetBackgroundColor( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ColorF clrBackground) + { + 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(RemoteGdiDevice.Msg13_SetBackgroundColor); + RemoteGdiDevice.Msg13_SetBackgroundColor* setBackgroundColorPtr = (RemoteGdiDevice.Msg13_SetBackgroundColor*)_priv_portUse.AllocMessageBuffer(size); + setBackgroundColorPtr->_priv_size = size; + setBackgroundColorPtr->_priv_msgid = 13U; + setBackgroundColorPtr->clrBackground = clrBackground; + setBackgroundColorPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setBackgroundColorPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg13_SetBackgroundColor, typeof(RemoteGdiDevice.Msg13_SetBackgroundColor), 0, 0); + _priv_pmsgUse = (Message*)setBackgroundColorPtr; + } + + public unsafe void SendSetBackgroundColor(ColorF clrBackground) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetBackgroundColor(out _priv_portUse, out _priv_pmsgUse, clrBackground); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetUseSystemMemoryBitmaps( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fSystemMemoryBitmaps) + { + 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(RemoteGdiDevice.Msg15_SetUseSystemMemoryBitmaps); + RemoteGdiDevice.Msg15_SetUseSystemMemoryBitmaps* systemMemoryBitmapsPtr = (RemoteGdiDevice.Msg15_SetUseSystemMemoryBitmaps*)_priv_portUse.AllocMessageBuffer(size); + systemMemoryBitmapsPtr->_priv_size = size; + systemMemoryBitmapsPtr->_priv_msgid = 15U; + systemMemoryBitmapsPtr->fSystemMemoryBitmaps = fSystemMemoryBitmaps ? uint.MaxValue : 0U; + systemMemoryBitmapsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)systemMemoryBitmapsPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg15_SetUseSystemMemoryBitmaps, typeof(RemoteGdiDevice.Msg15_SetUseSystemMemoryBitmaps), 0, 0); + _priv_pmsgUse = (Message*)systemMemoryBitmapsPtr; + } + + public unsafe void SendSetUseSystemMemoryBitmaps(bool fSystemMemoryBitmaps) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetUseSystemMemoryBitmaps(out _priv_portUse, out _priv_pmsgUse, fSystemMemoryBitmaps); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetEnableBackBuffer( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fEnableBackBuffer) + { + 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(RemoteGdiDevice.Msg17_SetEnableBackBuffer); + RemoteGdiDevice.Msg17_SetEnableBackBuffer* enableBackBufferPtr = (RemoteGdiDevice.Msg17_SetEnableBackBuffer*)_priv_portUse.AllocMessageBuffer(size); + enableBackBufferPtr->_priv_size = size; + enableBackBufferPtr->_priv_msgid = 17U; + enableBackBufferPtr->fEnableBackBuffer = fEnableBackBuffer ? uint.MaxValue : 0U; + enableBackBufferPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)enableBackBufferPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg17_SetEnableBackBuffer, typeof(RemoteGdiDevice.Msg17_SetEnableBackBuffer), 0, 0); + _priv_pmsgUse = (Message*)enableBackBufferPtr; + } + + public unsafe void SendSetEnableBackBuffer(bool fEnableBackBuffer) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetEnableBackBuffer(out _priv_portUse, out _priv_pmsgUse, fEnableBackBuffer); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetAllowAnimations( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fAllowAnimations) + { + 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(RemoteGdiDevice.Msg19_SetAllowAnimations); + RemoteGdiDevice.Msg19_SetAllowAnimations* setAllowAnimationsPtr = (RemoteGdiDevice.Msg19_SetAllowAnimations*)_priv_portUse.AllocMessageBuffer(size); + setAllowAnimationsPtr->_priv_size = size; + setAllowAnimationsPtr->_priv_msgid = 19U; + setAllowAnimationsPtr->fAllowAnimations = fAllowAnimations ? uint.MaxValue : 0U; + setAllowAnimationsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setAllowAnimationsPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg19_SetAllowAnimations, typeof(RemoteGdiDevice.Msg19_SetAllowAnimations), 0, 0); + _priv_pmsgUse = (Message*)setAllowAnimationsPtr; + } + + public unsafe void SendSetAllowAnimations(bool fAllowAnimations) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetAllowAnimations(out _priv_portUse, out _priv_pmsgUse, fAllowAnimations); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetAllowAlpha( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fAllowAlpha) + { + 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(RemoteGdiDevice.Msg21_SetAllowAlpha); + RemoteGdiDevice.Msg21_SetAllowAlpha* msg21SetAllowAlphaPtr = (RemoteGdiDevice.Msg21_SetAllowAlpha*)_priv_portUse.AllocMessageBuffer(size); + msg21SetAllowAlphaPtr->_priv_size = size; + msg21SetAllowAlphaPtr->_priv_msgid = 21U; + msg21SetAllowAlphaPtr->fAllowAlpha = fAllowAlpha ? uint.MaxValue : 0U; + msg21SetAllowAlphaPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg21SetAllowAlphaPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg21_SetAllowAlpha, typeof(RemoteGdiDevice.Msg21_SetAllowAlpha), 0, 0); + _priv_pmsgUse = (Message*)msg21SetAllowAlphaPtr; + } + + public unsafe void SendSetAllowAlpha(bool fAllowAlpha) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetAllowAlpha(out _priv_portUse, out _priv_pmsgUse, fAllowAlpha); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteGdiDevice CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteGdiDevice(port, handle, true); + } + + public static RemoteGdiDevice CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteGdiDevice(port, handle, false); + } + + protected RemoteGdiDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteGdiDevice(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteGdiDevice && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg23_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + } + + [ComVisible(false)] + private struct Msg8_SecureDesktopMode + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fEnabled; + } + + [ComVisible(false)] + private struct Msg9_SetZoomMode + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public VideoZoomMode vzmZoomMode; + } + + [ComVisible(false)] + private struct Msg11_SetEnableAlphaTracking + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fEnableAlphaTracking; + } + + [ComVisible(false)] + private struct Msg13_SetBackgroundColor + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public ColorF clrBackground; + } + + [ComVisible(false)] + private struct Msg15_SetUseSystemMemoryBitmaps + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fSystemMemoryBitmaps; + } + + [ComVisible(false)] + private struct Msg17_SetEnableBackBuffer + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fEnableBackBuffer; + } + + [ComVisible(false)] + private struct Msg19_SetAllowAnimations + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fAllowAnimations; + } + + [ComVisible(false)] + private struct Msg21_SetAllowAlpha + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fAllowAlpha; + } } - - public static unsafe RemoteGdiDevice Create( - ProtocolSplashRenderingNt _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - LocalDeviceCallback cb) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE deviceClassHandle = _priv_protocolInstance.GdiDevice_ClassHandle; - RemoteGdiDevice remoteGdiDevice = new RemoteGdiDevice(port, _priv_owner); - uint num = (uint) sizeof (RemoteGdiDevice.Msg23_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteGdiDevice.Msg23_Create* msg23CreatePtr = (RemoteGdiDevice.Msg23_Create*) pMem; - msg23CreatePtr->_priv_size = num; - msg23CreatePtr->_priv_msgid = 23U; - msg23CreatePtr->_priv_objcb = cb.RenderHandle; - msg23CreatePtr->_priv_ctxcb = port.Session.LocalContext; - msg23CreatePtr->_priv_idObjectSubject = remoteGdiDevice.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteGdiDevice.s_priv_ByteOrder_Msg23_Create, typeof (RemoteGdiDevice.Msg23_Create), 0, 0); - port.CreateRemoteObject(deviceClassHandle, remoteGdiDevice.m_renderHandle, (Message*) msg23CreatePtr); - return remoteGdiDevice; - } - - public unsafe void BuildSecureDesktopMode( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fEnabled) - { - 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 (RemoteGdiDevice.Msg8_SecureDesktopMode); - RemoteGdiDevice.Msg8_SecureDesktopMode* secureDesktopModePtr = (RemoteGdiDevice.Msg8_SecureDesktopMode*) _priv_portUse.AllocMessageBuffer(size); - secureDesktopModePtr->_priv_size = size; - secureDesktopModePtr->_priv_msgid = 8U; - secureDesktopModePtr->fEnabled = fEnabled ? uint.MaxValue : 0U; - secureDesktopModePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) secureDesktopModePtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg8_SecureDesktopMode, typeof (RemoteGdiDevice.Msg8_SecureDesktopMode), 0, 0); - _priv_pmsgUse = (Message*) secureDesktopModePtr; - } - - public unsafe void SendSecureDesktopMode(bool fEnabled) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSecureDesktopMode(out _priv_portUse, out _priv_pmsgUse, fEnabled); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetZoomMode( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - VideoZoomMode vzmZoomMode) - { - 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 (RemoteGdiDevice.Msg9_SetZoomMode); - RemoteGdiDevice.Msg9_SetZoomMode* msg9SetZoomModePtr = (RemoteGdiDevice.Msg9_SetZoomMode*) _priv_portUse.AllocMessageBuffer(size); - msg9SetZoomModePtr->_priv_size = size; - msg9SetZoomModePtr->_priv_msgid = 9U; - msg9SetZoomModePtr->vzmZoomMode = vzmZoomMode; - msg9SetZoomModePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg9SetZoomModePtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg9_SetZoomMode, typeof (RemoteGdiDevice.Msg9_SetZoomMode), 0, 0); - _priv_pmsgUse = (Message*) msg9SetZoomModePtr; - } - - public unsafe void SendSetZoomMode(VideoZoomMode vzmZoomMode) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetZoomMode(out _priv_portUse, out _priv_pmsgUse, vzmZoomMode); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetEnableAlphaTracking( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fEnableAlphaTracking) - { - 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 (RemoteGdiDevice.Msg11_SetEnableAlphaTracking); - RemoteGdiDevice.Msg11_SetEnableAlphaTracking* enableAlphaTrackingPtr = (RemoteGdiDevice.Msg11_SetEnableAlphaTracking*) _priv_portUse.AllocMessageBuffer(size); - enableAlphaTrackingPtr->_priv_size = size; - enableAlphaTrackingPtr->_priv_msgid = 11U; - enableAlphaTrackingPtr->fEnableAlphaTracking = fEnableAlphaTracking ? uint.MaxValue : 0U; - enableAlphaTrackingPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) enableAlphaTrackingPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg11_SetEnableAlphaTracking, typeof (RemoteGdiDevice.Msg11_SetEnableAlphaTracking), 0, 0); - _priv_pmsgUse = (Message*) enableAlphaTrackingPtr; - } - - public unsafe void SendSetEnableAlphaTracking(bool fEnableAlphaTracking) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetEnableAlphaTracking(out _priv_portUse, out _priv_pmsgUse, fEnableAlphaTracking); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetBackgroundColor( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ColorF clrBackground) - { - 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 (RemoteGdiDevice.Msg13_SetBackgroundColor); - RemoteGdiDevice.Msg13_SetBackgroundColor* setBackgroundColorPtr = (RemoteGdiDevice.Msg13_SetBackgroundColor*) _priv_portUse.AllocMessageBuffer(size); - setBackgroundColorPtr->_priv_size = size; - setBackgroundColorPtr->_priv_msgid = 13U; - setBackgroundColorPtr->clrBackground = clrBackground; - setBackgroundColorPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setBackgroundColorPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg13_SetBackgroundColor, typeof (RemoteGdiDevice.Msg13_SetBackgroundColor), 0, 0); - _priv_pmsgUse = (Message*) setBackgroundColorPtr; - } - - public unsafe void SendSetBackgroundColor(ColorF clrBackground) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetBackgroundColor(out _priv_portUse, out _priv_pmsgUse, clrBackground); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetUseSystemMemoryBitmaps( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fSystemMemoryBitmaps) - { - 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 (RemoteGdiDevice.Msg15_SetUseSystemMemoryBitmaps); - RemoteGdiDevice.Msg15_SetUseSystemMemoryBitmaps* systemMemoryBitmapsPtr = (RemoteGdiDevice.Msg15_SetUseSystemMemoryBitmaps*) _priv_portUse.AllocMessageBuffer(size); - systemMemoryBitmapsPtr->_priv_size = size; - systemMemoryBitmapsPtr->_priv_msgid = 15U; - systemMemoryBitmapsPtr->fSystemMemoryBitmaps = fSystemMemoryBitmaps ? uint.MaxValue : 0U; - systemMemoryBitmapsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) systemMemoryBitmapsPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg15_SetUseSystemMemoryBitmaps, typeof (RemoteGdiDevice.Msg15_SetUseSystemMemoryBitmaps), 0, 0); - _priv_pmsgUse = (Message*) systemMemoryBitmapsPtr; - } - - public unsafe void SendSetUseSystemMemoryBitmaps(bool fSystemMemoryBitmaps) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetUseSystemMemoryBitmaps(out _priv_portUse, out _priv_pmsgUse, fSystemMemoryBitmaps); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetEnableBackBuffer( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fEnableBackBuffer) - { - 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 (RemoteGdiDevice.Msg17_SetEnableBackBuffer); - RemoteGdiDevice.Msg17_SetEnableBackBuffer* enableBackBufferPtr = (RemoteGdiDevice.Msg17_SetEnableBackBuffer*) _priv_portUse.AllocMessageBuffer(size); - enableBackBufferPtr->_priv_size = size; - enableBackBufferPtr->_priv_msgid = 17U; - enableBackBufferPtr->fEnableBackBuffer = fEnableBackBuffer ? uint.MaxValue : 0U; - enableBackBufferPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) enableBackBufferPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg17_SetEnableBackBuffer, typeof (RemoteGdiDevice.Msg17_SetEnableBackBuffer), 0, 0); - _priv_pmsgUse = (Message*) enableBackBufferPtr; - } - - public unsafe void SendSetEnableBackBuffer(bool fEnableBackBuffer) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetEnableBackBuffer(out _priv_portUse, out _priv_pmsgUse, fEnableBackBuffer); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetAllowAnimations( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fAllowAnimations) - { - 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 (RemoteGdiDevice.Msg19_SetAllowAnimations); - RemoteGdiDevice.Msg19_SetAllowAnimations* setAllowAnimationsPtr = (RemoteGdiDevice.Msg19_SetAllowAnimations*) _priv_portUse.AllocMessageBuffer(size); - setAllowAnimationsPtr->_priv_size = size; - setAllowAnimationsPtr->_priv_msgid = 19U; - setAllowAnimationsPtr->fAllowAnimations = fAllowAnimations ? uint.MaxValue : 0U; - setAllowAnimationsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setAllowAnimationsPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg19_SetAllowAnimations, typeof (RemoteGdiDevice.Msg19_SetAllowAnimations), 0, 0); - _priv_pmsgUse = (Message*) setAllowAnimationsPtr; - } - - public unsafe void SendSetAllowAnimations(bool fAllowAnimations) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetAllowAnimations(out _priv_portUse, out _priv_pmsgUse, fAllowAnimations); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetAllowAlpha( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fAllowAlpha) - { - 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 (RemoteGdiDevice.Msg21_SetAllowAlpha); - RemoteGdiDevice.Msg21_SetAllowAlpha* msg21SetAllowAlphaPtr = (RemoteGdiDevice.Msg21_SetAllowAlpha*) _priv_portUse.AllocMessageBuffer(size); - msg21SetAllowAlphaPtr->_priv_size = size; - msg21SetAllowAlphaPtr->_priv_msgid = 21U; - msg21SetAllowAlphaPtr->fAllowAlpha = fAllowAlpha ? uint.MaxValue : 0U; - msg21SetAllowAlphaPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg21SetAllowAlphaPtr, ref RemoteGdiDevice.s_priv_ByteOrder_Msg21_SetAllowAlpha, typeof (RemoteGdiDevice.Msg21_SetAllowAlpha), 0, 0); - _priv_pmsgUse = (Message*) msg21SetAllowAlphaPtr; - } - - public unsafe void SendSetAllowAlpha(bool fAllowAlpha) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetAllowAlpha(out _priv_portUse, out _priv_pmsgUse, fAllowAlpha); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteGdiDevice CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteGdiDevice(port, handle, true); - } - - public static RemoteGdiDevice CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteGdiDevice(port, handle, false); - } - - protected RemoteGdiDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteGdiDevice(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteGdiDevice && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg23_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - } - - [ComVisible(false)] - private struct Msg8_SecureDesktopMode - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fEnabled; - } - - [ComVisible(false)] - private struct Msg9_SetZoomMode - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public VideoZoomMode vzmZoomMode; - } - - [ComVisible(false)] - private struct Msg11_SetEnableAlphaTracking - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fEnableAlphaTracking; - } - - [ComVisible(false)] - private struct Msg13_SetBackgroundColor - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public ColorF clrBackground; - } - - [ComVisible(false)] - private struct Msg15_SetUseSystemMemoryBitmaps - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fSystemMemoryBitmaps; - } - - [ComVisible(false)] - private struct Msg17_SetEnableBackBuffer - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fEnableBackBuffer; - } - - [ComVisible(false)] - private struct Msg19_SetAllowAnimations - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fAllowAnimations; - } - - [ComVisible(false)] - private struct Msg21_SetAllowAlpha - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fAllowAlpha; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiEffect.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiEffect.cs index 7992fbe..a08fb80 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiEffect.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiEffect.cs @@ -10,89 +10,89 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering.Nt { - internal class RemoteGdiEffect : RemoteEffect - { - private static ushort[] s_priv_ByteOrder_Msg8_SetType; - - protected RemoteGdiEffect() + internal class RemoteGdiEffect : RemoteEffect { + private static ushort[] s_priv_ByteOrder_Msg8_SetType; + + protected RemoteGdiEffect() + { + } + + public static unsafe RemoteGdiEffect Create( + ProtocolSplashRenderingNt _priv_protocolInstance, + IRenderHandleOwner _priv_owner) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE effectClassHandle = _priv_protocolInstance.GdiEffect_ClassHandle; + RemoteGdiEffect remoteGdiEffect = new RemoteGdiEffect(port, _priv_owner); + port.CreateRemoteObject(effectClassHandle, remoteGdiEffect.m_renderHandle, (Message*)null); + return remoteGdiEffect; + } + + public unsafe void BuildSetType( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nType) + { + 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(RemoteGdiEffect.Msg8_SetType); + RemoteGdiEffect.Msg8_SetType* msg8SetTypePtr = (RemoteGdiEffect.Msg8_SetType*)_priv_portUse.AllocMessageBuffer(size); + msg8SetTypePtr->_priv_size = size; + msg8SetTypePtr->_priv_msgid = 8U; + msg8SetTypePtr->nType = nType; + msg8SetTypePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg8SetTypePtr, ref RemoteGdiEffect.s_priv_ByteOrder_Msg8_SetType, typeof(RemoteGdiEffect.Msg8_SetType), 0, 0); + _priv_pmsgUse = (Message*)msg8SetTypePtr; + } + + public unsafe void SendSetType(int nType) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetType(out _priv_portUse, out _priv_pmsgUse, nType); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteGdiEffect CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteGdiEffect(port, handle, true); + } + + public static RemoteGdiEffect CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteGdiEffect(port, handle, false); + } + + protected RemoteGdiEffect(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteGdiEffect(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteGdiEffect && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg8_SetType + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nType; + } } - - public static unsafe RemoteGdiEffect Create( - ProtocolSplashRenderingNt _priv_protocolInstance, - IRenderHandleOwner _priv_owner) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE effectClassHandle = _priv_protocolInstance.GdiEffect_ClassHandle; - RemoteGdiEffect remoteGdiEffect = new RemoteGdiEffect(port, _priv_owner); - port.CreateRemoteObject(effectClassHandle, remoteGdiEffect.m_renderHandle, (Message*) null); - return remoteGdiEffect; - } - - public unsafe void BuildSetType( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nType) - { - 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 (RemoteGdiEffect.Msg8_SetType); - RemoteGdiEffect.Msg8_SetType* msg8SetTypePtr = (RemoteGdiEffect.Msg8_SetType*) _priv_portUse.AllocMessageBuffer(size); - msg8SetTypePtr->_priv_size = size; - msg8SetTypePtr->_priv_msgid = 8U; - msg8SetTypePtr->nType = nType; - msg8SetTypePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg8SetTypePtr, ref RemoteGdiEffect.s_priv_ByteOrder_Msg8_SetType, typeof (RemoteGdiEffect.Msg8_SetType), 0, 0); - _priv_pmsgUse = (Message*) msg8SetTypePtr; - } - - public unsafe void SendSetType(int nType) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetType(out _priv_portUse, out _priv_pmsgUse, nType); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteGdiEffect CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteGdiEffect(port, handle, true); - } - - public static RemoteGdiEffect CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteGdiEffect(port, handle, false); - } - - protected RemoteGdiEffect(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteGdiEffect(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteGdiEffect && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg8_SetType - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nType; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiSprite.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiSprite.cs index f7f8392..cf7c600 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiSprite.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteGdiSprite.cs @@ -9,70 +9,70 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering.Nt { - internal class RemoteGdiSprite : RemoteSprite - { - private static ushort[] s_priv_ByteOrder_Msg22_Create; - - protected RemoteGdiSprite() + internal class RemoteGdiSprite : RemoteSprite { + private static ushort[] s_priv_ByteOrder_Msg22_Create; + + protected RemoteGdiSprite() + { + } + + public static unsafe RemoteGdiSprite Create( + ProtocolSplashRenderingNt _priv_protocolInstance, + IRenderHandleOwner _priv_owner) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE spriteClassHandle = _priv_protocolInstance.GdiSprite_ClassHandle; + RemoteGdiSprite remoteGdiSprite = new RemoteGdiSprite(port, _priv_owner); + uint num = (uint)sizeof(RemoteGdiSprite.Msg22_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteGdiSprite.Msg22_Create* msg22CreatePtr = (RemoteGdiSprite.Msg22_Create*)pMem; + msg22CreatePtr->_priv_size = num; + msg22CreatePtr->_priv_msgid = 22U; + msg22CreatePtr->_priv_idObjectSubject = remoteGdiSprite.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteGdiSprite.s_priv_ByteOrder_Msg22_Create, typeof(RemoteGdiSprite.Msg22_Create), 0, 0); + port.CreateRemoteObject(spriteClassHandle, remoteGdiSprite.m_renderHandle, (Message*)msg22CreatePtr); + return remoteGdiSprite; + } + + public static RemoteGdiSprite CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteGdiSprite(port, handle, true); + } + + public static RemoteGdiSprite CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteGdiSprite(port, handle, false); + } + + protected RemoteGdiSprite(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteGdiSprite(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteGdiSprite && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg22_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } } - - public static unsafe RemoteGdiSprite Create( - ProtocolSplashRenderingNt _priv_protocolInstance, - IRenderHandleOwner _priv_owner) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE spriteClassHandle = _priv_protocolInstance.GdiSprite_ClassHandle; - RemoteGdiSprite remoteGdiSprite = new RemoteGdiSprite(port, _priv_owner); - uint num = (uint) sizeof (RemoteGdiSprite.Msg22_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteGdiSprite.Msg22_Create* msg22CreatePtr = (RemoteGdiSprite.Msg22_Create*) pMem; - msg22CreatePtr->_priv_size = num; - msg22CreatePtr->_priv_msgid = 22U; - msg22CreatePtr->_priv_idObjectSubject = remoteGdiSprite.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteGdiSprite.s_priv_ByteOrder_Msg22_Create, typeof (RemoteGdiSprite.Msg22_Create), 0, 0); - port.CreateRemoteObject(spriteClassHandle, remoteGdiSprite.m_renderHandle, (Message*) msg22CreatePtr); - return remoteGdiSprite; - } - - public static RemoteGdiSprite CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteGdiSprite(port, handle, true); - } - - public static RemoteGdiSprite CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteGdiSprite(port, handle, false); - } - - protected RemoteGdiSprite(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteGdiSprite(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteGdiSprite && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg22_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteNtDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteNtDevice.cs index 13bb6ac..30844d9 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteNtDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteNtDevice.cs @@ -10,260 +10,260 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering.Nt { - internal class RemoteNtDevice : RemoteDx9Device - { - private static ushort[] s_priv_ByteOrder_Msg19_Create; - private static ushort[] s_priv_ByteOrder_Msg11_RenderNowIfPossible; - private static ushort[] s_priv_ByteOrder_Msg12_CreateTransferBuffer; - private static ushort[] s_priv_ByteOrder_Msg13_SetMaxOverscan; - private static ushort[] s_priv_ByteOrder_Msg15_SetDisplayOverscan; - private static ushort[] s_priv_ByteOrder_Msg17_SetEnablePageFlip; - - protected RemoteNtDevice() + internal class RemoteNtDevice : RemoteDx9Device { + private static ushort[] s_priv_ByteOrder_Msg19_Create; + private static ushort[] s_priv_ByteOrder_Msg11_RenderNowIfPossible; + private static ushort[] s_priv_ByteOrder_Msg12_CreateTransferBuffer; + private static ushort[] s_priv_ByteOrder_Msg13_SetMaxOverscan; + private static ushort[] s_priv_ByteOrder_Msg15_SetDisplayOverscan; + private static ushort[] s_priv_ByteOrder_Msg17_SetEnablePageFlip; + + protected RemoteNtDevice() + { + } + + public static unsafe RemoteNtDevice Create( + ProtocolSplashRenderingNt _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + LocalDeviceCallback cb) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE deviceClassHandle = _priv_protocolInstance.NtDevice_ClassHandle; + RemoteNtDevice remoteNtDevice = new RemoteNtDevice(port, _priv_owner); + uint num = (uint)sizeof(RemoteNtDevice.Msg19_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteNtDevice.Msg19_Create* msg19CreatePtr = (RemoteNtDevice.Msg19_Create*)pMem; + msg19CreatePtr->_priv_size = num; + msg19CreatePtr->_priv_msgid = 19U; + msg19CreatePtr->_priv_objcb = cb.RenderHandle; + msg19CreatePtr->_priv_ctxcb = port.Session.LocalContext; + msg19CreatePtr->_priv_idObjectSubject = remoteNtDevice.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteNtDevice.s_priv_ByteOrder_Msg19_Create, typeof(RemoteNtDevice.Msg19_Create), 0, 0); + port.CreateRemoteObject(deviceClassHandle, remoteNtDevice.m_renderHandle, (Message*)msg19CreatePtr); + return remoteNtDevice; + } + + public unsafe void BuildRenderNowIfPossible( + 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(RemoteNtDevice.Msg11_RenderNowIfPossible); + RemoteNtDevice.Msg11_RenderNowIfPossible* renderNowIfPossiblePtr = (RemoteNtDevice.Msg11_RenderNowIfPossible*)_priv_portUse.AllocMessageBuffer(size); + renderNowIfPossiblePtr->_priv_size = size; + renderNowIfPossiblePtr->_priv_msgid = 11U; + renderNowIfPossiblePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)renderNowIfPossiblePtr, ref RemoteNtDevice.s_priv_ByteOrder_Msg11_RenderNowIfPossible, typeof(RemoteNtDevice.Msg11_RenderNowIfPossible), 0, 0); + _priv_pmsgUse = (Message*)renderNowIfPossiblePtr; + } + + public unsafe void SendRenderNowIfPossible() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRenderNowIfPossible(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildCreateTransferBuffer( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Size sizeTransferPxl, + SurfaceFormat nFormat) + { + 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(RemoteNtDevice.Msg12_CreateTransferBuffer); + RemoteNtDevice.Msg12_CreateTransferBuffer* createTransferBufferPtr = (RemoteNtDevice.Msg12_CreateTransferBuffer*)_priv_portUse.AllocMessageBuffer(size); + createTransferBufferPtr->_priv_size = size; + createTransferBufferPtr->_priv_msgid = 12U; + createTransferBufferPtr->sizeTransferPxl = sizeTransferPxl; + createTransferBufferPtr->nFormat = nFormat; + createTransferBufferPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)createTransferBufferPtr, ref RemoteNtDevice.s_priv_ByteOrder_Msg12_CreateTransferBuffer, typeof(RemoteNtDevice.Msg12_CreateTransferBuffer), 0, 0); + _priv_pmsgUse = (Message*)createTransferBufferPtr; + } + + public unsafe void SendCreateTransferBuffer(Size sizeTransferPxl, SurfaceFormat nFormat) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildCreateTransferBuffer(out _priv_portUse, out _priv_pmsgUse, sizeTransferPxl, nFormat); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetMaxOverscan( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + float flMaxOverscan) + { + 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(RemoteNtDevice.Msg13_SetMaxOverscan); + RemoteNtDevice.Msg13_SetMaxOverscan* msg13SetMaxOverscanPtr = (RemoteNtDevice.Msg13_SetMaxOverscan*)_priv_portUse.AllocMessageBuffer(size); + msg13SetMaxOverscanPtr->_priv_size = size; + msg13SetMaxOverscanPtr->_priv_msgid = 13U; + msg13SetMaxOverscanPtr->flMaxOverscan = flMaxOverscan; + msg13SetMaxOverscanPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg13SetMaxOverscanPtr, ref RemoteNtDevice.s_priv_ByteOrder_Msg13_SetMaxOverscan, typeof(RemoteNtDevice.Msg13_SetMaxOverscan), 0, 0); + _priv_pmsgUse = (Message*)msg13SetMaxOverscanPtr; + } + + public unsafe void SendSetMaxOverscan(float flMaxOverscan) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetMaxOverscan(out _priv_portUse, out _priv_pmsgUse, flMaxOverscan); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetDisplayOverscan( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + float flDisplayOverscan) + { + 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(RemoteNtDevice.Msg15_SetDisplayOverscan); + RemoteNtDevice.Msg15_SetDisplayOverscan* setDisplayOverscanPtr = (RemoteNtDevice.Msg15_SetDisplayOverscan*)_priv_portUse.AllocMessageBuffer(size); + setDisplayOverscanPtr->_priv_size = size; + setDisplayOverscanPtr->_priv_msgid = 15U; + setDisplayOverscanPtr->flDisplayOverscan = flDisplayOverscan; + setDisplayOverscanPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setDisplayOverscanPtr, ref RemoteNtDevice.s_priv_ByteOrder_Msg15_SetDisplayOverscan, typeof(RemoteNtDevice.Msg15_SetDisplayOverscan), 0, 0); + _priv_pmsgUse = (Message*)setDisplayOverscanPtr; + } + + public unsafe void SendSetDisplayOverscan(float flDisplayOverscan) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetDisplayOverscan(out _priv_portUse, out _priv_pmsgUse, flDisplayOverscan); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetEnablePageFlip( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fPageFlip) + { + 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(RemoteNtDevice.Msg17_SetEnablePageFlip); + RemoteNtDevice.Msg17_SetEnablePageFlip* setEnablePageFlipPtr = (RemoteNtDevice.Msg17_SetEnablePageFlip*)_priv_portUse.AllocMessageBuffer(size); + setEnablePageFlipPtr->_priv_size = size; + setEnablePageFlipPtr->_priv_msgid = 17U; + setEnablePageFlipPtr->fPageFlip = fPageFlip ? uint.MaxValue : 0U; + setEnablePageFlipPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setEnablePageFlipPtr, ref RemoteNtDevice.s_priv_ByteOrder_Msg17_SetEnablePageFlip, typeof(RemoteNtDevice.Msg17_SetEnablePageFlip), 0, 0); + _priv_pmsgUse = (Message*)setEnablePageFlipPtr; + } + + public unsafe void SendSetEnablePageFlip(bool fPageFlip) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetEnablePageFlip(out _priv_portUse, out _priv_pmsgUse, fPageFlip); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteNtDevice CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteNtDevice(port, handle, true); + } + + public static RemoteNtDevice CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteNtDevice(port, handle, false); + } + + protected RemoteNtDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteNtDevice(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteNtDevice && 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; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + } + + [ComVisible(false)] + private struct Msg11_RenderNowIfPossible + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg12_CreateTransferBuffer + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Size sizeTransferPxl; + public SurfaceFormat nFormat; + } + + [ComVisible(false)] + private struct Msg13_SetMaxOverscan + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public float flMaxOverscan; + } + + [ComVisible(false)] + private struct Msg15_SetDisplayOverscan + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public float flDisplayOverscan; + } + + [ComVisible(false)] + private struct Msg17_SetEnablePageFlip + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fPageFlip; + } } - - public static unsafe RemoteNtDevice Create( - ProtocolSplashRenderingNt _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - LocalDeviceCallback cb) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE deviceClassHandle = _priv_protocolInstance.NtDevice_ClassHandle; - RemoteNtDevice remoteNtDevice = new RemoteNtDevice(port, _priv_owner); - uint num = (uint) sizeof (RemoteNtDevice.Msg19_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteNtDevice.Msg19_Create* msg19CreatePtr = (RemoteNtDevice.Msg19_Create*) pMem; - msg19CreatePtr->_priv_size = num; - msg19CreatePtr->_priv_msgid = 19U; - msg19CreatePtr->_priv_objcb = cb.RenderHandle; - msg19CreatePtr->_priv_ctxcb = port.Session.LocalContext; - msg19CreatePtr->_priv_idObjectSubject = remoteNtDevice.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteNtDevice.s_priv_ByteOrder_Msg19_Create, typeof (RemoteNtDevice.Msg19_Create), 0, 0); - port.CreateRemoteObject(deviceClassHandle, remoteNtDevice.m_renderHandle, (Message*) msg19CreatePtr); - return remoteNtDevice; - } - - public unsafe void BuildRenderNowIfPossible( - 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 (RemoteNtDevice.Msg11_RenderNowIfPossible); - RemoteNtDevice.Msg11_RenderNowIfPossible* renderNowIfPossiblePtr = (RemoteNtDevice.Msg11_RenderNowIfPossible*) _priv_portUse.AllocMessageBuffer(size); - renderNowIfPossiblePtr->_priv_size = size; - renderNowIfPossiblePtr->_priv_msgid = 11U; - renderNowIfPossiblePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) renderNowIfPossiblePtr, ref RemoteNtDevice.s_priv_ByteOrder_Msg11_RenderNowIfPossible, typeof (RemoteNtDevice.Msg11_RenderNowIfPossible), 0, 0); - _priv_pmsgUse = (Message*) renderNowIfPossiblePtr; - } - - public unsafe void SendRenderNowIfPossible() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRenderNowIfPossible(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildCreateTransferBuffer( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Size sizeTransferPxl, - SurfaceFormat nFormat) - { - 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 (RemoteNtDevice.Msg12_CreateTransferBuffer); - RemoteNtDevice.Msg12_CreateTransferBuffer* createTransferBufferPtr = (RemoteNtDevice.Msg12_CreateTransferBuffer*) _priv_portUse.AllocMessageBuffer(size); - createTransferBufferPtr->_priv_size = size; - createTransferBufferPtr->_priv_msgid = 12U; - createTransferBufferPtr->sizeTransferPxl = sizeTransferPxl; - createTransferBufferPtr->nFormat = nFormat; - createTransferBufferPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) createTransferBufferPtr, ref RemoteNtDevice.s_priv_ByteOrder_Msg12_CreateTransferBuffer, typeof (RemoteNtDevice.Msg12_CreateTransferBuffer), 0, 0); - _priv_pmsgUse = (Message*) createTransferBufferPtr; - } - - public unsafe void SendCreateTransferBuffer(Size sizeTransferPxl, SurfaceFormat nFormat) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildCreateTransferBuffer(out _priv_portUse, out _priv_pmsgUse, sizeTransferPxl, nFormat); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetMaxOverscan( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - float flMaxOverscan) - { - 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 (RemoteNtDevice.Msg13_SetMaxOverscan); - RemoteNtDevice.Msg13_SetMaxOverscan* msg13SetMaxOverscanPtr = (RemoteNtDevice.Msg13_SetMaxOverscan*) _priv_portUse.AllocMessageBuffer(size); - msg13SetMaxOverscanPtr->_priv_size = size; - msg13SetMaxOverscanPtr->_priv_msgid = 13U; - msg13SetMaxOverscanPtr->flMaxOverscan = flMaxOverscan; - msg13SetMaxOverscanPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg13SetMaxOverscanPtr, ref RemoteNtDevice.s_priv_ByteOrder_Msg13_SetMaxOverscan, typeof (RemoteNtDevice.Msg13_SetMaxOverscan), 0, 0); - _priv_pmsgUse = (Message*) msg13SetMaxOverscanPtr; - } - - public unsafe void SendSetMaxOverscan(float flMaxOverscan) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetMaxOverscan(out _priv_portUse, out _priv_pmsgUse, flMaxOverscan); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetDisplayOverscan( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - float flDisplayOverscan) - { - 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 (RemoteNtDevice.Msg15_SetDisplayOverscan); - RemoteNtDevice.Msg15_SetDisplayOverscan* setDisplayOverscanPtr = (RemoteNtDevice.Msg15_SetDisplayOverscan*) _priv_portUse.AllocMessageBuffer(size); - setDisplayOverscanPtr->_priv_size = size; - setDisplayOverscanPtr->_priv_msgid = 15U; - setDisplayOverscanPtr->flDisplayOverscan = flDisplayOverscan; - setDisplayOverscanPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setDisplayOverscanPtr, ref RemoteNtDevice.s_priv_ByteOrder_Msg15_SetDisplayOverscan, typeof (RemoteNtDevice.Msg15_SetDisplayOverscan), 0, 0); - _priv_pmsgUse = (Message*) setDisplayOverscanPtr; - } - - public unsafe void SendSetDisplayOverscan(float flDisplayOverscan) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetDisplayOverscan(out _priv_portUse, out _priv_pmsgUse, flDisplayOverscan); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetEnablePageFlip( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fPageFlip) - { - 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 (RemoteNtDevice.Msg17_SetEnablePageFlip); - RemoteNtDevice.Msg17_SetEnablePageFlip* setEnablePageFlipPtr = (RemoteNtDevice.Msg17_SetEnablePageFlip*) _priv_portUse.AllocMessageBuffer(size); - setEnablePageFlipPtr->_priv_size = size; - setEnablePageFlipPtr->_priv_msgid = 17U; - setEnablePageFlipPtr->fPageFlip = fPageFlip ? uint.MaxValue : 0U; - setEnablePageFlipPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setEnablePageFlipPtr, ref RemoteNtDevice.s_priv_ByteOrder_Msg17_SetEnablePageFlip, typeof (RemoteNtDevice.Msg17_SetEnablePageFlip), 0, 0); - _priv_pmsgUse = (Message*) setEnablePageFlipPtr; - } - - public unsafe void SendSetEnablePageFlip(bool fPageFlip) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetEnablePageFlip(out _priv_portUse, out _priv_pmsgUse, fPageFlip); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteNtDevice CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteNtDevice(port, handle, true); - } - - public static RemoteNtDevice CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteNtDevice(port, handle, false); - } - - protected RemoteNtDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteNtDevice(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteNtDevice && 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; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - } - - [ComVisible(false)] - private struct Msg11_RenderNowIfPossible - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg12_CreateTransferBuffer - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Size sizeTransferPxl; - public SurfaceFormat nFormat; - } - - [ComVisible(false)] - private struct Msg13_SetMaxOverscan - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public float flMaxOverscan; - } - - [ComVisible(false)] - private struct Msg15_SetDisplayOverscan - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public float flDisplayOverscan; - } - - [ComVisible(false)] - private struct Msg17_SetEnablePageFlip - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fPageFlip; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteWinSoundDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteWinSoundDevice.cs index 6060dcd..e5b777b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteWinSoundDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Nt/RemoteWinSoundDevice.cs @@ -9,70 +9,70 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering.Nt { - internal class RemoteWinSoundDevice : RemoteSoundDevice - { - private static ushort[] s_priv_ByteOrder_Msg4_Create; - - protected RemoteWinSoundDevice() + internal class RemoteWinSoundDevice : RemoteSoundDevice { + private static ushort[] s_priv_ByteOrder_Msg4_Create; + + protected RemoteWinSoundDevice() + { + } + + public static unsafe RemoteWinSoundDevice Create( + ProtocolSplashRenderingNt _priv_protocolInstance, + IRenderHandleOwner _priv_owner) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE deviceClassHandle = _priv_protocolInstance.WinSoundDevice_ClassHandle; + RemoteWinSoundDevice remoteWinSoundDevice = new RemoteWinSoundDevice(port, _priv_owner); + uint num = (uint)sizeof(RemoteWinSoundDevice.Msg4_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteWinSoundDevice.Msg4_Create* msg4CreatePtr = (RemoteWinSoundDevice.Msg4_Create*)pMem; + msg4CreatePtr->_priv_size = num; + msg4CreatePtr->_priv_msgid = 4U; + msg4CreatePtr->_priv_idObjectSubject = remoteWinSoundDevice.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteWinSoundDevice.s_priv_ByteOrder_Msg4_Create, typeof(RemoteWinSoundDevice.Msg4_Create), 0, 0); + port.CreateRemoteObject(deviceClassHandle, remoteWinSoundDevice.m_renderHandle, (Message*)msg4CreatePtr); + return remoteWinSoundDevice; + } + + public static RemoteWinSoundDevice CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteWinSoundDevice(port, handle, true); + } + + public static RemoteWinSoundDevice CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteWinSoundDevice(port, handle, false); + } + + protected RemoteWinSoundDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteWinSoundDevice(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteWinSoundDevice && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg4_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } } - - public static unsafe RemoteWinSoundDevice Create( - ProtocolSplashRenderingNt _priv_protocolInstance, - IRenderHandleOwner _priv_owner) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE deviceClassHandle = _priv_protocolInstance.WinSoundDevice_ClassHandle; - RemoteWinSoundDevice remoteWinSoundDevice = new RemoteWinSoundDevice(port, _priv_owner); - uint num = (uint) sizeof (RemoteWinSoundDevice.Msg4_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteWinSoundDevice.Msg4_Create* msg4CreatePtr = (RemoteWinSoundDevice.Msg4_Create*) pMem; - msg4CreatePtr->_priv_size = num; - msg4CreatePtr->_priv_msgid = 4U; - msg4CreatePtr->_priv_idObjectSubject = remoteWinSoundDevice.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteWinSoundDevice.s_priv_ByteOrder_Msg4_Create, typeof (RemoteWinSoundDevice.Msg4_Create), 0, 0); - port.CreateRemoteObject(deviceClassHandle, remoteWinSoundDevice.m_renderHandle, (Message*) msg4CreatePtr); - return remoteWinSoundDevice; - } - - public static RemoteWinSoundDevice CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteWinSoundDevice(port, handle, true); - } - - public static RemoteWinSoundDevice CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteWinSoundDevice(port, handle, false); - } - - protected RemoteWinSoundDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteWinSoundDevice(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteWinSoundDevice && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg4_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/ProtocolSplashRendering.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/ProtocolSplashRendering.cs index 53ac42f..ce7d3a9 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/ProtocolSplashRendering.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/ProtocolSplashRendering.cs @@ -11,232 +11,232 @@ using System; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal sealed class ProtocolSplashRendering : ProtocolInstance - { - private RENDERHANDLE _priv_remoteClass_Window; - private RENDERHANDLE _priv_remoteClass_RenderCaps; - private RENDERHANDLE _priv_remoteClass_Visual; - private RENDERHANDLE _priv_remoteClass_Camera; - private RENDERHANDLE _priv_remoteClass_VisualContainer; - private RENDERHANDLE _priv_remoteClass_Device; - private RENDERHANDLE _priv_remoteClass_Surface; - private RENDERHANDLE _priv_remoteClass_SurfacePool; - private RENDERHANDLE _priv_remoteClass_VideoPool; - private RENDERHANDLE _priv_remoteClass_Rasterizer; - private RENDERHANDLE _priv_remoteClass_Gradient; - private RENDERHANDLE _priv_remoteClass_AnimationManager; - private RENDERHANDLE _priv_remoteClass_Animation; - private RENDERHANDLE _priv_remoteClass_ExternalAnimationInput; - private RENDERHANDLE _priv_remoteClass_AnimationInputProvider; - private RENDERHANDLE _priv_remoteClass_WaitCursor; - private RENDERHANDLE _priv_remoteClass_NullDevice; - private RENDERHANDLE _priv_remoteClass_Dx9Device; - private RENDERHANDLE _priv_remoteClass_Dx9EffectResource; - private RENDERHANDLE _priv_remoteClass_Effect; - private RENDERHANDLE _priv_remoteClass_Dx9Effect; - private RENDERHANDLE _priv_remoteClass_Sprite; - private RENDERHANDLE _priv_remoteClass_Dx9Sprite; - private RENDERHANDLE _priv_remoteClass_DynamicSurfaceFactory; - private RENDERHANDLE _priv_remoteClass_SoundBuffer; - private RENDERHANDLE _priv_remoteClass_Sound; - private RENDERHANDLE _priv_remoteClass_SoundDevice; - private RENDERHANDLE _priv_callbackInstance_RenderCapsCallback; - private RENDERHANDLE _priv_callbackInstance_DeviceCallback; - private RENDERHANDLE _priv_callbackInstance_VideoPoolCallback; - private RENDERHANDLE _priv_callbackInstance_AnimationCallback; - private RENDERHANDLE _priv_callbackInstance_SoundBufferCallback; - - public static ProtocolSplashRendering Bind(RenderPort port) + internal sealed class ProtocolSplashRendering : ProtocolInstance { - Debug2.Validate(port != null, typeof (ArgumentNullException), nameof (port)); - ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Rendering"); - if (protocolInstance != null) - { - ProtocolSplashRendering protocolSplashRendering = protocolInstance as ProtocolSplashRendering; - Debug2.Validate(protocolSplashRendering != null, typeof (InvalidOperationException), "protocol name collision"); - return protocolSplashRendering; - } - ProtocolSplashRendering protocolSplashRendering1 = new ProtocolSplashRendering(port); - port.BindProtocol((ProtocolInstance) protocolSplashRendering1); - return protocolSplashRendering1; + private RENDERHANDLE _priv_remoteClass_Window; + private RENDERHANDLE _priv_remoteClass_RenderCaps; + private RENDERHANDLE _priv_remoteClass_Visual; + private RENDERHANDLE _priv_remoteClass_Camera; + private RENDERHANDLE _priv_remoteClass_VisualContainer; + private RENDERHANDLE _priv_remoteClass_Device; + private RENDERHANDLE _priv_remoteClass_Surface; + private RENDERHANDLE _priv_remoteClass_SurfacePool; + private RENDERHANDLE _priv_remoteClass_VideoPool; + private RENDERHANDLE _priv_remoteClass_Rasterizer; + private RENDERHANDLE _priv_remoteClass_Gradient; + private RENDERHANDLE _priv_remoteClass_AnimationManager; + private RENDERHANDLE _priv_remoteClass_Animation; + private RENDERHANDLE _priv_remoteClass_ExternalAnimationInput; + private RENDERHANDLE _priv_remoteClass_AnimationInputProvider; + private RENDERHANDLE _priv_remoteClass_WaitCursor; + private RENDERHANDLE _priv_remoteClass_NullDevice; + private RENDERHANDLE _priv_remoteClass_Dx9Device; + private RENDERHANDLE _priv_remoteClass_Dx9EffectResource; + private RENDERHANDLE _priv_remoteClass_Effect; + private RENDERHANDLE _priv_remoteClass_Dx9Effect; + private RENDERHANDLE _priv_remoteClass_Sprite; + private RENDERHANDLE _priv_remoteClass_Dx9Sprite; + private RENDERHANDLE _priv_remoteClass_DynamicSurfaceFactory; + private RENDERHANDLE _priv_remoteClass_SoundBuffer; + private RENDERHANDLE _priv_remoteClass_Sound; + private RENDERHANDLE _priv_remoteClass_SoundDevice; + private RENDERHANDLE _priv_callbackInstance_RenderCapsCallback; + private RENDERHANDLE _priv_callbackInstance_DeviceCallback; + private RENDERHANDLE _priv_callbackInstance_VideoPoolCallback; + private RENDERHANDLE _priv_callbackInstance_AnimationCallback; + private RENDERHANDLE _priv_callbackInstance_SoundBufferCallback; + + public static ProtocolSplashRendering Bind(RenderPort port) + { + Debug2.Validate(port != null, typeof(ArgumentNullException), nameof(port)); + ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Rendering"); + if (protocolInstance != null) + { + ProtocolSplashRendering protocolSplashRendering = protocolInstance as ProtocolSplashRendering; + Debug2.Validate(protocolSplashRendering != null, typeof(InvalidOperationException), "protocol name collision"); + return protocolSplashRendering; + } + ProtocolSplashRendering protocolSplashRendering1 = new ProtocolSplashRendering(port); + port.BindProtocol((ProtocolInstance)protocolSplashRendering1); + return protocolSplashRendering1; + } + + public LocalRenderCapsCallback LocalRenderCapsCallbackHandle => LocalRenderCapsCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_RenderCapsCallback); + + public LocalDeviceCallback LocalDeviceCallbackHandle => LocalDeviceCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_DeviceCallback); + + public LocalVideoPoolCallback LocalVideoPoolCallbackHandle => LocalVideoPoolCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_VideoPoolCallback); + + public LocalAnimationCallback LocalAnimationCallbackHandle => LocalAnimationCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_AnimationCallback); + + public LocalSoundBufferCallback LocalSoundBufferCallbackHandle => LocalSoundBufferCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_SoundBufferCallback); + + private ProtocolSplashRendering(RenderPort port) + : base(port, "Splash::Rendering") + { + } + + protected override void Init() + { + RenderPort port = this.Port; + this._priv_remoteClass_Window = port.InitRemoteClass("Splash::Rendering::Window"); + this._priv_remoteClass_RenderCaps = port.InitRemoteClass("Splash::Rendering::RenderCaps"); + this._priv_remoteClass_Visual = port.InitRemoteClass("Splash::Rendering::Visual"); + this._priv_remoteClass_Camera = port.InitRemoteClass("Splash::Rendering::Camera"); + this._priv_remoteClass_VisualContainer = port.InitRemoteClass("Splash::Rendering::VisualContainer"); + this._priv_remoteClass_Device = port.InitRemoteClass("Splash::Rendering::Device"); + this._priv_remoteClass_Surface = port.InitRemoteClass("Splash::Rendering::Surface"); + this._priv_remoteClass_SurfacePool = port.InitRemoteClass("Splash::Rendering::SurfacePool"); + this._priv_remoteClass_VideoPool = port.InitRemoteClass("Splash::Rendering::VideoPool"); + this._priv_remoteClass_Rasterizer = port.InitRemoteClass("Splash::Rendering::Rasterizer"); + this._priv_remoteClass_Gradient = port.InitRemoteClass("Splash::Rendering::Gradient"); + this._priv_remoteClass_AnimationManager = port.InitRemoteClass("Splash::Rendering::AnimationManager"); + this._priv_remoteClass_Animation = port.InitRemoteClass("Splash::Rendering::Animation"); + this._priv_remoteClass_ExternalAnimationInput = port.InitRemoteClass("Splash::Rendering::ExternalAnimationInput"); + this._priv_remoteClass_AnimationInputProvider = port.InitRemoteClass("Splash::Rendering::AnimationInputProvider"); + this._priv_remoteClass_WaitCursor = port.InitRemoteClass("Splash::Rendering::WaitCursor"); + this._priv_remoteClass_NullDevice = port.InitRemoteClass("Splash::Rendering::NullDevice"); + this._priv_remoteClass_Dx9Device = port.InitRemoteClass("Splash::Rendering::Dx9Device"); + this._priv_remoteClass_Dx9EffectResource = port.InitRemoteClass("Splash::Rendering::Dx9EffectResource"); + this._priv_remoteClass_Effect = port.InitRemoteClass("Splash::Rendering::Effect"); + this._priv_remoteClass_Dx9Effect = port.InitRemoteClass("Splash::Rendering::Dx9Effect"); + this._priv_remoteClass_Sprite = port.InitRemoteClass("Splash::Rendering::Sprite"); + this._priv_remoteClass_Dx9Sprite = port.InitRemoteClass("Splash::Rendering::Dx9Sprite"); + this._priv_remoteClass_DynamicSurfaceFactory = port.InitRemoteClass("Splash::Rendering::DynamicSurfaceFactory"); + this._priv_remoteClass_SoundBuffer = port.InitRemoteClass("Splash::Rendering::SoundBuffer"); + this._priv_remoteClass_Sound = port.InitRemoteClass("Splash::Rendering::Sound"); + this._priv_remoteClass_SoundDevice = port.InitRemoteClass("Splash::Rendering::SoundDevice"); + this._priv_callbackInstance_RenderCapsCallback = LocalRenderCapsCallback.BindCallback(port); + this._priv_callbackInstance_DeviceCallback = LocalDeviceCallback.BindCallback(port); + this._priv_callbackInstance_VideoPoolCallback = LocalVideoPoolCallback.BindCallback(port); + this._priv_callbackInstance_AnimationCallback = LocalAnimationCallback.BindCallback(port); + this._priv_callbackInstance_SoundBufferCallback = LocalSoundBufferCallback.BindCallback(port); + } + + internal RENDERHANDLE Window_ClassHandle => this._priv_remoteClass_Window; + + internal RENDERHANDLE RenderCaps_ClassHandle => this._priv_remoteClass_RenderCaps; + + internal RENDERHANDLE Visual_ClassHandle => this._priv_remoteClass_Visual; + + internal RENDERHANDLE Camera_ClassHandle => this._priv_remoteClass_Camera; + + internal RENDERHANDLE VisualContainer_ClassHandle => this._priv_remoteClass_VisualContainer; + + internal RENDERHANDLE Device_ClassHandle => this._priv_remoteClass_Device; + + internal RENDERHANDLE Surface_ClassHandle => this._priv_remoteClass_Surface; + + internal RENDERHANDLE SurfacePool_ClassHandle => this._priv_remoteClass_SurfacePool; + + internal RENDERHANDLE VideoPool_ClassHandle => this._priv_remoteClass_VideoPool; + + internal RENDERHANDLE Rasterizer_ClassHandle => this._priv_remoteClass_Rasterizer; + + internal RENDERHANDLE Gradient_ClassHandle => this._priv_remoteClass_Gradient; + + internal RENDERHANDLE AnimationManager_ClassHandle => this._priv_remoteClass_AnimationManager; + + internal RENDERHANDLE Animation_ClassHandle => this._priv_remoteClass_Animation; + + internal RENDERHANDLE ExternalAnimationInput_ClassHandle => this._priv_remoteClass_ExternalAnimationInput; + + internal RENDERHANDLE AnimationInputProvider_ClassHandle => this._priv_remoteClass_AnimationInputProvider; + + internal RENDERHANDLE WaitCursor_ClassHandle => this._priv_remoteClass_WaitCursor; + + internal RENDERHANDLE NullDevice_ClassHandle => this._priv_remoteClass_NullDevice; + + internal RENDERHANDLE Dx9Device_ClassHandle => this._priv_remoteClass_Dx9Device; + + internal RENDERHANDLE Dx9EffectResource_ClassHandle => this._priv_remoteClass_Dx9EffectResource; + + internal RENDERHANDLE Effect_ClassHandle => this._priv_remoteClass_Effect; + + internal RENDERHANDLE Dx9Effect_ClassHandle => this._priv_remoteClass_Dx9Effect; + + internal RENDERHANDLE Sprite_ClassHandle => this._priv_remoteClass_Sprite; + + internal RENDERHANDLE Dx9Sprite_ClassHandle => this._priv_remoteClass_Dx9Sprite; + + internal RENDERHANDLE DynamicSurfaceFactory_ClassHandle => this._priv_remoteClass_DynamicSurfaceFactory; + + internal RENDERHANDLE SoundBuffer_ClassHandle => this._priv_remoteClass_SoundBuffer; + + internal RENDERHANDLE Sound_ClassHandle => this._priv_remoteClass_Sound; + + internal RENDERHANDLE SoundDevice_ClassHandle => this._priv_remoteClass_SoundDevice; + + internal RENDERHANDLE RenderCapsCallback_CallbackInstance => this._priv_callbackInstance_RenderCapsCallback; + + internal RENDERHANDLE DeviceCallback_CallbackInstance => this._priv_callbackInstance_DeviceCallback; + + internal RENDERHANDLE VideoPoolCallback_CallbackInstance => this._priv_callbackInstance_VideoPoolCallback; + + internal RENDERHANDLE AnimationCallback_CallbackInstance => this._priv_callbackInstance_AnimationCallback; + + internal RENDERHANDLE SoundBufferCallback_CallbackInstance => this._priv_callbackInstance_SoundBufferCallback; + + internal RemoteRenderCaps BuildRemoteRenderCaps( + IRenderHandleOwner _priv_owner, + LocalRenderCapsCallback callback) + { + return RemoteRenderCaps.Create(this, _priv_owner, callback); + } + + internal RemoteCamera BuildRemoteCamera(IRenderHandleOwner _priv_owner) => RemoteCamera.Create(this, _priv_owner); + + internal RemoteVisualContainer BuildRemoteVisualContainer( + IRenderHandleOwner _priv_owner) + { + return RemoteVisualContainer.Create(this, _priv_owner); + } + + internal RemoteAnimationManager BuildRemoteAnimationManager( + IRenderHandleOwner _priv_owner) + { + return RemoteAnimationManager.Create(this, _priv_owner); + } + + internal RemoteAnimation BuildRemoteAnimation( + IRenderHandleOwner _priv_owner, + AnimationInputType animationType, + LocalAnimationCallback cb) + { + return RemoteAnimation.Create(this, _priv_owner, animationType, cb); + } + + internal RemoteExternalAnimationInput BuildRemoteExternalAnimationInput( + IRenderHandleOwner _priv_owner, + uint nUniqueId) + { + return RemoteExternalAnimationInput.Create(this, _priv_owner, nUniqueId); + } + + internal RemoteAnimationInputProvider BuildRemoteAnimationInputProvider( + IRenderHandleOwner _priv_owner, + uint nExternalAnimationInputId) + { + return RemoteAnimationInputProvider.Create(this, _priv_owner, nExternalAnimationInputId); + } + + internal RemoteWaitCursor BuildRemoteWaitCursor(IRenderHandleOwner _priv_owner) => RemoteWaitCursor.Create(this, _priv_owner); + + internal RemoteNullDevice BuildRemoteNullDevice( + IRenderHandleOwner _priv_owner, + LocalDeviceCallback cb) + { + return RemoteNullDevice.Create(this, _priv_owner, cb); + } + + internal RemoteDx9EffectResource BuildRemoteDx9EffectResource( + IRenderHandleOwner _priv_owner, + RemoteDevice devOwner, + RemoteDataBuffer dataBuffer) + { + return RemoteDx9EffectResource.Create(this, _priv_owner, devOwner, dataBuffer); + } + + internal RemoteDx9Sprite BuildRemoteDx9Sprite(IRenderHandleOwner _priv_owner) => RemoteDx9Sprite.Create(this, _priv_owner); } - - public LocalRenderCapsCallback LocalRenderCapsCallbackHandle => LocalRenderCapsCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_RenderCapsCallback); - - public LocalDeviceCallback LocalDeviceCallbackHandle => LocalDeviceCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_DeviceCallback); - - public LocalVideoPoolCallback LocalVideoPoolCallbackHandle => LocalVideoPoolCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_VideoPoolCallback); - - public LocalAnimationCallback LocalAnimationCallbackHandle => LocalAnimationCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_AnimationCallback); - - public LocalSoundBufferCallback LocalSoundBufferCallbackHandle => LocalSoundBufferCallback.CreateCallbackImpl(this.Port, this._priv_callbackInstance_SoundBufferCallback); - - private ProtocolSplashRendering(RenderPort port) - : base(port, "Splash::Rendering") - { - } - - protected override void Init() - { - RenderPort port = this.Port; - this._priv_remoteClass_Window = port.InitRemoteClass("Splash::Rendering::Window"); - this._priv_remoteClass_RenderCaps = port.InitRemoteClass("Splash::Rendering::RenderCaps"); - this._priv_remoteClass_Visual = port.InitRemoteClass("Splash::Rendering::Visual"); - this._priv_remoteClass_Camera = port.InitRemoteClass("Splash::Rendering::Camera"); - this._priv_remoteClass_VisualContainer = port.InitRemoteClass("Splash::Rendering::VisualContainer"); - this._priv_remoteClass_Device = port.InitRemoteClass("Splash::Rendering::Device"); - this._priv_remoteClass_Surface = port.InitRemoteClass("Splash::Rendering::Surface"); - this._priv_remoteClass_SurfacePool = port.InitRemoteClass("Splash::Rendering::SurfacePool"); - this._priv_remoteClass_VideoPool = port.InitRemoteClass("Splash::Rendering::VideoPool"); - this._priv_remoteClass_Rasterizer = port.InitRemoteClass("Splash::Rendering::Rasterizer"); - this._priv_remoteClass_Gradient = port.InitRemoteClass("Splash::Rendering::Gradient"); - this._priv_remoteClass_AnimationManager = port.InitRemoteClass("Splash::Rendering::AnimationManager"); - this._priv_remoteClass_Animation = port.InitRemoteClass("Splash::Rendering::Animation"); - this._priv_remoteClass_ExternalAnimationInput = port.InitRemoteClass("Splash::Rendering::ExternalAnimationInput"); - this._priv_remoteClass_AnimationInputProvider = port.InitRemoteClass("Splash::Rendering::AnimationInputProvider"); - this._priv_remoteClass_WaitCursor = port.InitRemoteClass("Splash::Rendering::WaitCursor"); - this._priv_remoteClass_NullDevice = port.InitRemoteClass("Splash::Rendering::NullDevice"); - this._priv_remoteClass_Dx9Device = port.InitRemoteClass("Splash::Rendering::Dx9Device"); - this._priv_remoteClass_Dx9EffectResource = port.InitRemoteClass("Splash::Rendering::Dx9EffectResource"); - this._priv_remoteClass_Effect = port.InitRemoteClass("Splash::Rendering::Effect"); - this._priv_remoteClass_Dx9Effect = port.InitRemoteClass("Splash::Rendering::Dx9Effect"); - this._priv_remoteClass_Sprite = port.InitRemoteClass("Splash::Rendering::Sprite"); - this._priv_remoteClass_Dx9Sprite = port.InitRemoteClass("Splash::Rendering::Dx9Sprite"); - this._priv_remoteClass_DynamicSurfaceFactory = port.InitRemoteClass("Splash::Rendering::DynamicSurfaceFactory"); - this._priv_remoteClass_SoundBuffer = port.InitRemoteClass("Splash::Rendering::SoundBuffer"); - this._priv_remoteClass_Sound = port.InitRemoteClass("Splash::Rendering::Sound"); - this._priv_remoteClass_SoundDevice = port.InitRemoteClass("Splash::Rendering::SoundDevice"); - this._priv_callbackInstance_RenderCapsCallback = LocalRenderCapsCallback.BindCallback(port); - this._priv_callbackInstance_DeviceCallback = LocalDeviceCallback.BindCallback(port); - this._priv_callbackInstance_VideoPoolCallback = LocalVideoPoolCallback.BindCallback(port); - this._priv_callbackInstance_AnimationCallback = LocalAnimationCallback.BindCallback(port); - this._priv_callbackInstance_SoundBufferCallback = LocalSoundBufferCallback.BindCallback(port); - } - - internal RENDERHANDLE Window_ClassHandle => this._priv_remoteClass_Window; - - internal RENDERHANDLE RenderCaps_ClassHandle => this._priv_remoteClass_RenderCaps; - - internal RENDERHANDLE Visual_ClassHandle => this._priv_remoteClass_Visual; - - internal RENDERHANDLE Camera_ClassHandle => this._priv_remoteClass_Camera; - - internal RENDERHANDLE VisualContainer_ClassHandle => this._priv_remoteClass_VisualContainer; - - internal RENDERHANDLE Device_ClassHandle => this._priv_remoteClass_Device; - - internal RENDERHANDLE Surface_ClassHandle => this._priv_remoteClass_Surface; - - internal RENDERHANDLE SurfacePool_ClassHandle => this._priv_remoteClass_SurfacePool; - - internal RENDERHANDLE VideoPool_ClassHandle => this._priv_remoteClass_VideoPool; - - internal RENDERHANDLE Rasterizer_ClassHandle => this._priv_remoteClass_Rasterizer; - - internal RENDERHANDLE Gradient_ClassHandle => this._priv_remoteClass_Gradient; - - internal RENDERHANDLE AnimationManager_ClassHandle => this._priv_remoteClass_AnimationManager; - - internal RENDERHANDLE Animation_ClassHandle => this._priv_remoteClass_Animation; - - internal RENDERHANDLE ExternalAnimationInput_ClassHandle => this._priv_remoteClass_ExternalAnimationInput; - - internal RENDERHANDLE AnimationInputProvider_ClassHandle => this._priv_remoteClass_AnimationInputProvider; - - internal RENDERHANDLE WaitCursor_ClassHandle => this._priv_remoteClass_WaitCursor; - - internal RENDERHANDLE NullDevice_ClassHandle => this._priv_remoteClass_NullDevice; - - internal RENDERHANDLE Dx9Device_ClassHandle => this._priv_remoteClass_Dx9Device; - - internal RENDERHANDLE Dx9EffectResource_ClassHandle => this._priv_remoteClass_Dx9EffectResource; - - internal RENDERHANDLE Effect_ClassHandle => this._priv_remoteClass_Effect; - - internal RENDERHANDLE Dx9Effect_ClassHandle => this._priv_remoteClass_Dx9Effect; - - internal RENDERHANDLE Sprite_ClassHandle => this._priv_remoteClass_Sprite; - - internal RENDERHANDLE Dx9Sprite_ClassHandle => this._priv_remoteClass_Dx9Sprite; - - internal RENDERHANDLE DynamicSurfaceFactory_ClassHandle => this._priv_remoteClass_DynamicSurfaceFactory; - - internal RENDERHANDLE SoundBuffer_ClassHandle => this._priv_remoteClass_SoundBuffer; - - internal RENDERHANDLE Sound_ClassHandle => this._priv_remoteClass_Sound; - - internal RENDERHANDLE SoundDevice_ClassHandle => this._priv_remoteClass_SoundDevice; - - internal RENDERHANDLE RenderCapsCallback_CallbackInstance => this._priv_callbackInstance_RenderCapsCallback; - - internal RENDERHANDLE DeviceCallback_CallbackInstance => this._priv_callbackInstance_DeviceCallback; - - internal RENDERHANDLE VideoPoolCallback_CallbackInstance => this._priv_callbackInstance_VideoPoolCallback; - - internal RENDERHANDLE AnimationCallback_CallbackInstance => this._priv_callbackInstance_AnimationCallback; - - internal RENDERHANDLE SoundBufferCallback_CallbackInstance => this._priv_callbackInstance_SoundBufferCallback; - - internal RemoteRenderCaps BuildRemoteRenderCaps( - IRenderHandleOwner _priv_owner, - LocalRenderCapsCallback callback) - { - return RemoteRenderCaps.Create(this, _priv_owner, callback); - } - - internal RemoteCamera BuildRemoteCamera(IRenderHandleOwner _priv_owner) => RemoteCamera.Create(this, _priv_owner); - - internal RemoteVisualContainer BuildRemoteVisualContainer( - IRenderHandleOwner _priv_owner) - { - return RemoteVisualContainer.Create(this, _priv_owner); - } - - internal RemoteAnimationManager BuildRemoteAnimationManager( - IRenderHandleOwner _priv_owner) - { - return RemoteAnimationManager.Create(this, _priv_owner); - } - - internal RemoteAnimation BuildRemoteAnimation( - IRenderHandleOwner _priv_owner, - AnimationInputType animationType, - LocalAnimationCallback cb) - { - return RemoteAnimation.Create(this, _priv_owner, animationType, cb); - } - - internal RemoteExternalAnimationInput BuildRemoteExternalAnimationInput( - IRenderHandleOwner _priv_owner, - uint nUniqueId) - { - return RemoteExternalAnimationInput.Create(this, _priv_owner, nUniqueId); - } - - internal RemoteAnimationInputProvider BuildRemoteAnimationInputProvider( - IRenderHandleOwner _priv_owner, - uint nExternalAnimationInputId) - { - return RemoteAnimationInputProvider.Create(this, _priv_owner, nExternalAnimationInputId); - } - - internal RemoteWaitCursor BuildRemoteWaitCursor(IRenderHandleOwner _priv_owner) => RemoteWaitCursor.Create(this, _priv_owner); - - internal RemoteNullDevice BuildRemoteNullDevice( - IRenderHandleOwner _priv_owner, - LocalDeviceCallback cb) - { - return RemoteNullDevice.Create(this, _priv_owner, cb); - } - - internal RemoteDx9EffectResource BuildRemoteDx9EffectResource( - IRenderHandleOwner _priv_owner, - RemoteDevice devOwner, - RemoteDataBuffer dataBuffer) - { - return RemoteDx9EffectResource.Create(this, _priv_owner, devOwner, dataBuffer); - } - - internal RemoteDx9Sprite BuildRemoteDx9Sprite(IRenderHandleOwner _priv_owner) => RemoteDx9Sprite.Create(this, _priv_owner); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimation.cs index eaacdef..60a98a1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimation.cs @@ -10,1694 +10,1694 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteAnimation : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg43_Create; - private static ushort[] s_priv_ByteOrder_Msg0_RemoveAllEvents; - private static ushort[] s_priv_ByteOrder_Msg1_RemoveEvent; - private static ushort[] s_priv_ByteOrder_Msg2_AddValueEvent; - private static ushort[] s_priv_ByteOrder_Msg3_AddProgressEvent; - private static ushort[] s_priv_ByteOrder_Msg4_AddTimeEvent; - private static ushort[] s_priv_ByteOrder_Msg5_AddStageEvent; - private static ushort[] s_priv_ByteOrder_Msg6_RemoveTarget; - private static ushort[] s_priv_ByteOrder_Msg7_AddTarget; - private static ushort[] s_priv_ByteOrder_Msg8_SetEaseOut; - private static ushort[] s_priv_ByteOrder_Msg9_SetEaseIn; - private static ushort[] s_priv_ByteOrder_Msg10_SetBezier; - private static ushort[] s_priv_ByteOrder_Msg11_SetCosine; - private static ushort[] s_priv_ByteOrder_Msg12_SetSine; - private static ushort[] s_priv_ByteOrder_Msg13_SetSCurve; - private static ushort[] s_priv_ByteOrder_Msg14_SetLogarithmic; - private static ushort[] s_priv_ByteOrder_Msg15_SetExponential; - private static ushort[] s_priv_ByteOrder_Msg16_SetLinear; - private static ushort[] s_priv_ByteOrder_Msg17_SetBinaryOperation; - private static ushort[] s_priv_ByteOrder_Msg18_SetContinuous; - private static ushort[] s_priv_ByteOrder_Msg19_SetCaptured; - private static ushort[] s_priv_ByteOrder_Msg20_SetQuaternion; - private static ushort[] s_priv_ByteOrder_Msg21_SetVector4; - private static ushort[] s_priv_ByteOrder_Msg22_SetVector3; - private static ushort[] s_priv_ByteOrder_Msg23_SetVector2; - private static ushort[] s_priv_ByteOrder_Msg24_SetFloat; - private static ushort[] s_priv_ByteOrder_Msg25_EndAnimationInput; - private static ushort[] s_priv_ByteOrder_Msg26_BeginAnimationInput; - private static ushort[] s_priv_ByteOrder_Msg27_SetKeyframeTime; - private static ushort[] s_priv_ByteOrder_Msg29_SetKeyframeCount; - private static ushort[] s_priv_ByteOrder_Msg31_AddKeyframe; - private static ushort[] s_priv_ByteOrder_Msg32_InstantFinish; - private static ushort[] s_priv_ByteOrder_Msg33_InstantAdvance; - private static ushort[] s_priv_ByteOrder_Msg34_Reset; - private static ushort[] s_priv_ByteOrder_Msg35_Pause; - private static ushort[] s_priv_ByteOrder_Msg36_Play; - private static ushort[] s_priv_ByteOrder_Msg37_SetResetBehavior; - private static ushort[] s_priv_ByteOrder_Msg39_SetAutoReset; - private static ushort[] s_priv_ByteOrder_Msg41_SetRepeatCount; - - protected RemoteAnimation() - { - } - - public static unsafe RemoteAnimation Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - AnimationInputType animationType, - LocalAnimationCallback cb) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE animationClassHandle = _priv_protocolInstance.Animation_ClassHandle; - RemoteAnimation remoteAnimation = new RemoteAnimation(port, _priv_owner); - uint num = (uint) sizeof (RemoteAnimation.Msg43_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteAnimation.Msg43_Create* msg43CreatePtr = (RemoteAnimation.Msg43_Create*) pMem; - msg43CreatePtr->_priv_size = num; - msg43CreatePtr->_priv_msgid = 43U; - msg43CreatePtr->animationType = animationType; - msg43CreatePtr->_priv_objcb = cb.RenderHandle; - msg43CreatePtr->_priv_ctxcb = port.Session.LocalContext; - msg43CreatePtr->_priv_idObjectSubject = remoteAnimation.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteAnimation.s_priv_ByteOrder_Msg43_Create, typeof (RemoteAnimation.Msg43_Create), 0, 0); - port.CreateRemoteObject(animationClassHandle, remoteAnimation.m_renderHandle, (Message*) msg43CreatePtr); - return remoteAnimation; - } - - public unsafe void BuildRemoveAllEvents( - 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 (RemoteAnimation.Msg0_RemoveAllEvents); - RemoteAnimation.Msg0_RemoveAllEvents* msg0RemoveAllEventsPtr = (RemoteAnimation.Msg0_RemoveAllEvents*) _priv_portUse.AllocMessageBuffer(size); - msg0RemoveAllEventsPtr->_priv_size = size; - msg0RemoveAllEventsPtr->_priv_msgid = 0U; - msg0RemoveAllEventsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0RemoveAllEventsPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg0_RemoveAllEvents, typeof (RemoteAnimation.Msg0_RemoveAllEvents), 0, 0); - _priv_pmsgUse = (Message*) msg0RemoveAllEventsPtr; - } - - public unsafe void SendRemoveAllEvents() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRemoveAllEvents(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRemoveEvent( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint idEvent) - { - 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 (RemoteAnimation.Msg1_RemoveEvent); - RemoteAnimation.Msg1_RemoveEvent* msg1RemoveEventPtr = (RemoteAnimation.Msg1_RemoveEvent*) _priv_portUse.AllocMessageBuffer(size); - msg1RemoveEventPtr->_priv_size = size; - msg1RemoveEventPtr->_priv_msgid = 1U; - msg1RemoveEventPtr->idEvent = idEvent; - msg1RemoveEventPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1RemoveEventPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg1_RemoveEvent, typeof (RemoteAnimation.Msg1_RemoveEvent), 0, 0); - _priv_pmsgUse = (Message*) msg1RemoveEventPtr; - } - - public unsafe void SendRemoveEvent(uint idEvent) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRemoveEvent(out _priv_portUse, out _priv_pmsgUse, idEvent); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddValueEvent( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint idEvent, - ValueEventCondition nCondition, - RENDERHANDLE idTargetObject, - uint nTargetMethodId, - uint nTargetMethodArg, - bool fInitialActivation, - bool fAllowRepeat) - { - 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 (RemoteAnimation.Msg2_AddValueEvent); - RemoteAnimation.Msg2_AddValueEvent* msg2AddValueEventPtr = (RemoteAnimation.Msg2_AddValueEvent*) _priv_portUse.AllocMessageBuffer(size); - msg2AddValueEventPtr->_priv_size = size; - msg2AddValueEventPtr->_priv_msgid = 2U; - msg2AddValueEventPtr->idEvent = idEvent; - msg2AddValueEventPtr->nCondition = nCondition; - msg2AddValueEventPtr->idTargetObject = idTargetObject; - msg2AddValueEventPtr->nTargetMethodId = nTargetMethodId; - msg2AddValueEventPtr->nTargetMethodArg = nTargetMethodArg; - msg2AddValueEventPtr->fInitialActivation = fInitialActivation ? uint.MaxValue : 0U; - msg2AddValueEventPtr->fAllowRepeat = fAllowRepeat ? uint.MaxValue : 0U; - msg2AddValueEventPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg2AddValueEventPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg2_AddValueEvent, typeof (RemoteAnimation.Msg2_AddValueEvent), 0, 0); - _priv_pmsgUse = (Message*) msg2AddValueEventPtr; - } - - public unsafe void SendAddValueEvent( - uint idEvent, - ValueEventCondition nCondition, - RENDERHANDLE idTargetObject, - uint nTargetMethodId, - uint nTargetMethodArg, - bool fInitialActivation, - bool fAllowRepeat) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddValueEvent(out _priv_portUse, out _priv_pmsgUse, idEvent, nCondition, idTargetObject, nTargetMethodId, nTargetMethodArg, fInitialActivation, fAllowRepeat); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddProgressEvent( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint idEvent, - float flProgress, - RENDERHANDLE idTargetObject, - uint nTargetMethodId, - uint nTargetMethodArg, - bool fInitialActivation, - bool fAllowRepeat) - { - 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 (RemoteAnimation.Msg3_AddProgressEvent); - RemoteAnimation.Msg3_AddProgressEvent* addProgressEventPtr = (RemoteAnimation.Msg3_AddProgressEvent*) _priv_portUse.AllocMessageBuffer(size); - addProgressEventPtr->_priv_size = size; - addProgressEventPtr->_priv_msgid = 3U; - addProgressEventPtr->idEvent = idEvent; - addProgressEventPtr->flProgress = flProgress; - addProgressEventPtr->idTargetObject = idTargetObject; - addProgressEventPtr->nTargetMethodId = nTargetMethodId; - addProgressEventPtr->nTargetMethodArg = nTargetMethodArg; - addProgressEventPtr->fInitialActivation = fInitialActivation ? uint.MaxValue : 0U; - addProgressEventPtr->fAllowRepeat = fAllowRepeat ? uint.MaxValue : 0U; - addProgressEventPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) addProgressEventPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg3_AddProgressEvent, typeof (RemoteAnimation.Msg3_AddProgressEvent), 0, 0); - _priv_pmsgUse = (Message*) addProgressEventPtr; - } - - public unsafe void SendAddProgressEvent( - uint idEvent, - float flProgress, - RENDERHANDLE idTargetObject, - uint nTargetMethodId, - uint nTargetMethodArg, - bool fInitialActivation, - bool fAllowRepeat) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddProgressEvent(out _priv_portUse, out _priv_pmsgUse, idEvent, flProgress, idTargetObject, nTargetMethodId, nTargetMethodArg, fInitialActivation, fAllowRepeat); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddTimeEvent( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint idEvent, - float flEventTime, - RENDERHANDLE idTargetObject, - uint nTargetMethodId, - uint nTargetMethodArg, - bool fInitialActivation, - bool fAllowRepeat) - { - 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 (RemoteAnimation.Msg4_AddTimeEvent); - RemoteAnimation.Msg4_AddTimeEvent* msg4AddTimeEventPtr = (RemoteAnimation.Msg4_AddTimeEvent*) _priv_portUse.AllocMessageBuffer(size); - msg4AddTimeEventPtr->_priv_size = size; - msg4AddTimeEventPtr->_priv_msgid = 4U; - msg4AddTimeEventPtr->idEvent = idEvent; - msg4AddTimeEventPtr->flEventTime = flEventTime; - msg4AddTimeEventPtr->idTargetObject = idTargetObject; - msg4AddTimeEventPtr->nTargetMethodId = nTargetMethodId; - msg4AddTimeEventPtr->nTargetMethodArg = nTargetMethodArg; - msg4AddTimeEventPtr->fInitialActivation = fInitialActivation ? uint.MaxValue : 0U; - msg4AddTimeEventPtr->fAllowRepeat = fAllowRepeat ? uint.MaxValue : 0U; - msg4AddTimeEventPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4AddTimeEventPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg4_AddTimeEvent, typeof (RemoteAnimation.Msg4_AddTimeEvent), 0, 0); - _priv_pmsgUse = (Message*) msg4AddTimeEventPtr; - } - - public unsafe void SendAddTimeEvent( - uint idEvent, - float flEventTime, - RENDERHANDLE idTargetObject, - uint nTargetMethodId, - uint nTargetMethodArg, - bool fInitialActivation, - bool fAllowRepeat) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddTimeEvent(out _priv_portUse, out _priv_pmsgUse, idEvent, flEventTime, idTargetObject, nTargetMethodId, nTargetMethodArg, fInitialActivation, fAllowRepeat); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddStageEvent( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint idEvent, - AnimationStage nStage, - RENDERHANDLE idTargetObject, - uint nTargetMethodId, - uint nTargetMethodArg, - bool fInitialActivation, - bool fAllowRepeat) - { - 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 (RemoteAnimation.Msg5_AddStageEvent); - RemoteAnimation.Msg5_AddStageEvent* msg5AddStageEventPtr = (RemoteAnimation.Msg5_AddStageEvent*) _priv_portUse.AllocMessageBuffer(size); - msg5AddStageEventPtr->_priv_size = size; - msg5AddStageEventPtr->_priv_msgid = 5U; - msg5AddStageEventPtr->idEvent = idEvent; - msg5AddStageEventPtr->nStage = nStage; - msg5AddStageEventPtr->idTargetObject = idTargetObject; - msg5AddStageEventPtr->nTargetMethodId = nTargetMethodId; - msg5AddStageEventPtr->nTargetMethodArg = nTargetMethodArg; - msg5AddStageEventPtr->fInitialActivation = fInitialActivation ? uint.MaxValue : 0U; - msg5AddStageEventPtr->fAllowRepeat = fAllowRepeat ? uint.MaxValue : 0U; - msg5AddStageEventPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg5AddStageEventPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg5_AddStageEvent, typeof (RemoteAnimation.Msg5_AddStageEvent), 0, 0); - _priv_pmsgUse = (Message*) msg5AddStageEventPtr; - } - - public unsafe void SendAddStageEvent( - uint idEvent, - AnimationStage nStage, - RENDERHANDLE idTargetObject, - uint nTargetMethodId, - uint nTargetMethodArg, - bool fInitialActivation, - bool fAllowRepeat) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddStageEvent(out _priv_portUse, out _priv_pmsgUse, idEvent, nStage, idTargetObject, nTargetMethodId, nTargetMethodArg, fInitialActivation, fAllowRepeat); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRemoveTarget( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int targetId) - { - 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 (RemoteAnimation.Msg6_RemoveTarget); - RemoteAnimation.Msg6_RemoveTarget* msg6RemoveTargetPtr = (RemoteAnimation.Msg6_RemoveTarget*) _priv_portUse.AllocMessageBuffer(size); - msg6RemoveTargetPtr->_priv_size = size; - msg6RemoveTargetPtr->_priv_msgid = 6U; - msg6RemoveTargetPtr->targetId = targetId; - msg6RemoveTargetPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg6RemoveTargetPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg6_RemoveTarget, typeof (RemoteAnimation.Msg6_RemoveTarget), 0, 0); - _priv_pmsgUse = (Message*) msg6RemoveTargetPtr; - } - - public unsafe void SendRemoveTarget(int targetId) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRemoveTarget(out _priv_portUse, out _priv_pmsgUse, targetId); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddTarget( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int targetId, - RENDERHANDLE objectId, - uint propertyId, - uint propertyInfo) - { - 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 (RemoteAnimation.Msg7_AddTarget); - RemoteAnimation.Msg7_AddTarget* msg7AddTargetPtr = (RemoteAnimation.Msg7_AddTarget*) _priv_portUse.AllocMessageBuffer(size); - msg7AddTargetPtr->_priv_size = size; - msg7AddTargetPtr->_priv_msgid = 7U; - msg7AddTargetPtr->targetId = targetId; - msg7AddTargetPtr->objectId = objectId; - msg7AddTargetPtr->propertyId = propertyId; - msg7AddTargetPtr->propertyInfo = propertyInfo; - msg7AddTargetPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg7AddTargetPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg7_AddTarget, typeof (RemoteAnimation.Msg7_AddTarget), 0, 0); - _priv_pmsgUse = (Message*) msg7AddTargetPtr; - } - - public unsafe void SendAddTarget( - int targetId, - RENDERHANDLE objectId, - uint propertyId, - uint propertyInfo) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddTarget(out _priv_portUse, out _priv_pmsgUse, targetId, objectId, propertyId, propertyInfo); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetEaseOut( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - bool fSpherical, - float flWeight, - float flHandle) - { - 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 (RemoteAnimation.Msg8_SetEaseOut); - RemoteAnimation.Msg8_SetEaseOut* msg8SetEaseOutPtr = (RemoteAnimation.Msg8_SetEaseOut*) _priv_portUse.AllocMessageBuffer(size); - msg8SetEaseOutPtr->_priv_size = size; - msg8SetEaseOutPtr->_priv_msgid = 8U; - msg8SetEaseOutPtr->idxKeyframe = idxKeyframe; - msg8SetEaseOutPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; - msg8SetEaseOutPtr->flWeight = flWeight; - msg8SetEaseOutPtr->flHandle = flHandle; - msg8SetEaseOutPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg8SetEaseOutPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg8_SetEaseOut, typeof (RemoteAnimation.Msg8_SetEaseOut), 0, 0); - _priv_pmsgUse = (Message*) msg8SetEaseOutPtr; - } - - public unsafe void SendSetEaseOut( - int idxKeyframe, - bool fSpherical, - float flWeight, - float flHandle) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetEaseOut(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flWeight, flHandle); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetEaseIn( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - bool fSpherical, - float flWeight, - float flHandle) - { - 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 (RemoteAnimation.Msg9_SetEaseIn); - RemoteAnimation.Msg9_SetEaseIn* msg9SetEaseInPtr = (RemoteAnimation.Msg9_SetEaseIn*) _priv_portUse.AllocMessageBuffer(size); - msg9SetEaseInPtr->_priv_size = size; - msg9SetEaseInPtr->_priv_msgid = 9U; - msg9SetEaseInPtr->idxKeyframe = idxKeyframe; - msg9SetEaseInPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; - msg9SetEaseInPtr->flWeight = flWeight; - msg9SetEaseInPtr->flHandle = flHandle; - msg9SetEaseInPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg9SetEaseInPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg9_SetEaseIn, typeof (RemoteAnimation.Msg9_SetEaseIn), 0, 0); - _priv_pmsgUse = (Message*) msg9SetEaseInPtr; - } - - public unsafe void SendSetEaseIn( - int idxKeyframe, - bool fSpherical, - float flWeight, - float flHandle) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetEaseIn(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flWeight, flHandle); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetBezier( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - bool fSpherical, - float flHandle1, - float flHandle2) - { - 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 (RemoteAnimation.Msg10_SetBezier); - RemoteAnimation.Msg10_SetBezier* msg10SetBezierPtr = (RemoteAnimation.Msg10_SetBezier*) _priv_portUse.AllocMessageBuffer(size); - msg10SetBezierPtr->_priv_size = size; - msg10SetBezierPtr->_priv_msgid = 10U; - msg10SetBezierPtr->idxKeyframe = idxKeyframe; - msg10SetBezierPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; - msg10SetBezierPtr->flHandle1 = flHandle1; - msg10SetBezierPtr->flHandle2 = flHandle2; - msg10SetBezierPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg10SetBezierPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg10_SetBezier, typeof (RemoteAnimation.Msg10_SetBezier), 0, 0); - _priv_pmsgUse = (Message*) msg10SetBezierPtr; - } - - public unsafe void SendSetBezier( - int idxKeyframe, - bool fSpherical, - float flHandle1, - float flHandle2) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetBezier(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flHandle1, flHandle2); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetCosine( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - bool fSpherical) - { - 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 (RemoteAnimation.Msg11_SetCosine); - RemoteAnimation.Msg11_SetCosine* msg11SetCosinePtr = (RemoteAnimation.Msg11_SetCosine*) _priv_portUse.AllocMessageBuffer(size); - msg11SetCosinePtr->_priv_size = size; - msg11SetCosinePtr->_priv_msgid = 11U; - msg11SetCosinePtr->idxKeyframe = idxKeyframe; - msg11SetCosinePtr->fSpherical = fSpherical ? uint.MaxValue : 0U; - msg11SetCosinePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg11SetCosinePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg11_SetCosine, typeof (RemoteAnimation.Msg11_SetCosine), 0, 0); - _priv_pmsgUse = (Message*) msg11SetCosinePtr; - } - - public unsafe void SendSetCosine(int idxKeyframe, bool fSpherical) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetCosine(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetSine( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - bool fSpherical) - { - 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 (RemoteAnimation.Msg12_SetSine); - RemoteAnimation.Msg12_SetSine* msg12SetSinePtr = (RemoteAnimation.Msg12_SetSine*) _priv_portUse.AllocMessageBuffer(size); - msg12SetSinePtr->_priv_size = size; - msg12SetSinePtr->_priv_msgid = 12U; - msg12SetSinePtr->idxKeyframe = idxKeyframe; - msg12SetSinePtr->fSpherical = fSpherical ? uint.MaxValue : 0U; - msg12SetSinePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg12SetSinePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg12_SetSine, typeof (RemoteAnimation.Msg12_SetSine), 0, 0); - _priv_pmsgUse = (Message*) msg12SetSinePtr; - } - - public unsafe void SendSetSine(int idxKeyframe, bool fSpherical) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetSine(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetSCurve( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - bool fSpherical, - float flWeight) - { - 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 (RemoteAnimation.Msg13_SetSCurve); - RemoteAnimation.Msg13_SetSCurve* msg13SetScurvePtr = (RemoteAnimation.Msg13_SetSCurve*) _priv_portUse.AllocMessageBuffer(size); - msg13SetScurvePtr->_priv_size = size; - msg13SetScurvePtr->_priv_msgid = 13U; - msg13SetScurvePtr->idxKeyframe = idxKeyframe; - msg13SetScurvePtr->fSpherical = fSpherical ? uint.MaxValue : 0U; - msg13SetScurvePtr->flWeight = flWeight; - msg13SetScurvePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg13SetScurvePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg13_SetSCurve, typeof (RemoteAnimation.Msg13_SetSCurve), 0, 0); - _priv_pmsgUse = (Message*) msg13SetScurvePtr; - } - - public unsafe void SendSetSCurve(int idxKeyframe, bool fSpherical, float flWeight) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetSCurve(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flWeight); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetLogarithmic( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - bool fSpherical, - float flWeight) - { - 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 (RemoteAnimation.Msg14_SetLogarithmic); - RemoteAnimation.Msg14_SetLogarithmic* msg14SetLogarithmicPtr = (RemoteAnimation.Msg14_SetLogarithmic*) _priv_portUse.AllocMessageBuffer(size); - msg14SetLogarithmicPtr->_priv_size = size; - msg14SetLogarithmicPtr->_priv_msgid = 14U; - msg14SetLogarithmicPtr->idxKeyframe = idxKeyframe; - msg14SetLogarithmicPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; - msg14SetLogarithmicPtr->flWeight = flWeight; - msg14SetLogarithmicPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg14SetLogarithmicPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg14_SetLogarithmic, typeof (RemoteAnimation.Msg14_SetLogarithmic), 0, 0); - _priv_pmsgUse = (Message*) msg14SetLogarithmicPtr; - } - - public unsafe void SendSetLogarithmic(int idxKeyframe, bool fSpherical, float flWeight) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetLogarithmic(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flWeight); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetExponential( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - bool fSpherical, - float flWeight) - { - 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 (RemoteAnimation.Msg15_SetExponential); - RemoteAnimation.Msg15_SetExponential* msg15SetExponentialPtr = (RemoteAnimation.Msg15_SetExponential*) _priv_portUse.AllocMessageBuffer(size); - msg15SetExponentialPtr->_priv_size = size; - msg15SetExponentialPtr->_priv_msgid = 15U; - msg15SetExponentialPtr->idxKeyframe = idxKeyframe; - msg15SetExponentialPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; - msg15SetExponentialPtr->flWeight = flWeight; - msg15SetExponentialPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg15SetExponentialPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg15_SetExponential, typeof (RemoteAnimation.Msg15_SetExponential), 0, 0); - _priv_pmsgUse = (Message*) msg15SetExponentialPtr; - } - - public unsafe void SendSetExponential(int idxKeyframe, bool fSpherical, float flWeight) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetExponential(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flWeight); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetLinear( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - bool fSpherical) - { - 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 (RemoteAnimation.Msg16_SetLinear); - RemoteAnimation.Msg16_SetLinear* msg16SetLinearPtr = (RemoteAnimation.Msg16_SetLinear*) _priv_portUse.AllocMessageBuffer(size); - msg16SetLinearPtr->_priv_size = size; - msg16SetLinearPtr->_priv_msgid = 16U; - msg16SetLinearPtr->idxKeyframe = idxKeyframe; - msg16SetLinearPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; - msg16SetLinearPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg16SetLinearPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg16_SetLinear, typeof (RemoteAnimation.Msg16_SetLinear), 0, 0); - _priv_pmsgUse = (Message*) msg16SetLinearPtr; - } - - public unsafe void SendSetLinear(int idxKeyframe, bool fSpherical) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetLinear(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetBinaryOperation( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - BinaryOpCode opCode) - { - 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 (RemoteAnimation.Msg17_SetBinaryOperation); - RemoteAnimation.Msg17_SetBinaryOperation* setBinaryOperationPtr = (RemoteAnimation.Msg17_SetBinaryOperation*) _priv_portUse.AllocMessageBuffer(size); - setBinaryOperationPtr->_priv_size = size; - setBinaryOperationPtr->_priv_msgid = 17U; - setBinaryOperationPtr->idxKeyframe = idxKeyframe; - setBinaryOperationPtr->opCode = opCode; - setBinaryOperationPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setBinaryOperationPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg17_SetBinaryOperation, typeof (RemoteAnimation.Msg17_SetBinaryOperation), 0, 0); - _priv_pmsgUse = (Message*) setBinaryOperationPtr; - } - - public unsafe void SendSetBinaryOperation(int idxKeyframe, BinaryOpCode opCode) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetBinaryOperation(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, opCode); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetContinuous( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - RENDERHANDLE idObject, - uint idProperty, - uint propertyInfo) - { - 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 (RemoteAnimation.Msg18_SetContinuous); - RemoteAnimation.Msg18_SetContinuous* msg18SetContinuousPtr = (RemoteAnimation.Msg18_SetContinuous*) _priv_portUse.AllocMessageBuffer(size); - msg18SetContinuousPtr->_priv_size = size; - msg18SetContinuousPtr->_priv_msgid = 18U; - msg18SetContinuousPtr->idxKeyframe = idxKeyframe; - msg18SetContinuousPtr->idObject = idObject; - msg18SetContinuousPtr->idProperty = idProperty; - msg18SetContinuousPtr->propertyInfo = propertyInfo; - msg18SetContinuousPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg18SetContinuousPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg18_SetContinuous, typeof (RemoteAnimation.Msg18_SetContinuous), 0, 0); - _priv_pmsgUse = (Message*) msg18SetContinuousPtr; - } - - public unsafe void SendSetContinuous( - int idxKeyframe, - RENDERHANDLE idObject, - uint idProperty, - uint propertyInfo) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetContinuous(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, idObject, idProperty, propertyInfo); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetCaptured( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - RENDERHANDLE idObject, - uint idProperty, - uint propertyInfo, - bool fRefreshOnRepeat) - { - 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 (RemoteAnimation.Msg19_SetCaptured); - RemoteAnimation.Msg19_SetCaptured* msg19SetCapturedPtr = (RemoteAnimation.Msg19_SetCaptured*) _priv_portUse.AllocMessageBuffer(size); - msg19SetCapturedPtr->_priv_size = size; - msg19SetCapturedPtr->_priv_msgid = 19U; - msg19SetCapturedPtr->idxKeyframe = idxKeyframe; - msg19SetCapturedPtr->idObject = idObject; - msg19SetCapturedPtr->idProperty = idProperty; - msg19SetCapturedPtr->propertyInfo = propertyInfo; - msg19SetCapturedPtr->fRefreshOnRepeat = fRefreshOnRepeat ? uint.MaxValue : 0U; - msg19SetCapturedPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg19SetCapturedPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg19_SetCaptured, typeof (RemoteAnimation.Msg19_SetCaptured), 0, 0); - _priv_pmsgUse = (Message*) msg19SetCapturedPtr; - } - - public unsafe void SendSetCaptured( - int idxKeyframe, - RENDERHANDLE idObject, - uint idProperty, - uint propertyInfo, - bool fRefreshOnRepeat) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetCaptured(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, idObject, idProperty, propertyInfo, fRefreshOnRepeat); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetQuaternion( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - Quaternion qValue) - { - 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 (RemoteAnimation.Msg20_SetQuaternion); - RemoteAnimation.Msg20_SetQuaternion* msg20SetQuaternionPtr = (RemoteAnimation.Msg20_SetQuaternion*) _priv_portUse.AllocMessageBuffer(size); - msg20SetQuaternionPtr->_priv_size = size; - msg20SetQuaternionPtr->_priv_msgid = 20U; - msg20SetQuaternionPtr->idxKeyframe = idxKeyframe; - msg20SetQuaternionPtr->qValue = qValue; - msg20SetQuaternionPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg20SetQuaternionPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg20_SetQuaternion, typeof (RemoteAnimation.Msg20_SetQuaternion), 0, 0); - _priv_pmsgUse = (Message*) msg20SetQuaternionPtr; - } - - public unsafe void SendSetQuaternion(int idxKeyframe, Quaternion qValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetQuaternion(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, qValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetVector4( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - Vector4 vValue) - { - 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 (RemoteAnimation.Msg21_SetVector4); - RemoteAnimation.Msg21_SetVector4* msg21SetVector4Ptr = (RemoteAnimation.Msg21_SetVector4*) _priv_portUse.AllocMessageBuffer(size); - msg21SetVector4Ptr->_priv_size = size; - msg21SetVector4Ptr->_priv_msgid = 21U; - msg21SetVector4Ptr->idxKeyframe = idxKeyframe; - msg21SetVector4Ptr->vValue = vValue; - msg21SetVector4Ptr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg21SetVector4Ptr, ref RemoteAnimation.s_priv_ByteOrder_Msg21_SetVector4, typeof (RemoteAnimation.Msg21_SetVector4), 0, 0); - _priv_pmsgUse = (Message*) msg21SetVector4Ptr; - } - - public unsafe void SendSetVector4(int idxKeyframe, Vector4 vValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetVector4(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, vValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetVector3( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - Vector3 vValue) - { - 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 (RemoteAnimation.Msg22_SetVector3); - RemoteAnimation.Msg22_SetVector3* msg22SetVector3Ptr = (RemoteAnimation.Msg22_SetVector3*) _priv_portUse.AllocMessageBuffer(size); - msg22SetVector3Ptr->_priv_size = size; - msg22SetVector3Ptr->_priv_msgid = 22U; - msg22SetVector3Ptr->idxKeyframe = idxKeyframe; - msg22SetVector3Ptr->vValue = vValue; - msg22SetVector3Ptr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg22SetVector3Ptr, ref RemoteAnimation.s_priv_ByteOrder_Msg22_SetVector3, typeof (RemoteAnimation.Msg22_SetVector3), 0, 0); - _priv_pmsgUse = (Message*) msg22SetVector3Ptr; - } - - public unsafe void SendSetVector3(int idxKeyframe, Vector3 vValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetVector3(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, vValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetVector2( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - Vector2 vValue) - { - 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 (RemoteAnimation.Msg23_SetVector2); - RemoteAnimation.Msg23_SetVector2* msg23SetVector2Ptr = (RemoteAnimation.Msg23_SetVector2*) _priv_portUse.AllocMessageBuffer(size); - msg23SetVector2Ptr->_priv_size = size; - msg23SetVector2Ptr->_priv_msgid = 23U; - msg23SetVector2Ptr->idxKeyframe = idxKeyframe; - msg23SetVector2Ptr->vValue = vValue; - msg23SetVector2Ptr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg23SetVector2Ptr, ref RemoteAnimation.s_priv_ByteOrder_Msg23_SetVector2, typeof (RemoteAnimation.Msg23_SetVector2), 0, 0); - _priv_pmsgUse = (Message*) msg23SetVector2Ptr; - } - - public unsafe void SendSetVector2(int idxKeyframe, Vector2 vValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetVector2(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, vValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetFloat( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - float flValue) - { - 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 (RemoteAnimation.Msg24_SetFloat); - RemoteAnimation.Msg24_SetFloat* msg24SetFloatPtr = (RemoteAnimation.Msg24_SetFloat*) _priv_portUse.AllocMessageBuffer(size); - msg24SetFloatPtr->_priv_size = size; - msg24SetFloatPtr->_priv_msgid = 24U; - msg24SetFloatPtr->idxKeyframe = idxKeyframe; - msg24SetFloatPtr->flValue = flValue; - msg24SetFloatPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg24SetFloatPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg24_SetFloat, typeof (RemoteAnimation.Msg24_SetFloat), 0, 0); - _priv_pmsgUse = (Message*) msg24SetFloatPtr; - } - - public unsafe void SendSetFloat(int idxKeyframe, float flValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetFloat(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, flValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildEndAnimationInput( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe) - { - 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 (RemoteAnimation.Msg25_EndAnimationInput); - RemoteAnimation.Msg25_EndAnimationInput* endAnimationInputPtr = (RemoteAnimation.Msg25_EndAnimationInput*) _priv_portUse.AllocMessageBuffer(size); - endAnimationInputPtr->_priv_size = size; - endAnimationInputPtr->_priv_msgid = 25U; - endAnimationInputPtr->idxKeyframe = idxKeyframe; - endAnimationInputPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) endAnimationInputPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg25_EndAnimationInput, typeof (RemoteAnimation.Msg25_EndAnimationInput), 0, 0); - _priv_pmsgUse = (Message*) endAnimationInputPtr; - } - - public unsafe void SendEndAnimationInput(int idxKeyframe) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildEndAnimationInput(out _priv_portUse, out _priv_pmsgUse, idxKeyframe); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildBeginAnimationInput( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe) - { - 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 (RemoteAnimation.Msg26_BeginAnimationInput); - RemoteAnimation.Msg26_BeginAnimationInput* beginAnimationInputPtr = (RemoteAnimation.Msg26_BeginAnimationInput*) _priv_portUse.AllocMessageBuffer(size); - beginAnimationInputPtr->_priv_size = size; - beginAnimationInputPtr->_priv_msgid = 26U; - beginAnimationInputPtr->idxKeyframe = idxKeyframe; - beginAnimationInputPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) beginAnimationInputPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg26_BeginAnimationInput, typeof (RemoteAnimation.Msg26_BeginAnimationInput), 0, 0); - _priv_pmsgUse = (Message*) beginAnimationInputPtr; - } - - public unsafe void SendBeginAnimationInput(int idxKeyframe) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildBeginAnimationInput(out _priv_portUse, out _priv_pmsgUse, idxKeyframe); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetKeyframeTime( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - float flTimeSec) - { - 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 (RemoteAnimation.Msg27_SetKeyframeTime); - RemoteAnimation.Msg27_SetKeyframeTime* msg27SetKeyframeTimePtr = (RemoteAnimation.Msg27_SetKeyframeTime*) _priv_portUse.AllocMessageBuffer(size); - msg27SetKeyframeTimePtr->_priv_size = size; - msg27SetKeyframeTimePtr->_priv_msgid = 27U; - msg27SetKeyframeTimePtr->idxKeyframe = idxKeyframe; - msg27SetKeyframeTimePtr->flTimeSec = flTimeSec; - msg27SetKeyframeTimePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg27SetKeyframeTimePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg27_SetKeyframeTime, typeof (RemoteAnimation.Msg27_SetKeyframeTime), 0, 0); - _priv_pmsgUse = (Message*) msg27SetKeyframeTimePtr; - } - - public unsafe void SendSetKeyframeTime(int idxKeyframe, float flTimeSec) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetKeyframeTime(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, flTimeSec); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetKeyframeCount( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int cKeyframes) - { - 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 (RemoteAnimation.Msg29_SetKeyframeCount); - RemoteAnimation.Msg29_SetKeyframeCount* setKeyframeCountPtr = (RemoteAnimation.Msg29_SetKeyframeCount*) _priv_portUse.AllocMessageBuffer(size); - setKeyframeCountPtr->_priv_size = size; - setKeyframeCountPtr->_priv_msgid = 29U; - setKeyframeCountPtr->cKeyframes = cKeyframes; - setKeyframeCountPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setKeyframeCountPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg29_SetKeyframeCount, typeof (RemoteAnimation.Msg29_SetKeyframeCount), 0, 0); - _priv_pmsgUse = (Message*) setKeyframeCountPtr; - } - - public unsafe void SendSetKeyframeCount(int cKeyframes) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetKeyframeCount(out _priv_portUse, out _priv_pmsgUse, cKeyframes); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddKeyframe( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxKeyframe, - float flTimeSec) - { - 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 (RemoteAnimation.Msg31_AddKeyframe); - RemoteAnimation.Msg31_AddKeyframe* msg31AddKeyframePtr = (RemoteAnimation.Msg31_AddKeyframe*) _priv_portUse.AllocMessageBuffer(size); - msg31AddKeyframePtr->_priv_size = size; - msg31AddKeyframePtr->_priv_msgid = 31U; - msg31AddKeyframePtr->idxKeyframe = idxKeyframe; - msg31AddKeyframePtr->flTimeSec = flTimeSec; - msg31AddKeyframePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg31AddKeyframePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg31_AddKeyframe, typeof (RemoteAnimation.Msg31_AddKeyframe), 0, 0); - _priv_pmsgUse = (Message*) msg31AddKeyframePtr; - } - - public unsafe void SendAddKeyframe(int idxKeyframe, float flTimeSec) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddKeyframe(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, flTimeSec); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildInstantFinish(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 (RemoteAnimation.Msg32_InstantFinish); - RemoteAnimation.Msg32_InstantFinish* msg32InstantFinishPtr = (RemoteAnimation.Msg32_InstantFinish*) _priv_portUse.AllocMessageBuffer(size); - msg32InstantFinishPtr->_priv_size = size; - msg32InstantFinishPtr->_priv_msgid = 32U; - msg32InstantFinishPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg32InstantFinishPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg32_InstantFinish, typeof (RemoteAnimation.Msg32_InstantFinish), 0, 0); - _priv_pmsgUse = (Message*) msg32InstantFinishPtr; - } - - public unsafe void SendInstantFinish() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildInstantFinish(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildInstantAdvance( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - float advanceTime) - { - 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 (RemoteAnimation.Msg33_InstantAdvance); - RemoteAnimation.Msg33_InstantAdvance* msg33InstantAdvancePtr = (RemoteAnimation.Msg33_InstantAdvance*) _priv_portUse.AllocMessageBuffer(size); - msg33InstantAdvancePtr->_priv_size = size; - msg33InstantAdvancePtr->_priv_msgid = 33U; - msg33InstantAdvancePtr->advanceTime = advanceTime; - msg33InstantAdvancePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg33InstantAdvancePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg33_InstantAdvance, typeof (RemoteAnimation.Msg33_InstantAdvance), 0, 0); - _priv_pmsgUse = (Message*) msg33InstantAdvancePtr; - } - - public unsafe void SendInstantAdvance(float advanceTime) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildInstantAdvance(out _priv_portUse, out _priv_pmsgUse, advanceTime); - _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 (RemoteAnimation.Msg34_Reset); - RemoteAnimation.Msg34_Reset* msg34ResetPtr = (RemoteAnimation.Msg34_Reset*) _priv_portUse.AllocMessageBuffer(size); - msg34ResetPtr->_priv_size = size; - msg34ResetPtr->_priv_msgid = 34U; - msg34ResetPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg34ResetPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg34_Reset, typeof (RemoteAnimation.Msg34_Reset), 0, 0); - _priv_pmsgUse = (Message*) msg34ResetPtr; - } - - public unsafe void SendReset() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildReset(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildPause(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 (RemoteAnimation.Msg35_Pause); - RemoteAnimation.Msg35_Pause* msg35PausePtr = (RemoteAnimation.Msg35_Pause*) _priv_portUse.AllocMessageBuffer(size); - msg35PausePtr->_priv_size = size; - msg35PausePtr->_priv_msgid = 35U; - msg35PausePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg35PausePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg35_Pause, typeof (RemoteAnimation.Msg35_Pause), 0, 0); - _priv_pmsgUse = (Message*) msg35PausePtr; - } - - public unsafe void SendPause() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildPause(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildPlay(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 (RemoteAnimation.Msg36_Play); - RemoteAnimation.Msg36_Play* msg36PlayPtr = (RemoteAnimation.Msg36_Play*) _priv_portUse.AllocMessageBuffer(size); - msg36PlayPtr->_priv_size = size; - msg36PlayPtr->_priv_msgid = 36U; - msg36PlayPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg36PlayPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg36_Play, typeof (RemoteAnimation.Msg36_Play), 0, 0); - _priv_pmsgUse = (Message*) msg36PlayPtr; - } - - public unsafe void SendPlay() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildPlay(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetResetBehavior( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - AnimationResetBehavior behavior) - { - 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 (RemoteAnimation.Msg37_SetResetBehavior); - RemoteAnimation.Msg37_SetResetBehavior* setResetBehaviorPtr = (RemoteAnimation.Msg37_SetResetBehavior*) _priv_portUse.AllocMessageBuffer(size); - setResetBehaviorPtr->_priv_size = size; - setResetBehaviorPtr->_priv_msgid = 37U; - setResetBehaviorPtr->behavior = behavior; - setResetBehaviorPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setResetBehaviorPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg37_SetResetBehavior, typeof (RemoteAnimation.Msg37_SetResetBehavior), 0, 0); - _priv_pmsgUse = (Message*) setResetBehaviorPtr; - } - - public unsafe void SendSetResetBehavior(AnimationResetBehavior behavior) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetResetBehavior(out _priv_portUse, out _priv_pmsgUse, behavior); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetAutoReset( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fAutoReset) - { - 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 (RemoteAnimation.Msg39_SetAutoReset); - RemoteAnimation.Msg39_SetAutoReset* msg39SetAutoResetPtr = (RemoteAnimation.Msg39_SetAutoReset*) _priv_portUse.AllocMessageBuffer(size); - msg39SetAutoResetPtr->_priv_size = size; - msg39SetAutoResetPtr->_priv_msgid = 39U; - msg39SetAutoResetPtr->fAutoReset = fAutoReset ? uint.MaxValue : 0U; - msg39SetAutoResetPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg39SetAutoResetPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg39_SetAutoReset, typeof (RemoteAnimation.Msg39_SetAutoReset), 0, 0); - _priv_pmsgUse = (Message*) msg39SetAutoResetPtr; - } - - public unsafe void SendSetAutoReset(bool fAutoReset) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetAutoReset(out _priv_portUse, out _priv_pmsgUse, fAutoReset); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetRepeatCount( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int cRepeats) - { - 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 (RemoteAnimation.Msg41_SetRepeatCount); - RemoteAnimation.Msg41_SetRepeatCount* msg41SetRepeatCountPtr = (RemoteAnimation.Msg41_SetRepeatCount*) _priv_portUse.AllocMessageBuffer(size); - msg41SetRepeatCountPtr->_priv_size = size; - msg41SetRepeatCountPtr->_priv_msgid = 41U; - msg41SetRepeatCountPtr->cRepeats = cRepeats; - msg41SetRepeatCountPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg41SetRepeatCountPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg41_SetRepeatCount, typeof (RemoteAnimation.Msg41_SetRepeatCount), 0, 0); - _priv_pmsgUse = (Message*) msg41SetRepeatCountPtr; - } - - public unsafe void SendSetRepeatCount(int cRepeats) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetRepeatCount(out _priv_portUse, out _priv_pmsgUse, cRepeats); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteAnimation CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteAnimation(port, handle, true); - } - - public static RemoteAnimation CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteAnimation(port, handle, false); - } - - protected RemoteAnimation(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteAnimation(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteAnimation && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg43_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public AnimationInputType animationType; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - } - - [ComVisible(false)] - private struct Msg0_RemoveAllEvents - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg1_RemoveEvent - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint idEvent; - } - - [ComVisible(false)] - private struct Msg2_AddValueEvent - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint idEvent; - public ValueEventCondition nCondition; - public RENDERHANDLE idTargetObject; - public uint nTargetMethodId; - public uint nTargetMethodArg; - public uint fInitialActivation; - public uint fAllowRepeat; - } - - [ComVisible(false)] - private struct Msg3_AddProgressEvent - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint idEvent; - public float flProgress; - public RENDERHANDLE idTargetObject; - public uint nTargetMethodId; - public uint nTargetMethodArg; - public uint fInitialActivation; - public uint fAllowRepeat; - } - - [ComVisible(false)] - private struct Msg4_AddTimeEvent - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint idEvent; - public float flEventTime; - public RENDERHANDLE idTargetObject; - public uint nTargetMethodId; - public uint nTargetMethodArg; - public uint fInitialActivation; - public uint fAllowRepeat; - } - - [ComVisible(false)] - private struct Msg5_AddStageEvent - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint idEvent; - public AnimationStage nStage; - public RENDERHANDLE idTargetObject; - public uint nTargetMethodId; - public uint nTargetMethodArg; - public uint fInitialActivation; - public uint fAllowRepeat; - } - - [ComVisible(false)] - private struct Msg6_RemoveTarget - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int targetId; - } - - [ComVisible(false)] - private struct Msg7_AddTarget - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int targetId; - public RENDERHANDLE objectId; - public uint propertyId; - public uint propertyInfo; - } - - [ComVisible(false)] - private struct Msg8_SetEaseOut - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public uint fSpherical; - public float flWeight; - public float flHandle; - } - - [ComVisible(false)] - private struct Msg9_SetEaseIn - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public uint fSpherical; - public float flWeight; - public float flHandle; - } - - [ComVisible(false)] - private struct Msg10_SetBezier - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public uint fSpherical; - public float flHandle1; - public float flHandle2; - } - - [ComVisible(false)] - private struct Msg11_SetCosine - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public uint fSpherical; - } - - [ComVisible(false)] - private struct Msg12_SetSine - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public uint fSpherical; - } - - [ComVisible(false)] - private struct Msg13_SetSCurve - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public uint fSpherical; - public float flWeight; - } - - [ComVisible(false)] - private struct Msg14_SetLogarithmic - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public uint fSpherical; - public float flWeight; - } - - [ComVisible(false)] - private struct Msg15_SetExponential - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public uint fSpherical; - public float flWeight; - } - - [ComVisible(false)] - private struct Msg16_SetLinear - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public uint fSpherical; - } - - [ComVisible(false)] - private struct Msg17_SetBinaryOperation - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public BinaryOpCode opCode; - } - - [ComVisible(false)] - private struct Msg18_SetContinuous - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public RENDERHANDLE idObject; - public uint idProperty; - public uint propertyInfo; - } - - [ComVisible(false)] - private struct Msg19_SetCaptured - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public RENDERHANDLE idObject; - public uint idProperty; - public uint propertyInfo; - public uint fRefreshOnRepeat; - } - - [ComVisible(false)] - private struct Msg20_SetQuaternion - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public Quaternion qValue; - } - - [ComVisible(false)] - private struct Msg21_SetVector4 - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public Vector4 vValue; - } - - [ComVisible(false)] - private struct Msg22_SetVector3 - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public Vector3 vValue; - } - - [ComVisible(false)] - private struct Msg23_SetVector2 - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public Vector2 vValue; - } - - [ComVisible(false)] - private struct Msg24_SetFloat - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public float flValue; - } - - [ComVisible(false)] - private struct Msg25_EndAnimationInput - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - } - - [ComVisible(false)] - private struct Msg26_BeginAnimationInput - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - } - - [ComVisible(false)] - private struct Msg27_SetKeyframeTime - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public float flTimeSec; - } - - [ComVisible(false)] - private struct Msg29_SetKeyframeCount - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int cKeyframes; - } - - [ComVisible(false)] - private struct Msg31_AddKeyframe - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxKeyframe; - public float flTimeSec; - } - - [ComVisible(false)] - private struct Msg32_InstantFinish - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg33_InstantAdvance - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public float advanceTime; - } - - [ComVisible(false)] - private struct Msg34_Reset - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg35_Pause - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg36_Play - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg37_SetResetBehavior - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public AnimationResetBehavior behavior; - } - - [ComVisible(false)] - private struct Msg39_SetAutoReset - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fAutoReset; - } - - [ComVisible(false)] - private struct Msg41_SetRepeatCount - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int cRepeats; + internal class RemoteAnimation : RemoteObject + { + private static ushort[] s_priv_ByteOrder_Msg43_Create; + private static ushort[] s_priv_ByteOrder_Msg0_RemoveAllEvents; + private static ushort[] s_priv_ByteOrder_Msg1_RemoveEvent; + private static ushort[] s_priv_ByteOrder_Msg2_AddValueEvent; + private static ushort[] s_priv_ByteOrder_Msg3_AddProgressEvent; + private static ushort[] s_priv_ByteOrder_Msg4_AddTimeEvent; + private static ushort[] s_priv_ByteOrder_Msg5_AddStageEvent; + private static ushort[] s_priv_ByteOrder_Msg6_RemoveTarget; + private static ushort[] s_priv_ByteOrder_Msg7_AddTarget; + private static ushort[] s_priv_ByteOrder_Msg8_SetEaseOut; + private static ushort[] s_priv_ByteOrder_Msg9_SetEaseIn; + private static ushort[] s_priv_ByteOrder_Msg10_SetBezier; + private static ushort[] s_priv_ByteOrder_Msg11_SetCosine; + private static ushort[] s_priv_ByteOrder_Msg12_SetSine; + private static ushort[] s_priv_ByteOrder_Msg13_SetSCurve; + private static ushort[] s_priv_ByteOrder_Msg14_SetLogarithmic; + private static ushort[] s_priv_ByteOrder_Msg15_SetExponential; + private static ushort[] s_priv_ByteOrder_Msg16_SetLinear; + private static ushort[] s_priv_ByteOrder_Msg17_SetBinaryOperation; + private static ushort[] s_priv_ByteOrder_Msg18_SetContinuous; + private static ushort[] s_priv_ByteOrder_Msg19_SetCaptured; + private static ushort[] s_priv_ByteOrder_Msg20_SetQuaternion; + private static ushort[] s_priv_ByteOrder_Msg21_SetVector4; + private static ushort[] s_priv_ByteOrder_Msg22_SetVector3; + private static ushort[] s_priv_ByteOrder_Msg23_SetVector2; + private static ushort[] s_priv_ByteOrder_Msg24_SetFloat; + private static ushort[] s_priv_ByteOrder_Msg25_EndAnimationInput; + private static ushort[] s_priv_ByteOrder_Msg26_BeginAnimationInput; + private static ushort[] s_priv_ByteOrder_Msg27_SetKeyframeTime; + private static ushort[] s_priv_ByteOrder_Msg29_SetKeyframeCount; + private static ushort[] s_priv_ByteOrder_Msg31_AddKeyframe; + private static ushort[] s_priv_ByteOrder_Msg32_InstantFinish; + private static ushort[] s_priv_ByteOrder_Msg33_InstantAdvance; + private static ushort[] s_priv_ByteOrder_Msg34_Reset; + private static ushort[] s_priv_ByteOrder_Msg35_Pause; + private static ushort[] s_priv_ByteOrder_Msg36_Play; + private static ushort[] s_priv_ByteOrder_Msg37_SetResetBehavior; + private static ushort[] s_priv_ByteOrder_Msg39_SetAutoReset; + private static ushort[] s_priv_ByteOrder_Msg41_SetRepeatCount; + + protected RemoteAnimation() + { + } + + public static unsafe RemoteAnimation Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + AnimationInputType animationType, + LocalAnimationCallback cb) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE animationClassHandle = _priv_protocolInstance.Animation_ClassHandle; + RemoteAnimation remoteAnimation = new RemoteAnimation(port, _priv_owner); + uint num = (uint)sizeof(RemoteAnimation.Msg43_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteAnimation.Msg43_Create* msg43CreatePtr = (RemoteAnimation.Msg43_Create*)pMem; + msg43CreatePtr->_priv_size = num; + msg43CreatePtr->_priv_msgid = 43U; + msg43CreatePtr->animationType = animationType; + msg43CreatePtr->_priv_objcb = cb.RenderHandle; + msg43CreatePtr->_priv_ctxcb = port.Session.LocalContext; + msg43CreatePtr->_priv_idObjectSubject = remoteAnimation.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteAnimation.s_priv_ByteOrder_Msg43_Create, typeof(RemoteAnimation.Msg43_Create), 0, 0); + port.CreateRemoteObject(animationClassHandle, remoteAnimation.m_renderHandle, (Message*)msg43CreatePtr); + return remoteAnimation; + } + + public unsafe void BuildRemoveAllEvents( + 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(RemoteAnimation.Msg0_RemoveAllEvents); + RemoteAnimation.Msg0_RemoveAllEvents* msg0RemoveAllEventsPtr = (RemoteAnimation.Msg0_RemoveAllEvents*)_priv_portUse.AllocMessageBuffer(size); + msg0RemoveAllEventsPtr->_priv_size = size; + msg0RemoveAllEventsPtr->_priv_msgid = 0U; + msg0RemoveAllEventsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0RemoveAllEventsPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg0_RemoveAllEvents, typeof(RemoteAnimation.Msg0_RemoveAllEvents), 0, 0); + _priv_pmsgUse = (Message*)msg0RemoveAllEventsPtr; + } + + public unsafe void SendRemoveAllEvents() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRemoveAllEvents(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRemoveEvent( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint idEvent) + { + 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(RemoteAnimation.Msg1_RemoveEvent); + RemoteAnimation.Msg1_RemoveEvent* msg1RemoveEventPtr = (RemoteAnimation.Msg1_RemoveEvent*)_priv_portUse.AllocMessageBuffer(size); + msg1RemoveEventPtr->_priv_size = size; + msg1RemoveEventPtr->_priv_msgid = 1U; + msg1RemoveEventPtr->idEvent = idEvent; + msg1RemoveEventPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1RemoveEventPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg1_RemoveEvent, typeof(RemoteAnimation.Msg1_RemoveEvent), 0, 0); + _priv_pmsgUse = (Message*)msg1RemoveEventPtr; + } + + public unsafe void SendRemoveEvent(uint idEvent) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRemoveEvent(out _priv_portUse, out _priv_pmsgUse, idEvent); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddValueEvent( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint idEvent, + ValueEventCondition nCondition, + RENDERHANDLE idTargetObject, + uint nTargetMethodId, + uint nTargetMethodArg, + bool fInitialActivation, + bool fAllowRepeat) + { + 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(RemoteAnimation.Msg2_AddValueEvent); + RemoteAnimation.Msg2_AddValueEvent* msg2AddValueEventPtr = (RemoteAnimation.Msg2_AddValueEvent*)_priv_portUse.AllocMessageBuffer(size); + msg2AddValueEventPtr->_priv_size = size; + msg2AddValueEventPtr->_priv_msgid = 2U; + msg2AddValueEventPtr->idEvent = idEvent; + msg2AddValueEventPtr->nCondition = nCondition; + msg2AddValueEventPtr->idTargetObject = idTargetObject; + msg2AddValueEventPtr->nTargetMethodId = nTargetMethodId; + msg2AddValueEventPtr->nTargetMethodArg = nTargetMethodArg; + msg2AddValueEventPtr->fInitialActivation = fInitialActivation ? uint.MaxValue : 0U; + msg2AddValueEventPtr->fAllowRepeat = fAllowRepeat ? uint.MaxValue : 0U; + msg2AddValueEventPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg2AddValueEventPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg2_AddValueEvent, typeof(RemoteAnimation.Msg2_AddValueEvent), 0, 0); + _priv_pmsgUse = (Message*)msg2AddValueEventPtr; + } + + public unsafe void SendAddValueEvent( + uint idEvent, + ValueEventCondition nCondition, + RENDERHANDLE idTargetObject, + uint nTargetMethodId, + uint nTargetMethodArg, + bool fInitialActivation, + bool fAllowRepeat) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddValueEvent(out _priv_portUse, out _priv_pmsgUse, idEvent, nCondition, idTargetObject, nTargetMethodId, nTargetMethodArg, fInitialActivation, fAllowRepeat); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddProgressEvent( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint idEvent, + float flProgress, + RENDERHANDLE idTargetObject, + uint nTargetMethodId, + uint nTargetMethodArg, + bool fInitialActivation, + bool fAllowRepeat) + { + 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(RemoteAnimation.Msg3_AddProgressEvent); + RemoteAnimation.Msg3_AddProgressEvent* addProgressEventPtr = (RemoteAnimation.Msg3_AddProgressEvent*)_priv_portUse.AllocMessageBuffer(size); + addProgressEventPtr->_priv_size = size; + addProgressEventPtr->_priv_msgid = 3U; + addProgressEventPtr->idEvent = idEvent; + addProgressEventPtr->flProgress = flProgress; + addProgressEventPtr->idTargetObject = idTargetObject; + addProgressEventPtr->nTargetMethodId = nTargetMethodId; + addProgressEventPtr->nTargetMethodArg = nTargetMethodArg; + addProgressEventPtr->fInitialActivation = fInitialActivation ? uint.MaxValue : 0U; + addProgressEventPtr->fAllowRepeat = fAllowRepeat ? uint.MaxValue : 0U; + addProgressEventPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)addProgressEventPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg3_AddProgressEvent, typeof(RemoteAnimation.Msg3_AddProgressEvent), 0, 0); + _priv_pmsgUse = (Message*)addProgressEventPtr; + } + + public unsafe void SendAddProgressEvent( + uint idEvent, + float flProgress, + RENDERHANDLE idTargetObject, + uint nTargetMethodId, + uint nTargetMethodArg, + bool fInitialActivation, + bool fAllowRepeat) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddProgressEvent(out _priv_portUse, out _priv_pmsgUse, idEvent, flProgress, idTargetObject, nTargetMethodId, nTargetMethodArg, fInitialActivation, fAllowRepeat); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddTimeEvent( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint idEvent, + float flEventTime, + RENDERHANDLE idTargetObject, + uint nTargetMethodId, + uint nTargetMethodArg, + bool fInitialActivation, + bool fAllowRepeat) + { + 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(RemoteAnimation.Msg4_AddTimeEvent); + RemoteAnimation.Msg4_AddTimeEvent* msg4AddTimeEventPtr = (RemoteAnimation.Msg4_AddTimeEvent*)_priv_portUse.AllocMessageBuffer(size); + msg4AddTimeEventPtr->_priv_size = size; + msg4AddTimeEventPtr->_priv_msgid = 4U; + msg4AddTimeEventPtr->idEvent = idEvent; + msg4AddTimeEventPtr->flEventTime = flEventTime; + msg4AddTimeEventPtr->idTargetObject = idTargetObject; + msg4AddTimeEventPtr->nTargetMethodId = nTargetMethodId; + msg4AddTimeEventPtr->nTargetMethodArg = nTargetMethodArg; + msg4AddTimeEventPtr->fInitialActivation = fInitialActivation ? uint.MaxValue : 0U; + msg4AddTimeEventPtr->fAllowRepeat = fAllowRepeat ? uint.MaxValue : 0U; + msg4AddTimeEventPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4AddTimeEventPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg4_AddTimeEvent, typeof(RemoteAnimation.Msg4_AddTimeEvent), 0, 0); + _priv_pmsgUse = (Message*)msg4AddTimeEventPtr; + } + + public unsafe void SendAddTimeEvent( + uint idEvent, + float flEventTime, + RENDERHANDLE idTargetObject, + uint nTargetMethodId, + uint nTargetMethodArg, + bool fInitialActivation, + bool fAllowRepeat) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddTimeEvent(out _priv_portUse, out _priv_pmsgUse, idEvent, flEventTime, idTargetObject, nTargetMethodId, nTargetMethodArg, fInitialActivation, fAllowRepeat); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddStageEvent( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint idEvent, + AnimationStage nStage, + RENDERHANDLE idTargetObject, + uint nTargetMethodId, + uint nTargetMethodArg, + bool fInitialActivation, + bool fAllowRepeat) + { + 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(RemoteAnimation.Msg5_AddStageEvent); + RemoteAnimation.Msg5_AddStageEvent* msg5AddStageEventPtr = (RemoteAnimation.Msg5_AddStageEvent*)_priv_portUse.AllocMessageBuffer(size); + msg5AddStageEventPtr->_priv_size = size; + msg5AddStageEventPtr->_priv_msgid = 5U; + msg5AddStageEventPtr->idEvent = idEvent; + msg5AddStageEventPtr->nStage = nStage; + msg5AddStageEventPtr->idTargetObject = idTargetObject; + msg5AddStageEventPtr->nTargetMethodId = nTargetMethodId; + msg5AddStageEventPtr->nTargetMethodArg = nTargetMethodArg; + msg5AddStageEventPtr->fInitialActivation = fInitialActivation ? uint.MaxValue : 0U; + msg5AddStageEventPtr->fAllowRepeat = fAllowRepeat ? uint.MaxValue : 0U; + msg5AddStageEventPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg5AddStageEventPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg5_AddStageEvent, typeof(RemoteAnimation.Msg5_AddStageEvent), 0, 0); + _priv_pmsgUse = (Message*)msg5AddStageEventPtr; + } + + public unsafe void SendAddStageEvent( + uint idEvent, + AnimationStage nStage, + RENDERHANDLE idTargetObject, + uint nTargetMethodId, + uint nTargetMethodArg, + bool fInitialActivation, + bool fAllowRepeat) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddStageEvent(out _priv_portUse, out _priv_pmsgUse, idEvent, nStage, idTargetObject, nTargetMethodId, nTargetMethodArg, fInitialActivation, fAllowRepeat); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRemoveTarget( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int targetId) + { + 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(RemoteAnimation.Msg6_RemoveTarget); + RemoteAnimation.Msg6_RemoveTarget* msg6RemoveTargetPtr = (RemoteAnimation.Msg6_RemoveTarget*)_priv_portUse.AllocMessageBuffer(size); + msg6RemoveTargetPtr->_priv_size = size; + msg6RemoveTargetPtr->_priv_msgid = 6U; + msg6RemoveTargetPtr->targetId = targetId; + msg6RemoveTargetPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg6RemoveTargetPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg6_RemoveTarget, typeof(RemoteAnimation.Msg6_RemoveTarget), 0, 0); + _priv_pmsgUse = (Message*)msg6RemoveTargetPtr; + } + + public unsafe void SendRemoveTarget(int targetId) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRemoveTarget(out _priv_portUse, out _priv_pmsgUse, targetId); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddTarget( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int targetId, + RENDERHANDLE objectId, + uint propertyId, + uint propertyInfo) + { + 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(RemoteAnimation.Msg7_AddTarget); + RemoteAnimation.Msg7_AddTarget* msg7AddTargetPtr = (RemoteAnimation.Msg7_AddTarget*)_priv_portUse.AllocMessageBuffer(size); + msg7AddTargetPtr->_priv_size = size; + msg7AddTargetPtr->_priv_msgid = 7U; + msg7AddTargetPtr->targetId = targetId; + msg7AddTargetPtr->objectId = objectId; + msg7AddTargetPtr->propertyId = propertyId; + msg7AddTargetPtr->propertyInfo = propertyInfo; + msg7AddTargetPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg7AddTargetPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg7_AddTarget, typeof(RemoteAnimation.Msg7_AddTarget), 0, 0); + _priv_pmsgUse = (Message*)msg7AddTargetPtr; + } + + public unsafe void SendAddTarget( + int targetId, + RENDERHANDLE objectId, + uint propertyId, + uint propertyInfo) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddTarget(out _priv_portUse, out _priv_pmsgUse, targetId, objectId, propertyId, propertyInfo); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetEaseOut( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + bool fSpherical, + float flWeight, + float flHandle) + { + 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(RemoteAnimation.Msg8_SetEaseOut); + RemoteAnimation.Msg8_SetEaseOut* msg8SetEaseOutPtr = (RemoteAnimation.Msg8_SetEaseOut*)_priv_portUse.AllocMessageBuffer(size); + msg8SetEaseOutPtr->_priv_size = size; + msg8SetEaseOutPtr->_priv_msgid = 8U; + msg8SetEaseOutPtr->idxKeyframe = idxKeyframe; + msg8SetEaseOutPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; + msg8SetEaseOutPtr->flWeight = flWeight; + msg8SetEaseOutPtr->flHandle = flHandle; + msg8SetEaseOutPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg8SetEaseOutPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg8_SetEaseOut, typeof(RemoteAnimation.Msg8_SetEaseOut), 0, 0); + _priv_pmsgUse = (Message*)msg8SetEaseOutPtr; + } + + public unsafe void SendSetEaseOut( + int idxKeyframe, + bool fSpherical, + float flWeight, + float flHandle) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetEaseOut(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flWeight, flHandle); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetEaseIn( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + bool fSpherical, + float flWeight, + float flHandle) + { + 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(RemoteAnimation.Msg9_SetEaseIn); + RemoteAnimation.Msg9_SetEaseIn* msg9SetEaseInPtr = (RemoteAnimation.Msg9_SetEaseIn*)_priv_portUse.AllocMessageBuffer(size); + msg9SetEaseInPtr->_priv_size = size; + msg9SetEaseInPtr->_priv_msgid = 9U; + msg9SetEaseInPtr->idxKeyframe = idxKeyframe; + msg9SetEaseInPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; + msg9SetEaseInPtr->flWeight = flWeight; + msg9SetEaseInPtr->flHandle = flHandle; + msg9SetEaseInPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg9SetEaseInPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg9_SetEaseIn, typeof(RemoteAnimation.Msg9_SetEaseIn), 0, 0); + _priv_pmsgUse = (Message*)msg9SetEaseInPtr; + } + + public unsafe void SendSetEaseIn( + int idxKeyframe, + bool fSpherical, + float flWeight, + float flHandle) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetEaseIn(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flWeight, flHandle); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetBezier( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + bool fSpherical, + float flHandle1, + float flHandle2) + { + 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(RemoteAnimation.Msg10_SetBezier); + RemoteAnimation.Msg10_SetBezier* msg10SetBezierPtr = (RemoteAnimation.Msg10_SetBezier*)_priv_portUse.AllocMessageBuffer(size); + msg10SetBezierPtr->_priv_size = size; + msg10SetBezierPtr->_priv_msgid = 10U; + msg10SetBezierPtr->idxKeyframe = idxKeyframe; + msg10SetBezierPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; + msg10SetBezierPtr->flHandle1 = flHandle1; + msg10SetBezierPtr->flHandle2 = flHandle2; + msg10SetBezierPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg10SetBezierPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg10_SetBezier, typeof(RemoteAnimation.Msg10_SetBezier), 0, 0); + _priv_pmsgUse = (Message*)msg10SetBezierPtr; + } + + public unsafe void SendSetBezier( + int idxKeyframe, + bool fSpherical, + float flHandle1, + float flHandle2) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetBezier(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flHandle1, flHandle2); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetCosine( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + bool fSpherical) + { + 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(RemoteAnimation.Msg11_SetCosine); + RemoteAnimation.Msg11_SetCosine* msg11SetCosinePtr = (RemoteAnimation.Msg11_SetCosine*)_priv_portUse.AllocMessageBuffer(size); + msg11SetCosinePtr->_priv_size = size; + msg11SetCosinePtr->_priv_msgid = 11U; + msg11SetCosinePtr->idxKeyframe = idxKeyframe; + msg11SetCosinePtr->fSpherical = fSpherical ? uint.MaxValue : 0U; + msg11SetCosinePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg11SetCosinePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg11_SetCosine, typeof(RemoteAnimation.Msg11_SetCosine), 0, 0); + _priv_pmsgUse = (Message*)msg11SetCosinePtr; + } + + public unsafe void SendSetCosine(int idxKeyframe, bool fSpherical) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetCosine(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetSine( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + bool fSpherical) + { + 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(RemoteAnimation.Msg12_SetSine); + RemoteAnimation.Msg12_SetSine* msg12SetSinePtr = (RemoteAnimation.Msg12_SetSine*)_priv_portUse.AllocMessageBuffer(size); + msg12SetSinePtr->_priv_size = size; + msg12SetSinePtr->_priv_msgid = 12U; + msg12SetSinePtr->idxKeyframe = idxKeyframe; + msg12SetSinePtr->fSpherical = fSpherical ? uint.MaxValue : 0U; + msg12SetSinePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg12SetSinePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg12_SetSine, typeof(RemoteAnimation.Msg12_SetSine), 0, 0); + _priv_pmsgUse = (Message*)msg12SetSinePtr; + } + + public unsafe void SendSetSine(int idxKeyframe, bool fSpherical) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetSine(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetSCurve( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + bool fSpherical, + float flWeight) + { + 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(RemoteAnimation.Msg13_SetSCurve); + RemoteAnimation.Msg13_SetSCurve* msg13SetScurvePtr = (RemoteAnimation.Msg13_SetSCurve*)_priv_portUse.AllocMessageBuffer(size); + msg13SetScurvePtr->_priv_size = size; + msg13SetScurvePtr->_priv_msgid = 13U; + msg13SetScurvePtr->idxKeyframe = idxKeyframe; + msg13SetScurvePtr->fSpherical = fSpherical ? uint.MaxValue : 0U; + msg13SetScurvePtr->flWeight = flWeight; + msg13SetScurvePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg13SetScurvePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg13_SetSCurve, typeof(RemoteAnimation.Msg13_SetSCurve), 0, 0); + _priv_pmsgUse = (Message*)msg13SetScurvePtr; + } + + public unsafe void SendSetSCurve(int idxKeyframe, bool fSpherical, float flWeight) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetSCurve(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flWeight); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetLogarithmic( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + bool fSpherical, + float flWeight) + { + 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(RemoteAnimation.Msg14_SetLogarithmic); + RemoteAnimation.Msg14_SetLogarithmic* msg14SetLogarithmicPtr = (RemoteAnimation.Msg14_SetLogarithmic*)_priv_portUse.AllocMessageBuffer(size); + msg14SetLogarithmicPtr->_priv_size = size; + msg14SetLogarithmicPtr->_priv_msgid = 14U; + msg14SetLogarithmicPtr->idxKeyframe = idxKeyframe; + msg14SetLogarithmicPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; + msg14SetLogarithmicPtr->flWeight = flWeight; + msg14SetLogarithmicPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg14SetLogarithmicPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg14_SetLogarithmic, typeof(RemoteAnimation.Msg14_SetLogarithmic), 0, 0); + _priv_pmsgUse = (Message*)msg14SetLogarithmicPtr; + } + + public unsafe void SendSetLogarithmic(int idxKeyframe, bool fSpherical, float flWeight) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetLogarithmic(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flWeight); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetExponential( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + bool fSpherical, + float flWeight) + { + 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(RemoteAnimation.Msg15_SetExponential); + RemoteAnimation.Msg15_SetExponential* msg15SetExponentialPtr = (RemoteAnimation.Msg15_SetExponential*)_priv_portUse.AllocMessageBuffer(size); + msg15SetExponentialPtr->_priv_size = size; + msg15SetExponentialPtr->_priv_msgid = 15U; + msg15SetExponentialPtr->idxKeyframe = idxKeyframe; + msg15SetExponentialPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; + msg15SetExponentialPtr->flWeight = flWeight; + msg15SetExponentialPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg15SetExponentialPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg15_SetExponential, typeof(RemoteAnimation.Msg15_SetExponential), 0, 0); + _priv_pmsgUse = (Message*)msg15SetExponentialPtr; + } + + public unsafe void SendSetExponential(int idxKeyframe, bool fSpherical, float flWeight) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetExponential(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical, flWeight); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetLinear( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + bool fSpherical) + { + 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(RemoteAnimation.Msg16_SetLinear); + RemoteAnimation.Msg16_SetLinear* msg16SetLinearPtr = (RemoteAnimation.Msg16_SetLinear*)_priv_portUse.AllocMessageBuffer(size); + msg16SetLinearPtr->_priv_size = size; + msg16SetLinearPtr->_priv_msgid = 16U; + msg16SetLinearPtr->idxKeyframe = idxKeyframe; + msg16SetLinearPtr->fSpherical = fSpherical ? uint.MaxValue : 0U; + msg16SetLinearPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg16SetLinearPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg16_SetLinear, typeof(RemoteAnimation.Msg16_SetLinear), 0, 0); + _priv_pmsgUse = (Message*)msg16SetLinearPtr; + } + + public unsafe void SendSetLinear(int idxKeyframe, bool fSpherical) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetLinear(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, fSpherical); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetBinaryOperation( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + BinaryOpCode opCode) + { + 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(RemoteAnimation.Msg17_SetBinaryOperation); + RemoteAnimation.Msg17_SetBinaryOperation* setBinaryOperationPtr = (RemoteAnimation.Msg17_SetBinaryOperation*)_priv_portUse.AllocMessageBuffer(size); + setBinaryOperationPtr->_priv_size = size; + setBinaryOperationPtr->_priv_msgid = 17U; + setBinaryOperationPtr->idxKeyframe = idxKeyframe; + setBinaryOperationPtr->opCode = opCode; + setBinaryOperationPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setBinaryOperationPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg17_SetBinaryOperation, typeof(RemoteAnimation.Msg17_SetBinaryOperation), 0, 0); + _priv_pmsgUse = (Message*)setBinaryOperationPtr; + } + + public unsafe void SendSetBinaryOperation(int idxKeyframe, BinaryOpCode opCode) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetBinaryOperation(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, opCode); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetContinuous( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + RENDERHANDLE idObject, + uint idProperty, + uint propertyInfo) + { + 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(RemoteAnimation.Msg18_SetContinuous); + RemoteAnimation.Msg18_SetContinuous* msg18SetContinuousPtr = (RemoteAnimation.Msg18_SetContinuous*)_priv_portUse.AllocMessageBuffer(size); + msg18SetContinuousPtr->_priv_size = size; + msg18SetContinuousPtr->_priv_msgid = 18U; + msg18SetContinuousPtr->idxKeyframe = idxKeyframe; + msg18SetContinuousPtr->idObject = idObject; + msg18SetContinuousPtr->idProperty = idProperty; + msg18SetContinuousPtr->propertyInfo = propertyInfo; + msg18SetContinuousPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg18SetContinuousPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg18_SetContinuous, typeof(RemoteAnimation.Msg18_SetContinuous), 0, 0); + _priv_pmsgUse = (Message*)msg18SetContinuousPtr; + } + + public unsafe void SendSetContinuous( + int idxKeyframe, + RENDERHANDLE idObject, + uint idProperty, + uint propertyInfo) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetContinuous(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, idObject, idProperty, propertyInfo); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetCaptured( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + RENDERHANDLE idObject, + uint idProperty, + uint propertyInfo, + bool fRefreshOnRepeat) + { + 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(RemoteAnimation.Msg19_SetCaptured); + RemoteAnimation.Msg19_SetCaptured* msg19SetCapturedPtr = (RemoteAnimation.Msg19_SetCaptured*)_priv_portUse.AllocMessageBuffer(size); + msg19SetCapturedPtr->_priv_size = size; + msg19SetCapturedPtr->_priv_msgid = 19U; + msg19SetCapturedPtr->idxKeyframe = idxKeyframe; + msg19SetCapturedPtr->idObject = idObject; + msg19SetCapturedPtr->idProperty = idProperty; + msg19SetCapturedPtr->propertyInfo = propertyInfo; + msg19SetCapturedPtr->fRefreshOnRepeat = fRefreshOnRepeat ? uint.MaxValue : 0U; + msg19SetCapturedPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg19SetCapturedPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg19_SetCaptured, typeof(RemoteAnimation.Msg19_SetCaptured), 0, 0); + _priv_pmsgUse = (Message*)msg19SetCapturedPtr; + } + + public unsafe void SendSetCaptured( + int idxKeyframe, + RENDERHANDLE idObject, + uint idProperty, + uint propertyInfo, + bool fRefreshOnRepeat) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetCaptured(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, idObject, idProperty, propertyInfo, fRefreshOnRepeat); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetQuaternion( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + Quaternion qValue) + { + 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(RemoteAnimation.Msg20_SetQuaternion); + RemoteAnimation.Msg20_SetQuaternion* msg20SetQuaternionPtr = (RemoteAnimation.Msg20_SetQuaternion*)_priv_portUse.AllocMessageBuffer(size); + msg20SetQuaternionPtr->_priv_size = size; + msg20SetQuaternionPtr->_priv_msgid = 20U; + msg20SetQuaternionPtr->idxKeyframe = idxKeyframe; + msg20SetQuaternionPtr->qValue = qValue; + msg20SetQuaternionPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg20SetQuaternionPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg20_SetQuaternion, typeof(RemoteAnimation.Msg20_SetQuaternion), 0, 0); + _priv_pmsgUse = (Message*)msg20SetQuaternionPtr; + } + + public unsafe void SendSetQuaternion(int idxKeyframe, Quaternion qValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetQuaternion(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, qValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetVector4( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + Vector4 vValue) + { + 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(RemoteAnimation.Msg21_SetVector4); + RemoteAnimation.Msg21_SetVector4* msg21SetVector4Ptr = (RemoteAnimation.Msg21_SetVector4*)_priv_portUse.AllocMessageBuffer(size); + msg21SetVector4Ptr->_priv_size = size; + msg21SetVector4Ptr->_priv_msgid = 21U; + msg21SetVector4Ptr->idxKeyframe = idxKeyframe; + msg21SetVector4Ptr->vValue = vValue; + msg21SetVector4Ptr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg21SetVector4Ptr, ref RemoteAnimation.s_priv_ByteOrder_Msg21_SetVector4, typeof(RemoteAnimation.Msg21_SetVector4), 0, 0); + _priv_pmsgUse = (Message*)msg21SetVector4Ptr; + } + + public unsafe void SendSetVector4(int idxKeyframe, Vector4 vValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetVector4(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, vValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetVector3( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + Vector3 vValue) + { + 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(RemoteAnimation.Msg22_SetVector3); + RemoteAnimation.Msg22_SetVector3* msg22SetVector3Ptr = (RemoteAnimation.Msg22_SetVector3*)_priv_portUse.AllocMessageBuffer(size); + msg22SetVector3Ptr->_priv_size = size; + msg22SetVector3Ptr->_priv_msgid = 22U; + msg22SetVector3Ptr->idxKeyframe = idxKeyframe; + msg22SetVector3Ptr->vValue = vValue; + msg22SetVector3Ptr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg22SetVector3Ptr, ref RemoteAnimation.s_priv_ByteOrder_Msg22_SetVector3, typeof(RemoteAnimation.Msg22_SetVector3), 0, 0); + _priv_pmsgUse = (Message*)msg22SetVector3Ptr; + } + + public unsafe void SendSetVector3(int idxKeyframe, Vector3 vValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetVector3(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, vValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetVector2( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + Vector2 vValue) + { + 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(RemoteAnimation.Msg23_SetVector2); + RemoteAnimation.Msg23_SetVector2* msg23SetVector2Ptr = (RemoteAnimation.Msg23_SetVector2*)_priv_portUse.AllocMessageBuffer(size); + msg23SetVector2Ptr->_priv_size = size; + msg23SetVector2Ptr->_priv_msgid = 23U; + msg23SetVector2Ptr->idxKeyframe = idxKeyframe; + msg23SetVector2Ptr->vValue = vValue; + msg23SetVector2Ptr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg23SetVector2Ptr, ref RemoteAnimation.s_priv_ByteOrder_Msg23_SetVector2, typeof(RemoteAnimation.Msg23_SetVector2), 0, 0); + _priv_pmsgUse = (Message*)msg23SetVector2Ptr; + } + + public unsafe void SendSetVector2(int idxKeyframe, Vector2 vValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetVector2(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, vValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetFloat( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + float flValue) + { + 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(RemoteAnimation.Msg24_SetFloat); + RemoteAnimation.Msg24_SetFloat* msg24SetFloatPtr = (RemoteAnimation.Msg24_SetFloat*)_priv_portUse.AllocMessageBuffer(size); + msg24SetFloatPtr->_priv_size = size; + msg24SetFloatPtr->_priv_msgid = 24U; + msg24SetFloatPtr->idxKeyframe = idxKeyframe; + msg24SetFloatPtr->flValue = flValue; + msg24SetFloatPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg24SetFloatPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg24_SetFloat, typeof(RemoteAnimation.Msg24_SetFloat), 0, 0); + _priv_pmsgUse = (Message*)msg24SetFloatPtr; + } + + public unsafe void SendSetFloat(int idxKeyframe, float flValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetFloat(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, flValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildEndAnimationInput( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe) + { + 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(RemoteAnimation.Msg25_EndAnimationInput); + RemoteAnimation.Msg25_EndAnimationInput* endAnimationInputPtr = (RemoteAnimation.Msg25_EndAnimationInput*)_priv_portUse.AllocMessageBuffer(size); + endAnimationInputPtr->_priv_size = size; + endAnimationInputPtr->_priv_msgid = 25U; + endAnimationInputPtr->idxKeyframe = idxKeyframe; + endAnimationInputPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)endAnimationInputPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg25_EndAnimationInput, typeof(RemoteAnimation.Msg25_EndAnimationInput), 0, 0); + _priv_pmsgUse = (Message*)endAnimationInputPtr; + } + + public unsafe void SendEndAnimationInput(int idxKeyframe) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildEndAnimationInput(out _priv_portUse, out _priv_pmsgUse, idxKeyframe); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildBeginAnimationInput( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe) + { + 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(RemoteAnimation.Msg26_BeginAnimationInput); + RemoteAnimation.Msg26_BeginAnimationInput* beginAnimationInputPtr = (RemoteAnimation.Msg26_BeginAnimationInput*)_priv_portUse.AllocMessageBuffer(size); + beginAnimationInputPtr->_priv_size = size; + beginAnimationInputPtr->_priv_msgid = 26U; + beginAnimationInputPtr->idxKeyframe = idxKeyframe; + beginAnimationInputPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)beginAnimationInputPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg26_BeginAnimationInput, typeof(RemoteAnimation.Msg26_BeginAnimationInput), 0, 0); + _priv_pmsgUse = (Message*)beginAnimationInputPtr; + } + + public unsafe void SendBeginAnimationInput(int idxKeyframe) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildBeginAnimationInput(out _priv_portUse, out _priv_pmsgUse, idxKeyframe); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetKeyframeTime( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + float flTimeSec) + { + 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(RemoteAnimation.Msg27_SetKeyframeTime); + RemoteAnimation.Msg27_SetKeyframeTime* msg27SetKeyframeTimePtr = (RemoteAnimation.Msg27_SetKeyframeTime*)_priv_portUse.AllocMessageBuffer(size); + msg27SetKeyframeTimePtr->_priv_size = size; + msg27SetKeyframeTimePtr->_priv_msgid = 27U; + msg27SetKeyframeTimePtr->idxKeyframe = idxKeyframe; + msg27SetKeyframeTimePtr->flTimeSec = flTimeSec; + msg27SetKeyframeTimePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg27SetKeyframeTimePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg27_SetKeyframeTime, typeof(RemoteAnimation.Msg27_SetKeyframeTime), 0, 0); + _priv_pmsgUse = (Message*)msg27SetKeyframeTimePtr; + } + + public unsafe void SendSetKeyframeTime(int idxKeyframe, float flTimeSec) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetKeyframeTime(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, flTimeSec); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetKeyframeCount( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int cKeyframes) + { + 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(RemoteAnimation.Msg29_SetKeyframeCount); + RemoteAnimation.Msg29_SetKeyframeCount* setKeyframeCountPtr = (RemoteAnimation.Msg29_SetKeyframeCount*)_priv_portUse.AllocMessageBuffer(size); + setKeyframeCountPtr->_priv_size = size; + setKeyframeCountPtr->_priv_msgid = 29U; + setKeyframeCountPtr->cKeyframes = cKeyframes; + setKeyframeCountPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setKeyframeCountPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg29_SetKeyframeCount, typeof(RemoteAnimation.Msg29_SetKeyframeCount), 0, 0); + _priv_pmsgUse = (Message*)setKeyframeCountPtr; + } + + public unsafe void SendSetKeyframeCount(int cKeyframes) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetKeyframeCount(out _priv_portUse, out _priv_pmsgUse, cKeyframes); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddKeyframe( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxKeyframe, + float flTimeSec) + { + 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(RemoteAnimation.Msg31_AddKeyframe); + RemoteAnimation.Msg31_AddKeyframe* msg31AddKeyframePtr = (RemoteAnimation.Msg31_AddKeyframe*)_priv_portUse.AllocMessageBuffer(size); + msg31AddKeyframePtr->_priv_size = size; + msg31AddKeyframePtr->_priv_msgid = 31U; + msg31AddKeyframePtr->idxKeyframe = idxKeyframe; + msg31AddKeyframePtr->flTimeSec = flTimeSec; + msg31AddKeyframePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg31AddKeyframePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg31_AddKeyframe, typeof(RemoteAnimation.Msg31_AddKeyframe), 0, 0); + _priv_pmsgUse = (Message*)msg31AddKeyframePtr; + } + + public unsafe void SendAddKeyframe(int idxKeyframe, float flTimeSec) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddKeyframe(out _priv_portUse, out _priv_pmsgUse, idxKeyframe, flTimeSec); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildInstantFinish(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(RemoteAnimation.Msg32_InstantFinish); + RemoteAnimation.Msg32_InstantFinish* msg32InstantFinishPtr = (RemoteAnimation.Msg32_InstantFinish*)_priv_portUse.AllocMessageBuffer(size); + msg32InstantFinishPtr->_priv_size = size; + msg32InstantFinishPtr->_priv_msgid = 32U; + msg32InstantFinishPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg32InstantFinishPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg32_InstantFinish, typeof(RemoteAnimation.Msg32_InstantFinish), 0, 0); + _priv_pmsgUse = (Message*)msg32InstantFinishPtr; + } + + public unsafe void SendInstantFinish() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildInstantFinish(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildInstantAdvance( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + float advanceTime) + { + 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(RemoteAnimation.Msg33_InstantAdvance); + RemoteAnimation.Msg33_InstantAdvance* msg33InstantAdvancePtr = (RemoteAnimation.Msg33_InstantAdvance*)_priv_portUse.AllocMessageBuffer(size); + msg33InstantAdvancePtr->_priv_size = size; + msg33InstantAdvancePtr->_priv_msgid = 33U; + msg33InstantAdvancePtr->advanceTime = advanceTime; + msg33InstantAdvancePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg33InstantAdvancePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg33_InstantAdvance, typeof(RemoteAnimation.Msg33_InstantAdvance), 0, 0); + _priv_pmsgUse = (Message*)msg33InstantAdvancePtr; + } + + public unsafe void SendInstantAdvance(float advanceTime) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildInstantAdvance(out _priv_portUse, out _priv_pmsgUse, advanceTime); + _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(RemoteAnimation.Msg34_Reset); + RemoteAnimation.Msg34_Reset* msg34ResetPtr = (RemoteAnimation.Msg34_Reset*)_priv_portUse.AllocMessageBuffer(size); + msg34ResetPtr->_priv_size = size; + msg34ResetPtr->_priv_msgid = 34U; + msg34ResetPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg34ResetPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg34_Reset, typeof(RemoteAnimation.Msg34_Reset), 0, 0); + _priv_pmsgUse = (Message*)msg34ResetPtr; + } + + public unsafe void SendReset() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildReset(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildPause(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(RemoteAnimation.Msg35_Pause); + RemoteAnimation.Msg35_Pause* msg35PausePtr = (RemoteAnimation.Msg35_Pause*)_priv_portUse.AllocMessageBuffer(size); + msg35PausePtr->_priv_size = size; + msg35PausePtr->_priv_msgid = 35U; + msg35PausePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg35PausePtr, ref RemoteAnimation.s_priv_ByteOrder_Msg35_Pause, typeof(RemoteAnimation.Msg35_Pause), 0, 0); + _priv_pmsgUse = (Message*)msg35PausePtr; + } + + public unsafe void SendPause() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildPause(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildPlay(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(RemoteAnimation.Msg36_Play); + RemoteAnimation.Msg36_Play* msg36PlayPtr = (RemoteAnimation.Msg36_Play*)_priv_portUse.AllocMessageBuffer(size); + msg36PlayPtr->_priv_size = size; + msg36PlayPtr->_priv_msgid = 36U; + msg36PlayPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg36PlayPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg36_Play, typeof(RemoteAnimation.Msg36_Play), 0, 0); + _priv_pmsgUse = (Message*)msg36PlayPtr; + } + + public unsafe void SendPlay() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildPlay(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetResetBehavior( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + AnimationResetBehavior behavior) + { + 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(RemoteAnimation.Msg37_SetResetBehavior); + RemoteAnimation.Msg37_SetResetBehavior* setResetBehaviorPtr = (RemoteAnimation.Msg37_SetResetBehavior*)_priv_portUse.AllocMessageBuffer(size); + setResetBehaviorPtr->_priv_size = size; + setResetBehaviorPtr->_priv_msgid = 37U; + setResetBehaviorPtr->behavior = behavior; + setResetBehaviorPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setResetBehaviorPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg37_SetResetBehavior, typeof(RemoteAnimation.Msg37_SetResetBehavior), 0, 0); + _priv_pmsgUse = (Message*)setResetBehaviorPtr; + } + + public unsafe void SendSetResetBehavior(AnimationResetBehavior behavior) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetResetBehavior(out _priv_portUse, out _priv_pmsgUse, behavior); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetAutoReset( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fAutoReset) + { + 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(RemoteAnimation.Msg39_SetAutoReset); + RemoteAnimation.Msg39_SetAutoReset* msg39SetAutoResetPtr = (RemoteAnimation.Msg39_SetAutoReset*)_priv_portUse.AllocMessageBuffer(size); + msg39SetAutoResetPtr->_priv_size = size; + msg39SetAutoResetPtr->_priv_msgid = 39U; + msg39SetAutoResetPtr->fAutoReset = fAutoReset ? uint.MaxValue : 0U; + msg39SetAutoResetPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg39SetAutoResetPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg39_SetAutoReset, typeof(RemoteAnimation.Msg39_SetAutoReset), 0, 0); + _priv_pmsgUse = (Message*)msg39SetAutoResetPtr; + } + + public unsafe void SendSetAutoReset(bool fAutoReset) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetAutoReset(out _priv_portUse, out _priv_pmsgUse, fAutoReset); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetRepeatCount( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int cRepeats) + { + 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(RemoteAnimation.Msg41_SetRepeatCount); + RemoteAnimation.Msg41_SetRepeatCount* msg41SetRepeatCountPtr = (RemoteAnimation.Msg41_SetRepeatCount*)_priv_portUse.AllocMessageBuffer(size); + msg41SetRepeatCountPtr->_priv_size = size; + msg41SetRepeatCountPtr->_priv_msgid = 41U; + msg41SetRepeatCountPtr->cRepeats = cRepeats; + msg41SetRepeatCountPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg41SetRepeatCountPtr, ref RemoteAnimation.s_priv_ByteOrder_Msg41_SetRepeatCount, typeof(RemoteAnimation.Msg41_SetRepeatCount), 0, 0); + _priv_pmsgUse = (Message*)msg41SetRepeatCountPtr; + } + + public unsafe void SendSetRepeatCount(int cRepeats) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetRepeatCount(out _priv_portUse, out _priv_pmsgUse, cRepeats); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteAnimation CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteAnimation(port, handle, true); + } + + public static RemoteAnimation CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteAnimation(port, handle, false); + } + + protected RemoteAnimation(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteAnimation(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteAnimation && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg43_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public AnimationInputType animationType; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + } + + [ComVisible(false)] + private struct Msg0_RemoveAllEvents + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg1_RemoveEvent + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint idEvent; + } + + [ComVisible(false)] + private struct Msg2_AddValueEvent + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint idEvent; + public ValueEventCondition nCondition; + public RENDERHANDLE idTargetObject; + public uint nTargetMethodId; + public uint nTargetMethodArg; + public uint fInitialActivation; + public uint fAllowRepeat; + } + + [ComVisible(false)] + private struct Msg3_AddProgressEvent + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint idEvent; + public float flProgress; + public RENDERHANDLE idTargetObject; + public uint nTargetMethodId; + public uint nTargetMethodArg; + public uint fInitialActivation; + public uint fAllowRepeat; + } + + [ComVisible(false)] + private struct Msg4_AddTimeEvent + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint idEvent; + public float flEventTime; + public RENDERHANDLE idTargetObject; + public uint nTargetMethodId; + public uint nTargetMethodArg; + public uint fInitialActivation; + public uint fAllowRepeat; + } + + [ComVisible(false)] + private struct Msg5_AddStageEvent + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint idEvent; + public AnimationStage nStage; + public RENDERHANDLE idTargetObject; + public uint nTargetMethodId; + public uint nTargetMethodArg; + public uint fInitialActivation; + public uint fAllowRepeat; + } + + [ComVisible(false)] + private struct Msg6_RemoveTarget + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int targetId; + } + + [ComVisible(false)] + private struct Msg7_AddTarget + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int targetId; + public RENDERHANDLE objectId; + public uint propertyId; + public uint propertyInfo; + } + + [ComVisible(false)] + private struct Msg8_SetEaseOut + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public uint fSpherical; + public float flWeight; + public float flHandle; + } + + [ComVisible(false)] + private struct Msg9_SetEaseIn + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public uint fSpherical; + public float flWeight; + public float flHandle; + } + + [ComVisible(false)] + private struct Msg10_SetBezier + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public uint fSpherical; + public float flHandle1; + public float flHandle2; + } + + [ComVisible(false)] + private struct Msg11_SetCosine + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public uint fSpherical; + } + + [ComVisible(false)] + private struct Msg12_SetSine + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public uint fSpherical; + } + + [ComVisible(false)] + private struct Msg13_SetSCurve + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public uint fSpherical; + public float flWeight; + } + + [ComVisible(false)] + private struct Msg14_SetLogarithmic + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public uint fSpherical; + public float flWeight; + } + + [ComVisible(false)] + private struct Msg15_SetExponential + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public uint fSpherical; + public float flWeight; + } + + [ComVisible(false)] + private struct Msg16_SetLinear + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public uint fSpherical; + } + + [ComVisible(false)] + private struct Msg17_SetBinaryOperation + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public BinaryOpCode opCode; + } + + [ComVisible(false)] + private struct Msg18_SetContinuous + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public RENDERHANDLE idObject; + public uint idProperty; + public uint propertyInfo; + } + + [ComVisible(false)] + private struct Msg19_SetCaptured + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public RENDERHANDLE idObject; + public uint idProperty; + public uint propertyInfo; + public uint fRefreshOnRepeat; + } + + [ComVisible(false)] + private struct Msg20_SetQuaternion + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public Quaternion qValue; + } + + [ComVisible(false)] + private struct Msg21_SetVector4 + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public Vector4 vValue; + } + + [ComVisible(false)] + private struct Msg22_SetVector3 + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public Vector3 vValue; + } + + [ComVisible(false)] + private struct Msg23_SetVector2 + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public Vector2 vValue; + } + + [ComVisible(false)] + private struct Msg24_SetFloat + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public float flValue; + } + + [ComVisible(false)] + private struct Msg25_EndAnimationInput + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + } + + [ComVisible(false)] + private struct Msg26_BeginAnimationInput + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + } + + [ComVisible(false)] + private struct Msg27_SetKeyframeTime + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public float flTimeSec; + } + + [ComVisible(false)] + private struct Msg29_SetKeyframeCount + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int cKeyframes; + } + + [ComVisible(false)] + private struct Msg31_AddKeyframe + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxKeyframe; + public float flTimeSec; + } + + [ComVisible(false)] + private struct Msg32_InstantFinish + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg33_InstantAdvance + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public float advanceTime; + } + + [ComVisible(false)] + private struct Msg34_Reset + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg35_Pause + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg36_Play + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg37_SetResetBehavior + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public AnimationResetBehavior behavior; + } + + [ComVisible(false)] + private struct Msg39_SetAutoReset + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fAutoReset; + } + + [ComVisible(false)] + private struct Msg41_SetRepeatCount + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int cRepeats; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationInputProvider.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationInputProvider.cs index f94d65c..2e142f7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationInputProvider.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationInputProvider.cs @@ -10,461 +10,461 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteAnimationInputProvider : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg10_Create; - private static ushort[] s_priv_ByteOrder_Msg0_RevokeQuaternion; - private static ushort[] s_priv_ByteOrder_Msg1_RevokeVector4; - private static ushort[] s_priv_ByteOrder_Msg2_RevokeVector3; - private static ushort[] s_priv_ByteOrder_Msg3_RevokeVector2; - private static ushort[] s_priv_ByteOrder_Msg4_RevokeFloat; - private static ushort[] s_priv_ByteOrder_Msg5_PublishQuaternion; - private static ushort[] s_priv_ByteOrder_Msg6_PublishVector4; - private static ushort[] s_priv_ByteOrder_Msg7_PublishVector3; - private static ushort[] s_priv_ByteOrder_Msg8_PublishVector2; - private static ushort[] s_priv_ByteOrder_Msg9_PublishFloat; - - protected RemoteAnimationInputProvider() + internal class RemoteAnimationInputProvider : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg10_Create; + private static ushort[] s_priv_ByteOrder_Msg0_RevokeQuaternion; + private static ushort[] s_priv_ByteOrder_Msg1_RevokeVector4; + private static ushort[] s_priv_ByteOrder_Msg2_RevokeVector3; + private static ushort[] s_priv_ByteOrder_Msg3_RevokeVector2; + private static ushort[] s_priv_ByteOrder_Msg4_RevokeFloat; + private static ushort[] s_priv_ByteOrder_Msg5_PublishQuaternion; + private static ushort[] s_priv_ByteOrder_Msg6_PublishVector4; + private static ushort[] s_priv_ByteOrder_Msg7_PublishVector3; + private static ushort[] s_priv_ByteOrder_Msg8_PublishVector2; + private static ushort[] s_priv_ByteOrder_Msg9_PublishFloat; + + protected RemoteAnimationInputProvider() + { + } + + public static unsafe RemoteAnimationInputProvider Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + uint nExternalAnimationInputId) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE providerClassHandle = _priv_protocolInstance.AnimationInputProvider_ClassHandle; + RemoteAnimationInputProvider animationInputProvider = new RemoteAnimationInputProvider(port, _priv_owner); + uint num = (uint)sizeof(RemoteAnimationInputProvider.Msg10_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteAnimationInputProvider.Msg10_Create* msg10CreatePtr = (RemoteAnimationInputProvider.Msg10_Create*)pMem; + msg10CreatePtr->_priv_size = num; + msg10CreatePtr->_priv_msgid = 10U; + msg10CreatePtr->nExternalAnimationInputId = nExternalAnimationInputId; + msg10CreatePtr->_priv_idObjectSubject = animationInputProvider.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg10_Create, typeof(RemoteAnimationInputProvider.Msg10_Create), 0, 0); + port.CreateRemoteObject(providerClassHandle, animationInputProvider.m_renderHandle, (Message*)msg10CreatePtr); + return animationInputProvider; + } + + public unsafe void BuildRevokeQuaternion( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint propertyId) + { + 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(RemoteAnimationInputProvider.Msg0_RevokeQuaternion); + RemoteAnimationInputProvider.Msg0_RevokeQuaternion* revokeQuaternionPtr = (RemoteAnimationInputProvider.Msg0_RevokeQuaternion*)_priv_portUse.AllocMessageBuffer(size); + revokeQuaternionPtr->_priv_size = size; + revokeQuaternionPtr->_priv_msgid = 0U; + revokeQuaternionPtr->propertyId = propertyId; + revokeQuaternionPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)revokeQuaternionPtr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg0_RevokeQuaternion, typeof(RemoteAnimationInputProvider.Msg0_RevokeQuaternion), 0, 0); + _priv_pmsgUse = (Message*)revokeQuaternionPtr; + } + + public unsafe void SendRevokeQuaternion(uint propertyId) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRevokeQuaternion(out _priv_portUse, out _priv_pmsgUse, propertyId); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRevokeVector4( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint propertyId) + { + 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(RemoteAnimationInputProvider.Msg1_RevokeVector4); + RemoteAnimationInputProvider.Msg1_RevokeVector4* msg1RevokeVector4Ptr = (RemoteAnimationInputProvider.Msg1_RevokeVector4*)_priv_portUse.AllocMessageBuffer(size); + msg1RevokeVector4Ptr->_priv_size = size; + msg1RevokeVector4Ptr->_priv_msgid = 1U; + msg1RevokeVector4Ptr->propertyId = propertyId; + msg1RevokeVector4Ptr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1RevokeVector4Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg1_RevokeVector4, typeof(RemoteAnimationInputProvider.Msg1_RevokeVector4), 0, 0); + _priv_pmsgUse = (Message*)msg1RevokeVector4Ptr; + } + + public unsafe void SendRevokeVector4(uint propertyId) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRevokeVector4(out _priv_portUse, out _priv_pmsgUse, propertyId); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRevokeVector3( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint propertyId) + { + 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(RemoteAnimationInputProvider.Msg2_RevokeVector3); + RemoteAnimationInputProvider.Msg2_RevokeVector3* msg2RevokeVector3Ptr = (RemoteAnimationInputProvider.Msg2_RevokeVector3*)_priv_portUse.AllocMessageBuffer(size); + msg2RevokeVector3Ptr->_priv_size = size; + msg2RevokeVector3Ptr->_priv_msgid = 2U; + msg2RevokeVector3Ptr->propertyId = propertyId; + msg2RevokeVector3Ptr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg2RevokeVector3Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg2_RevokeVector3, typeof(RemoteAnimationInputProvider.Msg2_RevokeVector3), 0, 0); + _priv_pmsgUse = (Message*)msg2RevokeVector3Ptr; + } + + public unsafe void SendRevokeVector3(uint propertyId) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRevokeVector3(out _priv_portUse, out _priv_pmsgUse, propertyId); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRevokeVector2( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint propertyId) + { + 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(RemoteAnimationInputProvider.Msg3_RevokeVector2); + RemoteAnimationInputProvider.Msg3_RevokeVector2* msg3RevokeVector2Ptr = (RemoteAnimationInputProvider.Msg3_RevokeVector2*)_priv_portUse.AllocMessageBuffer(size); + msg3RevokeVector2Ptr->_priv_size = size; + msg3RevokeVector2Ptr->_priv_msgid = 3U; + msg3RevokeVector2Ptr->propertyId = propertyId; + msg3RevokeVector2Ptr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg3RevokeVector2Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg3_RevokeVector2, typeof(RemoteAnimationInputProvider.Msg3_RevokeVector2), 0, 0); + _priv_pmsgUse = (Message*)msg3RevokeVector2Ptr; + } + + public unsafe void SendRevokeVector2(uint propertyId) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRevokeVector2(out _priv_portUse, out _priv_pmsgUse, propertyId); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRevokeFloat( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint propertyId) + { + 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(RemoteAnimationInputProvider.Msg4_RevokeFloat); + RemoteAnimationInputProvider.Msg4_RevokeFloat* msg4RevokeFloatPtr = (RemoteAnimationInputProvider.Msg4_RevokeFloat*)_priv_portUse.AllocMessageBuffer(size); + msg4RevokeFloatPtr->_priv_size = size; + msg4RevokeFloatPtr->_priv_msgid = 4U; + msg4RevokeFloatPtr->propertyId = propertyId; + msg4RevokeFloatPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4RevokeFloatPtr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg4_RevokeFloat, typeof(RemoteAnimationInputProvider.Msg4_RevokeFloat), 0, 0); + _priv_pmsgUse = (Message*)msg4RevokeFloatPtr; + } + + public unsafe void SendRevokeFloat(uint propertyId) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRevokeFloat(out _priv_portUse, out _priv_pmsgUse, propertyId); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildPublishQuaternion( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint propertyId, + Quaternion value) + { + 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(RemoteAnimationInputProvider.Msg5_PublishQuaternion); + RemoteAnimationInputProvider.Msg5_PublishQuaternion* publishQuaternionPtr = (RemoteAnimationInputProvider.Msg5_PublishQuaternion*)_priv_portUse.AllocMessageBuffer(size); + publishQuaternionPtr->_priv_size = size; + publishQuaternionPtr->_priv_msgid = 5U; + publishQuaternionPtr->propertyId = propertyId; + publishQuaternionPtr->value = value; + publishQuaternionPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)publishQuaternionPtr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg5_PublishQuaternion, typeof(RemoteAnimationInputProvider.Msg5_PublishQuaternion), 0, 0); + _priv_pmsgUse = (Message*)publishQuaternionPtr; + } + + public unsafe void SendPublishQuaternion(uint propertyId, Quaternion value) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildPublishQuaternion(out _priv_portUse, out _priv_pmsgUse, propertyId, value); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildPublishVector4( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint propertyId, + Vector4 value) + { + 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(RemoteAnimationInputProvider.Msg6_PublishVector4); + RemoteAnimationInputProvider.Msg6_PublishVector4* msg6PublishVector4Ptr = (RemoteAnimationInputProvider.Msg6_PublishVector4*)_priv_portUse.AllocMessageBuffer(size); + msg6PublishVector4Ptr->_priv_size = size; + msg6PublishVector4Ptr->_priv_msgid = 6U; + msg6PublishVector4Ptr->propertyId = propertyId; + msg6PublishVector4Ptr->value = value; + msg6PublishVector4Ptr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg6PublishVector4Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg6_PublishVector4, typeof(RemoteAnimationInputProvider.Msg6_PublishVector4), 0, 0); + _priv_pmsgUse = (Message*)msg6PublishVector4Ptr; + } + + public unsafe void SendPublishVector4(uint propertyId, Vector4 value) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildPublishVector4(out _priv_portUse, out _priv_pmsgUse, propertyId, value); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildPublishVector3( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint propertyId, + Vector3 value) + { + 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(RemoteAnimationInputProvider.Msg7_PublishVector3); + RemoteAnimationInputProvider.Msg7_PublishVector3* msg7PublishVector3Ptr = (RemoteAnimationInputProvider.Msg7_PublishVector3*)_priv_portUse.AllocMessageBuffer(size); + msg7PublishVector3Ptr->_priv_size = size; + msg7PublishVector3Ptr->_priv_msgid = 7U; + msg7PublishVector3Ptr->propertyId = propertyId; + msg7PublishVector3Ptr->value = value; + msg7PublishVector3Ptr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg7PublishVector3Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg7_PublishVector3, typeof(RemoteAnimationInputProvider.Msg7_PublishVector3), 0, 0); + _priv_pmsgUse = (Message*)msg7PublishVector3Ptr; + } + + public unsafe void SendPublishVector3(uint propertyId, Vector3 value) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildPublishVector3(out _priv_portUse, out _priv_pmsgUse, propertyId, value); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildPublishVector2( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint propertyId, + Vector2 value) + { + 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(RemoteAnimationInputProvider.Msg8_PublishVector2); + RemoteAnimationInputProvider.Msg8_PublishVector2* msg8PublishVector2Ptr = (RemoteAnimationInputProvider.Msg8_PublishVector2*)_priv_portUse.AllocMessageBuffer(size); + msg8PublishVector2Ptr->_priv_size = size; + msg8PublishVector2Ptr->_priv_msgid = 8U; + msg8PublishVector2Ptr->propertyId = propertyId; + msg8PublishVector2Ptr->value = value; + msg8PublishVector2Ptr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg8PublishVector2Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg8_PublishVector2, typeof(RemoteAnimationInputProvider.Msg8_PublishVector2), 0, 0); + _priv_pmsgUse = (Message*)msg8PublishVector2Ptr; + } + + public unsafe void SendPublishVector2(uint propertyId, Vector2 value) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildPublishVector2(out _priv_portUse, out _priv_pmsgUse, propertyId, value); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildPublishFloat( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint propertyId, + float value) + { + 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(RemoteAnimationInputProvider.Msg9_PublishFloat); + RemoteAnimationInputProvider.Msg9_PublishFloat* msg9PublishFloatPtr = (RemoteAnimationInputProvider.Msg9_PublishFloat*)_priv_portUse.AllocMessageBuffer(size); + msg9PublishFloatPtr->_priv_size = size; + msg9PublishFloatPtr->_priv_msgid = 9U; + msg9PublishFloatPtr->propertyId = propertyId; + msg9PublishFloatPtr->value = value; + msg9PublishFloatPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg9PublishFloatPtr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg9_PublishFloat, typeof(RemoteAnimationInputProvider.Msg9_PublishFloat), 0, 0); + _priv_pmsgUse = (Message*)msg9PublishFloatPtr; + } + + public unsafe void SendPublishFloat(uint propertyId, float value) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildPublishFloat(out _priv_portUse, out _priv_pmsgUse, propertyId, value); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteAnimationInputProvider CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteAnimationInputProvider(port, handle, true); + } + + public static RemoteAnimationInputProvider CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteAnimationInputProvider(port, handle, false); + } + + protected RemoteAnimationInputProvider( + RenderPort port, + RENDERHANDLE handle, + bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteAnimationInputProvider(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteAnimationInputProvider && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg10_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint nExternalAnimationInputId; + } + + [ComVisible(false)] + private struct Msg0_RevokeQuaternion + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint propertyId; + } + + [ComVisible(false)] + private struct Msg1_RevokeVector4 + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint propertyId; + } + + [ComVisible(false)] + private struct Msg2_RevokeVector3 + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint propertyId; + } + + [ComVisible(false)] + private struct Msg3_RevokeVector2 + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint propertyId; + } + + [ComVisible(false)] + private struct Msg4_RevokeFloat + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint propertyId; + } + + [ComVisible(false)] + private struct Msg5_PublishQuaternion + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint propertyId; + public Quaternion value; + } + + [ComVisible(false)] + private struct Msg6_PublishVector4 + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint propertyId; + public Vector4 value; + } + + [ComVisible(false)] + private struct Msg7_PublishVector3 + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint propertyId; + public Vector3 value; + } + + [ComVisible(false)] + private struct Msg8_PublishVector2 + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint propertyId; + public Vector2 value; + } + + [ComVisible(false)] + private struct Msg9_PublishFloat + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint propertyId; + public float value; + } } - - public static unsafe RemoteAnimationInputProvider Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - uint nExternalAnimationInputId) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE providerClassHandle = _priv_protocolInstance.AnimationInputProvider_ClassHandle; - RemoteAnimationInputProvider animationInputProvider = new RemoteAnimationInputProvider(port, _priv_owner); - uint num = (uint) sizeof (RemoteAnimationInputProvider.Msg10_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteAnimationInputProvider.Msg10_Create* msg10CreatePtr = (RemoteAnimationInputProvider.Msg10_Create*) pMem; - msg10CreatePtr->_priv_size = num; - msg10CreatePtr->_priv_msgid = 10U; - msg10CreatePtr->nExternalAnimationInputId = nExternalAnimationInputId; - msg10CreatePtr->_priv_idObjectSubject = animationInputProvider.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg10_Create, typeof (RemoteAnimationInputProvider.Msg10_Create), 0, 0); - port.CreateRemoteObject(providerClassHandle, animationInputProvider.m_renderHandle, (Message*) msg10CreatePtr); - return animationInputProvider; - } - - public unsafe void BuildRevokeQuaternion( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint propertyId) - { - 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 (RemoteAnimationInputProvider.Msg0_RevokeQuaternion); - RemoteAnimationInputProvider.Msg0_RevokeQuaternion* revokeQuaternionPtr = (RemoteAnimationInputProvider.Msg0_RevokeQuaternion*) _priv_portUse.AllocMessageBuffer(size); - revokeQuaternionPtr->_priv_size = size; - revokeQuaternionPtr->_priv_msgid = 0U; - revokeQuaternionPtr->propertyId = propertyId; - revokeQuaternionPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) revokeQuaternionPtr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg0_RevokeQuaternion, typeof (RemoteAnimationInputProvider.Msg0_RevokeQuaternion), 0, 0); - _priv_pmsgUse = (Message*) revokeQuaternionPtr; - } - - public unsafe void SendRevokeQuaternion(uint propertyId) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRevokeQuaternion(out _priv_portUse, out _priv_pmsgUse, propertyId); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRevokeVector4( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint propertyId) - { - 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 (RemoteAnimationInputProvider.Msg1_RevokeVector4); - RemoteAnimationInputProvider.Msg1_RevokeVector4* msg1RevokeVector4Ptr = (RemoteAnimationInputProvider.Msg1_RevokeVector4*) _priv_portUse.AllocMessageBuffer(size); - msg1RevokeVector4Ptr->_priv_size = size; - msg1RevokeVector4Ptr->_priv_msgid = 1U; - msg1RevokeVector4Ptr->propertyId = propertyId; - msg1RevokeVector4Ptr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1RevokeVector4Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg1_RevokeVector4, typeof (RemoteAnimationInputProvider.Msg1_RevokeVector4), 0, 0); - _priv_pmsgUse = (Message*) msg1RevokeVector4Ptr; - } - - public unsafe void SendRevokeVector4(uint propertyId) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRevokeVector4(out _priv_portUse, out _priv_pmsgUse, propertyId); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRevokeVector3( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint propertyId) - { - 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 (RemoteAnimationInputProvider.Msg2_RevokeVector3); - RemoteAnimationInputProvider.Msg2_RevokeVector3* msg2RevokeVector3Ptr = (RemoteAnimationInputProvider.Msg2_RevokeVector3*) _priv_portUse.AllocMessageBuffer(size); - msg2RevokeVector3Ptr->_priv_size = size; - msg2RevokeVector3Ptr->_priv_msgid = 2U; - msg2RevokeVector3Ptr->propertyId = propertyId; - msg2RevokeVector3Ptr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg2RevokeVector3Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg2_RevokeVector3, typeof (RemoteAnimationInputProvider.Msg2_RevokeVector3), 0, 0); - _priv_pmsgUse = (Message*) msg2RevokeVector3Ptr; - } - - public unsafe void SendRevokeVector3(uint propertyId) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRevokeVector3(out _priv_portUse, out _priv_pmsgUse, propertyId); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRevokeVector2( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint propertyId) - { - 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 (RemoteAnimationInputProvider.Msg3_RevokeVector2); - RemoteAnimationInputProvider.Msg3_RevokeVector2* msg3RevokeVector2Ptr = (RemoteAnimationInputProvider.Msg3_RevokeVector2*) _priv_portUse.AllocMessageBuffer(size); - msg3RevokeVector2Ptr->_priv_size = size; - msg3RevokeVector2Ptr->_priv_msgid = 3U; - msg3RevokeVector2Ptr->propertyId = propertyId; - msg3RevokeVector2Ptr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg3RevokeVector2Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg3_RevokeVector2, typeof (RemoteAnimationInputProvider.Msg3_RevokeVector2), 0, 0); - _priv_pmsgUse = (Message*) msg3RevokeVector2Ptr; - } - - public unsafe void SendRevokeVector2(uint propertyId) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRevokeVector2(out _priv_portUse, out _priv_pmsgUse, propertyId); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRevokeFloat( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint propertyId) - { - 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 (RemoteAnimationInputProvider.Msg4_RevokeFloat); - RemoteAnimationInputProvider.Msg4_RevokeFloat* msg4RevokeFloatPtr = (RemoteAnimationInputProvider.Msg4_RevokeFloat*) _priv_portUse.AllocMessageBuffer(size); - msg4RevokeFloatPtr->_priv_size = size; - msg4RevokeFloatPtr->_priv_msgid = 4U; - msg4RevokeFloatPtr->propertyId = propertyId; - msg4RevokeFloatPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4RevokeFloatPtr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg4_RevokeFloat, typeof (RemoteAnimationInputProvider.Msg4_RevokeFloat), 0, 0); - _priv_pmsgUse = (Message*) msg4RevokeFloatPtr; - } - - public unsafe void SendRevokeFloat(uint propertyId) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRevokeFloat(out _priv_portUse, out _priv_pmsgUse, propertyId); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildPublishQuaternion( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint propertyId, - Quaternion value) - { - 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 (RemoteAnimationInputProvider.Msg5_PublishQuaternion); - RemoteAnimationInputProvider.Msg5_PublishQuaternion* publishQuaternionPtr = (RemoteAnimationInputProvider.Msg5_PublishQuaternion*) _priv_portUse.AllocMessageBuffer(size); - publishQuaternionPtr->_priv_size = size; - publishQuaternionPtr->_priv_msgid = 5U; - publishQuaternionPtr->propertyId = propertyId; - publishQuaternionPtr->value = value; - publishQuaternionPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) publishQuaternionPtr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg5_PublishQuaternion, typeof (RemoteAnimationInputProvider.Msg5_PublishQuaternion), 0, 0); - _priv_pmsgUse = (Message*) publishQuaternionPtr; - } - - public unsafe void SendPublishQuaternion(uint propertyId, Quaternion value) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildPublishQuaternion(out _priv_portUse, out _priv_pmsgUse, propertyId, value); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildPublishVector4( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint propertyId, - Vector4 value) - { - 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 (RemoteAnimationInputProvider.Msg6_PublishVector4); - RemoteAnimationInputProvider.Msg6_PublishVector4* msg6PublishVector4Ptr = (RemoteAnimationInputProvider.Msg6_PublishVector4*) _priv_portUse.AllocMessageBuffer(size); - msg6PublishVector4Ptr->_priv_size = size; - msg6PublishVector4Ptr->_priv_msgid = 6U; - msg6PublishVector4Ptr->propertyId = propertyId; - msg6PublishVector4Ptr->value = value; - msg6PublishVector4Ptr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg6PublishVector4Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg6_PublishVector4, typeof (RemoteAnimationInputProvider.Msg6_PublishVector4), 0, 0); - _priv_pmsgUse = (Message*) msg6PublishVector4Ptr; - } - - public unsafe void SendPublishVector4(uint propertyId, Vector4 value) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildPublishVector4(out _priv_portUse, out _priv_pmsgUse, propertyId, value); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildPublishVector3( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint propertyId, - Vector3 value) - { - 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 (RemoteAnimationInputProvider.Msg7_PublishVector3); - RemoteAnimationInputProvider.Msg7_PublishVector3* msg7PublishVector3Ptr = (RemoteAnimationInputProvider.Msg7_PublishVector3*) _priv_portUse.AllocMessageBuffer(size); - msg7PublishVector3Ptr->_priv_size = size; - msg7PublishVector3Ptr->_priv_msgid = 7U; - msg7PublishVector3Ptr->propertyId = propertyId; - msg7PublishVector3Ptr->value = value; - msg7PublishVector3Ptr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg7PublishVector3Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg7_PublishVector3, typeof (RemoteAnimationInputProvider.Msg7_PublishVector3), 0, 0); - _priv_pmsgUse = (Message*) msg7PublishVector3Ptr; - } - - public unsafe void SendPublishVector3(uint propertyId, Vector3 value) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildPublishVector3(out _priv_portUse, out _priv_pmsgUse, propertyId, value); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildPublishVector2( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint propertyId, - Vector2 value) - { - 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 (RemoteAnimationInputProvider.Msg8_PublishVector2); - RemoteAnimationInputProvider.Msg8_PublishVector2* msg8PublishVector2Ptr = (RemoteAnimationInputProvider.Msg8_PublishVector2*) _priv_portUse.AllocMessageBuffer(size); - msg8PublishVector2Ptr->_priv_size = size; - msg8PublishVector2Ptr->_priv_msgid = 8U; - msg8PublishVector2Ptr->propertyId = propertyId; - msg8PublishVector2Ptr->value = value; - msg8PublishVector2Ptr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg8PublishVector2Ptr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg8_PublishVector2, typeof (RemoteAnimationInputProvider.Msg8_PublishVector2), 0, 0); - _priv_pmsgUse = (Message*) msg8PublishVector2Ptr; - } - - public unsafe void SendPublishVector2(uint propertyId, Vector2 value) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildPublishVector2(out _priv_portUse, out _priv_pmsgUse, propertyId, value); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildPublishFloat( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint propertyId, - float value) - { - 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 (RemoteAnimationInputProvider.Msg9_PublishFloat); - RemoteAnimationInputProvider.Msg9_PublishFloat* msg9PublishFloatPtr = (RemoteAnimationInputProvider.Msg9_PublishFloat*) _priv_portUse.AllocMessageBuffer(size); - msg9PublishFloatPtr->_priv_size = size; - msg9PublishFloatPtr->_priv_msgid = 9U; - msg9PublishFloatPtr->propertyId = propertyId; - msg9PublishFloatPtr->value = value; - msg9PublishFloatPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg9PublishFloatPtr, ref RemoteAnimationInputProvider.s_priv_ByteOrder_Msg9_PublishFloat, typeof (RemoteAnimationInputProvider.Msg9_PublishFloat), 0, 0); - _priv_pmsgUse = (Message*) msg9PublishFloatPtr; - } - - public unsafe void SendPublishFloat(uint propertyId, float value) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildPublishFloat(out _priv_portUse, out _priv_pmsgUse, propertyId, value); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteAnimationInputProvider CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteAnimationInputProvider(port, handle, true); - } - - public static RemoteAnimationInputProvider CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteAnimationInputProvider(port, handle, false); - } - - protected RemoteAnimationInputProvider( - RenderPort port, - RENDERHANDLE handle, - bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteAnimationInputProvider(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteAnimationInputProvider && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg10_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint nExternalAnimationInputId; - } - - [ComVisible(false)] - private struct Msg0_RevokeQuaternion - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint propertyId; - } - - [ComVisible(false)] - private struct Msg1_RevokeVector4 - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint propertyId; - } - - [ComVisible(false)] - private struct Msg2_RevokeVector3 - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint propertyId; - } - - [ComVisible(false)] - private struct Msg3_RevokeVector2 - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint propertyId; - } - - [ComVisible(false)] - private struct Msg4_RevokeFloat - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint propertyId; - } - - [ComVisible(false)] - private struct Msg5_PublishQuaternion - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint propertyId; - public Quaternion value; - } - - [ComVisible(false)] - private struct Msg6_PublishVector4 - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint propertyId; - public Vector4 value; - } - - [ComVisible(false)] - private struct Msg7_PublishVector3 - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint propertyId; - public Vector3 value; - } - - [ComVisible(false)] - private struct Msg8_PublishVector2 - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint propertyId; - public Vector2 value; - } - - [ComVisible(false)] - private struct Msg9_PublishFloat - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint propertyId; - public float value; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationManager.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationManager.cs index 0764e85..e26a3bd 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationManager.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationManager.cs @@ -10,181 +10,181 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteAnimationManager : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg3_Create; - private static ushort[] s_priv_ByteOrder_Msg0_SetAnimationRate; - private static ushort[] s_priv_ByteOrder_Msg1_PulseTimeAdvance; - private static ushort[] s_priv_ByteOrder_Msg2_SetGlobalSpeedAdjustment; - - protected RemoteAnimationManager() + internal class RemoteAnimationManager : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg3_Create; + private static ushort[] s_priv_ByteOrder_Msg0_SetAnimationRate; + private static ushort[] s_priv_ByteOrder_Msg1_PulseTimeAdvance; + private static ushort[] s_priv_ByteOrder_Msg2_SetGlobalSpeedAdjustment; + + protected RemoteAnimationManager() + { + } + + public static unsafe RemoteAnimationManager Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE managerClassHandle = _priv_protocolInstance.AnimationManager_ClassHandle; + RemoteAnimationManager animationManager = new RemoteAnimationManager(port, _priv_owner); + uint num = (uint)sizeof(RemoteAnimationManager.Msg3_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteAnimationManager.Msg3_Create* msg3CreatePtr = (RemoteAnimationManager.Msg3_Create*)pMem; + msg3CreatePtr->_priv_size = num; + msg3CreatePtr->_priv_msgid = 3U; + msg3CreatePtr->_priv_idObjectSubject = animationManager.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteAnimationManager.s_priv_ByteOrder_Msg3_Create, typeof(RemoteAnimationManager.Msg3_Create), 0, 0); + port.CreateRemoteObject(managerClassHandle, animationManager.m_renderHandle, (Message*)msg3CreatePtr); + return animationManager; + } + + public unsafe void BuildSetAnimationRate( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nFramesPerSecond) + { + 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(RemoteAnimationManager.Msg0_SetAnimationRate); + RemoteAnimationManager.Msg0_SetAnimationRate* setAnimationRatePtr = (RemoteAnimationManager.Msg0_SetAnimationRate*)_priv_portUse.AllocMessageBuffer(size); + setAnimationRatePtr->_priv_size = size; + setAnimationRatePtr->_priv_msgid = 0U; + setAnimationRatePtr->nFramesPerSecond = nFramesPerSecond; + setAnimationRatePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setAnimationRatePtr, ref RemoteAnimationManager.s_priv_ByteOrder_Msg0_SetAnimationRate, typeof(RemoteAnimationManager.Msg0_SetAnimationRate), 0, 0); + _priv_pmsgUse = (Message*)setAnimationRatePtr; + } + + public unsafe void SendSetAnimationRate(int nFramesPerSecond) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetAnimationRate(out _priv_portUse, out _priv_pmsgUse, nFramesPerSecond); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildPulseTimeAdvance( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nPulseMs) + { + 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(RemoteAnimationManager.Msg1_PulseTimeAdvance); + RemoteAnimationManager.Msg1_PulseTimeAdvance* pulseTimeAdvancePtr = (RemoteAnimationManager.Msg1_PulseTimeAdvance*)_priv_portUse.AllocMessageBuffer(size); + pulseTimeAdvancePtr->_priv_size = size; + pulseTimeAdvancePtr->_priv_msgid = 1U; + pulseTimeAdvancePtr->nPulseMs = nPulseMs; + pulseTimeAdvancePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)pulseTimeAdvancePtr, ref RemoteAnimationManager.s_priv_ByteOrder_Msg1_PulseTimeAdvance, typeof(RemoteAnimationManager.Msg1_PulseTimeAdvance), 0, 0); + _priv_pmsgUse = (Message*)pulseTimeAdvancePtr; + } + + public unsafe void SendPulseTimeAdvance(int nPulseMs) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildPulseTimeAdvance(out _priv_portUse, out _priv_pmsgUse, nPulseMs); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetGlobalSpeedAdjustment( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + float flFactor) + { + 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(RemoteAnimationManager.Msg2_SetGlobalSpeedAdjustment); + RemoteAnimationManager.Msg2_SetGlobalSpeedAdjustment* globalSpeedAdjustmentPtr = (RemoteAnimationManager.Msg2_SetGlobalSpeedAdjustment*)_priv_portUse.AllocMessageBuffer(size); + globalSpeedAdjustmentPtr->_priv_size = size; + globalSpeedAdjustmentPtr->_priv_msgid = 2U; + globalSpeedAdjustmentPtr->flFactor = flFactor; + globalSpeedAdjustmentPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)globalSpeedAdjustmentPtr, ref RemoteAnimationManager.s_priv_ByteOrder_Msg2_SetGlobalSpeedAdjustment, typeof(RemoteAnimationManager.Msg2_SetGlobalSpeedAdjustment), 0, 0); + _priv_pmsgUse = (Message*)globalSpeedAdjustmentPtr; + } + + public unsafe void SendSetGlobalSpeedAdjustment(float flFactor) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetGlobalSpeedAdjustment(out _priv_portUse, out _priv_pmsgUse, flFactor); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteAnimationManager CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteAnimationManager(port, handle, true); + } + + public static RemoteAnimationManager CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteAnimationManager(port, handle, false); + } + + protected RemoteAnimationManager(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteAnimationManager(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteAnimationManager && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg3_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg0_SetAnimationRate + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nFramesPerSecond; + } + + [ComVisible(false)] + private struct Msg1_PulseTimeAdvance + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nPulseMs; + } + + [ComVisible(false)] + private struct Msg2_SetGlobalSpeedAdjustment + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public float flFactor; + } } - - public static unsafe RemoteAnimationManager Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE managerClassHandle = _priv_protocolInstance.AnimationManager_ClassHandle; - RemoteAnimationManager animationManager = new RemoteAnimationManager(port, _priv_owner); - uint num = (uint) sizeof (RemoteAnimationManager.Msg3_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteAnimationManager.Msg3_Create* msg3CreatePtr = (RemoteAnimationManager.Msg3_Create*) pMem; - msg3CreatePtr->_priv_size = num; - msg3CreatePtr->_priv_msgid = 3U; - msg3CreatePtr->_priv_idObjectSubject = animationManager.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteAnimationManager.s_priv_ByteOrder_Msg3_Create, typeof (RemoteAnimationManager.Msg3_Create), 0, 0); - port.CreateRemoteObject(managerClassHandle, animationManager.m_renderHandle, (Message*) msg3CreatePtr); - return animationManager; - } - - public unsafe void BuildSetAnimationRate( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nFramesPerSecond) - { - 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 (RemoteAnimationManager.Msg0_SetAnimationRate); - RemoteAnimationManager.Msg0_SetAnimationRate* setAnimationRatePtr = (RemoteAnimationManager.Msg0_SetAnimationRate*) _priv_portUse.AllocMessageBuffer(size); - setAnimationRatePtr->_priv_size = size; - setAnimationRatePtr->_priv_msgid = 0U; - setAnimationRatePtr->nFramesPerSecond = nFramesPerSecond; - setAnimationRatePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setAnimationRatePtr, ref RemoteAnimationManager.s_priv_ByteOrder_Msg0_SetAnimationRate, typeof (RemoteAnimationManager.Msg0_SetAnimationRate), 0, 0); - _priv_pmsgUse = (Message*) setAnimationRatePtr; - } - - public unsafe void SendSetAnimationRate(int nFramesPerSecond) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetAnimationRate(out _priv_portUse, out _priv_pmsgUse, nFramesPerSecond); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildPulseTimeAdvance( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nPulseMs) - { - 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 (RemoteAnimationManager.Msg1_PulseTimeAdvance); - RemoteAnimationManager.Msg1_PulseTimeAdvance* pulseTimeAdvancePtr = (RemoteAnimationManager.Msg1_PulseTimeAdvance*) _priv_portUse.AllocMessageBuffer(size); - pulseTimeAdvancePtr->_priv_size = size; - pulseTimeAdvancePtr->_priv_msgid = 1U; - pulseTimeAdvancePtr->nPulseMs = nPulseMs; - pulseTimeAdvancePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) pulseTimeAdvancePtr, ref RemoteAnimationManager.s_priv_ByteOrder_Msg1_PulseTimeAdvance, typeof (RemoteAnimationManager.Msg1_PulseTimeAdvance), 0, 0); - _priv_pmsgUse = (Message*) pulseTimeAdvancePtr; - } - - public unsafe void SendPulseTimeAdvance(int nPulseMs) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildPulseTimeAdvance(out _priv_portUse, out _priv_pmsgUse, nPulseMs); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetGlobalSpeedAdjustment( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - float flFactor) - { - 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 (RemoteAnimationManager.Msg2_SetGlobalSpeedAdjustment); - RemoteAnimationManager.Msg2_SetGlobalSpeedAdjustment* globalSpeedAdjustmentPtr = (RemoteAnimationManager.Msg2_SetGlobalSpeedAdjustment*) _priv_portUse.AllocMessageBuffer(size); - globalSpeedAdjustmentPtr->_priv_size = size; - globalSpeedAdjustmentPtr->_priv_msgid = 2U; - globalSpeedAdjustmentPtr->flFactor = flFactor; - globalSpeedAdjustmentPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) globalSpeedAdjustmentPtr, ref RemoteAnimationManager.s_priv_ByteOrder_Msg2_SetGlobalSpeedAdjustment, typeof (RemoteAnimationManager.Msg2_SetGlobalSpeedAdjustment), 0, 0); - _priv_pmsgUse = (Message*) globalSpeedAdjustmentPtr; - } - - public unsafe void SendSetGlobalSpeedAdjustment(float flFactor) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetGlobalSpeedAdjustment(out _priv_portUse, out _priv_pmsgUse, flFactor); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteAnimationManager CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteAnimationManager(port, handle, true); - } - - public static RemoteAnimationManager CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteAnimationManager(port, handle, false); - } - - protected RemoteAnimationManager(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteAnimationManager(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteAnimationManager && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg3_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg0_SetAnimationRate - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nFramesPerSecond; - } - - [ComVisible(false)] - private struct Msg1_PulseTimeAdvance - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nPulseMs; - } - - [ComVisible(false)] - private struct Msg2_SetGlobalSpeedAdjustment - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public float flFactor; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteCamera.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteCamera.cs index e250ad8..6661bc0 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteCamera.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteCamera.cs @@ -10,250 +10,250 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteCamera : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg5_Create; - private static ushort[] s_priv_ByteOrder_Msg0_SetPerspective; - private static ushort[] s_priv_ByteOrder_Msg1_SetZn; - private static ushort[] s_priv_ByteOrder_Msg2_SetUp; - private static ushort[] s_priv_ByteOrder_Msg3_SetAt; - private static ushort[] s_priv_ByteOrder_Msg4_SetEye; - - protected RemoteCamera() + internal class RemoteCamera : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg5_Create; + private static ushort[] s_priv_ByteOrder_Msg0_SetPerspective; + private static ushort[] s_priv_ByteOrder_Msg1_SetZn; + private static ushort[] s_priv_ByteOrder_Msg2_SetUp; + private static ushort[] s_priv_ByteOrder_Msg3_SetAt; + private static ushort[] s_priv_ByteOrder_Msg4_SetEye; + + protected RemoteCamera() + { + } + + public static unsafe RemoteCamera Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE cameraClassHandle = _priv_protocolInstance.Camera_ClassHandle; + RemoteCamera remoteCamera = new RemoteCamera(port, _priv_owner); + uint num = (uint)sizeof(RemoteCamera.Msg5_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteCamera.Msg5_Create* msg5CreatePtr = (RemoteCamera.Msg5_Create*)pMem; + msg5CreatePtr->_priv_size = num; + msg5CreatePtr->_priv_msgid = 5U; + msg5CreatePtr->_priv_idObjectSubject = remoteCamera.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteCamera.s_priv_ByteOrder_Msg5_Create, typeof(RemoteCamera.Msg5_Create), 0, 0); + port.CreateRemoteObject(cameraClassHandle, remoteCamera.m_renderHandle, (Message*)msg5CreatePtr); + return remoteCamera; + } + + public unsafe void BuildSetPerspective( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fPerspective) + { + 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(RemoteCamera.Msg0_SetPerspective); + RemoteCamera.Msg0_SetPerspective* msg0SetPerspectivePtr = (RemoteCamera.Msg0_SetPerspective*)_priv_portUse.AllocMessageBuffer(size); + msg0SetPerspectivePtr->_priv_size = size; + msg0SetPerspectivePtr->_priv_msgid = 0U; + msg0SetPerspectivePtr->fPerspective = fPerspective ? uint.MaxValue : 0U; + msg0SetPerspectivePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0SetPerspectivePtr, ref RemoteCamera.s_priv_ByteOrder_Msg0_SetPerspective, typeof(RemoteCamera.Msg0_SetPerspective), 0, 0); + _priv_pmsgUse = (Message*)msg0SetPerspectivePtr; + } + + public unsafe void SendSetPerspective(bool fPerspective) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetPerspective(out _priv_portUse, out _priv_pmsgUse, fPerspective); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetZn( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + float flZn) + { + 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(RemoteCamera.Msg1_SetZn); + RemoteCamera.Msg1_SetZn* msg1SetZnPtr = (RemoteCamera.Msg1_SetZn*)_priv_portUse.AllocMessageBuffer(size); + msg1SetZnPtr->_priv_size = size; + msg1SetZnPtr->_priv_msgid = 1U; + msg1SetZnPtr->flZn = flZn; + msg1SetZnPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1SetZnPtr, ref RemoteCamera.s_priv_ByteOrder_Msg1_SetZn, typeof(RemoteCamera.Msg1_SetZn), 0, 0); + _priv_pmsgUse = (Message*)msg1SetZnPtr; + } + + public unsafe void SendSetZn(float flZn) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetZn(out _priv_portUse, out _priv_pmsgUse, flZn); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetUp( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Vector3 vUp) + { + 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(RemoteCamera.Msg2_SetUp); + RemoteCamera.Msg2_SetUp* msg2SetUpPtr = (RemoteCamera.Msg2_SetUp*)_priv_portUse.AllocMessageBuffer(size); + msg2SetUpPtr->_priv_size = size; + msg2SetUpPtr->_priv_msgid = 2U; + msg2SetUpPtr->vUp = vUp; + msg2SetUpPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg2SetUpPtr, ref RemoteCamera.s_priv_ByteOrder_Msg2_SetUp, typeof(RemoteCamera.Msg2_SetUp), 0, 0); + _priv_pmsgUse = (Message*)msg2SetUpPtr; + } + + public unsafe void SendSetUp(Vector3 vUp) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetUp(out _priv_portUse, out _priv_pmsgUse, vUp); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetAt( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Vector3 vAt) + { + 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(RemoteCamera.Msg3_SetAt); + RemoteCamera.Msg3_SetAt* msg3SetAtPtr = (RemoteCamera.Msg3_SetAt*)_priv_portUse.AllocMessageBuffer(size); + msg3SetAtPtr->_priv_size = size; + msg3SetAtPtr->_priv_msgid = 3U; + msg3SetAtPtr->vAt = vAt; + msg3SetAtPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg3SetAtPtr, ref RemoteCamera.s_priv_ByteOrder_Msg3_SetAt, typeof(RemoteCamera.Msg3_SetAt), 0, 0); + _priv_pmsgUse = (Message*)msg3SetAtPtr; + } + + public unsafe void SendSetAt(Vector3 vAt) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetAt(out _priv_portUse, out _priv_pmsgUse, vAt); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetEye( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Vector3 vEye) + { + 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(RemoteCamera.Msg4_SetEye); + RemoteCamera.Msg4_SetEye* msg4SetEyePtr = (RemoteCamera.Msg4_SetEye*)_priv_portUse.AllocMessageBuffer(size); + msg4SetEyePtr->_priv_size = size; + msg4SetEyePtr->_priv_msgid = 4U; + msg4SetEyePtr->vEye = vEye; + msg4SetEyePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4SetEyePtr, ref RemoteCamera.s_priv_ByteOrder_Msg4_SetEye, typeof(RemoteCamera.Msg4_SetEye), 0, 0); + _priv_pmsgUse = (Message*)msg4SetEyePtr; + } + + public unsafe void SendSetEye(Vector3 vEye) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetEye(out _priv_portUse, out _priv_pmsgUse, vEye); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteCamera CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteCamera(port, handle, true); + + public static RemoteCamera CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteCamera(port, handle, false); + } + + protected RemoteCamera(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteCamera(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteCamera && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg5_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg0_SetPerspective + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fPerspective; + } + + [ComVisible(false)] + private struct Msg1_SetZn + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public float flZn; + } + + [ComVisible(false)] + private struct Msg2_SetUp + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Vector3 vUp; + } + + [ComVisible(false)] + private struct Msg3_SetAt + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Vector3 vAt; + } + + [ComVisible(false)] + private struct Msg4_SetEye + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Vector3 vEye; + } } - - public static unsafe RemoteCamera Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE cameraClassHandle = _priv_protocolInstance.Camera_ClassHandle; - RemoteCamera remoteCamera = new RemoteCamera(port, _priv_owner); - uint num = (uint) sizeof (RemoteCamera.Msg5_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteCamera.Msg5_Create* msg5CreatePtr = (RemoteCamera.Msg5_Create*) pMem; - msg5CreatePtr->_priv_size = num; - msg5CreatePtr->_priv_msgid = 5U; - msg5CreatePtr->_priv_idObjectSubject = remoteCamera.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteCamera.s_priv_ByteOrder_Msg5_Create, typeof (RemoteCamera.Msg5_Create), 0, 0); - port.CreateRemoteObject(cameraClassHandle, remoteCamera.m_renderHandle, (Message*) msg5CreatePtr); - return remoteCamera; - } - - public unsafe void BuildSetPerspective( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fPerspective) - { - 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 (RemoteCamera.Msg0_SetPerspective); - RemoteCamera.Msg0_SetPerspective* msg0SetPerspectivePtr = (RemoteCamera.Msg0_SetPerspective*) _priv_portUse.AllocMessageBuffer(size); - msg0SetPerspectivePtr->_priv_size = size; - msg0SetPerspectivePtr->_priv_msgid = 0U; - msg0SetPerspectivePtr->fPerspective = fPerspective ? uint.MaxValue : 0U; - msg0SetPerspectivePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0SetPerspectivePtr, ref RemoteCamera.s_priv_ByteOrder_Msg0_SetPerspective, typeof (RemoteCamera.Msg0_SetPerspective), 0, 0); - _priv_pmsgUse = (Message*) msg0SetPerspectivePtr; - } - - public unsafe void SendSetPerspective(bool fPerspective) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetPerspective(out _priv_portUse, out _priv_pmsgUse, fPerspective); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetZn( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - float flZn) - { - 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 (RemoteCamera.Msg1_SetZn); - RemoteCamera.Msg1_SetZn* msg1SetZnPtr = (RemoteCamera.Msg1_SetZn*) _priv_portUse.AllocMessageBuffer(size); - msg1SetZnPtr->_priv_size = size; - msg1SetZnPtr->_priv_msgid = 1U; - msg1SetZnPtr->flZn = flZn; - msg1SetZnPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1SetZnPtr, ref RemoteCamera.s_priv_ByteOrder_Msg1_SetZn, typeof (RemoteCamera.Msg1_SetZn), 0, 0); - _priv_pmsgUse = (Message*) msg1SetZnPtr; - } - - public unsafe void SendSetZn(float flZn) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetZn(out _priv_portUse, out _priv_pmsgUse, flZn); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetUp( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Vector3 vUp) - { - 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 (RemoteCamera.Msg2_SetUp); - RemoteCamera.Msg2_SetUp* msg2SetUpPtr = (RemoteCamera.Msg2_SetUp*) _priv_portUse.AllocMessageBuffer(size); - msg2SetUpPtr->_priv_size = size; - msg2SetUpPtr->_priv_msgid = 2U; - msg2SetUpPtr->vUp = vUp; - msg2SetUpPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg2SetUpPtr, ref RemoteCamera.s_priv_ByteOrder_Msg2_SetUp, typeof (RemoteCamera.Msg2_SetUp), 0, 0); - _priv_pmsgUse = (Message*) msg2SetUpPtr; - } - - public unsafe void SendSetUp(Vector3 vUp) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetUp(out _priv_portUse, out _priv_pmsgUse, vUp); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetAt( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Vector3 vAt) - { - 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 (RemoteCamera.Msg3_SetAt); - RemoteCamera.Msg3_SetAt* msg3SetAtPtr = (RemoteCamera.Msg3_SetAt*) _priv_portUse.AllocMessageBuffer(size); - msg3SetAtPtr->_priv_size = size; - msg3SetAtPtr->_priv_msgid = 3U; - msg3SetAtPtr->vAt = vAt; - msg3SetAtPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg3SetAtPtr, ref RemoteCamera.s_priv_ByteOrder_Msg3_SetAt, typeof (RemoteCamera.Msg3_SetAt), 0, 0); - _priv_pmsgUse = (Message*) msg3SetAtPtr; - } - - public unsafe void SendSetAt(Vector3 vAt) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetAt(out _priv_portUse, out _priv_pmsgUse, vAt); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetEye( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Vector3 vEye) - { - 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 (RemoteCamera.Msg4_SetEye); - RemoteCamera.Msg4_SetEye* msg4SetEyePtr = (RemoteCamera.Msg4_SetEye*) _priv_portUse.AllocMessageBuffer(size); - msg4SetEyePtr->_priv_size = size; - msg4SetEyePtr->_priv_msgid = 4U; - msg4SetEyePtr->vEye = vEye; - msg4SetEyePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4SetEyePtr, ref RemoteCamera.s_priv_ByteOrder_Msg4_SetEye, typeof (RemoteCamera.Msg4_SetEye), 0, 0); - _priv_pmsgUse = (Message*) msg4SetEyePtr; - } - - public unsafe void SendSetEye(Vector3 vEye) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetEye(out _priv_portUse, out _priv_pmsgUse, vEye); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteCamera CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteCamera(port, handle, true); - - public static RemoteCamera CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteCamera(port, handle, false); - } - - protected RemoteCamera(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteCamera(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteCamera && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg5_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg0_SetPerspective - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fPerspective; - } - - [ComVisible(false)] - private struct Msg1_SetZn - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public float flZn; - } - - [ComVisible(false)] - private struct Msg2_SetUp - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Vector3 vUp; - } - - [ComVisible(false)] - private struct Msg3_SetAt - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Vector3 vAt; - } - - [ComVisible(false)] - private struct Msg4_SetEye - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Vector3 vEye; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDevice.cs index 693ce88..5abf92d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDevice.cs @@ -10,290 +10,290 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteDevice : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_TriggerDeviceReset; - private static ushort[] s_priv_ByteOrder_Msg1_EndCaptureBackBuffer; - private static ushort[] s_priv_ByteOrder_Msg2_BeginCaptureBackBuffer; - private static ushort[] s_priv_ByteOrder_Msg3_CreateGradient; - private static ushort[] s_priv_ByteOrder_Msg4_Stop; - private static ushort[] s_priv_ByteOrder_Msg5_Restart; - private static ushort[] s_priv_ByteOrder_Msg6_CreateSurfacePool; - - protected RemoteDevice() + internal class RemoteDevice : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_TriggerDeviceReset; + private static ushort[] s_priv_ByteOrder_Msg1_EndCaptureBackBuffer; + private static ushort[] s_priv_ByteOrder_Msg2_BeginCaptureBackBuffer; + private static ushort[] s_priv_ByteOrder_Msg3_CreateGradient; + private static ushort[] s_priv_ByteOrder_Msg4_Stop; + private static ushort[] s_priv_ByteOrder_Msg5_Restart; + private static ushort[] s_priv_ByteOrder_Msg6_CreateSurfacePool; + + protected RemoteDevice() + { + } + + public unsafe void BuildTriggerDeviceReset( + 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(RemoteDevice.Msg0_TriggerDeviceReset); + RemoteDevice.Msg0_TriggerDeviceReset* triggerDeviceResetPtr = (RemoteDevice.Msg0_TriggerDeviceReset*)_priv_portUse.AllocMessageBuffer(size); + triggerDeviceResetPtr->_priv_size = size; + triggerDeviceResetPtr->_priv_msgid = 0U; + triggerDeviceResetPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)triggerDeviceResetPtr, ref RemoteDevice.s_priv_ByteOrder_Msg0_TriggerDeviceReset, typeof(RemoteDevice.Msg0_TriggerDeviceReset), 0, 0); + _priv_pmsgUse = (Message*)triggerDeviceResetPtr; + } + + public unsafe void SendTriggerDeviceReset() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildTriggerDeviceReset(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildEndCaptureBackBuffer( + 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(RemoteDevice.Msg1_EndCaptureBackBuffer); + RemoteDevice.Msg1_EndCaptureBackBuffer* captureBackBufferPtr = (RemoteDevice.Msg1_EndCaptureBackBuffer*)_priv_portUse.AllocMessageBuffer(size); + captureBackBufferPtr->_priv_size = size; + captureBackBufferPtr->_priv_msgid = 1U; + captureBackBufferPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)captureBackBufferPtr, ref RemoteDevice.s_priv_ByteOrder_Msg1_EndCaptureBackBuffer, typeof(RemoteDevice.Msg1_EndCaptureBackBuffer), 0, 0); + _priv_pmsgUse = (Message*)captureBackBufferPtr; + } + + public unsafe void SendEndCaptureBackBuffer() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildEndCaptureBackBuffer(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildBeginCaptureBackBuffer( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stFileName) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteDevice.Msg2_BeginCaptureBackBuffer)); + BLOBREF blobref = blobInfo.Add(stFileName); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteDevice.Msg2_BeginCaptureBackBuffer* captureBackBufferPtr = (RemoteDevice.Msg2_BeginCaptureBackBuffer*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + captureBackBufferPtr->_priv_size = adjustedTotalSize; + captureBackBufferPtr->_priv_msgid = 2U; + captureBackBufferPtr->stFileName = blobref; + blobInfo.Attach((Message*)captureBackBufferPtr); + captureBackBufferPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)captureBackBufferPtr, ref RemoteDevice.s_priv_ByteOrder_Msg2_BeginCaptureBackBuffer, typeof(RemoteDevice.Msg2_BeginCaptureBackBuffer), 0, 0); + _priv_pmsgUse = (Message*)captureBackBufferPtr; + } + + public unsafe void SendBeginCaptureBackBuffer(string stFileName) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildBeginCaptureBackBuffer(out _priv_portUse, out _priv_pmsgUse, stFileName); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildCreateGradient( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RENDERHANDLE idNewGradient) + { + 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(RemoteDevice.Msg3_CreateGradient); + RemoteDevice.Msg3_CreateGradient* msg3CreateGradientPtr = (RemoteDevice.Msg3_CreateGradient*)_priv_portUse.AllocMessageBuffer(size); + msg3CreateGradientPtr->_priv_size = size; + msg3CreateGradientPtr->_priv_msgid = 3U; + msg3CreateGradientPtr->idNewGradient = idNewGradient; + msg3CreateGradientPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg3CreateGradientPtr, ref RemoteDevice.s_priv_ByteOrder_Msg3_CreateGradient, typeof(RemoteDevice.Msg3_CreateGradient), 0, 0); + _priv_pmsgUse = (Message*)msg3CreateGradientPtr; + } + + public unsafe void SendCreateGradient(RENDERHANDLE idNewGradient) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildCreateGradient(out _priv_portUse, out _priv_pmsgUse, idNewGradient); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildStop(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(RemoteDevice.Msg4_Stop); + RemoteDevice.Msg4_Stop* msg4StopPtr = (RemoteDevice.Msg4_Stop*)_priv_portUse.AllocMessageBuffer(size); + msg4StopPtr->_priv_size = size; + msg4StopPtr->_priv_msgid = 4U; + msg4StopPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4StopPtr, ref RemoteDevice.s_priv_ByteOrder_Msg4_Stop, typeof(RemoteDevice.Msg4_Stop), 0, 0); + _priv_pmsgUse = (Message*)msg4StopPtr; + } + + public unsafe void SendStop() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildStop(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRestart( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint nRenderGeneration) + { + 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(RemoteDevice.Msg5_Restart); + RemoteDevice.Msg5_Restart* msg5RestartPtr = (RemoteDevice.Msg5_Restart*)_priv_portUse.AllocMessageBuffer(size); + msg5RestartPtr->_priv_size = size; + msg5RestartPtr->_priv_msgid = 5U; + msg5RestartPtr->nRenderGeneration = nRenderGeneration; + msg5RestartPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg5RestartPtr, ref RemoteDevice.s_priv_ByteOrder_Msg5_Restart, typeof(RemoteDevice.Msg5_Restart), 0, 0); + _priv_pmsgUse = (Message*)msg5RestartPtr; + } + + public unsafe void SendRestart(uint nRenderGeneration) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRestart(out _priv_portUse, out _priv_pmsgUse, nRenderGeneration); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildCreateSurfacePool( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RENDERHANDLE idNewSurface, + SurfaceFormat nFormat) + { + 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(RemoteDevice.Msg6_CreateSurfacePool); + RemoteDevice.Msg6_CreateSurfacePool* createSurfacePoolPtr = (RemoteDevice.Msg6_CreateSurfacePool*)_priv_portUse.AllocMessageBuffer(size); + createSurfacePoolPtr->_priv_size = size; + createSurfacePoolPtr->_priv_msgid = 6U; + createSurfacePoolPtr->idNewSurface = idNewSurface; + createSurfacePoolPtr->nFormat = nFormat; + createSurfacePoolPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)createSurfacePoolPtr, ref RemoteDevice.s_priv_ByteOrder_Msg6_CreateSurfacePool, typeof(RemoteDevice.Msg6_CreateSurfacePool), 0, 0); + _priv_pmsgUse = (Message*)createSurfacePoolPtr; + } + + public unsafe void SendCreateSurfacePool(RENDERHANDLE idNewSurface, SurfaceFormat nFormat) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildCreateSurfacePool(out _priv_portUse, out _priv_pmsgUse, idNewSurface, nFormat); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteDevice CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteDevice(port, handle, true); + + public static RemoteDevice CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteDevice(port, handle, false); + } + + protected RemoteDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteDevice(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteDevice && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_TriggerDeviceReset + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg1_EndCaptureBackBuffer + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg2_BeginCaptureBackBuffer + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stFileName; + } + + [ComVisible(false)] + private struct Msg3_CreateGradient + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE idNewGradient; + } + + [ComVisible(false)] + private struct Msg4_Stop + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg5_Restart + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint nRenderGeneration; + } + + [ComVisible(false)] + private struct Msg6_CreateSurfacePool + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE idNewSurface; + public SurfaceFormat nFormat; + } } - - public unsafe void BuildTriggerDeviceReset( - 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 (RemoteDevice.Msg0_TriggerDeviceReset); - RemoteDevice.Msg0_TriggerDeviceReset* triggerDeviceResetPtr = (RemoteDevice.Msg0_TriggerDeviceReset*) _priv_portUse.AllocMessageBuffer(size); - triggerDeviceResetPtr->_priv_size = size; - triggerDeviceResetPtr->_priv_msgid = 0U; - triggerDeviceResetPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) triggerDeviceResetPtr, ref RemoteDevice.s_priv_ByteOrder_Msg0_TriggerDeviceReset, typeof (RemoteDevice.Msg0_TriggerDeviceReset), 0, 0); - _priv_pmsgUse = (Message*) triggerDeviceResetPtr; - } - - public unsafe void SendTriggerDeviceReset() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildTriggerDeviceReset(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildEndCaptureBackBuffer( - 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 (RemoteDevice.Msg1_EndCaptureBackBuffer); - RemoteDevice.Msg1_EndCaptureBackBuffer* captureBackBufferPtr = (RemoteDevice.Msg1_EndCaptureBackBuffer*) _priv_portUse.AllocMessageBuffer(size); - captureBackBufferPtr->_priv_size = size; - captureBackBufferPtr->_priv_msgid = 1U; - captureBackBufferPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) captureBackBufferPtr, ref RemoteDevice.s_priv_ByteOrder_Msg1_EndCaptureBackBuffer, typeof (RemoteDevice.Msg1_EndCaptureBackBuffer), 0, 0); - _priv_pmsgUse = (Message*) captureBackBufferPtr; - } - - public unsafe void SendEndCaptureBackBuffer() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildEndCaptureBackBuffer(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildBeginCaptureBackBuffer( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stFileName) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteDevice.Msg2_BeginCaptureBackBuffer)); - BLOBREF blobref = blobInfo.Add(stFileName); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteDevice.Msg2_BeginCaptureBackBuffer* captureBackBufferPtr = (RemoteDevice.Msg2_BeginCaptureBackBuffer*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - captureBackBufferPtr->_priv_size = adjustedTotalSize; - captureBackBufferPtr->_priv_msgid = 2U; - captureBackBufferPtr->stFileName = blobref; - blobInfo.Attach((Message*) captureBackBufferPtr); - captureBackBufferPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) captureBackBufferPtr, ref RemoteDevice.s_priv_ByteOrder_Msg2_BeginCaptureBackBuffer, typeof (RemoteDevice.Msg2_BeginCaptureBackBuffer), 0, 0); - _priv_pmsgUse = (Message*) captureBackBufferPtr; - } - - public unsafe void SendBeginCaptureBackBuffer(string stFileName) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildBeginCaptureBackBuffer(out _priv_portUse, out _priv_pmsgUse, stFileName); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildCreateGradient( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RENDERHANDLE idNewGradient) - { - 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 (RemoteDevice.Msg3_CreateGradient); - RemoteDevice.Msg3_CreateGradient* msg3CreateGradientPtr = (RemoteDevice.Msg3_CreateGradient*) _priv_portUse.AllocMessageBuffer(size); - msg3CreateGradientPtr->_priv_size = size; - msg3CreateGradientPtr->_priv_msgid = 3U; - msg3CreateGradientPtr->idNewGradient = idNewGradient; - msg3CreateGradientPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg3CreateGradientPtr, ref RemoteDevice.s_priv_ByteOrder_Msg3_CreateGradient, typeof (RemoteDevice.Msg3_CreateGradient), 0, 0); - _priv_pmsgUse = (Message*) msg3CreateGradientPtr; - } - - public unsafe void SendCreateGradient(RENDERHANDLE idNewGradient) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildCreateGradient(out _priv_portUse, out _priv_pmsgUse, idNewGradient); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildStop(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 (RemoteDevice.Msg4_Stop); - RemoteDevice.Msg4_Stop* msg4StopPtr = (RemoteDevice.Msg4_Stop*) _priv_portUse.AllocMessageBuffer(size); - msg4StopPtr->_priv_size = size; - msg4StopPtr->_priv_msgid = 4U; - msg4StopPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4StopPtr, ref RemoteDevice.s_priv_ByteOrder_Msg4_Stop, typeof (RemoteDevice.Msg4_Stop), 0, 0); - _priv_pmsgUse = (Message*) msg4StopPtr; - } - - public unsafe void SendStop() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildStop(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRestart( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint nRenderGeneration) - { - 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 (RemoteDevice.Msg5_Restart); - RemoteDevice.Msg5_Restart* msg5RestartPtr = (RemoteDevice.Msg5_Restart*) _priv_portUse.AllocMessageBuffer(size); - msg5RestartPtr->_priv_size = size; - msg5RestartPtr->_priv_msgid = 5U; - msg5RestartPtr->nRenderGeneration = nRenderGeneration; - msg5RestartPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg5RestartPtr, ref RemoteDevice.s_priv_ByteOrder_Msg5_Restart, typeof (RemoteDevice.Msg5_Restart), 0, 0); - _priv_pmsgUse = (Message*) msg5RestartPtr; - } - - public unsafe void SendRestart(uint nRenderGeneration) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRestart(out _priv_portUse, out _priv_pmsgUse, nRenderGeneration); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildCreateSurfacePool( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RENDERHANDLE idNewSurface, - SurfaceFormat nFormat) - { - 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 (RemoteDevice.Msg6_CreateSurfacePool); - RemoteDevice.Msg6_CreateSurfacePool* createSurfacePoolPtr = (RemoteDevice.Msg6_CreateSurfacePool*) _priv_portUse.AllocMessageBuffer(size); - createSurfacePoolPtr->_priv_size = size; - createSurfacePoolPtr->_priv_msgid = 6U; - createSurfacePoolPtr->idNewSurface = idNewSurface; - createSurfacePoolPtr->nFormat = nFormat; - createSurfacePoolPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) createSurfacePoolPtr, ref RemoteDevice.s_priv_ByteOrder_Msg6_CreateSurfacePool, typeof (RemoteDevice.Msg6_CreateSurfacePool), 0, 0); - _priv_pmsgUse = (Message*) createSurfacePoolPtr; - } - - public unsafe void SendCreateSurfacePool(RENDERHANDLE idNewSurface, SurfaceFormat nFormat) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildCreateSurfacePool(out _priv_portUse, out _priv_pmsgUse, idNewSurface, nFormat); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteDevice CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteDevice(port, handle, true); - - public static RemoteDevice CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteDevice(port, handle, false); - } - - protected RemoteDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteDevice(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteDevice && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_TriggerDeviceReset - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg1_EndCaptureBackBuffer - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg2_BeginCaptureBackBuffer - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stFileName; - } - - [ComVisible(false)] - private struct Msg3_CreateGradient - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE idNewGradient; - } - - [ComVisible(false)] - private struct Msg4_Stop - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg5_Restart - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint nRenderGeneration; - } - - [ComVisible(false)] - private struct Msg6_CreateSurfacePool - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE idNewSurface; - public SurfaceFormat nFormat; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Device.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Device.cs index 3f994b0..18f207a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Device.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Device.cs @@ -10,153 +10,153 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteDx9Device : RemoteDevice - { - private static ushort[] s_priv_ByteOrder_Msg8_CreateVideoPool; - private static ushort[] s_priv_ByteOrder_Msg9_EndVideoSurfaceAllocation; - private static ushort[] s_priv_ByteOrder_Msg10_BeginVideoSurfaceAllocation; - - protected RemoteDx9Device() + internal class RemoteDx9Device : RemoteDevice { + private static ushort[] s_priv_ByteOrder_Msg8_CreateVideoPool; + private static ushort[] s_priv_ByteOrder_Msg9_EndVideoSurfaceAllocation; + private static ushort[] s_priv_ByteOrder_Msg10_BeginVideoSurfaceAllocation; + + protected RemoteDx9Device() + { + } + + public unsafe void BuildCreateVideoPool( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + LocalVideoPoolCallback cbOwner, + RENDERHANDLE idNewSurface) + { + 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(RemoteDx9Device.Msg8_CreateVideoPool); + RemoteDx9Device.Msg8_CreateVideoPool* msg8CreateVideoPoolPtr = (RemoteDx9Device.Msg8_CreateVideoPool*)_priv_portUse.AllocMessageBuffer(size); + msg8CreateVideoPoolPtr->_priv_size = size; + msg8CreateVideoPoolPtr->_priv_msgid = 8U; + msg8CreateVideoPoolPtr->_priv_objcbOwner = cbOwner.RenderHandle; + msg8CreateVideoPoolPtr->_priv_ctxcbOwner = _priv_portUse.Session.LocalContext; + msg8CreateVideoPoolPtr->idNewSurface = idNewSurface; + msg8CreateVideoPoolPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg8CreateVideoPoolPtr, ref RemoteDx9Device.s_priv_ByteOrder_Msg8_CreateVideoPool, typeof(RemoteDx9Device.Msg8_CreateVideoPool), 0, 0); + _priv_pmsgUse = (Message*)msg8CreateVideoPoolPtr; + } + + public unsafe void SendCreateVideoPool( + LocalVideoPoolCallback cbOwner, + RENDERHANDLE idNewSurface) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildCreateVideoPool(out _priv_portUse, out _priv_pmsgUse, cbOwner, idNewSurface); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildEndVideoSurfaceAllocation( + 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(RemoteDx9Device.Msg9_EndVideoSurfaceAllocation); + RemoteDx9Device.Msg9_EndVideoSurfaceAllocation* surfaceAllocationPtr = (RemoteDx9Device.Msg9_EndVideoSurfaceAllocation*)_priv_portUse.AllocMessageBuffer(size); + surfaceAllocationPtr->_priv_size = size; + surfaceAllocationPtr->_priv_msgid = 9U; + surfaceAllocationPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)surfaceAllocationPtr, ref RemoteDx9Device.s_priv_ByteOrder_Msg9_EndVideoSurfaceAllocation, typeof(RemoteDx9Device.Msg9_EndVideoSurfaceAllocation), 0, 0); + _priv_pmsgUse = (Message*)surfaceAllocationPtr; + } + + public unsafe void SendEndVideoSurfaceAllocation() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildEndVideoSurfaceAllocation(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildBeginVideoSurfaceAllocation( + 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(RemoteDx9Device.Msg10_BeginVideoSurfaceAllocation); + RemoteDx9Device.Msg10_BeginVideoSurfaceAllocation* surfaceAllocationPtr = (RemoteDx9Device.Msg10_BeginVideoSurfaceAllocation*)_priv_portUse.AllocMessageBuffer(size); + surfaceAllocationPtr->_priv_size = size; + surfaceAllocationPtr->_priv_msgid = 10U; + surfaceAllocationPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)surfaceAllocationPtr, ref RemoteDx9Device.s_priv_ByteOrder_Msg10_BeginVideoSurfaceAllocation, typeof(RemoteDx9Device.Msg10_BeginVideoSurfaceAllocation), 0, 0); + _priv_pmsgUse = (Message*)surfaceAllocationPtr; + } + + public unsafe void SendBeginVideoSurfaceAllocation() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildBeginVideoSurfaceAllocation(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteDx9Device CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteDx9Device(port, handle, true); + } + + public static RemoteDx9Device CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteDx9Device(port, handle, false); + } + + protected RemoteDx9Device(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteDx9Device(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteDx9Device && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg8_CreateVideoPool + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE _priv_objcbOwner; + public ContextID _priv_ctxcbOwner; + public RENDERHANDLE idNewSurface; + } + + [ComVisible(false)] + private struct Msg9_EndVideoSurfaceAllocation + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg10_BeginVideoSurfaceAllocation + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } } - - public unsafe void BuildCreateVideoPool( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - LocalVideoPoolCallback cbOwner, - RENDERHANDLE idNewSurface) - { - 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 (RemoteDx9Device.Msg8_CreateVideoPool); - RemoteDx9Device.Msg8_CreateVideoPool* msg8CreateVideoPoolPtr = (RemoteDx9Device.Msg8_CreateVideoPool*) _priv_portUse.AllocMessageBuffer(size); - msg8CreateVideoPoolPtr->_priv_size = size; - msg8CreateVideoPoolPtr->_priv_msgid = 8U; - msg8CreateVideoPoolPtr->_priv_objcbOwner = cbOwner.RenderHandle; - msg8CreateVideoPoolPtr->_priv_ctxcbOwner = _priv_portUse.Session.LocalContext; - msg8CreateVideoPoolPtr->idNewSurface = idNewSurface; - msg8CreateVideoPoolPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg8CreateVideoPoolPtr, ref RemoteDx9Device.s_priv_ByteOrder_Msg8_CreateVideoPool, typeof (RemoteDx9Device.Msg8_CreateVideoPool), 0, 0); - _priv_pmsgUse = (Message*) msg8CreateVideoPoolPtr; - } - - public unsafe void SendCreateVideoPool( - LocalVideoPoolCallback cbOwner, - RENDERHANDLE idNewSurface) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildCreateVideoPool(out _priv_portUse, out _priv_pmsgUse, cbOwner, idNewSurface); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildEndVideoSurfaceAllocation( - 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 (RemoteDx9Device.Msg9_EndVideoSurfaceAllocation); - RemoteDx9Device.Msg9_EndVideoSurfaceAllocation* surfaceAllocationPtr = (RemoteDx9Device.Msg9_EndVideoSurfaceAllocation*) _priv_portUse.AllocMessageBuffer(size); - surfaceAllocationPtr->_priv_size = size; - surfaceAllocationPtr->_priv_msgid = 9U; - surfaceAllocationPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) surfaceAllocationPtr, ref RemoteDx9Device.s_priv_ByteOrder_Msg9_EndVideoSurfaceAllocation, typeof (RemoteDx9Device.Msg9_EndVideoSurfaceAllocation), 0, 0); - _priv_pmsgUse = (Message*) surfaceAllocationPtr; - } - - public unsafe void SendEndVideoSurfaceAllocation() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildEndVideoSurfaceAllocation(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildBeginVideoSurfaceAllocation( - 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 (RemoteDx9Device.Msg10_BeginVideoSurfaceAllocation); - RemoteDx9Device.Msg10_BeginVideoSurfaceAllocation* surfaceAllocationPtr = (RemoteDx9Device.Msg10_BeginVideoSurfaceAllocation*) _priv_portUse.AllocMessageBuffer(size); - surfaceAllocationPtr->_priv_size = size; - surfaceAllocationPtr->_priv_msgid = 10U; - surfaceAllocationPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) surfaceAllocationPtr, ref RemoteDx9Device.s_priv_ByteOrder_Msg10_BeginVideoSurfaceAllocation, typeof (RemoteDx9Device.Msg10_BeginVideoSurfaceAllocation), 0, 0); - _priv_pmsgUse = (Message*) surfaceAllocationPtr; - } - - public unsafe void SendBeginVideoSurfaceAllocation() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildBeginVideoSurfaceAllocation(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteDx9Device CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteDx9Device(port, handle, true); - } - - public static RemoteDx9Device CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteDx9Device(port, handle, false); - } - - protected RemoteDx9Device(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteDx9Device(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteDx9Device && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg8_CreateVideoPool - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE _priv_objcbOwner; - public ContextID _priv_ctxcbOwner; - public RENDERHANDLE idNewSurface; - } - - [ComVisible(false)] - private struct Msg9_EndVideoSurfaceAllocation - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg10_BeginVideoSurfaceAllocation - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Effect.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Effect.cs index e673239..6473313 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Effect.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Effect.cs @@ -10,91 +10,91 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteDx9Effect : RemoteEffect - { - private static ushort[] s_priv_ByteOrder_Msg8_LoadEffectResource; - - protected RemoteDx9Effect() + internal class RemoteDx9Effect : RemoteEffect { + private static ushort[] s_priv_ByteOrder_Msg8_LoadEffectResource; + + protected RemoteDx9Effect() + { + } + + public static unsafe RemoteDx9Effect Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE effectClassHandle = _priv_protocolInstance.Dx9Effect_ClassHandle; + RemoteDx9Effect remoteDx9Effect = new RemoteDx9Effect(port, _priv_owner); + port.CreateRemoteObject(effectClassHandle, remoteDx9Effect.m_renderHandle, (Message*)null); + return remoteDx9Effect; + } + + public unsafe void BuildLoadEffectResource( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteDx9EffectResource effectResource) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + if (effectResource != null) + _priv_portUse.ValidateHandleOrNull(effectResource.RenderHandle); + uint size = (uint)sizeof(RemoteDx9Effect.Msg8_LoadEffectResource); + RemoteDx9Effect.Msg8_LoadEffectResource* loadEffectResourcePtr = (RemoteDx9Effect.Msg8_LoadEffectResource*)_priv_portUse.AllocMessageBuffer(size); + loadEffectResourcePtr->_priv_size = size; + loadEffectResourcePtr->_priv_msgid = 8U; + loadEffectResourcePtr->effectResource = effectResource != null ? effectResource.RenderHandle : RENDERHANDLE.NULL; + loadEffectResourcePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)loadEffectResourcePtr, ref RemoteDx9Effect.s_priv_ByteOrder_Msg8_LoadEffectResource, typeof(RemoteDx9Effect.Msg8_LoadEffectResource), 0, 0); + _priv_pmsgUse = (Message*)loadEffectResourcePtr; + } + + public unsafe void SendLoadEffectResource(RemoteDx9EffectResource effectResource) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildLoadEffectResource(out _priv_portUse, out _priv_pmsgUse, effectResource); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteDx9Effect CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteDx9Effect(port, handle, true); + } + + public static RemoteDx9Effect CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteDx9Effect(port, handle, false); + } + + protected RemoteDx9Effect(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteDx9Effect(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteDx9Effect && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg8_LoadEffectResource + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE effectResource; + } } - - public static unsafe RemoteDx9Effect Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE effectClassHandle = _priv_protocolInstance.Dx9Effect_ClassHandle; - RemoteDx9Effect remoteDx9Effect = new RemoteDx9Effect(port, _priv_owner); - port.CreateRemoteObject(effectClassHandle, remoteDx9Effect.m_renderHandle, (Message*) null); - return remoteDx9Effect; - } - - public unsafe void BuildLoadEffectResource( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteDx9EffectResource effectResource) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - if (effectResource != null) - _priv_portUse.ValidateHandleOrNull(effectResource.RenderHandle); - uint size = (uint) sizeof (RemoteDx9Effect.Msg8_LoadEffectResource); - RemoteDx9Effect.Msg8_LoadEffectResource* loadEffectResourcePtr = (RemoteDx9Effect.Msg8_LoadEffectResource*) _priv_portUse.AllocMessageBuffer(size); - loadEffectResourcePtr->_priv_size = size; - loadEffectResourcePtr->_priv_msgid = 8U; - loadEffectResourcePtr->effectResource = effectResource != null ? effectResource.RenderHandle : RENDERHANDLE.NULL; - loadEffectResourcePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) loadEffectResourcePtr, ref RemoteDx9Effect.s_priv_ByteOrder_Msg8_LoadEffectResource, typeof (RemoteDx9Effect.Msg8_LoadEffectResource), 0, 0); - _priv_pmsgUse = (Message*) loadEffectResourcePtr; - } - - public unsafe void SendLoadEffectResource(RemoteDx9EffectResource effectResource) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildLoadEffectResource(out _priv_portUse, out _priv_pmsgUse, effectResource); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteDx9Effect CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteDx9Effect(port, handle, true); - } - - public static RemoteDx9Effect CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteDx9Effect(port, handle, false); - } - - protected RemoteDx9Effect(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteDx9Effect(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteDx9Effect && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg8_LoadEffectResource - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE effectResource; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9EffectResource.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9EffectResource.cs index 98936e0..d0616f7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9EffectResource.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9EffectResource.cs @@ -11,511 +11,511 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteDx9EffectResource : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg10_Create; - private static ushort[] s_priv_ByteOrder_Msg0_SetDebugID; - private static ushort[] s_priv_ByteOrder_Msg1_SetGutterSize; - private static ushort[] s_priv_ByteOrder_Msg2_PostPropertiesAdded; - private static ushort[] s_priv_ByteOrder_Msg3_AddTextureRequirements; - private static ushort[] s_priv_ByteOrder_Msg4_AddProperty; - private static ushort[] s_priv_ByteOrder_Msg5_AddProperty; - private static ushort[] s_priv_ByteOrder_Msg6_AddProperty; - private static ushort[] s_priv_ByteOrder_Msg7_AddProperty; - private static ushort[] s_priv_ByteOrder_Msg8_AddProperty; - private static ushort[] s_priv_ByteOrder_Msg9_AddProperty; - - protected RemoteDx9EffectResource() + internal class RemoteDx9EffectResource : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg10_Create; + private static ushort[] s_priv_ByteOrder_Msg0_SetDebugID; + private static ushort[] s_priv_ByteOrder_Msg1_SetGutterSize; + private static ushort[] s_priv_ByteOrder_Msg2_PostPropertiesAdded; + private static ushort[] s_priv_ByteOrder_Msg3_AddTextureRequirements; + private static ushort[] s_priv_ByteOrder_Msg4_AddProperty; + private static ushort[] s_priv_ByteOrder_Msg5_AddProperty; + private static ushort[] s_priv_ByteOrder_Msg6_AddProperty; + private static ushort[] s_priv_ByteOrder_Msg7_AddProperty; + private static ushort[] s_priv_ByteOrder_Msg8_AddProperty; + private static ushort[] s_priv_ByteOrder_Msg9_AddProperty; + + protected RemoteDx9EffectResource() + { + } + + public static unsafe RemoteDx9EffectResource Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + RemoteDevice devOwner, + RemoteDataBuffer dataBuffer) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE resourceClassHandle = _priv_protocolInstance.Dx9EffectResource_ClassHandle; + RemoteDx9EffectResource dx9EffectResource = new RemoteDx9EffectResource(port, _priv_owner); + uint num = (uint)sizeof(RemoteDx9EffectResource.Msg10_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteDx9EffectResource.Msg10_Create* msg10CreatePtr = (RemoteDx9EffectResource.Msg10_Create*)pMem; + msg10CreatePtr->_priv_size = num; + msg10CreatePtr->_priv_msgid = 10U; + msg10CreatePtr->devOwner = devOwner != null ? devOwner.RenderHandle : RENDERHANDLE.NULL; + msg10CreatePtr->dataBuffer = dataBuffer != null ? dataBuffer.RenderHandle : RENDERHANDLE.NULL; + msg10CreatePtr->_priv_idObjectSubject = dx9EffectResource.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg10_Create, typeof(RemoteDx9EffectResource.Msg10_Create), 0, 0); + port.CreateRemoteObject(resourceClassHandle, dx9EffectResource.m_renderHandle, (Message*)msg10CreatePtr); + return dx9EffectResource; + } + + public unsafe void BuildSetDebugID( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stDebugID) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteDx9EffectResource.Msg0_SetDebugID)); + BLOBREF blobref = blobInfo.Add(stDebugID); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteDx9EffectResource.Msg0_SetDebugID* msg0SetDebugIdPtr = (RemoteDx9EffectResource.Msg0_SetDebugID*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg0SetDebugIdPtr->_priv_size = adjustedTotalSize; + msg0SetDebugIdPtr->_priv_msgid = 0U; + msg0SetDebugIdPtr->stDebugID = blobref; + blobInfo.Attach((Message*)msg0SetDebugIdPtr); + msg0SetDebugIdPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0SetDebugIdPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg0_SetDebugID, typeof(RemoteDx9EffectResource.Msg0_SetDebugID), 0, 0); + _priv_pmsgUse = (Message*)msg0SetDebugIdPtr; + } + + public unsafe void SendSetDebugID(string stDebugID) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetDebugID(out _priv_portUse, out _priv_pmsgUse, stDebugID); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetGutterSize( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Size sizeGutterPxl) + { + 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(RemoteDx9EffectResource.Msg1_SetGutterSize); + RemoteDx9EffectResource.Msg1_SetGutterSize* msg1SetGutterSizePtr = (RemoteDx9EffectResource.Msg1_SetGutterSize*)_priv_portUse.AllocMessageBuffer(size); + msg1SetGutterSizePtr->_priv_size = size; + msg1SetGutterSizePtr->_priv_msgid = 1U; + msg1SetGutterSizePtr->sizeGutterPxl = sizeGutterPxl; + msg1SetGutterSizePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1SetGutterSizePtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg1_SetGutterSize, typeof(RemoteDx9EffectResource.Msg1_SetGutterSize), 0, 0); + _priv_pmsgUse = (Message*)msg1SetGutterSizePtr; + } + + public unsafe void SendSetGutterSize(Size sizeGutterPxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetGutterSize(out _priv_portUse, out _priv_pmsgUse, sizeGutterPxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildPostPropertiesAdded( + 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(RemoteDx9EffectResource.Msg2_PostPropertiesAdded); + RemoteDx9EffectResource.Msg2_PostPropertiesAdded* postPropertiesAddedPtr = (RemoteDx9EffectResource.Msg2_PostPropertiesAdded*)_priv_portUse.AllocMessageBuffer(size); + postPropertiesAddedPtr->_priv_size = size; + postPropertiesAddedPtr->_priv_msgid = 2U; + postPropertiesAddedPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)postPropertiesAddedPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg2_PostPropertiesAdded, typeof(RemoteDx9EffectResource.Msg2_PostPropertiesAdded), 0, 0); + _priv_pmsgUse = (Message*)postPropertiesAddedPtr; + } + + public unsafe void SendPostPropertiesAdded() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildPostPropertiesAdded(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddTextureRequirements( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxImage, + int nRequirements, + string stTexelSize, + string stTexUVSize, + string stTexUVRefPoint, + int nDownsamplePropertyID) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteDx9EffectResource.Msg3_AddTextureRequirements)); + BLOBREF blobref1 = blobInfo.Add(stTexelSize); + BLOBREF blobref2 = blobInfo.Add(stTexUVSize); + BLOBREF blobref3 = blobInfo.Add(stTexUVRefPoint); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteDx9EffectResource.Msg3_AddTextureRequirements* textureRequirementsPtr = (RemoteDx9EffectResource.Msg3_AddTextureRequirements*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + textureRequirementsPtr->_priv_size = adjustedTotalSize; + textureRequirementsPtr->_priv_msgid = 3U; + textureRequirementsPtr->idxImage = idxImage; + textureRequirementsPtr->nRequirements = nRequirements; + textureRequirementsPtr->stTexelSize = blobref1; + textureRequirementsPtr->stTexUVSize = blobref2; + textureRequirementsPtr->stTexUVRefPoint = blobref3; + textureRequirementsPtr->nDownsamplePropertyID = nDownsamplePropertyID; + blobInfo.Attach((Message*)textureRequirementsPtr); + textureRequirementsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)textureRequirementsPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg3_AddTextureRequirements, typeof(RemoteDx9EffectResource.Msg3_AddTextureRequirements), 0, 0); + _priv_pmsgUse = (Message*)textureRequirementsPtr; + } + + public unsafe void SendAddTextureRequirements( + int idxImage, + int nRequirements, + string stTexelSize, + string stTexUVSize, + string stTexUVRefPoint, + int nDownsamplePropertyID) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddTextureRequirements(out _priv_portUse, out _priv_pmsgUse, idxImage, nRequirements, stTexelSize, stTexUVSize, stTexUVRefPoint, nDownsamplePropertyID); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stName, + int nCoordinateMapID, + int nImageIndexID) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteDx9EffectResource.Msg4_AddProperty)); + BLOBREF blobref = blobInfo.Add(stName); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteDx9EffectResource.Msg4_AddProperty* msg4AddPropertyPtr = (RemoteDx9EffectResource.Msg4_AddProperty*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg4AddPropertyPtr->_priv_size = adjustedTotalSize; + msg4AddPropertyPtr->_priv_msgid = 4U; + msg4AddPropertyPtr->stName = blobref; + msg4AddPropertyPtr->nCoordinateMapID = nCoordinateMapID; + msg4AddPropertyPtr->nImageIndexID = nImageIndexID; + blobInfo.Attach((Message*)msg4AddPropertyPtr); + msg4AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg4_AddProperty, typeof(RemoteDx9EffectResource.Msg4_AddProperty), 0, 0); + _priv_pmsgUse = (Message*)msg4AddPropertyPtr; + } + + public unsafe void SendAddProperty(string stName, int nCoordinateMapID, int nImageIndexID) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, nCoordinateMapID, nImageIndexID); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stName, + Vector4 vValue) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteDx9EffectResource.Msg5_AddProperty)); + BLOBREF blobref = blobInfo.Add(stName); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteDx9EffectResource.Msg5_AddProperty* msg5AddPropertyPtr = (RemoteDx9EffectResource.Msg5_AddProperty*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg5AddPropertyPtr->_priv_size = adjustedTotalSize; + msg5AddPropertyPtr->_priv_msgid = 5U; + msg5AddPropertyPtr->stName = blobref; + msg5AddPropertyPtr->vValue = vValue; + blobInfo.Attach((Message*)msg5AddPropertyPtr); + msg5AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg5AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg5_AddProperty, typeof(RemoteDx9EffectResource.Msg5_AddProperty), 0, 0); + _priv_pmsgUse = (Message*)msg5AddPropertyPtr; + } + + public unsafe void SendAddProperty(string stName, Vector4 vValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, vValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stName, + Vector3 vValue) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteDx9EffectResource.Msg6_AddProperty)); + BLOBREF blobref = blobInfo.Add(stName); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteDx9EffectResource.Msg6_AddProperty* msg6AddPropertyPtr = (RemoteDx9EffectResource.Msg6_AddProperty*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg6AddPropertyPtr->_priv_size = adjustedTotalSize; + msg6AddPropertyPtr->_priv_msgid = 6U; + msg6AddPropertyPtr->stName = blobref; + msg6AddPropertyPtr->vValue = vValue; + blobInfo.Attach((Message*)msg6AddPropertyPtr); + msg6AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg6AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg6_AddProperty, typeof(RemoteDx9EffectResource.Msg6_AddProperty), 0, 0); + _priv_pmsgUse = (Message*)msg6AddPropertyPtr; + } + + public unsafe void SendAddProperty(string stName, Vector3 vValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, vValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stName, + Vector2 vValue) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteDx9EffectResource.Msg7_AddProperty)); + BLOBREF blobref = blobInfo.Add(stName); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteDx9EffectResource.Msg7_AddProperty* msg7AddPropertyPtr = (RemoteDx9EffectResource.Msg7_AddProperty*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg7AddPropertyPtr->_priv_size = adjustedTotalSize; + msg7AddPropertyPtr->_priv_msgid = 7U; + msg7AddPropertyPtr->stName = blobref; + msg7AddPropertyPtr->vValue = vValue; + blobInfo.Attach((Message*)msg7AddPropertyPtr); + msg7AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg7AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg7_AddProperty, typeof(RemoteDx9EffectResource.Msg7_AddProperty), 0, 0); + _priv_pmsgUse = (Message*)msg7AddPropertyPtr; + } + + public unsafe void SendAddProperty(string stName, Vector2 vValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, vValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stName, + float flValue) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteDx9EffectResource.Msg8_AddProperty)); + BLOBREF blobref = blobInfo.Add(stName); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteDx9EffectResource.Msg8_AddProperty* msg8AddPropertyPtr = (RemoteDx9EffectResource.Msg8_AddProperty*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg8AddPropertyPtr->_priv_size = adjustedTotalSize; + msg8AddPropertyPtr->_priv_msgid = 8U; + msg8AddPropertyPtr->stName = blobref; + msg8AddPropertyPtr->flValue = flValue; + blobInfo.Attach((Message*)msg8AddPropertyPtr); + msg8AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg8AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg8_AddProperty, typeof(RemoteDx9EffectResource.Msg8_AddProperty), 0, 0); + _priv_pmsgUse = (Message*)msg8AddPropertyPtr; + } + + public unsafe void SendAddProperty(string stName, float flValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, flValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stName, + int nValue) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteDx9EffectResource.Msg9_AddProperty)); + BLOBREF blobref = blobInfo.Add(stName); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteDx9EffectResource.Msg9_AddProperty* msg9AddPropertyPtr = (RemoteDx9EffectResource.Msg9_AddProperty*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg9AddPropertyPtr->_priv_size = adjustedTotalSize; + msg9AddPropertyPtr->_priv_msgid = 9U; + msg9AddPropertyPtr->stName = blobref; + msg9AddPropertyPtr->nValue = nValue; + blobInfo.Attach((Message*)msg9AddPropertyPtr); + msg9AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg9AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg9_AddProperty, typeof(RemoteDx9EffectResource.Msg9_AddProperty), 0, 0); + _priv_pmsgUse = (Message*)msg9AddPropertyPtr; + } + + public unsafe void SendAddProperty(string stName, int nValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, nValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteDx9EffectResource CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteDx9EffectResource(port, handle, true); + } + + public static RemoteDx9EffectResource CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteDx9EffectResource(port, handle, false); + } + + protected RemoteDx9EffectResource(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteDx9EffectResource(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteDx9EffectResource && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg10_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE devOwner; + public RENDERHANDLE dataBuffer; + } + + [ComVisible(false)] + private struct Msg0_SetDebugID + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stDebugID; + } + + [ComVisible(false)] + private struct Msg1_SetGutterSize + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Size sizeGutterPxl; + } + + [ComVisible(false)] + private struct Msg2_PostPropertiesAdded + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg3_AddTextureRequirements + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxImage; + public int nRequirements; + public BLOBREF stTexelSize; + public BLOBREF stTexUVSize; + public BLOBREF stTexUVRefPoint; + public int nDownsamplePropertyID; + } + + [ComVisible(false)] + private struct Msg4_AddProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stName; + public int nCoordinateMapID; + public int nImageIndexID; + } + + [ComVisible(false)] + private struct Msg5_AddProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stName; + public Vector4 vValue; + } + + [ComVisible(false)] + private struct Msg6_AddProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stName; + public Vector3 vValue; + } + + [ComVisible(false)] + private struct Msg7_AddProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stName; + public Vector2 vValue; + } + + [ComVisible(false)] + private struct Msg8_AddProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stName; + public float flValue; + } + + [ComVisible(false)] + private struct Msg9_AddProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stName; + public int nValue; + } } - - public static unsafe RemoteDx9EffectResource Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - RemoteDevice devOwner, - RemoteDataBuffer dataBuffer) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE resourceClassHandle = _priv_protocolInstance.Dx9EffectResource_ClassHandle; - RemoteDx9EffectResource dx9EffectResource = new RemoteDx9EffectResource(port, _priv_owner); - uint num = (uint) sizeof (RemoteDx9EffectResource.Msg10_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteDx9EffectResource.Msg10_Create* msg10CreatePtr = (RemoteDx9EffectResource.Msg10_Create*) pMem; - msg10CreatePtr->_priv_size = num; - msg10CreatePtr->_priv_msgid = 10U; - msg10CreatePtr->devOwner = devOwner != null ? devOwner.RenderHandle : RENDERHANDLE.NULL; - msg10CreatePtr->dataBuffer = dataBuffer != null ? dataBuffer.RenderHandle : RENDERHANDLE.NULL; - msg10CreatePtr->_priv_idObjectSubject = dx9EffectResource.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg10_Create, typeof (RemoteDx9EffectResource.Msg10_Create), 0, 0); - port.CreateRemoteObject(resourceClassHandle, dx9EffectResource.m_renderHandle, (Message*) msg10CreatePtr); - return dx9EffectResource; - } - - public unsafe void BuildSetDebugID( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stDebugID) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteDx9EffectResource.Msg0_SetDebugID)); - BLOBREF blobref = blobInfo.Add(stDebugID); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteDx9EffectResource.Msg0_SetDebugID* msg0SetDebugIdPtr = (RemoteDx9EffectResource.Msg0_SetDebugID*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg0SetDebugIdPtr->_priv_size = adjustedTotalSize; - msg0SetDebugIdPtr->_priv_msgid = 0U; - msg0SetDebugIdPtr->stDebugID = blobref; - blobInfo.Attach((Message*) msg0SetDebugIdPtr); - msg0SetDebugIdPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0SetDebugIdPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg0_SetDebugID, typeof (RemoteDx9EffectResource.Msg0_SetDebugID), 0, 0); - _priv_pmsgUse = (Message*) msg0SetDebugIdPtr; - } - - public unsafe void SendSetDebugID(string stDebugID) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetDebugID(out _priv_portUse, out _priv_pmsgUse, stDebugID); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetGutterSize( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Size sizeGutterPxl) - { - 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 (RemoteDx9EffectResource.Msg1_SetGutterSize); - RemoteDx9EffectResource.Msg1_SetGutterSize* msg1SetGutterSizePtr = (RemoteDx9EffectResource.Msg1_SetGutterSize*) _priv_portUse.AllocMessageBuffer(size); - msg1SetGutterSizePtr->_priv_size = size; - msg1SetGutterSizePtr->_priv_msgid = 1U; - msg1SetGutterSizePtr->sizeGutterPxl = sizeGutterPxl; - msg1SetGutterSizePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1SetGutterSizePtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg1_SetGutterSize, typeof (RemoteDx9EffectResource.Msg1_SetGutterSize), 0, 0); - _priv_pmsgUse = (Message*) msg1SetGutterSizePtr; - } - - public unsafe void SendSetGutterSize(Size sizeGutterPxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetGutterSize(out _priv_portUse, out _priv_pmsgUse, sizeGutterPxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildPostPropertiesAdded( - 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 (RemoteDx9EffectResource.Msg2_PostPropertiesAdded); - RemoteDx9EffectResource.Msg2_PostPropertiesAdded* postPropertiesAddedPtr = (RemoteDx9EffectResource.Msg2_PostPropertiesAdded*) _priv_portUse.AllocMessageBuffer(size); - postPropertiesAddedPtr->_priv_size = size; - postPropertiesAddedPtr->_priv_msgid = 2U; - postPropertiesAddedPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) postPropertiesAddedPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg2_PostPropertiesAdded, typeof (RemoteDx9EffectResource.Msg2_PostPropertiesAdded), 0, 0); - _priv_pmsgUse = (Message*) postPropertiesAddedPtr; - } - - public unsafe void SendPostPropertiesAdded() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildPostPropertiesAdded(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddTextureRequirements( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxImage, - int nRequirements, - string stTexelSize, - string stTexUVSize, - string stTexUVRefPoint, - int nDownsamplePropertyID) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteDx9EffectResource.Msg3_AddTextureRequirements)); - BLOBREF blobref1 = blobInfo.Add(stTexelSize); - BLOBREF blobref2 = blobInfo.Add(stTexUVSize); - BLOBREF blobref3 = blobInfo.Add(stTexUVRefPoint); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteDx9EffectResource.Msg3_AddTextureRequirements* textureRequirementsPtr = (RemoteDx9EffectResource.Msg3_AddTextureRequirements*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - textureRequirementsPtr->_priv_size = adjustedTotalSize; - textureRequirementsPtr->_priv_msgid = 3U; - textureRequirementsPtr->idxImage = idxImage; - textureRequirementsPtr->nRequirements = nRequirements; - textureRequirementsPtr->stTexelSize = blobref1; - textureRequirementsPtr->stTexUVSize = blobref2; - textureRequirementsPtr->stTexUVRefPoint = blobref3; - textureRequirementsPtr->nDownsamplePropertyID = nDownsamplePropertyID; - blobInfo.Attach((Message*) textureRequirementsPtr); - textureRequirementsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) textureRequirementsPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg3_AddTextureRequirements, typeof (RemoteDx9EffectResource.Msg3_AddTextureRequirements), 0, 0); - _priv_pmsgUse = (Message*) textureRequirementsPtr; - } - - public unsafe void SendAddTextureRequirements( - int idxImage, - int nRequirements, - string stTexelSize, - string stTexUVSize, - string stTexUVRefPoint, - int nDownsamplePropertyID) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddTextureRequirements(out _priv_portUse, out _priv_pmsgUse, idxImage, nRequirements, stTexelSize, stTexUVSize, stTexUVRefPoint, nDownsamplePropertyID); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stName, - int nCoordinateMapID, - int nImageIndexID) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteDx9EffectResource.Msg4_AddProperty)); - BLOBREF blobref = blobInfo.Add(stName); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteDx9EffectResource.Msg4_AddProperty* msg4AddPropertyPtr = (RemoteDx9EffectResource.Msg4_AddProperty*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg4AddPropertyPtr->_priv_size = adjustedTotalSize; - msg4AddPropertyPtr->_priv_msgid = 4U; - msg4AddPropertyPtr->stName = blobref; - msg4AddPropertyPtr->nCoordinateMapID = nCoordinateMapID; - msg4AddPropertyPtr->nImageIndexID = nImageIndexID; - blobInfo.Attach((Message*) msg4AddPropertyPtr); - msg4AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg4_AddProperty, typeof (RemoteDx9EffectResource.Msg4_AddProperty), 0, 0); - _priv_pmsgUse = (Message*) msg4AddPropertyPtr; - } - - public unsafe void SendAddProperty(string stName, int nCoordinateMapID, int nImageIndexID) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, nCoordinateMapID, nImageIndexID); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stName, - Vector4 vValue) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteDx9EffectResource.Msg5_AddProperty)); - BLOBREF blobref = blobInfo.Add(stName); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteDx9EffectResource.Msg5_AddProperty* msg5AddPropertyPtr = (RemoteDx9EffectResource.Msg5_AddProperty*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg5AddPropertyPtr->_priv_size = adjustedTotalSize; - msg5AddPropertyPtr->_priv_msgid = 5U; - msg5AddPropertyPtr->stName = blobref; - msg5AddPropertyPtr->vValue = vValue; - blobInfo.Attach((Message*) msg5AddPropertyPtr); - msg5AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg5AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg5_AddProperty, typeof (RemoteDx9EffectResource.Msg5_AddProperty), 0, 0); - _priv_pmsgUse = (Message*) msg5AddPropertyPtr; - } - - public unsafe void SendAddProperty(string stName, Vector4 vValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, vValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stName, - Vector3 vValue) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteDx9EffectResource.Msg6_AddProperty)); - BLOBREF blobref = blobInfo.Add(stName); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteDx9EffectResource.Msg6_AddProperty* msg6AddPropertyPtr = (RemoteDx9EffectResource.Msg6_AddProperty*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg6AddPropertyPtr->_priv_size = adjustedTotalSize; - msg6AddPropertyPtr->_priv_msgid = 6U; - msg6AddPropertyPtr->stName = blobref; - msg6AddPropertyPtr->vValue = vValue; - blobInfo.Attach((Message*) msg6AddPropertyPtr); - msg6AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg6AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg6_AddProperty, typeof (RemoteDx9EffectResource.Msg6_AddProperty), 0, 0); - _priv_pmsgUse = (Message*) msg6AddPropertyPtr; - } - - public unsafe void SendAddProperty(string stName, Vector3 vValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, vValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stName, - Vector2 vValue) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteDx9EffectResource.Msg7_AddProperty)); - BLOBREF blobref = blobInfo.Add(stName); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteDx9EffectResource.Msg7_AddProperty* msg7AddPropertyPtr = (RemoteDx9EffectResource.Msg7_AddProperty*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg7AddPropertyPtr->_priv_size = adjustedTotalSize; - msg7AddPropertyPtr->_priv_msgid = 7U; - msg7AddPropertyPtr->stName = blobref; - msg7AddPropertyPtr->vValue = vValue; - blobInfo.Attach((Message*) msg7AddPropertyPtr); - msg7AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg7AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg7_AddProperty, typeof (RemoteDx9EffectResource.Msg7_AddProperty), 0, 0); - _priv_pmsgUse = (Message*) msg7AddPropertyPtr; - } - - public unsafe void SendAddProperty(string stName, Vector2 vValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, vValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stName, - float flValue) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteDx9EffectResource.Msg8_AddProperty)); - BLOBREF blobref = blobInfo.Add(stName); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteDx9EffectResource.Msg8_AddProperty* msg8AddPropertyPtr = (RemoteDx9EffectResource.Msg8_AddProperty*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg8AddPropertyPtr->_priv_size = adjustedTotalSize; - msg8AddPropertyPtr->_priv_msgid = 8U; - msg8AddPropertyPtr->stName = blobref; - msg8AddPropertyPtr->flValue = flValue; - blobInfo.Attach((Message*) msg8AddPropertyPtr); - msg8AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg8AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg8_AddProperty, typeof (RemoteDx9EffectResource.Msg8_AddProperty), 0, 0); - _priv_pmsgUse = (Message*) msg8AddPropertyPtr; - } - - public unsafe void SendAddProperty(string stName, float flValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, flValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stName, - int nValue) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteDx9EffectResource.Msg9_AddProperty)); - BLOBREF blobref = blobInfo.Add(stName); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteDx9EffectResource.Msg9_AddProperty* msg9AddPropertyPtr = (RemoteDx9EffectResource.Msg9_AddProperty*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg9AddPropertyPtr->_priv_size = adjustedTotalSize; - msg9AddPropertyPtr->_priv_msgid = 9U; - msg9AddPropertyPtr->stName = blobref; - msg9AddPropertyPtr->nValue = nValue; - blobInfo.Attach((Message*) msg9AddPropertyPtr); - msg9AddPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg9AddPropertyPtr, ref RemoteDx9EffectResource.s_priv_ByteOrder_Msg9_AddProperty, typeof (RemoteDx9EffectResource.Msg9_AddProperty), 0, 0); - _priv_pmsgUse = (Message*) msg9AddPropertyPtr; - } - - public unsafe void SendAddProperty(string stName, int nValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddProperty(out _priv_portUse, out _priv_pmsgUse, stName, nValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteDx9EffectResource CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteDx9EffectResource(port, handle, true); - } - - public static RemoteDx9EffectResource CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteDx9EffectResource(port, handle, false); - } - - protected RemoteDx9EffectResource(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteDx9EffectResource(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteDx9EffectResource && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg10_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE devOwner; - public RENDERHANDLE dataBuffer; - } - - [ComVisible(false)] - private struct Msg0_SetDebugID - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stDebugID; - } - - [ComVisible(false)] - private struct Msg1_SetGutterSize - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Size sizeGutterPxl; - } - - [ComVisible(false)] - private struct Msg2_PostPropertiesAdded - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg3_AddTextureRequirements - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxImage; - public int nRequirements; - public BLOBREF stTexelSize; - public BLOBREF stTexUVSize; - public BLOBREF stTexUVRefPoint; - public int nDownsamplePropertyID; - } - - [ComVisible(false)] - private struct Msg4_AddProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stName; - public int nCoordinateMapID; - public int nImageIndexID; - } - - [ComVisible(false)] - private struct Msg5_AddProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stName; - public Vector4 vValue; - } - - [ComVisible(false)] - private struct Msg6_AddProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stName; - public Vector3 vValue; - } - - [ComVisible(false)] - private struct Msg7_AddProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stName; - public Vector2 vValue; - } - - [ComVisible(false)] - private struct Msg8_AddProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stName; - public float flValue; - } - - [ComVisible(false)] - private struct Msg9_AddProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stName; - public int nValue; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Sprite.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Sprite.cs index f1498da..97bca81 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Sprite.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDx9Sprite.cs @@ -9,70 +9,70 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteDx9Sprite : RemoteSprite - { - private static ushort[] s_priv_ByteOrder_Msg22_Create; - - protected RemoteDx9Sprite() + internal class RemoteDx9Sprite : RemoteSprite { + private static ushort[] s_priv_ByteOrder_Msg22_Create; + + protected RemoteDx9Sprite() + { + } + + public static unsafe RemoteDx9Sprite Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE spriteClassHandle = _priv_protocolInstance.Dx9Sprite_ClassHandle; + RemoteDx9Sprite remoteDx9Sprite = new RemoteDx9Sprite(port, _priv_owner); + uint num = (uint)sizeof(RemoteDx9Sprite.Msg22_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteDx9Sprite.Msg22_Create* msg22CreatePtr = (RemoteDx9Sprite.Msg22_Create*)pMem; + msg22CreatePtr->_priv_size = num; + msg22CreatePtr->_priv_msgid = 22U; + msg22CreatePtr->_priv_idObjectSubject = remoteDx9Sprite.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteDx9Sprite.s_priv_ByteOrder_Msg22_Create, typeof(RemoteDx9Sprite.Msg22_Create), 0, 0); + port.CreateRemoteObject(spriteClassHandle, remoteDx9Sprite.m_renderHandle, (Message*)msg22CreatePtr); + return remoteDx9Sprite; + } + + public static RemoteDx9Sprite CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteDx9Sprite(port, handle, true); + } + + public static RemoteDx9Sprite CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteDx9Sprite(port, handle, false); + } + + protected RemoteDx9Sprite(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteDx9Sprite(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteDx9Sprite && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg22_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } } - - public static unsafe RemoteDx9Sprite Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE spriteClassHandle = _priv_protocolInstance.Dx9Sprite_ClassHandle; - RemoteDx9Sprite remoteDx9Sprite = new RemoteDx9Sprite(port, _priv_owner); - uint num = (uint) sizeof (RemoteDx9Sprite.Msg22_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteDx9Sprite.Msg22_Create* msg22CreatePtr = (RemoteDx9Sprite.Msg22_Create*) pMem; - msg22CreatePtr->_priv_size = num; - msg22CreatePtr->_priv_msgid = 22U; - msg22CreatePtr->_priv_idObjectSubject = remoteDx9Sprite.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteDx9Sprite.s_priv_ByteOrder_Msg22_Create, typeof (RemoteDx9Sprite.Msg22_Create), 0, 0); - port.CreateRemoteObject(spriteClassHandle, remoteDx9Sprite.m_renderHandle, (Message*) msg22CreatePtr); - return remoteDx9Sprite; - } - - public static RemoteDx9Sprite CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteDx9Sprite(port, handle, true); - } - - public static RemoteDx9Sprite CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteDx9Sprite(port, handle, false); - } - - protected RemoteDx9Sprite(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteDx9Sprite(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteDx9Sprite && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg22_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDynamicSurfaceFactory.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDynamicSurfaceFactory.cs index 8a9846c..93b466b 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDynamicSurfaceFactory.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteDynamicSurfaceFactory.cs @@ -9,211 +9,211 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteDynamicSurfaceFactory : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_CloseInstance; - private static ushort[] s_priv_ByteOrder_Msg1_CreateVideoInstance; - private static ushort[] s_priv_ByteOrder_Msg2_CreateSurfaceInstance; - - protected RemoteDynamicSurfaceFactory() + internal class RemoteDynamicSurfaceFactory : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_CloseInstance; + private static ushort[] s_priv_ByteOrder_Msg1_CreateVideoInstance; + private static ushort[] s_priv_ByteOrder_Msg2_CreateSurfaceInstance; + + protected RemoteDynamicSurfaceFactory() + { + } + + public static unsafe void BuildCloseInstance( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashRendering _priv_protocolInstance, + int nUniqueID) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE factoryClassHandle = _priv_protocolInstance.DynamicSurfaceFactory_ClassHandle; + _priv_portUse.ValidateHandle(factoryClassHandle); + uint size = (uint)sizeof(RemoteDynamicSurfaceFactory.Msg0_CloseInstance); + RemoteDynamicSurfaceFactory.Msg0_CloseInstance* msg0CloseInstancePtr = (RemoteDynamicSurfaceFactory.Msg0_CloseInstance*)_priv_portUse.AllocMessageBuffer(size); + msg0CloseInstancePtr->_priv_size = size; + msg0CloseInstancePtr->_priv_msgid = 0U; + msg0CloseInstancePtr->nUniqueID = nUniqueID; + msg0CloseInstancePtr->_priv_idObjectSubject = factoryClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0CloseInstancePtr, ref RemoteDynamicSurfaceFactory.s_priv_ByteOrder_Msg0_CloseInstance, typeof(RemoteDynamicSurfaceFactory.Msg0_CloseInstance), 0, 0); + _priv_pmsgUse = (Message*)msg0CloseInstancePtr; + } + + public static unsafe void SendCloseInstance( + ProtocolSplashRendering _priv_protocolInstance, + int nUniqueID) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteDynamicSurfaceFactory.BuildCloseInstance(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, nUniqueID); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static unsafe void BuildCreateVideoInstance( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashRendering _priv_protocolInstance, + int nUniqueID, + RENDERHANDLE idClassContext, + RemoteDevice devOwner, + RemoteSurface surScene, + RemoteVideoPool poolScene) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE factoryClassHandle = _priv_protocolInstance.DynamicSurfaceFactory_ClassHandle; + _priv_portUse.ValidateHandle(factoryClassHandle); + if (devOwner != null) + _priv_portUse.ValidateHandleOrNull(devOwner.RenderHandle); + if (surScene != null) + _priv_portUse.ValidateHandleOrNull(surScene.RenderHandle); + if (poolScene != null) + _priv_portUse.ValidateHandleOrNull(poolScene.RenderHandle); + uint size = (uint)sizeof(RemoteDynamicSurfaceFactory.Msg1_CreateVideoInstance); + RemoteDynamicSurfaceFactory.Msg1_CreateVideoInstance* createVideoInstancePtr = (RemoteDynamicSurfaceFactory.Msg1_CreateVideoInstance*)_priv_portUse.AllocMessageBuffer(size); + createVideoInstancePtr->_priv_size = size; + createVideoInstancePtr->_priv_msgid = 1U; + createVideoInstancePtr->nUniqueID = nUniqueID; + createVideoInstancePtr->idClassContext = idClassContext; + createVideoInstancePtr->devOwner = devOwner != null ? devOwner.RenderHandle : RENDERHANDLE.NULL; + createVideoInstancePtr->surScene = surScene != null ? surScene.RenderHandle : RENDERHANDLE.NULL; + createVideoInstancePtr->poolScene = poolScene != null ? poolScene.RenderHandle : RENDERHANDLE.NULL; + createVideoInstancePtr->_priv_idObjectSubject = factoryClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)createVideoInstancePtr, ref RemoteDynamicSurfaceFactory.s_priv_ByteOrder_Msg1_CreateVideoInstance, typeof(RemoteDynamicSurfaceFactory.Msg1_CreateVideoInstance), 0, 0); + _priv_pmsgUse = (Message*)createVideoInstancePtr; + } + + public static unsafe void SendCreateVideoInstance( + ProtocolSplashRendering _priv_protocolInstance, + int nUniqueID, + RENDERHANDLE idClassContext, + RemoteDevice devOwner, + RemoteSurface surScene, + RemoteVideoPool poolScene) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteDynamicSurfaceFactory.BuildCreateVideoInstance(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, nUniqueID, idClassContext, devOwner, surScene, poolScene); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static unsafe void BuildCreateSurfaceInstance( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashRendering _priv_protocolInstance, + int nUniqueID, + RENDERHANDLE idClassContext, + RemoteDevice devOwner, + RemoteSurface surScene, + RemoteVideoPool poolScene) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE factoryClassHandle = _priv_protocolInstance.DynamicSurfaceFactory_ClassHandle; + _priv_portUse.ValidateHandle(factoryClassHandle); + if (devOwner != null) + _priv_portUse.ValidateHandleOrNull(devOwner.RenderHandle); + if (surScene != null) + _priv_portUse.ValidateHandleOrNull(surScene.RenderHandle); + if (poolScene != null) + _priv_portUse.ValidateHandleOrNull(poolScene.RenderHandle); + uint size = (uint)sizeof(RemoteDynamicSurfaceFactory.Msg2_CreateSurfaceInstance); + RemoteDynamicSurfaceFactory.Msg2_CreateSurfaceInstance* createSurfaceInstancePtr = (RemoteDynamicSurfaceFactory.Msg2_CreateSurfaceInstance*)_priv_portUse.AllocMessageBuffer(size); + createSurfaceInstancePtr->_priv_size = size; + createSurfaceInstancePtr->_priv_msgid = 2U; + createSurfaceInstancePtr->nUniqueID = nUniqueID; + createSurfaceInstancePtr->idClassContext = idClassContext; + createSurfaceInstancePtr->devOwner = devOwner != null ? devOwner.RenderHandle : RENDERHANDLE.NULL; + createSurfaceInstancePtr->surScene = surScene != null ? surScene.RenderHandle : RENDERHANDLE.NULL; + createSurfaceInstancePtr->poolScene = poolScene != null ? poolScene.RenderHandle : RENDERHANDLE.NULL; + createSurfaceInstancePtr->_priv_idObjectSubject = factoryClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)createSurfaceInstancePtr, ref RemoteDynamicSurfaceFactory.s_priv_ByteOrder_Msg2_CreateSurfaceInstance, typeof(RemoteDynamicSurfaceFactory.Msg2_CreateSurfaceInstance), 0, 0); + _priv_pmsgUse = (Message*)createSurfaceInstancePtr; + } + + public static unsafe void SendCreateSurfaceInstance( + ProtocolSplashRendering _priv_protocolInstance, + int nUniqueID, + RENDERHANDLE idClassContext, + RemoteDevice devOwner, + RemoteSurface surScene, + RemoteVideoPool poolScene) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteDynamicSurfaceFactory.BuildCreateSurfaceInstance(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, nUniqueID, idClassContext, devOwner, surScene, poolScene); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteDynamicSurfaceFactory CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteDynamicSurfaceFactory(port, handle, true); + } + + public static RemoteDynamicSurfaceFactory CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteDynamicSurfaceFactory(port, handle, false); + } + + protected RemoteDynamicSurfaceFactory( + RenderPort port, + RENDERHANDLE handle, + bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteDynamicSurfaceFactory(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteDynamicSurfaceFactory && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_CloseInstance + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nUniqueID; + } + + [ComVisible(false)] + private struct Msg1_CreateVideoInstance + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nUniqueID; + public RENDERHANDLE idClassContext; + public RENDERHANDLE devOwner; + public RENDERHANDLE surScene; + public RENDERHANDLE poolScene; + } + + [ComVisible(false)] + private struct Msg2_CreateSurfaceInstance + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nUniqueID; + public RENDERHANDLE idClassContext; + public RENDERHANDLE devOwner; + public RENDERHANDLE surScene; + public RENDERHANDLE poolScene; + } } - - public static unsafe void BuildCloseInstance( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashRendering _priv_protocolInstance, - int nUniqueID) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE factoryClassHandle = _priv_protocolInstance.DynamicSurfaceFactory_ClassHandle; - _priv_portUse.ValidateHandle(factoryClassHandle); - uint size = (uint) sizeof (RemoteDynamicSurfaceFactory.Msg0_CloseInstance); - RemoteDynamicSurfaceFactory.Msg0_CloseInstance* msg0CloseInstancePtr = (RemoteDynamicSurfaceFactory.Msg0_CloseInstance*) _priv_portUse.AllocMessageBuffer(size); - msg0CloseInstancePtr->_priv_size = size; - msg0CloseInstancePtr->_priv_msgid = 0U; - msg0CloseInstancePtr->nUniqueID = nUniqueID; - msg0CloseInstancePtr->_priv_idObjectSubject = factoryClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0CloseInstancePtr, ref RemoteDynamicSurfaceFactory.s_priv_ByteOrder_Msg0_CloseInstance, typeof (RemoteDynamicSurfaceFactory.Msg0_CloseInstance), 0, 0); - _priv_pmsgUse = (Message*) msg0CloseInstancePtr; - } - - public static unsafe void SendCloseInstance( - ProtocolSplashRendering _priv_protocolInstance, - int nUniqueID) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteDynamicSurfaceFactory.BuildCloseInstance(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, nUniqueID); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static unsafe void BuildCreateVideoInstance( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashRendering _priv_protocolInstance, - int nUniqueID, - RENDERHANDLE idClassContext, - RemoteDevice devOwner, - RemoteSurface surScene, - RemoteVideoPool poolScene) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE factoryClassHandle = _priv_protocolInstance.DynamicSurfaceFactory_ClassHandle; - _priv_portUse.ValidateHandle(factoryClassHandle); - if (devOwner != null) - _priv_portUse.ValidateHandleOrNull(devOwner.RenderHandle); - if (surScene != null) - _priv_portUse.ValidateHandleOrNull(surScene.RenderHandle); - if (poolScene != null) - _priv_portUse.ValidateHandleOrNull(poolScene.RenderHandle); - uint size = (uint) sizeof (RemoteDynamicSurfaceFactory.Msg1_CreateVideoInstance); - RemoteDynamicSurfaceFactory.Msg1_CreateVideoInstance* createVideoInstancePtr = (RemoteDynamicSurfaceFactory.Msg1_CreateVideoInstance*) _priv_portUse.AllocMessageBuffer(size); - createVideoInstancePtr->_priv_size = size; - createVideoInstancePtr->_priv_msgid = 1U; - createVideoInstancePtr->nUniqueID = nUniqueID; - createVideoInstancePtr->idClassContext = idClassContext; - createVideoInstancePtr->devOwner = devOwner != null ? devOwner.RenderHandle : RENDERHANDLE.NULL; - createVideoInstancePtr->surScene = surScene != null ? surScene.RenderHandle : RENDERHANDLE.NULL; - createVideoInstancePtr->poolScene = poolScene != null ? poolScene.RenderHandle : RENDERHANDLE.NULL; - createVideoInstancePtr->_priv_idObjectSubject = factoryClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) createVideoInstancePtr, ref RemoteDynamicSurfaceFactory.s_priv_ByteOrder_Msg1_CreateVideoInstance, typeof (RemoteDynamicSurfaceFactory.Msg1_CreateVideoInstance), 0, 0); - _priv_pmsgUse = (Message*) createVideoInstancePtr; - } - - public static unsafe void SendCreateVideoInstance( - ProtocolSplashRendering _priv_protocolInstance, - int nUniqueID, - RENDERHANDLE idClassContext, - RemoteDevice devOwner, - RemoteSurface surScene, - RemoteVideoPool poolScene) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteDynamicSurfaceFactory.BuildCreateVideoInstance(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, nUniqueID, idClassContext, devOwner, surScene, poolScene); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static unsafe void BuildCreateSurfaceInstance( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashRendering _priv_protocolInstance, - int nUniqueID, - RENDERHANDLE idClassContext, - RemoteDevice devOwner, - RemoteSurface surScene, - RemoteVideoPool poolScene) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE factoryClassHandle = _priv_protocolInstance.DynamicSurfaceFactory_ClassHandle; - _priv_portUse.ValidateHandle(factoryClassHandle); - if (devOwner != null) - _priv_portUse.ValidateHandleOrNull(devOwner.RenderHandle); - if (surScene != null) - _priv_portUse.ValidateHandleOrNull(surScene.RenderHandle); - if (poolScene != null) - _priv_portUse.ValidateHandleOrNull(poolScene.RenderHandle); - uint size = (uint) sizeof (RemoteDynamicSurfaceFactory.Msg2_CreateSurfaceInstance); - RemoteDynamicSurfaceFactory.Msg2_CreateSurfaceInstance* createSurfaceInstancePtr = (RemoteDynamicSurfaceFactory.Msg2_CreateSurfaceInstance*) _priv_portUse.AllocMessageBuffer(size); - createSurfaceInstancePtr->_priv_size = size; - createSurfaceInstancePtr->_priv_msgid = 2U; - createSurfaceInstancePtr->nUniqueID = nUniqueID; - createSurfaceInstancePtr->idClassContext = idClassContext; - createSurfaceInstancePtr->devOwner = devOwner != null ? devOwner.RenderHandle : RENDERHANDLE.NULL; - createSurfaceInstancePtr->surScene = surScene != null ? surScene.RenderHandle : RENDERHANDLE.NULL; - createSurfaceInstancePtr->poolScene = poolScene != null ? poolScene.RenderHandle : RENDERHANDLE.NULL; - createSurfaceInstancePtr->_priv_idObjectSubject = factoryClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) createSurfaceInstancePtr, ref RemoteDynamicSurfaceFactory.s_priv_ByteOrder_Msg2_CreateSurfaceInstance, typeof (RemoteDynamicSurfaceFactory.Msg2_CreateSurfaceInstance), 0, 0); - _priv_pmsgUse = (Message*) createSurfaceInstancePtr; - } - - public static unsafe void SendCreateSurfaceInstance( - ProtocolSplashRendering _priv_protocolInstance, - int nUniqueID, - RENDERHANDLE idClassContext, - RemoteDevice devOwner, - RemoteSurface surScene, - RemoteVideoPool poolScene) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteDynamicSurfaceFactory.BuildCreateSurfaceInstance(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, nUniqueID, idClassContext, devOwner, surScene, poolScene); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteDynamicSurfaceFactory CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteDynamicSurfaceFactory(port, handle, true); - } - - public static RemoteDynamicSurfaceFactory CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteDynamicSurfaceFactory(port, handle, false); - } - - protected RemoteDynamicSurfaceFactory( - RenderPort port, - RENDERHANDLE handle, - bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteDynamicSurfaceFactory(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteDynamicSurfaceFactory && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_CloseInstance - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nUniqueID; - } - - [ComVisible(false)] - private struct Msg1_CreateVideoInstance - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nUniqueID; - public RENDERHANDLE idClassContext; - public RENDERHANDLE devOwner; - public RENDERHANDLE surScene; - public RENDERHANDLE poolScene; - } - - [ComVisible(false)] - private struct Msg2_CreateSurfaceInstance - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nUniqueID; - public RENDERHANDLE idClassContext; - public RENDERHANDLE devOwner; - public RENDERHANDLE surScene; - public RENDERHANDLE poolScene; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteEffect.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteEffect.cs index 19feb1c..0c7d8c8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteEffect.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteEffect.cs @@ -10,364 +10,364 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteEffect : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_SetDebugID; - private static ushort[] s_priv_ByteOrder_Msg1_SetProperty; - private static ushort[] s_priv_ByteOrder_Msg2_SetProperty; - private static ushort[] s_priv_ByteOrder_Msg3_SetProperty; - private static ushort[] s_priv_ByteOrder_Msg4_SetProperty; - private static ushort[] s_priv_ByteOrder_Msg5_SetProperty; - private static ushort[] s_priv_ByteOrder_Msg6_SetProperty; - private static ushort[] s_priv_ByteOrder_Msg7_SetProperty; - - protected RemoteEffect() + internal class RemoteEffect : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_SetDebugID; + private static ushort[] s_priv_ByteOrder_Msg1_SetProperty; + private static ushort[] s_priv_ByteOrder_Msg2_SetProperty; + private static ushort[] s_priv_ByteOrder_Msg3_SetProperty; + private static ushort[] s_priv_ByteOrder_Msg4_SetProperty; + private static ushort[] s_priv_ByteOrder_Msg5_SetProperty; + private static ushort[] s_priv_ByteOrder_Msg6_SetProperty; + private static ushort[] s_priv_ByteOrder_Msg7_SetProperty; + + protected RemoteEffect() + { + } + + public unsafe void BuildSetDebugID( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stDebugID) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteEffect.Msg0_SetDebugID)); + BLOBREF blobref = blobInfo.Add(stDebugID); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteEffect.Msg0_SetDebugID* msg0SetDebugIdPtr = (RemoteEffect.Msg0_SetDebugID*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg0SetDebugIdPtr->_priv_size = adjustedTotalSize; + msg0SetDebugIdPtr->_priv_msgid = 0U; + msg0SetDebugIdPtr->stDebugID = blobref; + blobInfo.Attach((Message*)msg0SetDebugIdPtr); + msg0SetDebugIdPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0SetDebugIdPtr, ref RemoteEffect.s_priv_ByteOrder_Msg0_SetDebugID, typeof(RemoteEffect.Msg0_SetDebugID), 0, 0); + _priv_pmsgUse = (Message*)msg0SetDebugIdPtr; + } + + public unsafe void SendSetDebugID(string stDebugID) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetDebugID(out _priv_portUse, out _priv_pmsgUse, stDebugID); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nPropertyID, + RemoteSurface[] surfaceArray) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteEffect.Msg1_SetProperty)); + RENDERHANDLE[] renderHandleArray = MarshalHelper.CreateRenderHandleArray(surfaceArray.Length); + for (int index = 0; index < surfaceArray.Length; ++index) + renderHandleArray[index] = surfaceArray[index].RenderHandle; + BLOBREF blobref = blobInfo.Add(renderHandleArray); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteEffect.Msg1_SetProperty* msg1SetPropertyPtr = (RemoteEffect.Msg1_SetProperty*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg1SetPropertyPtr->_priv_size = adjustedTotalSize; + msg1SetPropertyPtr->_priv_msgid = 1U; + msg1SetPropertyPtr->nPropertyID = nPropertyID; + msg1SetPropertyPtr->surfaceArray = blobref; + blobInfo.Attach((Message*)msg1SetPropertyPtr); + msg1SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg1_SetProperty, typeof(RemoteEffect.Msg1_SetProperty), 0, 0); + _priv_pmsgUse = (Message*)msg1SetPropertyPtr; + } + + public unsafe void SendSetProperty(int nPropertyID, RemoteSurface[] surfaceArray) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, surfaceArray); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nPropertyID, + RemoteSurface surface) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + if (surface != null) + _priv_portUse.ValidateHandleOrNull(surface.RenderHandle); + uint size = (uint)sizeof(RemoteEffect.Msg2_SetProperty); + RemoteEffect.Msg2_SetProperty* msg2SetPropertyPtr = (RemoteEffect.Msg2_SetProperty*)_priv_portUse.AllocMessageBuffer(size); + msg2SetPropertyPtr->_priv_size = size; + msg2SetPropertyPtr->_priv_msgid = 2U; + msg2SetPropertyPtr->nPropertyID = nPropertyID; + msg2SetPropertyPtr->surface = surface != null ? surface.RenderHandle : RENDERHANDLE.NULL; + msg2SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg2SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg2_SetProperty, typeof(RemoteEffect.Msg2_SetProperty), 0, 0); + _priv_pmsgUse = (Message*)msg2SetPropertyPtr; + } + + public unsafe void SendSetProperty(int nPropertyID, RemoteSurface surface) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, surface); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nPropertyID, + Vector4 vValue) + { + 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(RemoteEffect.Msg3_SetProperty); + RemoteEffect.Msg3_SetProperty* msg3SetPropertyPtr = (RemoteEffect.Msg3_SetProperty*)_priv_portUse.AllocMessageBuffer(size); + msg3SetPropertyPtr->_priv_size = size; + msg3SetPropertyPtr->_priv_msgid = 3U; + msg3SetPropertyPtr->nPropertyID = nPropertyID; + msg3SetPropertyPtr->vValue = vValue; + msg3SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg3SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg3_SetProperty, typeof(RemoteEffect.Msg3_SetProperty), 0, 0); + _priv_pmsgUse = (Message*)msg3SetPropertyPtr; + } + + public unsafe void SendSetProperty(int nPropertyID, Vector4 vValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, vValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nPropertyID, + Vector3 vValue) + { + 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(RemoteEffect.Msg4_SetProperty); + RemoteEffect.Msg4_SetProperty* msg4SetPropertyPtr = (RemoteEffect.Msg4_SetProperty*)_priv_portUse.AllocMessageBuffer(size); + msg4SetPropertyPtr->_priv_size = size; + msg4SetPropertyPtr->_priv_msgid = 4U; + msg4SetPropertyPtr->nPropertyID = nPropertyID; + msg4SetPropertyPtr->vValue = vValue; + msg4SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg4_SetProperty, typeof(RemoteEffect.Msg4_SetProperty), 0, 0); + _priv_pmsgUse = (Message*)msg4SetPropertyPtr; + } + + public unsafe void SendSetProperty(int nPropertyID, Vector3 vValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, vValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nPropertyID, + Vector2 vValue) + { + 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(RemoteEffect.Msg5_SetProperty); + RemoteEffect.Msg5_SetProperty* msg5SetPropertyPtr = (RemoteEffect.Msg5_SetProperty*)_priv_portUse.AllocMessageBuffer(size); + msg5SetPropertyPtr->_priv_size = size; + msg5SetPropertyPtr->_priv_msgid = 5U; + msg5SetPropertyPtr->nPropertyID = nPropertyID; + msg5SetPropertyPtr->vValue = vValue; + msg5SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg5SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg5_SetProperty, typeof(RemoteEffect.Msg5_SetProperty), 0, 0); + _priv_pmsgUse = (Message*)msg5SetPropertyPtr; + } + + public unsafe void SendSetProperty(int nPropertyID, Vector2 vValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, vValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nPropertyID, + float flValue) + { + 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(RemoteEffect.Msg6_SetProperty); + RemoteEffect.Msg6_SetProperty* msg6SetPropertyPtr = (RemoteEffect.Msg6_SetProperty*)_priv_portUse.AllocMessageBuffer(size); + msg6SetPropertyPtr->_priv_size = size; + msg6SetPropertyPtr->_priv_msgid = 6U; + msg6SetPropertyPtr->nPropertyID = nPropertyID; + msg6SetPropertyPtr->flValue = flValue; + msg6SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg6SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg6_SetProperty, typeof(RemoteEffect.Msg6_SetProperty), 0, 0); + _priv_pmsgUse = (Message*)msg6SetPropertyPtr; + } + + public unsafe void SendSetProperty(int nPropertyID, float flValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, flValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetProperty( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nPropertyID, + int nValue) + { + 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(RemoteEffect.Msg7_SetProperty); + RemoteEffect.Msg7_SetProperty* msg7SetPropertyPtr = (RemoteEffect.Msg7_SetProperty*)_priv_portUse.AllocMessageBuffer(size); + msg7SetPropertyPtr->_priv_size = size; + msg7SetPropertyPtr->_priv_msgid = 7U; + msg7SetPropertyPtr->nPropertyID = nPropertyID; + msg7SetPropertyPtr->nValue = nValue; + msg7SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg7SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg7_SetProperty, typeof(RemoteEffect.Msg7_SetProperty), 0, 0); + _priv_pmsgUse = (Message*)msg7SetPropertyPtr; + } + + public unsafe void SendSetProperty(int nPropertyID, int nValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, nValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteEffect CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteEffect(port, handle, true); + + public static RemoteEffect CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteEffect(port, handle, false); + } + + protected RemoteEffect(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteEffect(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteEffect && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_SetDebugID + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stDebugID; + } + + [ComVisible(false)] + private struct Msg1_SetProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nPropertyID; + public BLOBREF surfaceArray; + } + + [ComVisible(false)] + private struct Msg2_SetProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nPropertyID; + public RENDERHANDLE surface; + } + + [ComVisible(false)] + private struct Msg3_SetProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nPropertyID; + public Vector4 vValue; + } + + [ComVisible(false)] + private struct Msg4_SetProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nPropertyID; + public Vector3 vValue; + } + + [ComVisible(false)] + private struct Msg5_SetProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nPropertyID; + public Vector2 vValue; + } + + [ComVisible(false)] + private struct Msg6_SetProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nPropertyID; + public float flValue; + } + + [ComVisible(false)] + private struct Msg7_SetProperty + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nPropertyID; + public int nValue; + } } - - public unsafe void BuildSetDebugID( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stDebugID) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteEffect.Msg0_SetDebugID)); - BLOBREF blobref = blobInfo.Add(stDebugID); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteEffect.Msg0_SetDebugID* msg0SetDebugIdPtr = (RemoteEffect.Msg0_SetDebugID*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg0SetDebugIdPtr->_priv_size = adjustedTotalSize; - msg0SetDebugIdPtr->_priv_msgid = 0U; - msg0SetDebugIdPtr->stDebugID = blobref; - blobInfo.Attach((Message*) msg0SetDebugIdPtr); - msg0SetDebugIdPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0SetDebugIdPtr, ref RemoteEffect.s_priv_ByteOrder_Msg0_SetDebugID, typeof (RemoteEffect.Msg0_SetDebugID), 0, 0); - _priv_pmsgUse = (Message*) msg0SetDebugIdPtr; - } - - public unsafe void SendSetDebugID(string stDebugID) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetDebugID(out _priv_portUse, out _priv_pmsgUse, stDebugID); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nPropertyID, - RemoteSurface[] surfaceArray) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteEffect.Msg1_SetProperty)); - RENDERHANDLE[] renderHandleArray = MarshalHelper.CreateRenderHandleArray(surfaceArray.Length); - for (int index = 0; index < surfaceArray.Length; ++index) - renderHandleArray[index] = surfaceArray[index].RenderHandle; - BLOBREF blobref = blobInfo.Add(renderHandleArray); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteEffect.Msg1_SetProperty* msg1SetPropertyPtr = (RemoteEffect.Msg1_SetProperty*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg1SetPropertyPtr->_priv_size = adjustedTotalSize; - msg1SetPropertyPtr->_priv_msgid = 1U; - msg1SetPropertyPtr->nPropertyID = nPropertyID; - msg1SetPropertyPtr->surfaceArray = blobref; - blobInfo.Attach((Message*) msg1SetPropertyPtr); - msg1SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg1_SetProperty, typeof (RemoteEffect.Msg1_SetProperty), 0, 0); - _priv_pmsgUse = (Message*) msg1SetPropertyPtr; - } - - public unsafe void SendSetProperty(int nPropertyID, RemoteSurface[] surfaceArray) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, surfaceArray); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nPropertyID, - RemoteSurface surface) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - if (surface != null) - _priv_portUse.ValidateHandleOrNull(surface.RenderHandle); - uint size = (uint) sizeof (RemoteEffect.Msg2_SetProperty); - RemoteEffect.Msg2_SetProperty* msg2SetPropertyPtr = (RemoteEffect.Msg2_SetProperty*) _priv_portUse.AllocMessageBuffer(size); - msg2SetPropertyPtr->_priv_size = size; - msg2SetPropertyPtr->_priv_msgid = 2U; - msg2SetPropertyPtr->nPropertyID = nPropertyID; - msg2SetPropertyPtr->surface = surface != null ? surface.RenderHandle : RENDERHANDLE.NULL; - msg2SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg2SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg2_SetProperty, typeof (RemoteEffect.Msg2_SetProperty), 0, 0); - _priv_pmsgUse = (Message*) msg2SetPropertyPtr; - } - - public unsafe void SendSetProperty(int nPropertyID, RemoteSurface surface) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, surface); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nPropertyID, - Vector4 vValue) - { - 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 (RemoteEffect.Msg3_SetProperty); - RemoteEffect.Msg3_SetProperty* msg3SetPropertyPtr = (RemoteEffect.Msg3_SetProperty*) _priv_portUse.AllocMessageBuffer(size); - msg3SetPropertyPtr->_priv_size = size; - msg3SetPropertyPtr->_priv_msgid = 3U; - msg3SetPropertyPtr->nPropertyID = nPropertyID; - msg3SetPropertyPtr->vValue = vValue; - msg3SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg3SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg3_SetProperty, typeof (RemoteEffect.Msg3_SetProperty), 0, 0); - _priv_pmsgUse = (Message*) msg3SetPropertyPtr; - } - - public unsafe void SendSetProperty(int nPropertyID, Vector4 vValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, vValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nPropertyID, - Vector3 vValue) - { - 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 (RemoteEffect.Msg4_SetProperty); - RemoteEffect.Msg4_SetProperty* msg4SetPropertyPtr = (RemoteEffect.Msg4_SetProperty*) _priv_portUse.AllocMessageBuffer(size); - msg4SetPropertyPtr->_priv_size = size; - msg4SetPropertyPtr->_priv_msgid = 4U; - msg4SetPropertyPtr->nPropertyID = nPropertyID; - msg4SetPropertyPtr->vValue = vValue; - msg4SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg4_SetProperty, typeof (RemoteEffect.Msg4_SetProperty), 0, 0); - _priv_pmsgUse = (Message*) msg4SetPropertyPtr; - } - - public unsafe void SendSetProperty(int nPropertyID, Vector3 vValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, vValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nPropertyID, - Vector2 vValue) - { - 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 (RemoteEffect.Msg5_SetProperty); - RemoteEffect.Msg5_SetProperty* msg5SetPropertyPtr = (RemoteEffect.Msg5_SetProperty*) _priv_portUse.AllocMessageBuffer(size); - msg5SetPropertyPtr->_priv_size = size; - msg5SetPropertyPtr->_priv_msgid = 5U; - msg5SetPropertyPtr->nPropertyID = nPropertyID; - msg5SetPropertyPtr->vValue = vValue; - msg5SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg5SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg5_SetProperty, typeof (RemoteEffect.Msg5_SetProperty), 0, 0); - _priv_pmsgUse = (Message*) msg5SetPropertyPtr; - } - - public unsafe void SendSetProperty(int nPropertyID, Vector2 vValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, vValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nPropertyID, - float flValue) - { - 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 (RemoteEffect.Msg6_SetProperty); - RemoteEffect.Msg6_SetProperty* msg6SetPropertyPtr = (RemoteEffect.Msg6_SetProperty*) _priv_portUse.AllocMessageBuffer(size); - msg6SetPropertyPtr->_priv_size = size; - msg6SetPropertyPtr->_priv_msgid = 6U; - msg6SetPropertyPtr->nPropertyID = nPropertyID; - msg6SetPropertyPtr->flValue = flValue; - msg6SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg6SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg6_SetProperty, typeof (RemoteEffect.Msg6_SetProperty), 0, 0); - _priv_pmsgUse = (Message*) msg6SetPropertyPtr; - } - - public unsafe void SendSetProperty(int nPropertyID, float flValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, flValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetProperty( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nPropertyID, - int nValue) - { - 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 (RemoteEffect.Msg7_SetProperty); - RemoteEffect.Msg7_SetProperty* msg7SetPropertyPtr = (RemoteEffect.Msg7_SetProperty*) _priv_portUse.AllocMessageBuffer(size); - msg7SetPropertyPtr->_priv_size = size; - msg7SetPropertyPtr->_priv_msgid = 7U; - msg7SetPropertyPtr->nPropertyID = nPropertyID; - msg7SetPropertyPtr->nValue = nValue; - msg7SetPropertyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg7SetPropertyPtr, ref RemoteEffect.s_priv_ByteOrder_Msg7_SetProperty, typeof (RemoteEffect.Msg7_SetProperty), 0, 0); - _priv_pmsgUse = (Message*) msg7SetPropertyPtr; - } - - public unsafe void SendSetProperty(int nPropertyID, int nValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetProperty(out _priv_portUse, out _priv_pmsgUse, nPropertyID, nValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteEffect CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteEffect(port, handle, true); - - public static RemoteEffect CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteEffect(port, handle, false); - } - - protected RemoteEffect(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteEffect(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteEffect && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_SetDebugID - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stDebugID; - } - - [ComVisible(false)] - private struct Msg1_SetProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nPropertyID; - public BLOBREF surfaceArray; - } - - [ComVisible(false)] - private struct Msg2_SetProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nPropertyID; - public RENDERHANDLE surface; - } - - [ComVisible(false)] - private struct Msg3_SetProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nPropertyID; - public Vector4 vValue; - } - - [ComVisible(false)] - private struct Msg4_SetProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nPropertyID; - public Vector3 vValue; - } - - [ComVisible(false)] - private struct Msg5_SetProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nPropertyID; - public Vector2 vValue; - } - - [ComVisible(false)] - private struct Msg6_SetProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nPropertyID; - public float flValue; - } - - [ComVisible(false)] - private struct Msg7_SetProperty - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nPropertyID; - public int nValue; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteExternalAnimationInput.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteExternalAnimationInput.cs index 7a1eaa9..0398357 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteExternalAnimationInput.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteExternalAnimationInput.cs @@ -9,76 +9,76 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteExternalAnimationInput : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_Create; - - protected RemoteExternalAnimationInput() + internal class RemoteExternalAnimationInput : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_Create; + + protected RemoteExternalAnimationInput() + { + } + + public static unsafe RemoteExternalAnimationInput Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + uint nUniqueId) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE inputClassHandle = _priv_protocolInstance.ExternalAnimationInput_ClassHandle; + RemoteExternalAnimationInput externalAnimationInput = new RemoteExternalAnimationInput(port, _priv_owner); + uint num = (uint)sizeof(RemoteExternalAnimationInput.Msg0_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteExternalAnimationInput.Msg0_Create* msg0CreatePtr = (RemoteExternalAnimationInput.Msg0_Create*)pMem; + msg0CreatePtr->_priv_size = num; + msg0CreatePtr->_priv_msgid = 0U; + msg0CreatePtr->nUniqueId = nUniqueId; + msg0CreatePtr->_priv_idObjectSubject = externalAnimationInput.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteExternalAnimationInput.s_priv_ByteOrder_Msg0_Create, typeof(RemoteExternalAnimationInput.Msg0_Create), 0, 0); + port.CreateRemoteObject(inputClassHandle, externalAnimationInput.m_renderHandle, (Message*)msg0CreatePtr); + return externalAnimationInput; + } + + public static RemoteExternalAnimationInput CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteExternalAnimationInput(port, handle, true); + } + + public static RemoteExternalAnimationInput CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteExternalAnimationInput(port, handle, false); + } + + protected RemoteExternalAnimationInput( + RenderPort port, + RENDERHANDLE handle, + bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteExternalAnimationInput(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteExternalAnimationInput && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint nUniqueId; + } } - - public static unsafe RemoteExternalAnimationInput Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - uint nUniqueId) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE inputClassHandle = _priv_protocolInstance.ExternalAnimationInput_ClassHandle; - RemoteExternalAnimationInput externalAnimationInput = new RemoteExternalAnimationInput(port, _priv_owner); - uint num = (uint) sizeof (RemoteExternalAnimationInput.Msg0_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteExternalAnimationInput.Msg0_Create* msg0CreatePtr = (RemoteExternalAnimationInput.Msg0_Create*) pMem; - msg0CreatePtr->_priv_size = num; - msg0CreatePtr->_priv_msgid = 0U; - msg0CreatePtr->nUniqueId = nUniqueId; - msg0CreatePtr->_priv_idObjectSubject = externalAnimationInput.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteExternalAnimationInput.s_priv_ByteOrder_Msg0_Create, typeof (RemoteExternalAnimationInput.Msg0_Create), 0, 0); - port.CreateRemoteObject(inputClassHandle, externalAnimationInput.m_renderHandle, (Message*) msg0CreatePtr); - return externalAnimationInput; - } - - public static RemoteExternalAnimationInput CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteExternalAnimationInput(port, handle, true); - } - - public static RemoteExternalAnimationInput CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteExternalAnimationInput(port, handle, false); - } - - protected RemoteExternalAnimationInput( - RenderPort port, - RENDERHANDLE handle, - bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteExternalAnimationInput(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteExternalAnimationInput && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint nUniqueId; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteGradient.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteGradient.cs index c410c0c..14ba804 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteGradient.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteGradient.cs @@ -10,227 +10,227 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteGradient : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_Clear; - private static ushort[] s_priv_ByteOrder_Msg1_AddValue; - private static ushort[] s_priv_ByteOrder_Msg2_SetOffset; - private static ushort[] s_priv_ByteOrder_Msg3_SetColorMask; - private static ushort[] s_priv_ByteOrder_Msg4_SetOrientation; - - protected RemoteGradient() + internal class RemoteGradient : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_Clear; + private static ushort[] s_priv_ByteOrder_Msg1_AddValue; + private static ushort[] s_priv_ByteOrder_Msg2_SetOffset; + private static ushort[] s_priv_ByteOrder_Msg3_SetColorMask; + private static ushort[] s_priv_ByteOrder_Msg4_SetOrientation; + + protected RemoteGradient() + { + } + + public unsafe void BuildClear(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(RemoteGradient.Msg0_Clear); + RemoteGradient.Msg0_Clear* msg0ClearPtr = (RemoteGradient.Msg0_Clear*)_priv_portUse.AllocMessageBuffer(size); + msg0ClearPtr->_priv_size = size; + msg0ClearPtr->_priv_msgid = 0U; + msg0ClearPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0ClearPtr, ref RemoteGradient.s_priv_ByteOrder_Msg0_Clear, typeof(RemoteGradient.Msg0_Clear), 0, 0); + _priv_pmsgUse = (Message*)msg0ClearPtr; + } + + public unsafe void SendClear() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildClear(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddValue( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + float flValue, + float flPosition, + RelativeSpace relative) + { + 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(RemoteGradient.Msg1_AddValue); + RemoteGradient.Msg1_AddValue* msg1AddValuePtr = (RemoteGradient.Msg1_AddValue*)_priv_portUse.AllocMessageBuffer(size); + msg1AddValuePtr->_priv_size = size; + msg1AddValuePtr->_priv_msgid = 1U; + msg1AddValuePtr->flValue = flValue; + msg1AddValuePtr->flPosition = flPosition; + msg1AddValuePtr->relative = relative; + msg1AddValuePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1AddValuePtr, ref RemoteGradient.s_priv_ByteOrder_Msg1_AddValue, typeof(RemoteGradient.Msg1_AddValue), 0, 0); + _priv_pmsgUse = (Message*)msg1AddValuePtr; + } + + public unsafe void SendAddValue(float flValue, float flPosition, RelativeSpace relative) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddValue(out _priv_portUse, out _priv_pmsgUse, flValue, flPosition, relative); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetOffset( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + float flOffset) + { + 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(RemoteGradient.Msg2_SetOffset); + RemoteGradient.Msg2_SetOffset* msg2SetOffsetPtr = (RemoteGradient.Msg2_SetOffset*)_priv_portUse.AllocMessageBuffer(size); + msg2SetOffsetPtr->_priv_size = size; + msg2SetOffsetPtr->_priv_msgid = 2U; + msg2SetOffsetPtr->flOffset = flOffset; + msg2SetOffsetPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg2SetOffsetPtr, ref RemoteGradient.s_priv_ByteOrder_Msg2_SetOffset, typeof(RemoteGradient.Msg2_SetOffset), 0, 0); + _priv_pmsgUse = (Message*)msg2SetOffsetPtr; + } + + public unsafe void SendSetOffset(float flOffset) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetOffset(out _priv_portUse, out _priv_pmsgUse, flOffset); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetColorMask( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ColorF clrMask) + { + 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(RemoteGradient.Msg3_SetColorMask); + RemoteGradient.Msg3_SetColorMask* msg3SetColorMaskPtr = (RemoteGradient.Msg3_SetColorMask*)_priv_portUse.AllocMessageBuffer(size); + msg3SetColorMaskPtr->_priv_size = size; + msg3SetColorMaskPtr->_priv_msgid = 3U; + msg3SetColorMaskPtr->clrMask = clrMask; + msg3SetColorMaskPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg3SetColorMaskPtr, ref RemoteGradient.s_priv_ByteOrder_Msg3_SetColorMask, typeof(RemoteGradient.Msg3_SetColorMask), 0, 0); + _priv_pmsgUse = (Message*)msg3SetColorMaskPtr; + } + + public unsafe void SendSetColorMask(ColorF clrMask) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetColorMask(out _priv_portUse, out _priv_pmsgUse, clrMask); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetOrientation( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Orientation dir) + { + 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(RemoteGradient.Msg4_SetOrientation); + RemoteGradient.Msg4_SetOrientation* msg4SetOrientationPtr = (RemoteGradient.Msg4_SetOrientation*)_priv_portUse.AllocMessageBuffer(size); + msg4SetOrientationPtr->_priv_size = size; + msg4SetOrientationPtr->_priv_msgid = 4U; + msg4SetOrientationPtr->dir = dir; + msg4SetOrientationPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4SetOrientationPtr, ref RemoteGradient.s_priv_ByteOrder_Msg4_SetOrientation, typeof(RemoteGradient.Msg4_SetOrientation), 0, 0); + _priv_pmsgUse = (Message*)msg4SetOrientationPtr; + } + + public unsafe void SendSetOrientation(Orientation dir) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetOrientation(out _priv_portUse, out _priv_pmsgUse, dir); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteGradient CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteGradient(port, handle, true); + } + + public static RemoteGradient CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteGradient(port, handle, false); + } + + protected RemoteGradient(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteGradient(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteGradient && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_Clear + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg1_AddValue + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public float flValue; + public float flPosition; + public RelativeSpace relative; + } + + [ComVisible(false)] + private struct Msg2_SetOffset + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public float flOffset; + } + + [ComVisible(false)] + private struct Msg3_SetColorMask + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public ColorF clrMask; + } + + [ComVisible(false)] + private struct Msg4_SetOrientation + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Orientation dir; + } } - - public unsafe void BuildClear(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 (RemoteGradient.Msg0_Clear); - RemoteGradient.Msg0_Clear* msg0ClearPtr = (RemoteGradient.Msg0_Clear*) _priv_portUse.AllocMessageBuffer(size); - msg0ClearPtr->_priv_size = size; - msg0ClearPtr->_priv_msgid = 0U; - msg0ClearPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0ClearPtr, ref RemoteGradient.s_priv_ByteOrder_Msg0_Clear, typeof (RemoteGradient.Msg0_Clear), 0, 0); - _priv_pmsgUse = (Message*) msg0ClearPtr; - } - - public unsafe void SendClear() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildClear(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddValue( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - float flValue, - float flPosition, - RelativeSpace relative) - { - 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 (RemoteGradient.Msg1_AddValue); - RemoteGradient.Msg1_AddValue* msg1AddValuePtr = (RemoteGradient.Msg1_AddValue*) _priv_portUse.AllocMessageBuffer(size); - msg1AddValuePtr->_priv_size = size; - msg1AddValuePtr->_priv_msgid = 1U; - msg1AddValuePtr->flValue = flValue; - msg1AddValuePtr->flPosition = flPosition; - msg1AddValuePtr->relative = relative; - msg1AddValuePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1AddValuePtr, ref RemoteGradient.s_priv_ByteOrder_Msg1_AddValue, typeof (RemoteGradient.Msg1_AddValue), 0, 0); - _priv_pmsgUse = (Message*) msg1AddValuePtr; - } - - public unsafe void SendAddValue(float flValue, float flPosition, RelativeSpace relative) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddValue(out _priv_portUse, out _priv_pmsgUse, flValue, flPosition, relative); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetOffset( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - float flOffset) - { - 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 (RemoteGradient.Msg2_SetOffset); - RemoteGradient.Msg2_SetOffset* msg2SetOffsetPtr = (RemoteGradient.Msg2_SetOffset*) _priv_portUse.AllocMessageBuffer(size); - msg2SetOffsetPtr->_priv_size = size; - msg2SetOffsetPtr->_priv_msgid = 2U; - msg2SetOffsetPtr->flOffset = flOffset; - msg2SetOffsetPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg2SetOffsetPtr, ref RemoteGradient.s_priv_ByteOrder_Msg2_SetOffset, typeof (RemoteGradient.Msg2_SetOffset), 0, 0); - _priv_pmsgUse = (Message*) msg2SetOffsetPtr; - } - - public unsafe void SendSetOffset(float flOffset) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetOffset(out _priv_portUse, out _priv_pmsgUse, flOffset); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetColorMask( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ColorF clrMask) - { - 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 (RemoteGradient.Msg3_SetColorMask); - RemoteGradient.Msg3_SetColorMask* msg3SetColorMaskPtr = (RemoteGradient.Msg3_SetColorMask*) _priv_portUse.AllocMessageBuffer(size); - msg3SetColorMaskPtr->_priv_size = size; - msg3SetColorMaskPtr->_priv_msgid = 3U; - msg3SetColorMaskPtr->clrMask = clrMask; - msg3SetColorMaskPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg3SetColorMaskPtr, ref RemoteGradient.s_priv_ByteOrder_Msg3_SetColorMask, typeof (RemoteGradient.Msg3_SetColorMask), 0, 0); - _priv_pmsgUse = (Message*) msg3SetColorMaskPtr; - } - - public unsafe void SendSetColorMask(ColorF clrMask) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetColorMask(out _priv_portUse, out _priv_pmsgUse, clrMask); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetOrientation( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Orientation dir) - { - 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 (RemoteGradient.Msg4_SetOrientation); - RemoteGradient.Msg4_SetOrientation* msg4SetOrientationPtr = (RemoteGradient.Msg4_SetOrientation*) _priv_portUse.AllocMessageBuffer(size); - msg4SetOrientationPtr->_priv_size = size; - msg4SetOrientationPtr->_priv_msgid = 4U; - msg4SetOrientationPtr->dir = dir; - msg4SetOrientationPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4SetOrientationPtr, ref RemoteGradient.s_priv_ByteOrder_Msg4_SetOrientation, typeof (RemoteGradient.Msg4_SetOrientation), 0, 0); - _priv_pmsgUse = (Message*) msg4SetOrientationPtr; - } - - public unsafe void SendSetOrientation(Orientation dir) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetOrientation(out _priv_portUse, out _priv_pmsgUse, dir); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteGradient CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteGradient(port, handle, true); - } - - public static RemoteGradient CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteGradient(port, handle, false); - } - - protected RemoteGradient(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteGradient(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteGradient && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_Clear - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg1_AddValue - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public float flValue; - public float flPosition; - public RelativeSpace relative; - } - - [ComVisible(false)] - private struct Msg2_SetOffset - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public float flOffset; - } - - [ComVisible(false)] - private struct Msg3_SetColorMask - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public ColorF clrMask; - } - - [ComVisible(false)] - private struct Msg4_SetOrientation - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Orientation dir; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteNullDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteNullDevice.cs index 6345287..f1375d1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteNullDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteNullDevice.cs @@ -9,75 +9,75 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteNullDevice : RemoteDevice - { - private static ushort[] s_priv_ByteOrder_Msg8_Create; - - protected RemoteNullDevice() + internal class RemoteNullDevice : RemoteDevice { + private static ushort[] s_priv_ByteOrder_Msg8_Create; + + protected RemoteNullDevice() + { + } + + public static unsafe RemoteNullDevice Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + LocalDeviceCallback cb) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE deviceClassHandle = _priv_protocolInstance.NullDevice_ClassHandle; + RemoteNullDevice remoteNullDevice = new RemoteNullDevice(port, _priv_owner); + uint num = (uint)sizeof(RemoteNullDevice.Msg8_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteNullDevice.Msg8_Create* msg8CreatePtr = (RemoteNullDevice.Msg8_Create*)pMem; + msg8CreatePtr->_priv_size = num; + msg8CreatePtr->_priv_msgid = 8U; + msg8CreatePtr->_priv_objcb = cb.RenderHandle; + msg8CreatePtr->_priv_ctxcb = port.Session.LocalContext; + msg8CreatePtr->_priv_idObjectSubject = remoteNullDevice.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteNullDevice.s_priv_ByteOrder_Msg8_Create, typeof(RemoteNullDevice.Msg8_Create), 0, 0); + port.CreateRemoteObject(deviceClassHandle, remoteNullDevice.m_renderHandle, (Message*)msg8CreatePtr); + return remoteNullDevice; + } + + public static RemoteNullDevice CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteNullDevice(port, handle, true); + } + + public static RemoteNullDevice CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteNullDevice(port, handle, false); + } + + protected RemoteNullDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteNullDevice(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteNullDevice && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg8_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + } } - - public static unsafe RemoteNullDevice Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - LocalDeviceCallback cb) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE deviceClassHandle = _priv_protocolInstance.NullDevice_ClassHandle; - RemoteNullDevice remoteNullDevice = new RemoteNullDevice(port, _priv_owner); - uint num = (uint) sizeof (RemoteNullDevice.Msg8_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteNullDevice.Msg8_Create* msg8CreatePtr = (RemoteNullDevice.Msg8_Create*) pMem; - msg8CreatePtr->_priv_size = num; - msg8CreatePtr->_priv_msgid = 8U; - msg8CreatePtr->_priv_objcb = cb.RenderHandle; - msg8CreatePtr->_priv_ctxcb = port.Session.LocalContext; - msg8CreatePtr->_priv_idObjectSubject = remoteNullDevice.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteNullDevice.s_priv_ByteOrder_Msg8_Create, typeof (RemoteNullDevice.Msg8_Create), 0, 0); - port.CreateRemoteObject(deviceClassHandle, remoteNullDevice.m_renderHandle, (Message*) msg8CreatePtr); - return remoteNullDevice; - } - - public static RemoteNullDevice CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteNullDevice(port, handle, true); - } - - public static RemoteNullDevice CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteNullDevice(port, handle, false); - } - - protected RemoteNullDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteNullDevice(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteNullDevice && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg8_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteRasterizer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteRasterizer.cs index b157716..1e2103c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteRasterizer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteRasterizer.cs @@ -11,94 +11,94 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteRasterizer : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_LoadRawImage; - - protected RemoteRasterizer() + internal class RemoteRasterizer : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_LoadRawImage; + + protected RemoteRasterizer() + { + } + + public static unsafe void BuildLoadRawImage( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ProtocolSplashRendering _priv_protocolInstance, + RemoteSurface surContent, + RemoteDataBuffer buffer, + ImageHeader info) + { + RenderPort port = _priv_protocolInstance.Port; + _priv_portUse = port; + RENDERHANDLE rasterizerClassHandle = _priv_protocolInstance.Rasterizer_ClassHandle; + _priv_portUse.ValidateHandle(rasterizerClassHandle); + if (surContent != null) + _priv_portUse.ValidateHandleOrNull(surContent.RenderHandle); + if (buffer != null) + _priv_portUse.ValidateHandleOrNull(buffer.RenderHandle); + uint size = (uint)sizeof(RemoteRasterizer.Msg0_LoadRawImage); + RemoteRasterizer.Msg0_LoadRawImage* msg0LoadRawImagePtr = (RemoteRasterizer.Msg0_LoadRawImage*)_priv_portUse.AllocMessageBuffer(size); + msg0LoadRawImagePtr->_priv_size = size; + msg0LoadRawImagePtr->_priv_msgid = 0U; + msg0LoadRawImagePtr->surContent = surContent != null ? surContent.RenderHandle : RENDERHANDLE.NULL; + msg0LoadRawImagePtr->buffer = buffer != null ? buffer.RenderHandle : RENDERHANDLE.NULL; + msg0LoadRawImagePtr->info = info; + msg0LoadRawImagePtr->_priv_idObjectSubject = rasterizerClassHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0LoadRawImagePtr, ref RemoteRasterizer.s_priv_ByteOrder_Msg0_LoadRawImage, typeof(RemoteRasterizer.Msg0_LoadRawImage), 0, 0); + _priv_pmsgUse = (Message*)msg0LoadRawImagePtr; + } + + public static unsafe void SendLoadRawImage( + ProtocolSplashRendering _priv_protocolInstance, + RemoteSurface surContent, + RemoteDataBuffer buffer, + ImageHeader info) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + RemoteRasterizer.BuildLoadRawImage(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, surContent, buffer, info); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteRasterizer CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteRasterizer(port, handle, true); + } + + public static RemoteRasterizer CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteRasterizer(port, handle, false); + } + + protected RemoteRasterizer(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteRasterizer(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteRasterizer && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_LoadRawImage + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE surContent; + public RENDERHANDLE buffer; + public ImageHeader info; + } } - - public static unsafe void BuildLoadRawImage( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ProtocolSplashRendering _priv_protocolInstance, - RemoteSurface surContent, - RemoteDataBuffer buffer, - ImageHeader info) - { - RenderPort port = _priv_protocolInstance.Port; - _priv_portUse = port; - RENDERHANDLE rasterizerClassHandle = _priv_protocolInstance.Rasterizer_ClassHandle; - _priv_portUse.ValidateHandle(rasterizerClassHandle); - if (surContent != null) - _priv_portUse.ValidateHandleOrNull(surContent.RenderHandle); - if (buffer != null) - _priv_portUse.ValidateHandleOrNull(buffer.RenderHandle); - uint size = (uint) sizeof (RemoteRasterizer.Msg0_LoadRawImage); - RemoteRasterizer.Msg0_LoadRawImage* msg0LoadRawImagePtr = (RemoteRasterizer.Msg0_LoadRawImage*) _priv_portUse.AllocMessageBuffer(size); - msg0LoadRawImagePtr->_priv_size = size; - msg0LoadRawImagePtr->_priv_msgid = 0U; - msg0LoadRawImagePtr->surContent = surContent != null ? surContent.RenderHandle : RENDERHANDLE.NULL; - msg0LoadRawImagePtr->buffer = buffer != null ? buffer.RenderHandle : RENDERHANDLE.NULL; - msg0LoadRawImagePtr->info = info; - msg0LoadRawImagePtr->_priv_idObjectSubject = rasterizerClassHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0LoadRawImagePtr, ref RemoteRasterizer.s_priv_ByteOrder_Msg0_LoadRawImage, typeof (RemoteRasterizer.Msg0_LoadRawImage), 0, 0); - _priv_pmsgUse = (Message*) msg0LoadRawImagePtr; - } - - public static unsafe void SendLoadRawImage( - ProtocolSplashRendering _priv_protocolInstance, - RemoteSurface surContent, - RemoteDataBuffer buffer, - ImageHeader info) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - RemoteRasterizer.BuildLoadRawImage(out _priv_portUse, out _priv_pmsgUse, _priv_protocolInstance, surContent, buffer, info); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteRasterizer CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteRasterizer(port, handle, true); - } - - public static RemoteRasterizer CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteRasterizer(port, handle, false); - } - - protected RemoteRasterizer(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteRasterizer(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteRasterizer && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_LoadRawImage - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE surContent; - public RENDERHANDLE buffer; - public ImageHeader info; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteRenderCaps.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteRenderCaps.cs index de4b34d..b1f060a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteRenderCaps.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteRenderCaps.cs @@ -10,112 +10,112 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteRenderCaps : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg1_Create; - private static ushort[] s_priv_ByteOrder_Msg0_CheckCaps; - - protected RemoteRenderCaps() + internal class RemoteRenderCaps : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg1_Create; + private static ushort[] s_priv_ByteOrder_Msg0_CheckCaps; + + protected RemoteRenderCaps() + { + } + + public static unsafe RemoteRenderCaps Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + LocalRenderCapsCallback callback) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE renderCapsClassHandle = _priv_protocolInstance.RenderCaps_ClassHandle; + RemoteRenderCaps remoteRenderCaps = new RemoteRenderCaps(port, _priv_owner); + uint num = (uint)sizeof(RemoteRenderCaps.Msg1_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteRenderCaps.Msg1_Create* msg1CreatePtr = (RemoteRenderCaps.Msg1_Create*)pMem; + msg1CreatePtr->_priv_size = num; + msg1CreatePtr->_priv_msgid = 1U; + msg1CreatePtr->_priv_objcallback = callback.RenderHandle; + msg1CreatePtr->_priv_ctxcallback = port.Session.LocalContext; + msg1CreatePtr->_priv_idObjectSubject = remoteRenderCaps.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteRenderCaps.s_priv_ByteOrder_Msg1_Create, typeof(RemoteRenderCaps.Msg1_Create), 0, 0); + port.CreateRemoteObject(renderCapsClassHandle, remoteRenderCaps.m_renderHandle, (Message*)msg1CreatePtr); + return remoteRenderCaps; + } + + public unsafe void BuildCheckCaps( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint nCookie) + { + 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(RemoteRenderCaps.Msg0_CheckCaps); + RemoteRenderCaps.Msg0_CheckCaps* msg0CheckCapsPtr = (RemoteRenderCaps.Msg0_CheckCaps*)_priv_portUse.AllocMessageBuffer(size); + msg0CheckCapsPtr->_priv_size = size; + msg0CheckCapsPtr->_priv_msgid = 0U; + msg0CheckCapsPtr->nCookie = nCookie; + msg0CheckCapsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0CheckCapsPtr, ref RemoteRenderCaps.s_priv_ByteOrder_Msg0_CheckCaps, typeof(RemoteRenderCaps.Msg0_CheckCaps), 0, 0); + _priv_pmsgUse = (Message*)msg0CheckCapsPtr; + } + + public unsafe void SendCheckCaps(uint nCookie) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildCheckCaps(out _priv_portUse, out _priv_pmsgUse, nCookie); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteRenderCaps CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteRenderCaps(port, handle, true); + } + + public static RemoteRenderCaps CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteRenderCaps(port, handle, false); + } + + protected RemoteRenderCaps(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteRenderCaps(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteRenderCaps && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg1_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE _priv_objcallback; + public ContextID _priv_ctxcallback; + } + + [ComVisible(false)] + private struct Msg0_CheckCaps + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint nCookie; + } } - - public static unsafe RemoteRenderCaps Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - LocalRenderCapsCallback callback) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE renderCapsClassHandle = _priv_protocolInstance.RenderCaps_ClassHandle; - RemoteRenderCaps remoteRenderCaps = new RemoteRenderCaps(port, _priv_owner); - uint num = (uint) sizeof (RemoteRenderCaps.Msg1_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteRenderCaps.Msg1_Create* msg1CreatePtr = (RemoteRenderCaps.Msg1_Create*) pMem; - msg1CreatePtr->_priv_size = num; - msg1CreatePtr->_priv_msgid = 1U; - msg1CreatePtr->_priv_objcallback = callback.RenderHandle; - msg1CreatePtr->_priv_ctxcallback = port.Session.LocalContext; - msg1CreatePtr->_priv_idObjectSubject = remoteRenderCaps.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteRenderCaps.s_priv_ByteOrder_Msg1_Create, typeof (RemoteRenderCaps.Msg1_Create), 0, 0); - port.CreateRemoteObject(renderCapsClassHandle, remoteRenderCaps.m_renderHandle, (Message*) msg1CreatePtr); - return remoteRenderCaps; - } - - public unsafe void BuildCheckCaps( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint nCookie) - { - 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 (RemoteRenderCaps.Msg0_CheckCaps); - RemoteRenderCaps.Msg0_CheckCaps* msg0CheckCapsPtr = (RemoteRenderCaps.Msg0_CheckCaps*) _priv_portUse.AllocMessageBuffer(size); - msg0CheckCapsPtr->_priv_size = size; - msg0CheckCapsPtr->_priv_msgid = 0U; - msg0CheckCapsPtr->nCookie = nCookie; - msg0CheckCapsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0CheckCapsPtr, ref RemoteRenderCaps.s_priv_ByteOrder_Msg0_CheckCaps, typeof (RemoteRenderCaps.Msg0_CheckCaps), 0, 0); - _priv_pmsgUse = (Message*) msg0CheckCapsPtr; - } - - public unsafe void SendCheckCaps(uint nCookie) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildCheckCaps(out _priv_portUse, out _priv_pmsgUse, nCookie); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteRenderCaps CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteRenderCaps(port, handle, true); - } - - public static RemoteRenderCaps CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteRenderCaps(port, handle, false); - } - - protected RemoteRenderCaps(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteRenderCaps(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteRenderCaps && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg1_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE _priv_objcallback; - public ContextID _priv_ctxcallback; - } - - [ComVisible(false)] - private struct Msg0_CheckCaps - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint nCookie; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSound.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSound.cs index 6d77551..ec6c247 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSound.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSound.cs @@ -10,100 +10,100 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteSound : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_Stop; - private static ushort[] s_priv_ByteOrder_Msg1_Play; - - protected RemoteSound() + internal class RemoteSound : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_Stop; + private static ushort[] s_priv_ByteOrder_Msg1_Play; + + protected RemoteSound() + { + } + + public unsafe void BuildStop(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(RemoteSound.Msg0_Stop); + RemoteSound.Msg0_Stop* msg0StopPtr = (RemoteSound.Msg0_Stop*)_priv_portUse.AllocMessageBuffer(size); + msg0StopPtr->_priv_size = size; + msg0StopPtr->_priv_msgid = 0U; + msg0StopPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0StopPtr, ref RemoteSound.s_priv_ByteOrder_Msg0_Stop, typeof(RemoteSound.Msg0_Stop), 0, 0); + _priv_pmsgUse = (Message*)msg0StopPtr; + } + + public unsafe void SendStop() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildStop(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildPlay(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(RemoteSound.Msg1_Play); + RemoteSound.Msg1_Play* msg1PlayPtr = (RemoteSound.Msg1_Play*)_priv_portUse.AllocMessageBuffer(size); + msg1PlayPtr->_priv_size = size; + msg1PlayPtr->_priv_msgid = 1U; + msg1PlayPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1PlayPtr, ref RemoteSound.s_priv_ByteOrder_Msg1_Play, typeof(RemoteSound.Msg1_Play), 0, 0); + _priv_pmsgUse = (Message*)msg1PlayPtr; + } + + public unsafe void SendPlay() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildPlay(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteSound CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteSound(port, handle, true); + + public static RemoteSound CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteSound(port, handle, false); + } + + protected RemoteSound(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteSound(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteSound && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_Stop + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg1_Play + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } } - - public unsafe void BuildStop(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 (RemoteSound.Msg0_Stop); - RemoteSound.Msg0_Stop* msg0StopPtr = (RemoteSound.Msg0_Stop*) _priv_portUse.AllocMessageBuffer(size); - msg0StopPtr->_priv_size = size; - msg0StopPtr->_priv_msgid = 0U; - msg0StopPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0StopPtr, ref RemoteSound.s_priv_ByteOrder_Msg0_Stop, typeof (RemoteSound.Msg0_Stop), 0, 0); - _priv_pmsgUse = (Message*) msg0StopPtr; - } - - public unsafe void SendStop() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildStop(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildPlay(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 (RemoteSound.Msg1_Play); - RemoteSound.Msg1_Play* msg1PlayPtr = (RemoteSound.Msg1_Play*) _priv_portUse.AllocMessageBuffer(size); - msg1PlayPtr->_priv_size = size; - msg1PlayPtr->_priv_msgid = 1U; - msg1PlayPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1PlayPtr, ref RemoteSound.s_priv_ByteOrder_Msg1_Play, typeof (RemoteSound.Msg1_Play), 0, 0); - _priv_pmsgUse = (Message*) msg1PlayPtr; - } - - public unsafe void SendPlay() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildPlay(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteSound CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteSound(port, handle, true); - - public static RemoteSound CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteSound(port, handle, false); - } - - protected RemoteSound(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteSound(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteSound && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_Stop - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg1_Play - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSoundBuffer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSoundBuffer.cs index cebaa2d..fcab43e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSoundBuffer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSoundBuffer.cs @@ -11,80 +11,80 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteSoundBuffer : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_LoadSoundData; - - protected RemoteSoundBuffer() + internal class RemoteSoundBuffer : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_LoadSoundData; + + protected RemoteSoundBuffer() + { + } + + public unsafe void BuildLoadSoundData( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteDataBuffer dataBuffer) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + if (dataBuffer != null) + _priv_portUse.ValidateHandleOrNull(dataBuffer.RenderHandle); + uint size = (uint)sizeof(RemoteSoundBuffer.Msg0_LoadSoundData); + RemoteSoundBuffer.Msg0_LoadSoundData* msg0LoadSoundDataPtr = (RemoteSoundBuffer.Msg0_LoadSoundData*)_priv_portUse.AllocMessageBuffer(size); + msg0LoadSoundDataPtr->_priv_size = size; + msg0LoadSoundDataPtr->_priv_msgid = 0U; + msg0LoadSoundDataPtr->dataBuffer = dataBuffer != null ? dataBuffer.RenderHandle : RENDERHANDLE.NULL; + msg0LoadSoundDataPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0LoadSoundDataPtr, ref RemoteSoundBuffer.s_priv_ByteOrder_Msg0_LoadSoundData, typeof(RemoteSoundBuffer.Msg0_LoadSoundData), 0, 0); + _priv_pmsgUse = (Message*)msg0LoadSoundDataPtr; + } + + public unsafe void SendLoadSoundData(RemoteDataBuffer dataBuffer) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildLoadSoundData(out _priv_portUse, out _priv_pmsgUse, dataBuffer); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteSoundBuffer CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteSoundBuffer(port, handle, true); + } + + public static RemoteSoundBuffer CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteSoundBuffer(port, handle, false); + } + + protected RemoteSoundBuffer(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteSoundBuffer(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteSoundBuffer && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_LoadSoundData + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE dataBuffer; + } } - - public unsafe void BuildLoadSoundData( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteDataBuffer dataBuffer) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - if (dataBuffer != null) - _priv_portUse.ValidateHandleOrNull(dataBuffer.RenderHandle); - uint size = (uint) sizeof (RemoteSoundBuffer.Msg0_LoadSoundData); - RemoteSoundBuffer.Msg0_LoadSoundData* msg0LoadSoundDataPtr = (RemoteSoundBuffer.Msg0_LoadSoundData*) _priv_portUse.AllocMessageBuffer(size); - msg0LoadSoundDataPtr->_priv_size = size; - msg0LoadSoundDataPtr->_priv_msgid = 0U; - msg0LoadSoundDataPtr->dataBuffer = dataBuffer != null ? dataBuffer.RenderHandle : RENDERHANDLE.NULL; - msg0LoadSoundDataPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0LoadSoundDataPtr, ref RemoteSoundBuffer.s_priv_ByteOrder_Msg0_LoadSoundData, typeof (RemoteSoundBuffer.Msg0_LoadSoundData), 0, 0); - _priv_pmsgUse = (Message*) msg0LoadSoundDataPtr; - } - - public unsafe void SendLoadSoundData(RemoteDataBuffer dataBuffer) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildLoadSoundData(out _priv_portUse, out _priv_pmsgUse, dataBuffer); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteSoundBuffer CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteSoundBuffer(port, handle, true); - } - - public static RemoteSoundBuffer CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteSoundBuffer(port, handle, false); - } - - protected RemoteSoundBuffer(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteSoundBuffer(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteSoundBuffer && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_LoadSoundData - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE dataBuffer; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSoundDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSoundDevice.cs index 195d2bd..3b8efa5 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSoundDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSoundDevice.cs @@ -11,199 +11,199 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteSoundDevice : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_CreateSound; - private static ushort[] s_priv_ByteOrder_Msg1_CreateSoundBuffer; - private static ushort[] s_priv_ByteOrder_Msg2_EvictExternalResources; - private static ushort[] s_priv_ByteOrder_Msg3_CreateExternalResources; - - protected RemoteSoundDevice() + internal class RemoteSoundDevice : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_CreateSound; + private static ushort[] s_priv_ByteOrder_Msg1_CreateSoundBuffer; + private static ushort[] s_priv_ByteOrder_Msg2_EvictExternalResources; + private static ushort[] s_priv_ByteOrder_Msg3_CreateExternalResources; + + protected RemoteSoundDevice() + { + } + + public unsafe void BuildCreateSound( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RENDERHANDLE idNewSound, + RemoteSoundBuffer soundBuffer) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + if (soundBuffer != null) + _priv_portUse.ValidateHandleOrNull(soundBuffer.RenderHandle); + uint size = (uint)sizeof(RemoteSoundDevice.Msg0_CreateSound); + RemoteSoundDevice.Msg0_CreateSound* msg0CreateSoundPtr = (RemoteSoundDevice.Msg0_CreateSound*)_priv_portUse.AllocMessageBuffer(size); + msg0CreateSoundPtr->_priv_size = size; + msg0CreateSoundPtr->_priv_msgid = 0U; + msg0CreateSoundPtr->idNewSound = idNewSound; + msg0CreateSoundPtr->soundBuffer = soundBuffer != null ? soundBuffer.RenderHandle : RENDERHANDLE.NULL; + msg0CreateSoundPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0CreateSoundPtr, ref RemoteSoundDevice.s_priv_ByteOrder_Msg0_CreateSound, typeof(RemoteSoundDevice.Msg0_CreateSound), 0, 0); + _priv_pmsgUse = (Message*)msg0CreateSoundPtr; + } + + public unsafe void SendCreateSound(RENDERHANDLE idNewSound, RemoteSoundBuffer soundBuffer) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildCreateSound(out _priv_portUse, out _priv_pmsgUse, idNewSound, soundBuffer); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildCreateSoundBuffer( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RENDERHANDLE idNewBuffer, + SoundHeader info, + LocalSoundBufferCallback cb) + { + 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(RemoteSoundDevice.Msg1_CreateSoundBuffer); + RemoteSoundDevice.Msg1_CreateSoundBuffer* createSoundBufferPtr = (RemoteSoundDevice.Msg1_CreateSoundBuffer*)_priv_portUse.AllocMessageBuffer(size); + createSoundBufferPtr->_priv_size = size; + createSoundBufferPtr->_priv_msgid = 1U; + createSoundBufferPtr->idNewBuffer = idNewBuffer; + createSoundBufferPtr->info = info; + createSoundBufferPtr->_priv_objcb = cb.RenderHandle; + createSoundBufferPtr->_priv_ctxcb = _priv_portUse.Session.LocalContext; + createSoundBufferPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)createSoundBufferPtr, ref RemoteSoundDevice.s_priv_ByteOrder_Msg1_CreateSoundBuffer, typeof(RemoteSoundDevice.Msg1_CreateSoundBuffer), 0, 0); + _priv_pmsgUse = (Message*)createSoundBufferPtr; + } + + public unsafe void SendCreateSoundBuffer( + RENDERHANDLE idNewBuffer, + SoundHeader info, + LocalSoundBufferCallback cb) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildCreateSoundBuffer(out _priv_portUse, out _priv_pmsgUse, idNewBuffer, info, cb); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildEvictExternalResources( + 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(RemoteSoundDevice.Msg2_EvictExternalResources); + RemoteSoundDevice.Msg2_EvictExternalResources* externalResourcesPtr = (RemoteSoundDevice.Msg2_EvictExternalResources*)_priv_portUse.AllocMessageBuffer(size); + externalResourcesPtr->_priv_size = size; + externalResourcesPtr->_priv_msgid = 2U; + externalResourcesPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)externalResourcesPtr, ref RemoteSoundDevice.s_priv_ByteOrder_Msg2_EvictExternalResources, typeof(RemoteSoundDevice.Msg2_EvictExternalResources), 0, 0); + _priv_pmsgUse = (Message*)externalResourcesPtr; + } + + public unsafe void SendEvictExternalResources() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildEvictExternalResources(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildCreateExternalResources( + 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(RemoteSoundDevice.Msg3_CreateExternalResources); + RemoteSoundDevice.Msg3_CreateExternalResources* externalResourcesPtr = (RemoteSoundDevice.Msg3_CreateExternalResources*)_priv_portUse.AllocMessageBuffer(size); + externalResourcesPtr->_priv_size = size; + externalResourcesPtr->_priv_msgid = 3U; + externalResourcesPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)externalResourcesPtr, ref RemoteSoundDevice.s_priv_ByteOrder_Msg3_CreateExternalResources, typeof(RemoteSoundDevice.Msg3_CreateExternalResources), 0, 0); + _priv_pmsgUse = (Message*)externalResourcesPtr; + } + + public unsafe void SendCreateExternalResources() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildCreateExternalResources(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteSoundDevice CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteSoundDevice(port, handle, true); + } + + public static RemoteSoundDevice CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteSoundDevice(port, handle, false); + } + + protected RemoteSoundDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteSoundDevice(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteSoundDevice && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_CreateSound + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE idNewSound; + public RENDERHANDLE soundBuffer; + } + + [ComVisible(false)] + private struct Msg1_CreateSoundBuffer + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE idNewBuffer; + public SoundHeader info; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + } + + [ComVisible(false)] + private struct Msg2_EvictExternalResources + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg3_CreateExternalResources + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } } - - public unsafe void BuildCreateSound( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RENDERHANDLE idNewSound, - RemoteSoundBuffer soundBuffer) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - if (soundBuffer != null) - _priv_portUse.ValidateHandleOrNull(soundBuffer.RenderHandle); - uint size = (uint) sizeof (RemoteSoundDevice.Msg0_CreateSound); - RemoteSoundDevice.Msg0_CreateSound* msg0CreateSoundPtr = (RemoteSoundDevice.Msg0_CreateSound*) _priv_portUse.AllocMessageBuffer(size); - msg0CreateSoundPtr->_priv_size = size; - msg0CreateSoundPtr->_priv_msgid = 0U; - msg0CreateSoundPtr->idNewSound = idNewSound; - msg0CreateSoundPtr->soundBuffer = soundBuffer != null ? soundBuffer.RenderHandle : RENDERHANDLE.NULL; - msg0CreateSoundPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0CreateSoundPtr, ref RemoteSoundDevice.s_priv_ByteOrder_Msg0_CreateSound, typeof (RemoteSoundDevice.Msg0_CreateSound), 0, 0); - _priv_pmsgUse = (Message*) msg0CreateSoundPtr; - } - - public unsafe void SendCreateSound(RENDERHANDLE idNewSound, RemoteSoundBuffer soundBuffer) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildCreateSound(out _priv_portUse, out _priv_pmsgUse, idNewSound, soundBuffer); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildCreateSoundBuffer( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RENDERHANDLE idNewBuffer, - SoundHeader info, - LocalSoundBufferCallback cb) - { - 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 (RemoteSoundDevice.Msg1_CreateSoundBuffer); - RemoteSoundDevice.Msg1_CreateSoundBuffer* createSoundBufferPtr = (RemoteSoundDevice.Msg1_CreateSoundBuffer*) _priv_portUse.AllocMessageBuffer(size); - createSoundBufferPtr->_priv_size = size; - createSoundBufferPtr->_priv_msgid = 1U; - createSoundBufferPtr->idNewBuffer = idNewBuffer; - createSoundBufferPtr->info = info; - createSoundBufferPtr->_priv_objcb = cb.RenderHandle; - createSoundBufferPtr->_priv_ctxcb = _priv_portUse.Session.LocalContext; - createSoundBufferPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) createSoundBufferPtr, ref RemoteSoundDevice.s_priv_ByteOrder_Msg1_CreateSoundBuffer, typeof (RemoteSoundDevice.Msg1_CreateSoundBuffer), 0, 0); - _priv_pmsgUse = (Message*) createSoundBufferPtr; - } - - public unsafe void SendCreateSoundBuffer( - RENDERHANDLE idNewBuffer, - SoundHeader info, - LocalSoundBufferCallback cb) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildCreateSoundBuffer(out _priv_portUse, out _priv_pmsgUse, idNewBuffer, info, cb); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildEvictExternalResources( - 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 (RemoteSoundDevice.Msg2_EvictExternalResources); - RemoteSoundDevice.Msg2_EvictExternalResources* externalResourcesPtr = (RemoteSoundDevice.Msg2_EvictExternalResources*) _priv_portUse.AllocMessageBuffer(size); - externalResourcesPtr->_priv_size = size; - externalResourcesPtr->_priv_msgid = 2U; - externalResourcesPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) externalResourcesPtr, ref RemoteSoundDevice.s_priv_ByteOrder_Msg2_EvictExternalResources, typeof (RemoteSoundDevice.Msg2_EvictExternalResources), 0, 0); - _priv_pmsgUse = (Message*) externalResourcesPtr; - } - - public unsafe void SendEvictExternalResources() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildEvictExternalResources(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildCreateExternalResources( - 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 (RemoteSoundDevice.Msg3_CreateExternalResources); - RemoteSoundDevice.Msg3_CreateExternalResources* externalResourcesPtr = (RemoteSoundDevice.Msg3_CreateExternalResources*) _priv_portUse.AllocMessageBuffer(size); - externalResourcesPtr->_priv_size = size; - externalResourcesPtr->_priv_msgid = 3U; - externalResourcesPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) externalResourcesPtr, ref RemoteSoundDevice.s_priv_ByteOrder_Msg3_CreateExternalResources, typeof (RemoteSoundDevice.Msg3_CreateExternalResources), 0, 0); - _priv_pmsgUse = (Message*) externalResourcesPtr; - } - - public unsafe void SendCreateExternalResources() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildCreateExternalResources(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteSoundDevice CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteSoundDevice(port, handle, true); - } - - public static RemoteSoundDevice CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteSoundDevice(port, handle, false); - } - - protected RemoteSoundDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteSoundDevice(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteSoundDevice && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_CreateSound - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE idNewSound; - public RENDERHANDLE soundBuffer; - } - - [ComVisible(false)] - private struct Msg1_CreateSoundBuffer - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE idNewBuffer; - public SoundHeader info; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - } - - [ComVisible(false)] - private struct Msg2_EvictExternalResources - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg3_CreateExternalResources - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSprite.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSprite.cs index 6622119..a0ea306 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSprite.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSprite.cs @@ -10,203 +10,203 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteSprite : RemoteVisual - { - private static ushort[] s_priv_ByteOrder_Msg18_SetNineGrid; - private static ushort[] s_priv_ByteOrder_Msg19_AddCoordMapEntry; - private static ushort[] s_priv_ByteOrder_Msg20_ClearCoordMaps; - private static ushort[] s_priv_ByteOrder_Msg21_SetEffect; - - protected RemoteSprite() + internal class RemoteSprite : RemoteVisual { + private static ushort[] s_priv_ByteOrder_Msg18_SetNineGrid; + private static ushort[] s_priv_ByteOrder_Msg19_AddCoordMapEntry; + private static ushort[] s_priv_ByteOrder_Msg20_ClearCoordMaps; + private static ushort[] s_priv_ByteOrder_Msg21_SetEffect; + + protected RemoteSprite() + { + } + + public unsafe void BuildSetNineGrid( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nLeft, + int nTop, + int nRight, + int nBottom) + { + 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(RemoteSprite.Msg18_SetNineGrid); + RemoteSprite.Msg18_SetNineGrid* msg18SetNineGridPtr = (RemoteSprite.Msg18_SetNineGrid*)_priv_portUse.AllocMessageBuffer(size); + msg18SetNineGridPtr->_priv_size = size; + msg18SetNineGridPtr->_priv_msgid = 18U; + msg18SetNineGridPtr->nLeft = nLeft; + msg18SetNineGridPtr->nTop = nTop; + msg18SetNineGridPtr->nRight = nRight; + msg18SetNineGridPtr->nBottom = nBottom; + msg18SetNineGridPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg18SetNineGridPtr, ref RemoteSprite.s_priv_ByteOrder_Msg18_SetNineGrid, typeof(RemoteSprite.Msg18_SetNineGrid), 0, 0); + _priv_pmsgUse = (Message*)msg18SetNineGridPtr; + } + + public unsafe void SendSetNineGrid(int nLeft, int nTop, int nRight, int nBottom) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetNineGrid(out _priv_portUse, out _priv_pmsgUse, nLeft, nTop, nRight, nBottom); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAddCoordMapEntry( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxLayer, + Orientation orientation, + float flPosition, + float flValue) + { + 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(RemoteSprite.Msg19_AddCoordMapEntry); + RemoteSprite.Msg19_AddCoordMapEntry* addCoordMapEntryPtr = (RemoteSprite.Msg19_AddCoordMapEntry*)_priv_portUse.AllocMessageBuffer(size); + addCoordMapEntryPtr->_priv_size = size; + addCoordMapEntryPtr->_priv_msgid = 19U; + addCoordMapEntryPtr->idxLayer = idxLayer; + addCoordMapEntryPtr->orientation = orientation; + addCoordMapEntryPtr->flPosition = flPosition; + addCoordMapEntryPtr->flValue = flValue; + addCoordMapEntryPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)addCoordMapEntryPtr, ref RemoteSprite.s_priv_ByteOrder_Msg19_AddCoordMapEntry, typeof(RemoteSprite.Msg19_AddCoordMapEntry), 0, 0); + _priv_pmsgUse = (Message*)addCoordMapEntryPtr; + } + + public unsafe void SendAddCoordMapEntry( + int idxLayer, + Orientation orientation, + float flPosition, + float flValue) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAddCoordMapEntry(out _priv_portUse, out _priv_pmsgUse, idxLayer, orientation, flPosition, flValue); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildClearCoordMaps(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(RemoteSprite.Msg20_ClearCoordMaps); + RemoteSprite.Msg20_ClearCoordMaps* msg20ClearCoordMapsPtr = (RemoteSprite.Msg20_ClearCoordMaps*)_priv_portUse.AllocMessageBuffer(size); + msg20ClearCoordMapsPtr->_priv_size = size; + msg20ClearCoordMapsPtr->_priv_msgid = 20U; + msg20ClearCoordMapsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg20ClearCoordMapsPtr, ref RemoteSprite.s_priv_ByteOrder_Msg20_ClearCoordMaps, typeof(RemoteSprite.Msg20_ClearCoordMaps), 0, 0); + _priv_pmsgUse = (Message*)msg20ClearCoordMapsPtr; + } + + public unsafe void SendClearCoordMaps() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildClearCoordMaps(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetEffect( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteEffect effect) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + if (effect != null) + _priv_portUse.ValidateHandleOrNull(effect.RenderHandle); + uint size = (uint)sizeof(RemoteSprite.Msg21_SetEffect); + RemoteSprite.Msg21_SetEffect* msg21SetEffectPtr = (RemoteSprite.Msg21_SetEffect*)_priv_portUse.AllocMessageBuffer(size); + msg21SetEffectPtr->_priv_size = size; + msg21SetEffectPtr->_priv_msgid = 21U; + msg21SetEffectPtr->effect = effect != null ? effect.RenderHandle : RENDERHANDLE.NULL; + msg21SetEffectPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg21SetEffectPtr, ref RemoteSprite.s_priv_ByteOrder_Msg21_SetEffect, typeof(RemoteSprite.Msg21_SetEffect), 0, 0); + _priv_pmsgUse = (Message*)msg21SetEffectPtr; + } + + public unsafe void SendSetEffect(RemoteEffect effect) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetEffect(out _priv_portUse, out _priv_pmsgUse, effect); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteSprite CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteSprite(port, handle, true); + + public static RemoteSprite CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteSprite(port, handle, false); + } + + protected RemoteSprite(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteSprite(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteSprite && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg18_SetNineGrid + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nLeft; + public int nTop; + public int nRight; + public int nBottom; + } + + [ComVisible(false)] + private struct Msg19_AddCoordMapEntry + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxLayer; + public Orientation orientation; + public float flPosition; + public float flValue; + } + + [ComVisible(false)] + private struct Msg20_ClearCoordMaps + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg21_SetEffect + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE effect; + } } - - public unsafe void BuildSetNineGrid( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nLeft, - int nTop, - int nRight, - int nBottom) - { - 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 (RemoteSprite.Msg18_SetNineGrid); - RemoteSprite.Msg18_SetNineGrid* msg18SetNineGridPtr = (RemoteSprite.Msg18_SetNineGrid*) _priv_portUse.AllocMessageBuffer(size); - msg18SetNineGridPtr->_priv_size = size; - msg18SetNineGridPtr->_priv_msgid = 18U; - msg18SetNineGridPtr->nLeft = nLeft; - msg18SetNineGridPtr->nTop = nTop; - msg18SetNineGridPtr->nRight = nRight; - msg18SetNineGridPtr->nBottom = nBottom; - msg18SetNineGridPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg18SetNineGridPtr, ref RemoteSprite.s_priv_ByteOrder_Msg18_SetNineGrid, typeof (RemoteSprite.Msg18_SetNineGrid), 0, 0); - _priv_pmsgUse = (Message*) msg18SetNineGridPtr; - } - - public unsafe void SendSetNineGrid(int nLeft, int nTop, int nRight, int nBottom) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetNineGrid(out _priv_portUse, out _priv_pmsgUse, nLeft, nTop, nRight, nBottom); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAddCoordMapEntry( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxLayer, - Orientation orientation, - float flPosition, - float flValue) - { - 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 (RemoteSprite.Msg19_AddCoordMapEntry); - RemoteSprite.Msg19_AddCoordMapEntry* addCoordMapEntryPtr = (RemoteSprite.Msg19_AddCoordMapEntry*) _priv_portUse.AllocMessageBuffer(size); - addCoordMapEntryPtr->_priv_size = size; - addCoordMapEntryPtr->_priv_msgid = 19U; - addCoordMapEntryPtr->idxLayer = idxLayer; - addCoordMapEntryPtr->orientation = orientation; - addCoordMapEntryPtr->flPosition = flPosition; - addCoordMapEntryPtr->flValue = flValue; - addCoordMapEntryPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) addCoordMapEntryPtr, ref RemoteSprite.s_priv_ByteOrder_Msg19_AddCoordMapEntry, typeof (RemoteSprite.Msg19_AddCoordMapEntry), 0, 0); - _priv_pmsgUse = (Message*) addCoordMapEntryPtr; - } - - public unsafe void SendAddCoordMapEntry( - int idxLayer, - Orientation orientation, - float flPosition, - float flValue) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAddCoordMapEntry(out _priv_portUse, out _priv_pmsgUse, idxLayer, orientation, flPosition, flValue); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildClearCoordMaps(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 (RemoteSprite.Msg20_ClearCoordMaps); - RemoteSprite.Msg20_ClearCoordMaps* msg20ClearCoordMapsPtr = (RemoteSprite.Msg20_ClearCoordMaps*) _priv_portUse.AllocMessageBuffer(size); - msg20ClearCoordMapsPtr->_priv_size = size; - msg20ClearCoordMapsPtr->_priv_msgid = 20U; - msg20ClearCoordMapsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg20ClearCoordMapsPtr, ref RemoteSprite.s_priv_ByteOrder_Msg20_ClearCoordMaps, typeof (RemoteSprite.Msg20_ClearCoordMaps), 0, 0); - _priv_pmsgUse = (Message*) msg20ClearCoordMapsPtr; - } - - public unsafe void SendClearCoordMaps() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildClearCoordMaps(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetEffect( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteEffect effect) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - if (effect != null) - _priv_portUse.ValidateHandleOrNull(effect.RenderHandle); - uint size = (uint) sizeof (RemoteSprite.Msg21_SetEffect); - RemoteSprite.Msg21_SetEffect* msg21SetEffectPtr = (RemoteSprite.Msg21_SetEffect*) _priv_portUse.AllocMessageBuffer(size); - msg21SetEffectPtr->_priv_size = size; - msg21SetEffectPtr->_priv_msgid = 21U; - msg21SetEffectPtr->effect = effect != null ? effect.RenderHandle : RENDERHANDLE.NULL; - msg21SetEffectPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg21SetEffectPtr, ref RemoteSprite.s_priv_ByteOrder_Msg21_SetEffect, typeof (RemoteSprite.Msg21_SetEffect), 0, 0); - _priv_pmsgUse = (Message*) msg21SetEffectPtr; - } - - public unsafe void SendSetEffect(RemoteEffect effect) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetEffect(out _priv_portUse, out _priv_pmsgUse, effect); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteSprite CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteSprite(port, handle, true); - - public static RemoteSprite CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteSprite(port, handle, false); - } - - protected RemoteSprite(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteSprite(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteSprite && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg18_SetNineGrid - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nLeft; - public int nTop; - public int nRight; - public int nBottom; - } - - [ComVisible(false)] - private struct Msg19_AddCoordMapEntry - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxLayer; - public Orientation orientation; - public float flPosition; - public float flValue; - } - - [ComVisible(false)] - private struct Msg20_ClearCoordMaps - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg21_SetEffect - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE effect; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSurface.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSurface.cs index f9011ea..a11d0c4 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSurface.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSurface.cs @@ -10,329 +10,329 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteSurface : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_RemapContainer; - private static ushort[] s_priv_ByteOrder_Msg1_RemapLocation; - private static ushort[] s_priv_ByteOrder_Msg2_MarkContentValid; - private static ushort[] s_priv_ByteOrder_Msg3_Clear; - private static ushort[] s_priv_ByteOrder_Msg5_SetGutter; - private static ushort[] s_priv_ByteOrder_Msg6_SetDescription; - private static ushort[] s_priv_ByteOrder_Msg7_SetRotation; - private static ushort[] s_priv_ByteOrder_Msg8_SetStorageSize; - - protected RemoteSurface() + internal class RemoteSurface : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_RemapContainer; + private static ushort[] s_priv_ByteOrder_Msg1_RemapLocation; + private static ushort[] s_priv_ByteOrder_Msg2_MarkContentValid; + private static ushort[] s_priv_ByteOrder_Msg3_Clear; + private static ushort[] s_priv_ByteOrder_Msg5_SetGutter; + private static ushort[] s_priv_ByteOrder_Msg6_SetDescription; + private static ushort[] s_priv_ByteOrder_Msg7_SetRotation; + private static ushort[] s_priv_ByteOrder_Msg8_SetStorageSize; + + protected RemoteSurface() + { + } + + public unsafe void BuildRemapContainer( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteSurfacePool poolNewContainer) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + if (poolNewContainer != null) + _priv_portUse.ValidateHandleOrNull(poolNewContainer.RenderHandle); + uint size = (uint)sizeof(RemoteSurface.Msg0_RemapContainer); + RemoteSurface.Msg0_RemapContainer* msg0RemapContainerPtr = (RemoteSurface.Msg0_RemapContainer*)_priv_portUse.AllocMessageBuffer(size); + msg0RemapContainerPtr->_priv_size = size; + msg0RemapContainerPtr->_priv_msgid = 0U; + msg0RemapContainerPtr->poolNewContainer = poolNewContainer != null ? poolNewContainer.RenderHandle : RENDERHANDLE.NULL; + msg0RemapContainerPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0RemapContainerPtr, ref RemoteSurface.s_priv_ByteOrder_Msg0_RemapContainer, typeof(RemoteSurface.Msg0_RemapContainer), 0, 0); + _priv_pmsgUse = (Message*)msg0RemapContainerPtr; + } + + public unsafe void SendRemapContainer(RemoteSurfacePool poolNewContainer) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRemapContainer(out _priv_portUse, out _priv_pmsgUse, poolNewContainer); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildRemapLocation( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Rectangle rcContentPxl) + { + 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(RemoteSurface.Msg1_RemapLocation); + RemoteSurface.Msg1_RemapLocation* msg1RemapLocationPtr = (RemoteSurface.Msg1_RemapLocation*)_priv_portUse.AllocMessageBuffer(size); + msg1RemapLocationPtr->_priv_size = size; + msg1RemapLocationPtr->_priv_msgid = 1U; + msg1RemapLocationPtr->rcContentPxl = rcContentPxl; + msg1RemapLocationPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1RemapLocationPtr, ref RemoteSurface.s_priv_ByteOrder_Msg1_RemapLocation, typeof(RemoteSurface.Msg1_RemapLocation), 0, 0); + _priv_pmsgUse = (Message*)msg1RemapLocationPtr; + } + + public unsafe void SendRemapLocation(Rectangle rcContentPxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildRemapLocation(out _priv_portUse, out _priv_pmsgUse, rcContentPxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildMarkContentValid( + 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(RemoteSurface.Msg2_MarkContentValid); + RemoteSurface.Msg2_MarkContentValid* markContentValidPtr = (RemoteSurface.Msg2_MarkContentValid*)_priv_portUse.AllocMessageBuffer(size); + markContentValidPtr->_priv_size = size; + markContentValidPtr->_priv_msgid = 2U; + markContentValidPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)markContentValidPtr, ref RemoteSurface.s_priv_ByteOrder_Msg2_MarkContentValid, typeof(RemoteSurface.Msg2_MarkContentValid), 0, 0); + _priv_pmsgUse = (Message*)markContentValidPtr; + } + + public unsafe void SendMarkContentValid() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildMarkContentValid(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildClear(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(RemoteSurface.Msg3_Clear); + RemoteSurface.Msg3_Clear* msg3ClearPtr = (RemoteSurface.Msg3_Clear*)_priv_portUse.AllocMessageBuffer(size); + msg3ClearPtr->_priv_size = size; + msg3ClearPtr->_priv_msgid = 3U; + msg3ClearPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg3ClearPtr, ref RemoteSurface.s_priv_ByteOrder_Msg3_Clear, typeof(RemoteSurface.Msg3_Clear), 0, 0); + _priv_pmsgUse = (Message*)msg3ClearPtr; + } + + public unsafe void SendClear() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildClear(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetGutter( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Size sizeGutter) + { + 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(RemoteSurface.Msg5_SetGutter); + RemoteSurface.Msg5_SetGutter* msg5SetGutterPtr = (RemoteSurface.Msg5_SetGutter*)_priv_portUse.AllocMessageBuffer(size); + msg5SetGutterPtr->_priv_size = size; + msg5SetGutterPtr->_priv_msgid = 5U; + msg5SetGutterPtr->sizeGutter = sizeGutter; + msg5SetGutterPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg5SetGutterPtr, ref RemoteSurface.s_priv_ByteOrder_Msg5_SetGutter, typeof(RemoteSurface.Msg5_SetGutter), 0, 0); + _priv_pmsgUse = (Message*)msg5SetGutterPtr; + } + + public unsafe void SendSetGutter(Size sizeGutter) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetGutter(out _priv_portUse, out _priv_pmsgUse, sizeGutter); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetDescription( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stDescription) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteSurface.Msg6_SetDescription)); + BLOBREF blobref = blobInfo.Add(stDescription); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteSurface.Msg6_SetDescription* msg6SetDescriptionPtr = (RemoteSurface.Msg6_SetDescription*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg6SetDescriptionPtr->_priv_size = adjustedTotalSize; + msg6SetDescriptionPtr->_priv_msgid = 6U; + msg6SetDescriptionPtr->stDescription = blobref; + blobInfo.Attach((Message*)msg6SetDescriptionPtr); + msg6SetDescriptionPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg6SetDescriptionPtr, ref RemoteSurface.s_priv_ByteOrder_Msg6_SetDescription, typeof(RemoteSurface.Msg6_SetDescription), 0, 0); + _priv_pmsgUse = (Message*)msg6SetDescriptionPtr; + } + + public unsafe void SendSetDescription(string stDescription) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetDescription(out _priv_portUse, out _priv_pmsgUse, stDescription); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetRotation( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fRotated) + { + 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(RemoteSurface.Msg7_SetRotation); + RemoteSurface.Msg7_SetRotation* msg7SetRotationPtr = (RemoteSurface.Msg7_SetRotation*)_priv_portUse.AllocMessageBuffer(size); + msg7SetRotationPtr->_priv_size = size; + msg7SetRotationPtr->_priv_msgid = 7U; + msg7SetRotationPtr->fRotated = fRotated ? uint.MaxValue : 0U; + msg7SetRotationPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg7SetRotationPtr, ref RemoteSurface.s_priv_ByteOrder_Msg7_SetRotation, typeof(RemoteSurface.Msg7_SetRotation), 0, 0); + _priv_pmsgUse = (Message*)msg7SetRotationPtr; + } + + public unsafe void SendSetRotation(bool fRotated) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetRotation(out _priv_portUse, out _priv_pmsgUse, fRotated); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetStorageSize( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Size sizeStoragePxl) + { + 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(RemoteSurface.Msg8_SetStorageSize); + RemoteSurface.Msg8_SetStorageSize* msg8SetStorageSizePtr = (RemoteSurface.Msg8_SetStorageSize*)_priv_portUse.AllocMessageBuffer(size); + msg8SetStorageSizePtr->_priv_size = size; + msg8SetStorageSizePtr->_priv_msgid = 8U; + msg8SetStorageSizePtr->sizeStoragePxl = sizeStoragePxl; + msg8SetStorageSizePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg8SetStorageSizePtr, ref RemoteSurface.s_priv_ByteOrder_Msg8_SetStorageSize, typeof(RemoteSurface.Msg8_SetStorageSize), 0, 0); + _priv_pmsgUse = (Message*)msg8SetStorageSizePtr; + } + + public unsafe void SendSetStorageSize(Size sizeStoragePxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetStorageSize(out _priv_portUse, out _priv_pmsgUse, sizeStoragePxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteSurface CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteSurface(port, handle, true); + + public static RemoteSurface CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteSurface(port, handle, false); + } + + protected RemoteSurface(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteSurface(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteSurface && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_RemapContainer + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE poolNewContainer; + } + + [ComVisible(false)] + private struct Msg1_RemapLocation + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Rectangle rcContentPxl; + } + + [ComVisible(false)] + private struct Msg2_MarkContentValid + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg3_Clear + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg5_SetGutter + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Size sizeGutter; + } + + [ComVisible(false)] + private struct Msg6_SetDescription + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stDescription; + } + + [ComVisible(false)] + private struct Msg7_SetRotation + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fRotated; + } + + [ComVisible(false)] + private struct Msg8_SetStorageSize + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Size sizeStoragePxl; + } } - - public unsafe void BuildRemapContainer( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteSurfacePool poolNewContainer) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - if (poolNewContainer != null) - _priv_portUse.ValidateHandleOrNull(poolNewContainer.RenderHandle); - uint size = (uint) sizeof (RemoteSurface.Msg0_RemapContainer); - RemoteSurface.Msg0_RemapContainer* msg0RemapContainerPtr = (RemoteSurface.Msg0_RemapContainer*) _priv_portUse.AllocMessageBuffer(size); - msg0RemapContainerPtr->_priv_size = size; - msg0RemapContainerPtr->_priv_msgid = 0U; - msg0RemapContainerPtr->poolNewContainer = poolNewContainer != null ? poolNewContainer.RenderHandle : RENDERHANDLE.NULL; - msg0RemapContainerPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0RemapContainerPtr, ref RemoteSurface.s_priv_ByteOrder_Msg0_RemapContainer, typeof (RemoteSurface.Msg0_RemapContainer), 0, 0); - _priv_pmsgUse = (Message*) msg0RemapContainerPtr; - } - - public unsafe void SendRemapContainer(RemoteSurfacePool poolNewContainer) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRemapContainer(out _priv_portUse, out _priv_pmsgUse, poolNewContainer); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildRemapLocation( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Rectangle rcContentPxl) - { - 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 (RemoteSurface.Msg1_RemapLocation); - RemoteSurface.Msg1_RemapLocation* msg1RemapLocationPtr = (RemoteSurface.Msg1_RemapLocation*) _priv_portUse.AllocMessageBuffer(size); - msg1RemapLocationPtr->_priv_size = size; - msg1RemapLocationPtr->_priv_msgid = 1U; - msg1RemapLocationPtr->rcContentPxl = rcContentPxl; - msg1RemapLocationPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1RemapLocationPtr, ref RemoteSurface.s_priv_ByteOrder_Msg1_RemapLocation, typeof (RemoteSurface.Msg1_RemapLocation), 0, 0); - _priv_pmsgUse = (Message*) msg1RemapLocationPtr; - } - - public unsafe void SendRemapLocation(Rectangle rcContentPxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildRemapLocation(out _priv_portUse, out _priv_pmsgUse, rcContentPxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildMarkContentValid( - 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 (RemoteSurface.Msg2_MarkContentValid); - RemoteSurface.Msg2_MarkContentValid* markContentValidPtr = (RemoteSurface.Msg2_MarkContentValid*) _priv_portUse.AllocMessageBuffer(size); - markContentValidPtr->_priv_size = size; - markContentValidPtr->_priv_msgid = 2U; - markContentValidPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) markContentValidPtr, ref RemoteSurface.s_priv_ByteOrder_Msg2_MarkContentValid, typeof (RemoteSurface.Msg2_MarkContentValid), 0, 0); - _priv_pmsgUse = (Message*) markContentValidPtr; - } - - public unsafe void SendMarkContentValid() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildMarkContentValid(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildClear(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 (RemoteSurface.Msg3_Clear); - RemoteSurface.Msg3_Clear* msg3ClearPtr = (RemoteSurface.Msg3_Clear*) _priv_portUse.AllocMessageBuffer(size); - msg3ClearPtr->_priv_size = size; - msg3ClearPtr->_priv_msgid = 3U; - msg3ClearPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg3ClearPtr, ref RemoteSurface.s_priv_ByteOrder_Msg3_Clear, typeof (RemoteSurface.Msg3_Clear), 0, 0); - _priv_pmsgUse = (Message*) msg3ClearPtr; - } - - public unsafe void SendClear() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildClear(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetGutter( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Size sizeGutter) - { - 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 (RemoteSurface.Msg5_SetGutter); - RemoteSurface.Msg5_SetGutter* msg5SetGutterPtr = (RemoteSurface.Msg5_SetGutter*) _priv_portUse.AllocMessageBuffer(size); - msg5SetGutterPtr->_priv_size = size; - msg5SetGutterPtr->_priv_msgid = 5U; - msg5SetGutterPtr->sizeGutter = sizeGutter; - msg5SetGutterPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg5SetGutterPtr, ref RemoteSurface.s_priv_ByteOrder_Msg5_SetGutter, typeof (RemoteSurface.Msg5_SetGutter), 0, 0); - _priv_pmsgUse = (Message*) msg5SetGutterPtr; - } - - public unsafe void SendSetGutter(Size sizeGutter) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetGutter(out _priv_portUse, out _priv_pmsgUse, sizeGutter); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetDescription( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stDescription) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteSurface.Msg6_SetDescription)); - BLOBREF blobref = blobInfo.Add(stDescription); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteSurface.Msg6_SetDescription* msg6SetDescriptionPtr = (RemoteSurface.Msg6_SetDescription*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg6SetDescriptionPtr->_priv_size = adjustedTotalSize; - msg6SetDescriptionPtr->_priv_msgid = 6U; - msg6SetDescriptionPtr->stDescription = blobref; - blobInfo.Attach((Message*) msg6SetDescriptionPtr); - msg6SetDescriptionPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg6SetDescriptionPtr, ref RemoteSurface.s_priv_ByteOrder_Msg6_SetDescription, typeof (RemoteSurface.Msg6_SetDescription), 0, 0); - _priv_pmsgUse = (Message*) msg6SetDescriptionPtr; - } - - public unsafe void SendSetDescription(string stDescription) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetDescription(out _priv_portUse, out _priv_pmsgUse, stDescription); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetRotation( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fRotated) - { - 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 (RemoteSurface.Msg7_SetRotation); - RemoteSurface.Msg7_SetRotation* msg7SetRotationPtr = (RemoteSurface.Msg7_SetRotation*) _priv_portUse.AllocMessageBuffer(size); - msg7SetRotationPtr->_priv_size = size; - msg7SetRotationPtr->_priv_msgid = 7U; - msg7SetRotationPtr->fRotated = fRotated ? uint.MaxValue : 0U; - msg7SetRotationPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg7SetRotationPtr, ref RemoteSurface.s_priv_ByteOrder_Msg7_SetRotation, typeof (RemoteSurface.Msg7_SetRotation), 0, 0); - _priv_pmsgUse = (Message*) msg7SetRotationPtr; - } - - public unsafe void SendSetRotation(bool fRotated) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetRotation(out _priv_portUse, out _priv_pmsgUse, fRotated); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetStorageSize( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Size sizeStoragePxl) - { - 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 (RemoteSurface.Msg8_SetStorageSize); - RemoteSurface.Msg8_SetStorageSize* msg8SetStorageSizePtr = (RemoteSurface.Msg8_SetStorageSize*) _priv_portUse.AllocMessageBuffer(size); - msg8SetStorageSizePtr->_priv_size = size; - msg8SetStorageSizePtr->_priv_msgid = 8U; - msg8SetStorageSizePtr->sizeStoragePxl = sizeStoragePxl; - msg8SetStorageSizePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg8SetStorageSizePtr, ref RemoteSurface.s_priv_ByteOrder_Msg8_SetStorageSize, typeof (RemoteSurface.Msg8_SetStorageSize), 0, 0); - _priv_pmsgUse = (Message*) msg8SetStorageSizePtr; - } - - public unsafe void SendSetStorageSize(Size sizeStoragePxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetStorageSize(out _priv_portUse, out _priv_pmsgUse, sizeStoragePxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteSurface CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteSurface(port, handle, true); - - public static RemoteSurface CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteSurface(port, handle, false); - } - - protected RemoteSurface(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteSurface(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteSurface && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_RemapContainer - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE poolNewContainer; - } - - [ComVisible(false)] - private struct Msg1_RemapLocation - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Rectangle rcContentPxl; - } - - [ComVisible(false)] - private struct Msg2_MarkContentValid - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg3_Clear - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg5_SetGutter - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Size sizeGutter; - } - - [ComVisible(false)] - private struct Msg6_SetDescription - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stDescription; - } - - [ComVisible(false)] - private struct Msg7_SetRotation - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fRotated; - } - - [ComVisible(false)] - private struct Msg8_SetStorageSize - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Size sizeStoragePxl; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSurfacePool.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSurfacePool.cs index 7c2d0a4..49c2d28 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSurfacePool.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteSurfacePool.cs @@ -10,223 +10,223 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteSurfacePool : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_SetEffect; - private static ushort[] s_priv_ByteOrder_Msg1_CreateSurface; - private static ushort[] s_priv_ByteOrder_Msg2_Free; - private static ushort[] s_priv_ByteOrder_Msg3_Allocate; - private static ushort[] s_priv_ByteOrder_Msg4_SetPriority; - - protected RemoteSurfacePool() + internal class RemoteSurfacePool : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_SetEffect; + private static ushort[] s_priv_ByteOrder_Msg1_CreateSurface; + private static ushort[] s_priv_ByteOrder_Msg2_Free; + private static ushort[] s_priv_ByteOrder_Msg3_Allocate; + private static ushort[] s_priv_ByteOrder_Msg4_SetPriority; + + protected RemoteSurfacePool() + { + } + + public unsafe void BuildSetEffect( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteEffect effect) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + if (effect != null) + _priv_portUse.ValidateHandleOrNull(effect.RenderHandle); + uint size = (uint)sizeof(RemoteSurfacePool.Msg0_SetEffect); + RemoteSurfacePool.Msg0_SetEffect* msg0SetEffectPtr = (RemoteSurfacePool.Msg0_SetEffect*)_priv_portUse.AllocMessageBuffer(size); + msg0SetEffectPtr->_priv_size = size; + msg0SetEffectPtr->_priv_msgid = 0U; + msg0SetEffectPtr->effect = effect != null ? effect.RenderHandle : RENDERHANDLE.NULL; + msg0SetEffectPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0SetEffectPtr, ref RemoteSurfacePool.s_priv_ByteOrder_Msg0_SetEffect, typeof(RemoteSurfacePool.Msg0_SetEffect), 0, 0); + _priv_pmsgUse = (Message*)msg0SetEffectPtr; + } + + public unsafe void SendSetEffect(RemoteEffect effect) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetEffect(out _priv_portUse, out _priv_pmsgUse, effect); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildCreateSurface( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RENDERHANDLE idNewSurface) + { + 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(RemoteSurfacePool.Msg1_CreateSurface); + RemoteSurfacePool.Msg1_CreateSurface* msg1CreateSurfacePtr = (RemoteSurfacePool.Msg1_CreateSurface*)_priv_portUse.AllocMessageBuffer(size); + msg1CreateSurfacePtr->_priv_size = size; + msg1CreateSurfacePtr->_priv_msgid = 1U; + msg1CreateSurfacePtr->idNewSurface = idNewSurface; + msg1CreateSurfacePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1CreateSurfacePtr, ref RemoteSurfacePool.s_priv_ByteOrder_Msg1_CreateSurface, typeof(RemoteSurfacePool.Msg1_CreateSurface), 0, 0); + _priv_pmsgUse = (Message*)msg1CreateSurfacePtr; + } + + public unsafe void SendCreateSurface(RENDERHANDLE idNewSurface) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildCreateSurface(out _priv_portUse, out _priv_pmsgUse, idNewSurface); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildFree(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(RemoteSurfacePool.Msg2_Free); + RemoteSurfacePool.Msg2_Free* msg2FreePtr = (RemoteSurfacePool.Msg2_Free*)_priv_portUse.AllocMessageBuffer(size); + msg2FreePtr->_priv_size = size; + msg2FreePtr->_priv_msgid = 2U; + msg2FreePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg2FreePtr, ref RemoteSurfacePool.s_priv_ByteOrder_Msg2_Free, typeof(RemoteSurfacePool.Msg2_Free), 0, 0); + _priv_pmsgUse = (Message*)msg2FreePtr; + } + + public unsafe void SendFree() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildFree(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildAllocate( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Size sizePxl) + { + 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(RemoteSurfacePool.Msg3_Allocate); + RemoteSurfacePool.Msg3_Allocate* msg3AllocatePtr = (RemoteSurfacePool.Msg3_Allocate*)_priv_portUse.AllocMessageBuffer(size); + msg3AllocatePtr->_priv_size = size; + msg3AllocatePtr->_priv_msgid = 3U; + msg3AllocatePtr->sizePxl = sizePxl; + msg3AllocatePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg3AllocatePtr, ref RemoteSurfacePool.s_priv_ByteOrder_Msg3_Allocate, typeof(RemoteSurfacePool.Msg3_Allocate), 0, 0); + _priv_pmsgUse = (Message*)msg3AllocatePtr; + } + + public unsafe void SendAllocate(Size sizePxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildAllocate(out _priv_portUse, out _priv_pmsgUse, sizePxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetPriority( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int nPriority) + { + 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(RemoteSurfacePool.Msg4_SetPriority); + RemoteSurfacePool.Msg4_SetPriority* msg4SetPriorityPtr = (RemoteSurfacePool.Msg4_SetPriority*)_priv_portUse.AllocMessageBuffer(size); + msg4SetPriorityPtr->_priv_size = size; + msg4SetPriorityPtr->_priv_msgid = 4U; + msg4SetPriorityPtr->nPriority = nPriority; + msg4SetPriorityPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4SetPriorityPtr, ref RemoteSurfacePool.s_priv_ByteOrder_Msg4_SetPriority, typeof(RemoteSurfacePool.Msg4_SetPriority), 0, 0); + _priv_pmsgUse = (Message*)msg4SetPriorityPtr; + } + + public unsafe void SendSetPriority(int nPriority) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetPriority(out _priv_portUse, out _priv_pmsgUse, nPriority); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteSurfacePool CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteSurfacePool(port, handle, true); + } + + public static RemoteSurfacePool CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteSurfacePool(port, handle, false); + } + + protected RemoteSurfacePool(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteSurfacePool(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteSurfacePool && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_SetEffect + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE effect; + } + + [ComVisible(false)] + private struct Msg1_CreateSurface + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE idNewSurface; + } + + [ComVisible(false)] + private struct Msg2_Free + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg3_Allocate + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Size sizePxl; + } + + [ComVisible(false)] + private struct Msg4_SetPriority + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int nPriority; + } } - - public unsafe void BuildSetEffect( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteEffect effect) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - if (effect != null) - _priv_portUse.ValidateHandleOrNull(effect.RenderHandle); - uint size = (uint) sizeof (RemoteSurfacePool.Msg0_SetEffect); - RemoteSurfacePool.Msg0_SetEffect* msg0SetEffectPtr = (RemoteSurfacePool.Msg0_SetEffect*) _priv_portUse.AllocMessageBuffer(size); - msg0SetEffectPtr->_priv_size = size; - msg0SetEffectPtr->_priv_msgid = 0U; - msg0SetEffectPtr->effect = effect != null ? effect.RenderHandle : RENDERHANDLE.NULL; - msg0SetEffectPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0SetEffectPtr, ref RemoteSurfacePool.s_priv_ByteOrder_Msg0_SetEffect, typeof (RemoteSurfacePool.Msg0_SetEffect), 0, 0); - _priv_pmsgUse = (Message*) msg0SetEffectPtr; - } - - public unsafe void SendSetEffect(RemoteEffect effect) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetEffect(out _priv_portUse, out _priv_pmsgUse, effect); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildCreateSurface( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RENDERHANDLE idNewSurface) - { - 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 (RemoteSurfacePool.Msg1_CreateSurface); - RemoteSurfacePool.Msg1_CreateSurface* msg1CreateSurfacePtr = (RemoteSurfacePool.Msg1_CreateSurface*) _priv_portUse.AllocMessageBuffer(size); - msg1CreateSurfacePtr->_priv_size = size; - msg1CreateSurfacePtr->_priv_msgid = 1U; - msg1CreateSurfacePtr->idNewSurface = idNewSurface; - msg1CreateSurfacePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1CreateSurfacePtr, ref RemoteSurfacePool.s_priv_ByteOrder_Msg1_CreateSurface, typeof (RemoteSurfacePool.Msg1_CreateSurface), 0, 0); - _priv_pmsgUse = (Message*) msg1CreateSurfacePtr; - } - - public unsafe void SendCreateSurface(RENDERHANDLE idNewSurface) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildCreateSurface(out _priv_portUse, out _priv_pmsgUse, idNewSurface); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildFree(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 (RemoteSurfacePool.Msg2_Free); - RemoteSurfacePool.Msg2_Free* msg2FreePtr = (RemoteSurfacePool.Msg2_Free*) _priv_portUse.AllocMessageBuffer(size); - msg2FreePtr->_priv_size = size; - msg2FreePtr->_priv_msgid = 2U; - msg2FreePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg2FreePtr, ref RemoteSurfacePool.s_priv_ByteOrder_Msg2_Free, typeof (RemoteSurfacePool.Msg2_Free), 0, 0); - _priv_pmsgUse = (Message*) msg2FreePtr; - } - - public unsafe void SendFree() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildFree(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildAllocate( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Size sizePxl) - { - 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 (RemoteSurfacePool.Msg3_Allocate); - RemoteSurfacePool.Msg3_Allocate* msg3AllocatePtr = (RemoteSurfacePool.Msg3_Allocate*) _priv_portUse.AllocMessageBuffer(size); - msg3AllocatePtr->_priv_size = size; - msg3AllocatePtr->_priv_msgid = 3U; - msg3AllocatePtr->sizePxl = sizePxl; - msg3AllocatePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg3AllocatePtr, ref RemoteSurfacePool.s_priv_ByteOrder_Msg3_Allocate, typeof (RemoteSurfacePool.Msg3_Allocate), 0, 0); - _priv_pmsgUse = (Message*) msg3AllocatePtr; - } - - public unsafe void SendAllocate(Size sizePxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildAllocate(out _priv_portUse, out _priv_pmsgUse, sizePxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetPriority( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int nPriority) - { - 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 (RemoteSurfacePool.Msg4_SetPriority); - RemoteSurfacePool.Msg4_SetPriority* msg4SetPriorityPtr = (RemoteSurfacePool.Msg4_SetPriority*) _priv_portUse.AllocMessageBuffer(size); - msg4SetPriorityPtr->_priv_size = size; - msg4SetPriorityPtr->_priv_msgid = 4U; - msg4SetPriorityPtr->nPriority = nPriority; - msg4SetPriorityPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4SetPriorityPtr, ref RemoteSurfacePool.s_priv_ByteOrder_Msg4_SetPriority, typeof (RemoteSurfacePool.Msg4_SetPriority), 0, 0); - _priv_pmsgUse = (Message*) msg4SetPriorityPtr; - } - - public unsafe void SendSetPriority(int nPriority) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetPriority(out _priv_portUse, out _priv_pmsgUse, nPriority); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteSurfacePool CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteSurfacePool(port, handle, true); - } - - public static RemoteSurfacePool CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteSurfacePool(port, handle, false); - } - - protected RemoteSurfacePool(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteSurfacePool(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteSurfacePool && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_SetEffect - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE effect; - } - - [ComVisible(false)] - private struct Msg1_CreateSurface - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE idNewSurface; - } - - [ComVisible(false)] - private struct Msg2_Free - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg3_Allocate - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Size sizePxl; - } - - [ComVisible(false)] - private struct Msg4_SetPriority - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int nPriority; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVideoPool.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVideoPool.cs index ae7f229..bcc2e71 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVideoPool.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVideoPool.cs @@ -10,359 +10,359 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteVideoPool : RemoteSurfacePool - { - private static ushort[] s_priv_ByteOrder_Msg6_NotifyVideoInputChanged; - private static ushort[] s_priv_ByteOrder_Msg7_SetContentOverscan; - private static ushort[] s_priv_ByteOrder_Msg8_NotifyVideoSizeChanged; - private static ushort[] s_priv_ByteOrder_Msg10_OnFrameReady; - private static ushort[] s_priv_ByteOrder_Msg11_OnClockStop; - private static ushort[] s_priv_ByteOrder_Msg12_OnClockStart; - private static ushort[] s_priv_ByteOrder_Msg13_OnDisconnect; - private static ushort[] s_priv_ByteOrder_Msg14_OnConnect; - - protected RemoteVideoPool() + internal class RemoteVideoPool : RemoteSurfacePool { + private static ushort[] s_priv_ByteOrder_Msg6_NotifyVideoInputChanged; + private static ushort[] s_priv_ByteOrder_Msg7_SetContentOverscan; + private static ushort[] s_priv_ByteOrder_Msg8_NotifyVideoSizeChanged; + private static ushort[] s_priv_ByteOrder_Msg10_OnFrameReady; + private static ushort[] s_priv_ByteOrder_Msg11_OnClockStop; + private static ushort[] s_priv_ByteOrder_Msg12_OnClockStart; + private static ushort[] s_priv_ByteOrder_Msg13_OnDisconnect; + private static ushort[] s_priv_ByteOrder_Msg14_OnConnect; + + protected RemoteVideoPool() + { + } + + public unsafe void BuildNotifyVideoInputChanged( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Size sizeContentPxl, + Size sizeAspectRatio) + { + 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(RemoteVideoPool.Msg6_NotifyVideoInputChanged); + RemoteVideoPool.Msg6_NotifyVideoInputChanged* videoInputChangedPtr = (RemoteVideoPool.Msg6_NotifyVideoInputChanged*)_priv_portUse.AllocMessageBuffer(size); + videoInputChangedPtr->_priv_size = size; + videoInputChangedPtr->_priv_msgid = 6U; + videoInputChangedPtr->sizeContentPxl = sizeContentPxl; + videoInputChangedPtr->sizeAspectRatio = sizeAspectRatio; + videoInputChangedPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)videoInputChangedPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg6_NotifyVideoInputChanged, typeof(RemoteVideoPool.Msg6_NotifyVideoInputChanged), 0, 0); + _priv_pmsgUse = (Message*)videoInputChangedPtr; + } + + public unsafe void SendNotifyVideoInputChanged(Size sizeContentPxl, Size sizeAspectRatio) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildNotifyVideoInputChanged(out _priv_portUse, out _priv_pmsgUse, sizeContentPxl, sizeAspectRatio); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetContentOverscan( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + float flContentOverscan) + { + 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(RemoteVideoPool.Msg7_SetContentOverscan); + RemoteVideoPool.Msg7_SetContentOverscan* setContentOverscanPtr = (RemoteVideoPool.Msg7_SetContentOverscan*)_priv_portUse.AllocMessageBuffer(size); + setContentOverscanPtr->_priv_size = size; + setContentOverscanPtr->_priv_msgid = 7U; + setContentOverscanPtr->flContentOverscan = flContentOverscan; + setContentOverscanPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setContentOverscanPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg7_SetContentOverscan, typeof(RemoteVideoPool.Msg7_SetContentOverscan), 0, 0); + _priv_pmsgUse = (Message*)setContentOverscanPtr; + } + + public unsafe void SendSetContentOverscan(float flContentOverscan) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetContentOverscan(out _priv_portUse, out _priv_pmsgUse, flContentOverscan); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildNotifyVideoSizeChanged( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Size sizeTargetPxl) + { + 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(RemoteVideoPool.Msg8_NotifyVideoSizeChanged); + RemoteVideoPool.Msg8_NotifyVideoSizeChanged* videoSizeChangedPtr = (RemoteVideoPool.Msg8_NotifyVideoSizeChanged*)_priv_portUse.AllocMessageBuffer(size); + videoSizeChangedPtr->_priv_size = size; + videoSizeChangedPtr->_priv_msgid = 8U; + videoSizeChangedPtr->sizeTargetPxl = sizeTargetPxl; + videoSizeChangedPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)videoSizeChangedPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg8_NotifyVideoSizeChanged, typeof(RemoteVideoPool.Msg8_NotifyVideoSizeChanged), 0, 0); + _priv_pmsgUse = (Message*)videoSizeChangedPtr; + } + + public unsafe void SendNotifyVideoSizeChanged(Size sizeTargetPxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildNotifyVideoSizeChanged(out _priv_portUse, out _priv_pmsgUse, sizeTargetPxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildOnFrameReady( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + int idxFrame, + long nTimeStampQPC, + long nFrameCount, + Rectangle rcContent, + uint nOptions) + { + 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(RemoteVideoPool.Msg10_OnFrameReady); + RemoteVideoPool.Msg10_OnFrameReady* msg10OnFrameReadyPtr = (RemoteVideoPool.Msg10_OnFrameReady*)_priv_portUse.AllocMessageBuffer(size); + msg10OnFrameReadyPtr->_priv_size = size; + msg10OnFrameReadyPtr->_priv_msgid = 10U; + msg10OnFrameReadyPtr->idxFrame = idxFrame; + msg10OnFrameReadyPtr->nTimeStampQPC = nTimeStampQPC; + msg10OnFrameReadyPtr->nFrameCount = nFrameCount; + msg10OnFrameReadyPtr->rcContent = rcContent; + msg10OnFrameReadyPtr->nOptions = nOptions; + msg10OnFrameReadyPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg10OnFrameReadyPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg10_OnFrameReady, typeof(RemoteVideoPool.Msg10_OnFrameReady), 0, 0); + _priv_pmsgUse = (Message*)msg10OnFrameReadyPtr; + } + + public unsafe void SendOnFrameReady( + int idxFrame, + long nTimeStampQPC, + long nFrameCount, + Rectangle rcContent, + uint nOptions) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildOnFrameReady(out _priv_portUse, out _priv_pmsgUse, idxFrame, nTimeStampQPC, nFrameCount, rcContent, nOptions); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildOnClockStop(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(RemoteVideoPool.Msg11_OnClockStop); + RemoteVideoPool.Msg11_OnClockStop* msg11OnClockStopPtr = (RemoteVideoPool.Msg11_OnClockStop*)_priv_portUse.AllocMessageBuffer(size); + msg11OnClockStopPtr->_priv_size = size; + msg11OnClockStopPtr->_priv_msgid = 11U; + msg11OnClockStopPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg11OnClockStopPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg11_OnClockStop, typeof(RemoteVideoPool.Msg11_OnClockStop), 0, 0); + _priv_pmsgUse = (Message*)msg11OnClockStopPtr; + } + + public unsafe void SendOnClockStop() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildOnClockStop(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildOnClockStart( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint nClockGeneration, + uint nFrameRateNumerator, + uint nFrameRateDenominator, + Rectangle rcBasisPxl, + Size sizeAspectRatio) + { + 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(RemoteVideoPool.Msg12_OnClockStart); + RemoteVideoPool.Msg12_OnClockStart* msg12OnClockStartPtr = (RemoteVideoPool.Msg12_OnClockStart*)_priv_portUse.AllocMessageBuffer(size); + msg12OnClockStartPtr->_priv_size = size; + msg12OnClockStartPtr->_priv_msgid = 12U; + msg12OnClockStartPtr->nClockGeneration = nClockGeneration; + msg12OnClockStartPtr->nFrameRateNumerator = nFrameRateNumerator; + msg12OnClockStartPtr->nFrameRateDenominator = nFrameRateDenominator; + msg12OnClockStartPtr->rcBasisPxl = rcBasisPxl; + msg12OnClockStartPtr->sizeAspectRatio = sizeAspectRatio; + msg12OnClockStartPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg12OnClockStartPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg12_OnClockStart, typeof(RemoteVideoPool.Msg12_OnClockStart), 0, 0); + _priv_pmsgUse = (Message*)msg12OnClockStartPtr; + } + + public unsafe void SendOnClockStart( + uint nClockGeneration, + uint nFrameRateNumerator, + uint nFrameRateDenominator, + Rectangle rcBasisPxl, + Size sizeAspectRatio) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildOnClockStart(out _priv_portUse, out _priv_pmsgUse, nClockGeneration, nFrameRateNumerator, nFrameRateDenominator, rcBasisPxl, sizeAspectRatio); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildOnDisconnect(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(RemoteVideoPool.Msg13_OnDisconnect); + RemoteVideoPool.Msg13_OnDisconnect* msg13OnDisconnectPtr = (RemoteVideoPool.Msg13_OnDisconnect*)_priv_portUse.AllocMessageBuffer(size); + msg13OnDisconnectPtr->_priv_size = size; + msg13OnDisconnectPtr->_priv_msgid = 13U; + msg13OnDisconnectPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg13OnDisconnectPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg13_OnDisconnect, typeof(RemoteVideoPool.Msg13_OnDisconnect), 0, 0); + _priv_pmsgUse = (Message*)msg13OnDisconnectPtr; + } + + public unsafe void SendOnDisconnect() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildOnDisconnect(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildOnConnect(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(RemoteVideoPool.Msg14_OnConnect); + RemoteVideoPool.Msg14_OnConnect* msg14OnConnectPtr = (RemoteVideoPool.Msg14_OnConnect*)_priv_portUse.AllocMessageBuffer(size); + msg14OnConnectPtr->_priv_size = size; + msg14OnConnectPtr->_priv_msgid = 14U; + msg14OnConnectPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg14OnConnectPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg14_OnConnect, typeof(RemoteVideoPool.Msg14_OnConnect), 0, 0); + _priv_pmsgUse = (Message*)msg14OnConnectPtr; + } + + public unsafe void SendOnConnect() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildOnConnect(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteVideoPool CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteVideoPool(port, handle, true); + } + + public static RemoteVideoPool CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteVideoPool(port, handle, false); + } + + protected RemoteVideoPool(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteVideoPool(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteVideoPool && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg6_NotifyVideoInputChanged + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Size sizeContentPxl; + public Size sizeAspectRatio; + } + + [ComVisible(false)] + private struct Msg7_SetContentOverscan + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public float flContentOverscan; + } + + [ComVisible(false)] + private struct Msg8_NotifyVideoSizeChanged + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Size sizeTargetPxl; + } + + [ComVisible(false)] + private struct Msg10_OnFrameReady + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public int idxFrame; + public long nTimeStampQPC; + public long nFrameCount; + public Rectangle rcContent; + public uint nOptions; + } + + [ComVisible(false)] + private struct Msg11_OnClockStop + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg12_OnClockStart + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint nClockGeneration; + public uint nFrameRateNumerator; + public uint nFrameRateDenominator; + public Rectangle rcBasisPxl; + public Size sizeAspectRatio; + } + + [ComVisible(false)] + private struct Msg13_OnDisconnect + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg14_OnConnect + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } } - - public unsafe void BuildNotifyVideoInputChanged( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Size sizeContentPxl, - Size sizeAspectRatio) - { - 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 (RemoteVideoPool.Msg6_NotifyVideoInputChanged); - RemoteVideoPool.Msg6_NotifyVideoInputChanged* videoInputChangedPtr = (RemoteVideoPool.Msg6_NotifyVideoInputChanged*) _priv_portUse.AllocMessageBuffer(size); - videoInputChangedPtr->_priv_size = size; - videoInputChangedPtr->_priv_msgid = 6U; - videoInputChangedPtr->sizeContentPxl = sizeContentPxl; - videoInputChangedPtr->sizeAspectRatio = sizeAspectRatio; - videoInputChangedPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) videoInputChangedPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg6_NotifyVideoInputChanged, typeof (RemoteVideoPool.Msg6_NotifyVideoInputChanged), 0, 0); - _priv_pmsgUse = (Message*) videoInputChangedPtr; - } - - public unsafe void SendNotifyVideoInputChanged(Size sizeContentPxl, Size sizeAspectRatio) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildNotifyVideoInputChanged(out _priv_portUse, out _priv_pmsgUse, sizeContentPxl, sizeAspectRatio); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetContentOverscan( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - float flContentOverscan) - { - 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 (RemoteVideoPool.Msg7_SetContentOverscan); - RemoteVideoPool.Msg7_SetContentOverscan* setContentOverscanPtr = (RemoteVideoPool.Msg7_SetContentOverscan*) _priv_portUse.AllocMessageBuffer(size); - setContentOverscanPtr->_priv_size = size; - setContentOverscanPtr->_priv_msgid = 7U; - setContentOverscanPtr->flContentOverscan = flContentOverscan; - setContentOverscanPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setContentOverscanPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg7_SetContentOverscan, typeof (RemoteVideoPool.Msg7_SetContentOverscan), 0, 0); - _priv_pmsgUse = (Message*) setContentOverscanPtr; - } - - public unsafe void SendSetContentOverscan(float flContentOverscan) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetContentOverscan(out _priv_portUse, out _priv_pmsgUse, flContentOverscan); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildNotifyVideoSizeChanged( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Size sizeTargetPxl) - { - 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 (RemoteVideoPool.Msg8_NotifyVideoSizeChanged); - RemoteVideoPool.Msg8_NotifyVideoSizeChanged* videoSizeChangedPtr = (RemoteVideoPool.Msg8_NotifyVideoSizeChanged*) _priv_portUse.AllocMessageBuffer(size); - videoSizeChangedPtr->_priv_size = size; - videoSizeChangedPtr->_priv_msgid = 8U; - videoSizeChangedPtr->sizeTargetPxl = sizeTargetPxl; - videoSizeChangedPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) videoSizeChangedPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg8_NotifyVideoSizeChanged, typeof (RemoteVideoPool.Msg8_NotifyVideoSizeChanged), 0, 0); - _priv_pmsgUse = (Message*) videoSizeChangedPtr; - } - - public unsafe void SendNotifyVideoSizeChanged(Size sizeTargetPxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildNotifyVideoSizeChanged(out _priv_portUse, out _priv_pmsgUse, sizeTargetPxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildOnFrameReady( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - int idxFrame, - long nTimeStampQPC, - long nFrameCount, - Rectangle rcContent, - uint nOptions) - { - 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 (RemoteVideoPool.Msg10_OnFrameReady); - RemoteVideoPool.Msg10_OnFrameReady* msg10OnFrameReadyPtr = (RemoteVideoPool.Msg10_OnFrameReady*) _priv_portUse.AllocMessageBuffer(size); - msg10OnFrameReadyPtr->_priv_size = size; - msg10OnFrameReadyPtr->_priv_msgid = 10U; - msg10OnFrameReadyPtr->idxFrame = idxFrame; - msg10OnFrameReadyPtr->nTimeStampQPC = nTimeStampQPC; - msg10OnFrameReadyPtr->nFrameCount = nFrameCount; - msg10OnFrameReadyPtr->rcContent = rcContent; - msg10OnFrameReadyPtr->nOptions = nOptions; - msg10OnFrameReadyPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg10OnFrameReadyPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg10_OnFrameReady, typeof (RemoteVideoPool.Msg10_OnFrameReady), 0, 0); - _priv_pmsgUse = (Message*) msg10OnFrameReadyPtr; - } - - public unsafe void SendOnFrameReady( - int idxFrame, - long nTimeStampQPC, - long nFrameCount, - Rectangle rcContent, - uint nOptions) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildOnFrameReady(out _priv_portUse, out _priv_pmsgUse, idxFrame, nTimeStampQPC, nFrameCount, rcContent, nOptions); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildOnClockStop(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 (RemoteVideoPool.Msg11_OnClockStop); - RemoteVideoPool.Msg11_OnClockStop* msg11OnClockStopPtr = (RemoteVideoPool.Msg11_OnClockStop*) _priv_portUse.AllocMessageBuffer(size); - msg11OnClockStopPtr->_priv_size = size; - msg11OnClockStopPtr->_priv_msgid = 11U; - msg11OnClockStopPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg11OnClockStopPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg11_OnClockStop, typeof (RemoteVideoPool.Msg11_OnClockStop), 0, 0); - _priv_pmsgUse = (Message*) msg11OnClockStopPtr; - } - - public unsafe void SendOnClockStop() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildOnClockStop(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildOnClockStart( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint nClockGeneration, - uint nFrameRateNumerator, - uint nFrameRateDenominator, - Rectangle rcBasisPxl, - Size sizeAspectRatio) - { - 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 (RemoteVideoPool.Msg12_OnClockStart); - RemoteVideoPool.Msg12_OnClockStart* msg12OnClockStartPtr = (RemoteVideoPool.Msg12_OnClockStart*) _priv_portUse.AllocMessageBuffer(size); - msg12OnClockStartPtr->_priv_size = size; - msg12OnClockStartPtr->_priv_msgid = 12U; - msg12OnClockStartPtr->nClockGeneration = nClockGeneration; - msg12OnClockStartPtr->nFrameRateNumerator = nFrameRateNumerator; - msg12OnClockStartPtr->nFrameRateDenominator = nFrameRateDenominator; - msg12OnClockStartPtr->rcBasisPxl = rcBasisPxl; - msg12OnClockStartPtr->sizeAspectRatio = sizeAspectRatio; - msg12OnClockStartPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg12OnClockStartPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg12_OnClockStart, typeof (RemoteVideoPool.Msg12_OnClockStart), 0, 0); - _priv_pmsgUse = (Message*) msg12OnClockStartPtr; - } - - public unsafe void SendOnClockStart( - uint nClockGeneration, - uint nFrameRateNumerator, - uint nFrameRateDenominator, - Rectangle rcBasisPxl, - Size sizeAspectRatio) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildOnClockStart(out _priv_portUse, out _priv_pmsgUse, nClockGeneration, nFrameRateNumerator, nFrameRateDenominator, rcBasisPxl, sizeAspectRatio); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildOnDisconnect(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 (RemoteVideoPool.Msg13_OnDisconnect); - RemoteVideoPool.Msg13_OnDisconnect* msg13OnDisconnectPtr = (RemoteVideoPool.Msg13_OnDisconnect*) _priv_portUse.AllocMessageBuffer(size); - msg13OnDisconnectPtr->_priv_size = size; - msg13OnDisconnectPtr->_priv_msgid = 13U; - msg13OnDisconnectPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg13OnDisconnectPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg13_OnDisconnect, typeof (RemoteVideoPool.Msg13_OnDisconnect), 0, 0); - _priv_pmsgUse = (Message*) msg13OnDisconnectPtr; - } - - public unsafe void SendOnDisconnect() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildOnDisconnect(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildOnConnect(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 (RemoteVideoPool.Msg14_OnConnect); - RemoteVideoPool.Msg14_OnConnect* msg14OnConnectPtr = (RemoteVideoPool.Msg14_OnConnect*) _priv_portUse.AllocMessageBuffer(size); - msg14OnConnectPtr->_priv_size = size; - msg14OnConnectPtr->_priv_msgid = 14U; - msg14OnConnectPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg14OnConnectPtr, ref RemoteVideoPool.s_priv_ByteOrder_Msg14_OnConnect, typeof (RemoteVideoPool.Msg14_OnConnect), 0, 0); - _priv_pmsgUse = (Message*) msg14OnConnectPtr; - } - - public unsafe void SendOnConnect() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildOnConnect(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteVideoPool CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteVideoPool(port, handle, true); - } - - public static RemoteVideoPool CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteVideoPool(port, handle, false); - } - - protected RemoteVideoPool(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteVideoPool(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteVideoPool && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg6_NotifyVideoInputChanged - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Size sizeContentPxl; - public Size sizeAspectRatio; - } - - [ComVisible(false)] - private struct Msg7_SetContentOverscan - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public float flContentOverscan; - } - - [ComVisible(false)] - private struct Msg8_NotifyVideoSizeChanged - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Size sizeTargetPxl; - } - - [ComVisible(false)] - private struct Msg10_OnFrameReady - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public int idxFrame; - public long nTimeStampQPC; - public long nFrameCount; - public Rectangle rcContent; - public uint nOptions; - } - - [ComVisible(false)] - private struct Msg11_OnClockStop - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg12_OnClockStart - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint nClockGeneration; - public uint nFrameRateNumerator; - public uint nFrameRateDenominator; - public Rectangle rcBasisPxl; - public Size sizeAspectRatio; - } - - [ComVisible(false)] - private struct Msg13_OnDisconnect - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg14_OnConnect - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVisual.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVisual.cs index 902d675..a3bd1a5 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVisual.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVisual.cs @@ -10,639 +10,639 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteVisual : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_ClearGradients; - private static ushort[] s_priv_ByteOrder_Msg1_AddGradient; - private static ushort[] s_priv_ByteOrder_Msg2_SetRelativeSize; - private static ushort[] s_priv_ByteOrder_Msg3_Reset; - private static ushort[] s_priv_ByteOrder_Msg4_ChangeDataBits; - private static ushort[] s_priv_ByteOrder_Msg5_ChangeParent; - private static ushort[] s_priv_ByteOrder_Msg6_SetDebugOutlineColor; - private static ushort[] s_priv_ByteOrder_Msg7_SetDebugID; - private static ushort[] s_priv_ByteOrder_Msg8_SetAlpha; - private static ushort[] s_priv_ByteOrder_Msg9_SetLayer; - private static ushort[] s_priv_ByteOrder_Msg10_SetRotation; - private static ushort[] s_priv_ByteOrder_Msg11_SetCenterPointScale; - private static ushort[] s_priv_ByteOrder_Msg12_SetScale; - private static ushort[] s_priv_ByteOrder_Msg13_SetSize; - private static ushort[] s_priv_ByteOrder_Msg14_SetPosition; - private static ushort[] s_priv_ByteOrder_Msg16_SetVisible; - - protected RemoteVisual() + internal class RemoteVisual : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_ClearGradients; + private static ushort[] s_priv_ByteOrder_Msg1_AddGradient; + private static ushort[] s_priv_ByteOrder_Msg2_SetRelativeSize; + private static ushort[] s_priv_ByteOrder_Msg3_Reset; + private static ushort[] s_priv_ByteOrder_Msg4_ChangeDataBits; + private static ushort[] s_priv_ByteOrder_Msg5_ChangeParent; + private static ushort[] s_priv_ByteOrder_Msg6_SetDebugOutlineColor; + private static ushort[] s_priv_ByteOrder_Msg7_SetDebugID; + private static ushort[] s_priv_ByteOrder_Msg8_SetAlpha; + private static ushort[] s_priv_ByteOrder_Msg9_SetLayer; + private static ushort[] s_priv_ByteOrder_Msg10_SetRotation; + private static ushort[] s_priv_ByteOrder_Msg11_SetCenterPointScale; + private static ushort[] s_priv_ByteOrder_Msg12_SetScale; + private static ushort[] s_priv_ByteOrder_Msg13_SetSize; + private static ushort[] s_priv_ByteOrder_Msg14_SetPosition; + private static ushort[] s_priv_ByteOrder_Msg16_SetVisible; + + protected RemoteVisual() + { + } + + 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 RemoteVisual.s_priv_ByteOrder_Msg0_ClearGradients, typeof(RemoteVisual.Msg0_ClearGradients), 0, 0); + _priv_pmsgUse = (Message*)msg0ClearGradientsPtr; + } + + 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 RemoteVisual.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 RemoteVisual.s_priv_ByteOrder_Msg2_SetRelativeSize, typeof(RemoteVisual.Msg2_SetRelativeSize), 0, 0); + _priv_pmsgUse = (Message*)msg2SetRelativeSizePtr; + } + + 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 RemoteVisual.s_priv_ByteOrder_Msg3_Reset, typeof(RemoteVisual.Msg3_Reset), 0, 0); + _priv_pmsgUse = (Message*)msg3ResetPtr; + } + + public unsafe void SendReset() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildReset(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildChangeDataBits( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint nValue, + uint nMask) + { + 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.Msg4_ChangeDataBits); + RemoteVisual.Msg4_ChangeDataBits* msg4ChangeDataBitsPtr = (RemoteVisual.Msg4_ChangeDataBits*)_priv_portUse.AllocMessageBuffer(size); + msg4ChangeDataBitsPtr->_priv_size = size; + msg4ChangeDataBitsPtr->_priv_msgid = 4U; + msg4ChangeDataBitsPtr->nValue = nValue; + msg4ChangeDataBitsPtr->nMask = nMask; + msg4ChangeDataBitsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4ChangeDataBitsPtr, ref RemoteVisual.s_priv_ByteOrder_Msg4_ChangeDataBits, typeof(RemoteVisual.Msg4_ChangeDataBits), 0, 0); + _priv_pmsgUse = (Message*)msg4ChangeDataBitsPtr; + } + + public unsafe void SendChangeDataBits(uint nValue, uint nMask) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildChangeDataBits(out _priv_portUse, out _priv_pmsgUse, nValue, nMask); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildChangeParent( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteVisual visNewParent, + RemoteVisual visSibling, + VisualOrder nOrder) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + if (visNewParent != null) + _priv_portUse.ValidateHandleOrNull(visNewParent.RenderHandle); + if (visSibling != null) + _priv_portUse.ValidateHandleOrNull(visSibling.RenderHandle); + uint size = (uint)sizeof(RemoteVisual.Msg5_ChangeParent); + RemoteVisual.Msg5_ChangeParent* msg5ChangeParentPtr = (RemoteVisual.Msg5_ChangeParent*)_priv_portUse.AllocMessageBuffer(size); + msg5ChangeParentPtr->_priv_size = size; + msg5ChangeParentPtr->_priv_msgid = 5U; + msg5ChangeParentPtr->visNewParent = visNewParent != null ? visNewParent.RenderHandle : RENDERHANDLE.NULL; + msg5ChangeParentPtr->visSibling = visSibling != null ? visSibling.RenderHandle : RENDERHANDLE.NULL; + msg5ChangeParentPtr->nOrder = nOrder; + msg5ChangeParentPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg5ChangeParentPtr, ref RemoteVisual.s_priv_ByteOrder_Msg5_ChangeParent, typeof(RemoteVisual.Msg5_ChangeParent), 0, 0); + _priv_pmsgUse = (Message*)msg5ChangeParentPtr; + } + + public unsafe void SendChangeParent( + RemoteVisual visNewParent, + RemoteVisual visSibling, + VisualOrder nOrder) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildChangeParent(out _priv_portUse, out _priv_pmsgUse, visNewParent, visSibling, nOrder); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetDebugOutlineColor( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ColorF clr) + { + 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.Msg6_SetDebugOutlineColor); + RemoteVisual.Msg6_SetDebugOutlineColor* debugOutlineColorPtr = (RemoteVisual.Msg6_SetDebugOutlineColor*)_priv_portUse.AllocMessageBuffer(size); + debugOutlineColorPtr->_priv_size = size; + debugOutlineColorPtr->_priv_msgid = 6U; + debugOutlineColorPtr->clr = clr; + debugOutlineColorPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)debugOutlineColorPtr, ref RemoteVisual.s_priv_ByteOrder_Msg6_SetDebugOutlineColor, typeof(RemoteVisual.Msg6_SetDebugOutlineColor), 0, 0); + _priv_pmsgUse = (Message*)debugOutlineColorPtr; + } + + public unsafe void SendSetDebugOutlineColor(ColorF clr) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetDebugOutlineColor(out _priv_portUse, out _priv_pmsgUse, clr); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetDebugID( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + string stDebugID) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteVisual.Msg7_SetDebugID)); + BLOBREF blobref = blobInfo.Add(stDebugID); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteVisual.Msg7_SetDebugID* msg7SetDebugIdPtr = (RemoteVisual.Msg7_SetDebugID*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg7SetDebugIdPtr->_priv_size = adjustedTotalSize; + msg7SetDebugIdPtr->_priv_msgid = 7U; + msg7SetDebugIdPtr->stDebugID = blobref; + blobInfo.Attach((Message*)msg7SetDebugIdPtr); + msg7SetDebugIdPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg7SetDebugIdPtr, ref RemoteVisual.s_priv_ByteOrder_Msg7_SetDebugID, typeof(RemoteVisual.Msg7_SetDebugID), 0, 0); + _priv_pmsgUse = (Message*)msg7SetDebugIdPtr; + } + + public unsafe void SendSetDebugID(string stDebugID) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetDebugID(out _priv_portUse, out _priv_pmsgUse, stDebugID); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetAlpha( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + float fAlpha) + { + 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.Msg8_SetAlpha); + RemoteVisual.Msg8_SetAlpha* msg8SetAlphaPtr = (RemoteVisual.Msg8_SetAlpha*)_priv_portUse.AllocMessageBuffer(size); + msg8SetAlphaPtr->_priv_size = size; + msg8SetAlphaPtr->_priv_msgid = 8U; + msg8SetAlphaPtr->fAlpha = fAlpha; + msg8SetAlphaPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg8SetAlphaPtr, ref RemoteVisual.s_priv_ByteOrder_Msg8_SetAlpha, typeof(RemoteVisual.Msg8_SetAlpha), 0, 0); + _priv_pmsgUse = (Message*)msg8SetAlphaPtr; + } + + public unsafe void SendSetAlpha(float fAlpha) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetAlpha(out _priv_portUse, out _priv_pmsgUse, fAlpha); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetLayer( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint layer) + { + 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.Msg9_SetLayer); + RemoteVisual.Msg9_SetLayer* msg9SetLayerPtr = (RemoteVisual.Msg9_SetLayer*)_priv_portUse.AllocMessageBuffer(size); + msg9SetLayerPtr->_priv_size = size; + msg9SetLayerPtr->_priv_msgid = 9U; + msg9SetLayerPtr->layer = layer; + msg9SetLayerPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg9SetLayerPtr, ref RemoteVisual.s_priv_ByteOrder_Msg9_SetLayer, typeof(RemoteVisual.Msg9_SetLayer), 0, 0); + _priv_pmsgUse = (Message*)msg9SetLayerPtr; + } + + public unsafe void SendSetLayer(uint layer) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetLayer(out _priv_portUse, out _priv_pmsgUse, layer); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetRotation( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + AxisAngle aaRotation) + { + 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.Msg10_SetRotation); + RemoteVisual.Msg10_SetRotation* msg10SetRotationPtr = (RemoteVisual.Msg10_SetRotation*)_priv_portUse.AllocMessageBuffer(size); + msg10SetRotationPtr->_priv_size = size; + msg10SetRotationPtr->_priv_msgid = 10U; + msg10SetRotationPtr->aaRotation = aaRotation; + msg10SetRotationPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg10SetRotationPtr, ref RemoteVisual.s_priv_ByteOrder_Msg10_SetRotation, typeof(RemoteVisual.Msg10_SetRotation), 0, 0); + _priv_pmsgUse = (Message*)msg10SetRotationPtr; + } + + public unsafe void SendSetRotation(AxisAngle aaRotation) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetRotation(out _priv_portUse, out _priv_pmsgUse, aaRotation); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetCenterPointScale( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Vector3 vCenterPointScale) + { + 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.Msg11_SetCenterPointScale); + RemoteVisual.Msg11_SetCenterPointScale* centerPointScalePtr = (RemoteVisual.Msg11_SetCenterPointScale*)_priv_portUse.AllocMessageBuffer(size); + centerPointScalePtr->_priv_size = size; + centerPointScalePtr->_priv_msgid = 11U; + centerPointScalePtr->vCenterPointScale = vCenterPointScale; + centerPointScalePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)centerPointScalePtr, ref RemoteVisual.s_priv_ByteOrder_Msg11_SetCenterPointScale, typeof(RemoteVisual.Msg11_SetCenterPointScale), 0, 0); + _priv_pmsgUse = (Message*)centerPointScalePtr; + } + + public unsafe void SendSetCenterPointScale(Vector3 vCenterPointScale) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetCenterPointScale(out _priv_portUse, out _priv_pmsgUse, vCenterPointScale); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetScale( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Vector3 vScale) + { + 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.Msg12_SetScale); + RemoteVisual.Msg12_SetScale* msg12SetScalePtr = (RemoteVisual.Msg12_SetScale*)_priv_portUse.AllocMessageBuffer(size); + msg12SetScalePtr->_priv_size = size; + msg12SetScalePtr->_priv_msgid = 12U; + msg12SetScalePtr->vScale = vScale; + msg12SetScalePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg12SetScalePtr, ref RemoteVisual.s_priv_ByteOrder_Msg12_SetScale, typeof(RemoteVisual.Msg12_SetScale), 0, 0); + _priv_pmsgUse = (Message*)msg12SetScalePtr; + } + + public unsafe void SendSetScale(Vector3 vScale) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetScale(out _priv_portUse, out _priv_pmsgUse, vScale); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetSize( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Vector2 vSizePxl) + { + 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.Msg13_SetSize); + RemoteVisual.Msg13_SetSize* msg13SetSizePtr = (RemoteVisual.Msg13_SetSize*)_priv_portUse.AllocMessageBuffer(size); + msg13SetSizePtr->_priv_size = size; + msg13SetSizePtr->_priv_msgid = 13U; + msg13SetSizePtr->vSizePxl = vSizePxl; + msg13SetSizePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg13SetSizePtr, ref RemoteVisual.s_priv_ByteOrder_Msg13_SetSize, typeof(RemoteVisual.Msg13_SetSize), 0, 0); + _priv_pmsgUse = (Message*)msg13SetSizePtr; + } + + public unsafe void SendSetSize(Vector2 vSizePxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetSize(out _priv_portUse, out _priv_pmsgUse, vSizePxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetPosition( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + Vector3 vPositionPxl) + { + 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.Msg14_SetPosition); + RemoteVisual.Msg14_SetPosition* msg14SetPositionPtr = (RemoteVisual.Msg14_SetPosition*)_priv_portUse.AllocMessageBuffer(size); + msg14SetPositionPtr->_priv_size = size; + msg14SetPositionPtr->_priv_msgid = 14U; + msg14SetPositionPtr->vPositionPxl = vPositionPxl; + msg14SetPositionPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg14SetPositionPtr, ref RemoteVisual.s_priv_ByteOrder_Msg14_SetPosition, typeof(RemoteVisual.Msg14_SetPosition), 0, 0); + _priv_pmsgUse = (Message*)msg14SetPositionPtr; + } + + public unsafe void SendSetPosition(Vector3 vPositionPxl) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetPosition(out _priv_portUse, out _priv_pmsgUse, vPositionPxl); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetVisible( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fVisible) + { + 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.Msg16_SetVisible); + RemoteVisual.Msg16_SetVisible* msg16SetVisiblePtr = (RemoteVisual.Msg16_SetVisible*)_priv_portUse.AllocMessageBuffer(size); + msg16SetVisiblePtr->_priv_size = size; + msg16SetVisiblePtr->_priv_msgid = 16U; + msg16SetVisiblePtr->fVisible = fVisible ? uint.MaxValue : 0U; + msg16SetVisiblePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg16SetVisiblePtr, ref RemoteVisual.s_priv_ByteOrder_Msg16_SetVisible, typeof(RemoteVisual.Msg16_SetVisible), 0, 0); + _priv_pmsgUse = (Message*)msg16SetVisiblePtr; + } + + public unsafe void SendSetVisible(bool fVisible) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetVisible(out _priv_portUse, out _priv_pmsgUse, fVisible); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteVisual CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteVisual(port, handle, true); + + public static RemoteVisual CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteVisual(port, handle, false); + } + + protected RemoteVisual(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteVisual(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteVisual && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + 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; + } + + [ComVisible(false)] + private struct Msg4_ChangeDataBits + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint nValue; + public uint nMask; + } + + [ComVisible(false)] + private struct Msg5_ChangeParent + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE visNewParent; + public RENDERHANDLE visSibling; + public VisualOrder nOrder; + } + + [ComVisible(false)] + private struct Msg6_SetDebugOutlineColor + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public ColorF clr; + } + + [ComVisible(false)] + private struct Msg7_SetDebugID + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF stDebugID; + } + + [ComVisible(false)] + private struct Msg8_SetAlpha + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public float fAlpha; + } + + [ComVisible(false)] + private struct Msg9_SetLayer + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint layer; + } + + [ComVisible(false)] + private struct Msg10_SetRotation + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public AxisAngle aaRotation; + } + + [ComVisible(false)] + private struct Msg11_SetCenterPointScale + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Vector3 vCenterPointScale; + } + + [ComVisible(false)] + private struct Msg12_SetScale + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Vector3 vScale; + } + + [ComVisible(false)] + private struct Msg13_SetSize + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Vector2 vSizePxl; + } + + [ComVisible(false)] + private struct Msg14_SetPosition + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public Vector3 vPositionPxl; + } + + [ComVisible(false)] + private struct Msg16_SetVisible + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fVisible; + } } - - 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 RemoteVisual.s_priv_ByteOrder_Msg0_ClearGradients, typeof (RemoteVisual.Msg0_ClearGradients), 0, 0); - _priv_pmsgUse = (Message*) msg0ClearGradientsPtr; - } - - 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 RemoteVisual.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 RemoteVisual.s_priv_ByteOrder_Msg2_SetRelativeSize, typeof (RemoteVisual.Msg2_SetRelativeSize), 0, 0); - _priv_pmsgUse = (Message*) msg2SetRelativeSizePtr; - } - - 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 RemoteVisual.s_priv_ByteOrder_Msg3_Reset, typeof (RemoteVisual.Msg3_Reset), 0, 0); - _priv_pmsgUse = (Message*) msg3ResetPtr; - } - - public unsafe void SendReset() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildReset(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildChangeDataBits( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint nValue, - uint nMask) - { - 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.Msg4_ChangeDataBits); - RemoteVisual.Msg4_ChangeDataBits* msg4ChangeDataBitsPtr = (RemoteVisual.Msg4_ChangeDataBits*) _priv_portUse.AllocMessageBuffer(size); - msg4ChangeDataBitsPtr->_priv_size = size; - msg4ChangeDataBitsPtr->_priv_msgid = 4U; - msg4ChangeDataBitsPtr->nValue = nValue; - msg4ChangeDataBitsPtr->nMask = nMask; - msg4ChangeDataBitsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4ChangeDataBitsPtr, ref RemoteVisual.s_priv_ByteOrder_Msg4_ChangeDataBits, typeof (RemoteVisual.Msg4_ChangeDataBits), 0, 0); - _priv_pmsgUse = (Message*) msg4ChangeDataBitsPtr; - } - - public unsafe void SendChangeDataBits(uint nValue, uint nMask) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildChangeDataBits(out _priv_portUse, out _priv_pmsgUse, nValue, nMask); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildChangeParent( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteVisual visNewParent, - RemoteVisual visSibling, - VisualOrder nOrder) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - if (visNewParent != null) - _priv_portUse.ValidateHandleOrNull(visNewParent.RenderHandle); - if (visSibling != null) - _priv_portUse.ValidateHandleOrNull(visSibling.RenderHandle); - uint size = (uint) sizeof (RemoteVisual.Msg5_ChangeParent); - RemoteVisual.Msg5_ChangeParent* msg5ChangeParentPtr = (RemoteVisual.Msg5_ChangeParent*) _priv_portUse.AllocMessageBuffer(size); - msg5ChangeParentPtr->_priv_size = size; - msg5ChangeParentPtr->_priv_msgid = 5U; - msg5ChangeParentPtr->visNewParent = visNewParent != null ? visNewParent.RenderHandle : RENDERHANDLE.NULL; - msg5ChangeParentPtr->visSibling = visSibling != null ? visSibling.RenderHandle : RENDERHANDLE.NULL; - msg5ChangeParentPtr->nOrder = nOrder; - msg5ChangeParentPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg5ChangeParentPtr, ref RemoteVisual.s_priv_ByteOrder_Msg5_ChangeParent, typeof (RemoteVisual.Msg5_ChangeParent), 0, 0); - _priv_pmsgUse = (Message*) msg5ChangeParentPtr; - } - - public unsafe void SendChangeParent( - RemoteVisual visNewParent, - RemoteVisual visSibling, - VisualOrder nOrder) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildChangeParent(out _priv_portUse, out _priv_pmsgUse, visNewParent, visSibling, nOrder); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetDebugOutlineColor( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ColorF clr) - { - 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.Msg6_SetDebugOutlineColor); - RemoteVisual.Msg6_SetDebugOutlineColor* debugOutlineColorPtr = (RemoteVisual.Msg6_SetDebugOutlineColor*) _priv_portUse.AllocMessageBuffer(size); - debugOutlineColorPtr->_priv_size = size; - debugOutlineColorPtr->_priv_msgid = 6U; - debugOutlineColorPtr->clr = clr; - debugOutlineColorPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) debugOutlineColorPtr, ref RemoteVisual.s_priv_ByteOrder_Msg6_SetDebugOutlineColor, typeof (RemoteVisual.Msg6_SetDebugOutlineColor), 0, 0); - _priv_pmsgUse = (Message*) debugOutlineColorPtr; - } - - public unsafe void SendSetDebugOutlineColor(ColorF clr) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetDebugOutlineColor(out _priv_portUse, out _priv_pmsgUse, clr); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetDebugID( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - string stDebugID) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteVisual.Msg7_SetDebugID)); - BLOBREF blobref = blobInfo.Add(stDebugID); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteVisual.Msg7_SetDebugID* msg7SetDebugIdPtr = (RemoteVisual.Msg7_SetDebugID*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg7SetDebugIdPtr->_priv_size = adjustedTotalSize; - msg7SetDebugIdPtr->_priv_msgid = 7U; - msg7SetDebugIdPtr->stDebugID = blobref; - blobInfo.Attach((Message*) msg7SetDebugIdPtr); - msg7SetDebugIdPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg7SetDebugIdPtr, ref RemoteVisual.s_priv_ByteOrder_Msg7_SetDebugID, typeof (RemoteVisual.Msg7_SetDebugID), 0, 0); - _priv_pmsgUse = (Message*) msg7SetDebugIdPtr; - } - - public unsafe void SendSetDebugID(string stDebugID) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetDebugID(out _priv_portUse, out _priv_pmsgUse, stDebugID); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetAlpha( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - float fAlpha) - { - 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.Msg8_SetAlpha); - RemoteVisual.Msg8_SetAlpha* msg8SetAlphaPtr = (RemoteVisual.Msg8_SetAlpha*) _priv_portUse.AllocMessageBuffer(size); - msg8SetAlphaPtr->_priv_size = size; - msg8SetAlphaPtr->_priv_msgid = 8U; - msg8SetAlphaPtr->fAlpha = fAlpha; - msg8SetAlphaPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg8SetAlphaPtr, ref RemoteVisual.s_priv_ByteOrder_Msg8_SetAlpha, typeof (RemoteVisual.Msg8_SetAlpha), 0, 0); - _priv_pmsgUse = (Message*) msg8SetAlphaPtr; - } - - public unsafe void SendSetAlpha(float fAlpha) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetAlpha(out _priv_portUse, out _priv_pmsgUse, fAlpha); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetLayer( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint layer) - { - 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.Msg9_SetLayer); - RemoteVisual.Msg9_SetLayer* msg9SetLayerPtr = (RemoteVisual.Msg9_SetLayer*) _priv_portUse.AllocMessageBuffer(size); - msg9SetLayerPtr->_priv_size = size; - msg9SetLayerPtr->_priv_msgid = 9U; - msg9SetLayerPtr->layer = layer; - msg9SetLayerPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg9SetLayerPtr, ref RemoteVisual.s_priv_ByteOrder_Msg9_SetLayer, typeof (RemoteVisual.Msg9_SetLayer), 0, 0); - _priv_pmsgUse = (Message*) msg9SetLayerPtr; - } - - public unsafe void SendSetLayer(uint layer) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetLayer(out _priv_portUse, out _priv_pmsgUse, layer); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetRotation( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - AxisAngle aaRotation) - { - 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.Msg10_SetRotation); - RemoteVisual.Msg10_SetRotation* msg10SetRotationPtr = (RemoteVisual.Msg10_SetRotation*) _priv_portUse.AllocMessageBuffer(size); - msg10SetRotationPtr->_priv_size = size; - msg10SetRotationPtr->_priv_msgid = 10U; - msg10SetRotationPtr->aaRotation = aaRotation; - msg10SetRotationPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg10SetRotationPtr, ref RemoteVisual.s_priv_ByteOrder_Msg10_SetRotation, typeof (RemoteVisual.Msg10_SetRotation), 0, 0); - _priv_pmsgUse = (Message*) msg10SetRotationPtr; - } - - public unsafe void SendSetRotation(AxisAngle aaRotation) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetRotation(out _priv_portUse, out _priv_pmsgUse, aaRotation); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetCenterPointScale( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Vector3 vCenterPointScale) - { - 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.Msg11_SetCenterPointScale); - RemoteVisual.Msg11_SetCenterPointScale* centerPointScalePtr = (RemoteVisual.Msg11_SetCenterPointScale*) _priv_portUse.AllocMessageBuffer(size); - centerPointScalePtr->_priv_size = size; - centerPointScalePtr->_priv_msgid = 11U; - centerPointScalePtr->vCenterPointScale = vCenterPointScale; - centerPointScalePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) centerPointScalePtr, ref RemoteVisual.s_priv_ByteOrder_Msg11_SetCenterPointScale, typeof (RemoteVisual.Msg11_SetCenterPointScale), 0, 0); - _priv_pmsgUse = (Message*) centerPointScalePtr; - } - - public unsafe void SendSetCenterPointScale(Vector3 vCenterPointScale) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetCenterPointScale(out _priv_portUse, out _priv_pmsgUse, vCenterPointScale); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetScale( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Vector3 vScale) - { - 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.Msg12_SetScale); - RemoteVisual.Msg12_SetScale* msg12SetScalePtr = (RemoteVisual.Msg12_SetScale*) _priv_portUse.AllocMessageBuffer(size); - msg12SetScalePtr->_priv_size = size; - msg12SetScalePtr->_priv_msgid = 12U; - msg12SetScalePtr->vScale = vScale; - msg12SetScalePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg12SetScalePtr, ref RemoteVisual.s_priv_ByteOrder_Msg12_SetScale, typeof (RemoteVisual.Msg12_SetScale), 0, 0); - _priv_pmsgUse = (Message*) msg12SetScalePtr; - } - - public unsafe void SendSetScale(Vector3 vScale) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetScale(out _priv_portUse, out _priv_pmsgUse, vScale); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetSize( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Vector2 vSizePxl) - { - 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.Msg13_SetSize); - RemoteVisual.Msg13_SetSize* msg13SetSizePtr = (RemoteVisual.Msg13_SetSize*) _priv_portUse.AllocMessageBuffer(size); - msg13SetSizePtr->_priv_size = size; - msg13SetSizePtr->_priv_msgid = 13U; - msg13SetSizePtr->vSizePxl = vSizePxl; - msg13SetSizePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg13SetSizePtr, ref RemoteVisual.s_priv_ByteOrder_Msg13_SetSize, typeof (RemoteVisual.Msg13_SetSize), 0, 0); - _priv_pmsgUse = (Message*) msg13SetSizePtr; - } - - public unsafe void SendSetSize(Vector2 vSizePxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetSize(out _priv_portUse, out _priv_pmsgUse, vSizePxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetPosition( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - Vector3 vPositionPxl) - { - 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.Msg14_SetPosition); - RemoteVisual.Msg14_SetPosition* msg14SetPositionPtr = (RemoteVisual.Msg14_SetPosition*) _priv_portUse.AllocMessageBuffer(size); - msg14SetPositionPtr->_priv_size = size; - msg14SetPositionPtr->_priv_msgid = 14U; - msg14SetPositionPtr->vPositionPxl = vPositionPxl; - msg14SetPositionPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg14SetPositionPtr, ref RemoteVisual.s_priv_ByteOrder_Msg14_SetPosition, typeof (RemoteVisual.Msg14_SetPosition), 0, 0); - _priv_pmsgUse = (Message*) msg14SetPositionPtr; - } - - public unsafe void SendSetPosition(Vector3 vPositionPxl) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetPosition(out _priv_portUse, out _priv_pmsgUse, vPositionPxl); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetVisible( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fVisible) - { - 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.Msg16_SetVisible); - RemoteVisual.Msg16_SetVisible* msg16SetVisiblePtr = (RemoteVisual.Msg16_SetVisible*) _priv_portUse.AllocMessageBuffer(size); - msg16SetVisiblePtr->_priv_size = size; - msg16SetVisiblePtr->_priv_msgid = 16U; - msg16SetVisiblePtr->fVisible = fVisible ? uint.MaxValue : 0U; - msg16SetVisiblePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg16SetVisiblePtr, ref RemoteVisual.s_priv_ByteOrder_Msg16_SetVisible, typeof (RemoteVisual.Msg16_SetVisible), 0, 0); - _priv_pmsgUse = (Message*) msg16SetVisiblePtr; - } - - public unsafe void SendSetVisible(bool fVisible) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetVisible(out _priv_portUse, out _priv_pmsgUse, fVisible); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteVisual CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteVisual(port, handle, true); - - public static RemoteVisual CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteVisual(port, handle, false); - } - - protected RemoteVisual(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteVisual(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteVisual && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - 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; - } - - [ComVisible(false)] - private struct Msg4_ChangeDataBits - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint nValue; - public uint nMask; - } - - [ComVisible(false)] - private struct Msg5_ChangeParent - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE visNewParent; - public RENDERHANDLE visSibling; - public VisualOrder nOrder; - } - - [ComVisible(false)] - private struct Msg6_SetDebugOutlineColor - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public ColorF clr; - } - - [ComVisible(false)] - private struct Msg7_SetDebugID - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF stDebugID; - } - - [ComVisible(false)] - private struct Msg8_SetAlpha - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public float fAlpha; - } - - [ComVisible(false)] - private struct Msg9_SetLayer - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint layer; - } - - [ComVisible(false)] - private struct Msg10_SetRotation - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public AxisAngle aaRotation; - } - - [ComVisible(false)] - private struct Msg11_SetCenterPointScale - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Vector3 vCenterPointScale; - } - - [ComVisible(false)] - private struct Msg12_SetScale - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Vector3 vScale; - } - - [ComVisible(false)] - private struct Msg13_SetSize - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Vector2 vSizePxl; - } - - [ComVisible(false)] - private struct Msg14_SetPosition - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public Vector3 vPositionPxl; - } - - [ComVisible(false)] - private struct Msg16_SetVisible - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fVisible; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVisualContainer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVisualContainer.cs index 9e9851e..39ff480 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVisualContainer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteVisualContainer.cs @@ -10,109 +10,109 @@ using System.Runtime.InteropServices; 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; - - protected RemoteVisualContainer() + internal class RemoteVisualContainer : RemoteVisual { + private static ushort[] s_priv_ByteOrder_Msg19_Create; + private static ushort[] s_priv_ByteOrder_Msg18_SetCamera; + + 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 = (byte*)__untypedstackalloc(1 * (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 RemoteVisualContainer.s_priv_ByteOrder_Msg19_Create, typeof(RemoteVisualContainer.Msg19_Create), 0, 0); + port.CreateRemoteObject(containerClassHandle, remoteVisualContainer.m_renderHandle, (Message*)msg19CreatePtr); + return remoteVisualContainer; + } + + 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 RemoteVisualContainer.s_priv_ByteOrder_Msg18_SetCamera, typeof(RemoteVisualContainer.Msg18_SetCamera), 0, 0); + _priv_pmsgUse = (Message*)msg18SetCameraPtr; + } + + 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) + { + } + + 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; + } } - - 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 = (byte*) __untypedstackalloc(1 * (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 RemoteVisualContainer.s_priv_ByteOrder_Msg19_Create, typeof (RemoteVisualContainer.Msg19_Create), 0, 0); - port.CreateRemoteObject(containerClassHandle, remoteVisualContainer.m_renderHandle, (Message*) msg19CreatePtr); - return remoteVisualContainer; - } - - 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 RemoteVisualContainer.s_priv_ByteOrder_Msg18_SetCamera, typeof (RemoteVisualContainer.Msg18_SetCamera), 0, 0); - _priv_pmsgUse = (Message*) msg18SetCameraPtr; - } - - 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) - { - } - - 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; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteWaitCursor.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteWaitCursor.cs index 8cdf3bd..85fedbb 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteWaitCursor.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteWaitCursor.cs @@ -10,263 +10,263 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteWaitCursor : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg5_Create; - private static ushort[] s_priv_ByteOrder_Msg0_Show; - private static ushort[] s_priv_ByteOrder_Msg1_Hide; - private static ushort[] s_priv_ByteOrder_Msg2_SetVisuals; - private static ushort[] s_priv_ByteOrder_Msg3_SetShowAnimations; - private static ushort[] s_priv_ByteOrder_Msg4_SetHideAnimations; - - protected RemoteWaitCursor() + internal class RemoteWaitCursor : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg5_Create; + private static ushort[] s_priv_ByteOrder_Msg0_Show; + private static ushort[] s_priv_ByteOrder_Msg1_Hide; + private static ushort[] s_priv_ByteOrder_Msg2_SetVisuals; + private static ushort[] s_priv_ByteOrder_Msg3_SetShowAnimations; + private static ushort[] s_priv_ByteOrder_Msg4_SetHideAnimations; + + protected RemoteWaitCursor() + { + } + + public static unsafe RemoteWaitCursor Create( + ProtocolSplashRendering _priv_protocolInstance, + IRenderHandleOwner _priv_owner) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE cursorClassHandle = _priv_protocolInstance.WaitCursor_ClassHandle; + RemoteWaitCursor remoteWaitCursor = new RemoteWaitCursor(port, _priv_owner); + uint num = (uint)sizeof(RemoteWaitCursor.Msg5_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteWaitCursor.Msg5_Create* msg5CreatePtr = (RemoteWaitCursor.Msg5_Create*)pMem; + msg5CreatePtr->_priv_size = num; + msg5CreatePtr->_priv_msgid = 5U; + msg5CreatePtr->_priv_idObjectSubject = remoteWaitCursor.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteWaitCursor.s_priv_ByteOrder_Msg5_Create, typeof(RemoteWaitCursor.Msg5_Create), 0, 0); + port.CreateRemoteObject(cursorClassHandle, remoteWaitCursor.m_renderHandle, (Message*)msg5CreatePtr); + return remoteWaitCursor; + } + + public unsafe void BuildShow(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(RemoteWaitCursor.Msg0_Show); + RemoteWaitCursor.Msg0_Show* msg0ShowPtr = (RemoteWaitCursor.Msg0_Show*)_priv_portUse.AllocMessageBuffer(size); + msg0ShowPtr->_priv_size = size; + msg0ShowPtr->_priv_msgid = 0U; + msg0ShowPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg0ShowPtr, ref RemoteWaitCursor.s_priv_ByteOrder_Msg0_Show, typeof(RemoteWaitCursor.Msg0_Show), 0, 0); + _priv_pmsgUse = (Message*)msg0ShowPtr; + } + + public unsafe void SendShow() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildShow(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildHide(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(RemoteWaitCursor.Msg1_Hide); + RemoteWaitCursor.Msg1_Hide* msg1HidePtr = (RemoteWaitCursor.Msg1_Hide*)_priv_portUse.AllocMessageBuffer(size); + msg1HidePtr->_priv_size = size; + msg1HidePtr->_priv_msgid = 1U; + msg1HidePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg1HidePtr, ref RemoteWaitCursor.s_priv_ByteOrder_Msg1_Hide, typeof(RemoteWaitCursor.Msg1_Hide), 0, 0); + _priv_pmsgUse = (Message*)msg1HidePtr; + } + + public unsafe void SendHide() + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildHide(out _priv_portUse, out _priv_pmsgUse); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetVisuals( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteVisual[] arVisuals) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteWaitCursor.Msg2_SetVisuals)); + RENDERHANDLE[] renderHandleArray = MarshalHelper.CreateRenderHandleArray(arVisuals.Length); + for (int index = 0; index < arVisuals.Length; ++index) + renderHandleArray[index] = arVisuals[index].RenderHandle; + BLOBREF blobref = blobInfo.Add(renderHandleArray); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteWaitCursor.Msg2_SetVisuals* msg2SetVisualsPtr = (RemoteWaitCursor.Msg2_SetVisuals*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + msg2SetVisualsPtr->_priv_size = adjustedTotalSize; + msg2SetVisualsPtr->_priv_msgid = 2U; + msg2SetVisualsPtr->arVisuals = blobref; + blobInfo.Attach((Message*)msg2SetVisualsPtr); + msg2SetVisualsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg2SetVisualsPtr, ref RemoteWaitCursor.s_priv_ByteOrder_Msg2_SetVisuals, typeof(RemoteWaitCursor.Msg2_SetVisuals), 0, 0); + _priv_pmsgUse = (Message*)msg2SetVisualsPtr; + } + + public unsafe void SendSetVisuals(RemoteVisual[] arVisuals) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetVisuals(out _priv_portUse, out _priv_pmsgUse, arVisuals); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetShowAnimations( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteAnimation[] arAnimations) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteWaitCursor.Msg3_SetShowAnimations)); + RENDERHANDLE[] renderHandleArray = MarshalHelper.CreateRenderHandleArray(arAnimations.Length); + for (int index = 0; index < arAnimations.Length; ++index) + renderHandleArray[index] = arAnimations[index].RenderHandle; + BLOBREF blobref = blobInfo.Add(renderHandleArray); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteWaitCursor.Msg3_SetShowAnimations* setShowAnimationsPtr = (RemoteWaitCursor.Msg3_SetShowAnimations*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + setShowAnimationsPtr->_priv_size = adjustedTotalSize; + setShowAnimationsPtr->_priv_msgid = 3U; + setShowAnimationsPtr->arAnimations = blobref; + blobInfo.Attach((Message*)setShowAnimationsPtr); + setShowAnimationsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setShowAnimationsPtr, ref RemoteWaitCursor.s_priv_ByteOrder_Msg3_SetShowAnimations, typeof(RemoteWaitCursor.Msg3_SetShowAnimations), 0, 0); + _priv_pmsgUse = (Message*)setShowAnimationsPtr; + } + + public unsafe void SendSetShowAnimations(RemoteAnimation[] arAnimations) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetShowAnimations(out _priv_portUse, out _priv_pmsgUse, arAnimations); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetHideAnimations( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteAnimation[] arAnimations) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint)sizeof(RemoteWaitCursor.Msg4_SetHideAnimations)); + RENDERHANDLE[] renderHandleArray = MarshalHelper.CreateRenderHandleArray(arAnimations.Length); + for (int index = 0; index < arAnimations.Length; ++index) + renderHandleArray[index] = arAnimations[index].RenderHandle; + BLOBREF blobref = blobInfo.Add(renderHandleArray); + uint adjustedTotalSize = blobInfo.AdjustedTotalSize; + RemoteWaitCursor.Msg4_SetHideAnimations* setHideAnimationsPtr = (RemoteWaitCursor.Msg4_SetHideAnimations*)_priv_portUse.AllocMessageBuffer(adjustedTotalSize); + setHideAnimationsPtr->_priv_size = adjustedTotalSize; + setHideAnimationsPtr->_priv_msgid = 4U; + setHideAnimationsPtr->arAnimations = blobref; + blobInfo.Attach((Message*)setHideAnimationsPtr); + setHideAnimationsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setHideAnimationsPtr, ref RemoteWaitCursor.s_priv_ByteOrder_Msg4_SetHideAnimations, typeof(RemoteWaitCursor.Msg4_SetHideAnimations), 0, 0); + _priv_pmsgUse = (Message*)setHideAnimationsPtr; + } + + public unsafe void SendSetHideAnimations(RemoteAnimation[] arAnimations) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetHideAnimations(out _priv_portUse, out _priv_pmsgUse, arAnimations); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteWaitCursor CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteWaitCursor(port, handle, true); + } + + public static RemoteWaitCursor CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteWaitCursor(port, handle, false); + } + + protected RemoteWaitCursor(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteWaitCursor(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteWaitCursor && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg5_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg0_Show + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg1_Hide + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg2_SetVisuals + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF arVisuals; + } + + [ComVisible(false)] + private struct Msg3_SetShowAnimations + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF arAnimations; + } + + [ComVisible(false)] + private struct Msg4_SetHideAnimations + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public BLOBREF arAnimations; + } } - - public static unsafe RemoteWaitCursor Create( - ProtocolSplashRendering _priv_protocolInstance, - IRenderHandleOwner _priv_owner) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE cursorClassHandle = _priv_protocolInstance.WaitCursor_ClassHandle; - RemoteWaitCursor remoteWaitCursor = new RemoteWaitCursor(port, _priv_owner); - uint num = (uint) sizeof (RemoteWaitCursor.Msg5_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteWaitCursor.Msg5_Create* msg5CreatePtr = (RemoteWaitCursor.Msg5_Create*) pMem; - msg5CreatePtr->_priv_size = num; - msg5CreatePtr->_priv_msgid = 5U; - msg5CreatePtr->_priv_idObjectSubject = remoteWaitCursor.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteWaitCursor.s_priv_ByteOrder_Msg5_Create, typeof (RemoteWaitCursor.Msg5_Create), 0, 0); - port.CreateRemoteObject(cursorClassHandle, remoteWaitCursor.m_renderHandle, (Message*) msg5CreatePtr); - return remoteWaitCursor; - } - - public unsafe void BuildShow(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 (RemoteWaitCursor.Msg0_Show); - RemoteWaitCursor.Msg0_Show* msg0ShowPtr = (RemoteWaitCursor.Msg0_Show*) _priv_portUse.AllocMessageBuffer(size); - msg0ShowPtr->_priv_size = size; - msg0ShowPtr->_priv_msgid = 0U; - msg0ShowPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg0ShowPtr, ref RemoteWaitCursor.s_priv_ByteOrder_Msg0_Show, typeof (RemoteWaitCursor.Msg0_Show), 0, 0); - _priv_pmsgUse = (Message*) msg0ShowPtr; - } - - public unsafe void SendShow() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildShow(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildHide(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 (RemoteWaitCursor.Msg1_Hide); - RemoteWaitCursor.Msg1_Hide* msg1HidePtr = (RemoteWaitCursor.Msg1_Hide*) _priv_portUse.AllocMessageBuffer(size); - msg1HidePtr->_priv_size = size; - msg1HidePtr->_priv_msgid = 1U; - msg1HidePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg1HidePtr, ref RemoteWaitCursor.s_priv_ByteOrder_Msg1_Hide, typeof (RemoteWaitCursor.Msg1_Hide), 0, 0); - _priv_pmsgUse = (Message*) msg1HidePtr; - } - - public unsafe void SendHide() - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildHide(out _priv_portUse, out _priv_pmsgUse); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetVisuals( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteVisual[] arVisuals) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteWaitCursor.Msg2_SetVisuals)); - RENDERHANDLE[] renderHandleArray = MarshalHelper.CreateRenderHandleArray(arVisuals.Length); - for (int index = 0; index < arVisuals.Length; ++index) - renderHandleArray[index] = arVisuals[index].RenderHandle; - BLOBREF blobref = blobInfo.Add(renderHandleArray); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteWaitCursor.Msg2_SetVisuals* msg2SetVisualsPtr = (RemoteWaitCursor.Msg2_SetVisuals*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - msg2SetVisualsPtr->_priv_size = adjustedTotalSize; - msg2SetVisualsPtr->_priv_msgid = 2U; - msg2SetVisualsPtr->arVisuals = blobref; - blobInfo.Attach((Message*) msg2SetVisualsPtr); - msg2SetVisualsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg2SetVisualsPtr, ref RemoteWaitCursor.s_priv_ByteOrder_Msg2_SetVisuals, typeof (RemoteWaitCursor.Msg2_SetVisuals), 0, 0); - _priv_pmsgUse = (Message*) msg2SetVisualsPtr; - } - - public unsafe void SendSetVisuals(RemoteVisual[] arVisuals) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetVisuals(out _priv_portUse, out _priv_pmsgUse, arVisuals); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetShowAnimations( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteAnimation[] arAnimations) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteWaitCursor.Msg3_SetShowAnimations)); - RENDERHANDLE[] renderHandleArray = MarshalHelper.CreateRenderHandleArray(arAnimations.Length); - for (int index = 0; index < arAnimations.Length; ++index) - renderHandleArray[index] = arAnimations[index].RenderHandle; - BLOBREF blobref = blobInfo.Add(renderHandleArray); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteWaitCursor.Msg3_SetShowAnimations* setShowAnimationsPtr = (RemoteWaitCursor.Msg3_SetShowAnimations*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - setShowAnimationsPtr->_priv_size = adjustedTotalSize; - setShowAnimationsPtr->_priv_msgid = 3U; - setShowAnimationsPtr->arAnimations = blobref; - blobInfo.Attach((Message*) setShowAnimationsPtr); - setShowAnimationsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setShowAnimationsPtr, ref RemoteWaitCursor.s_priv_ByteOrder_Msg3_SetShowAnimations, typeof (RemoteWaitCursor.Msg3_SetShowAnimations), 0, 0); - _priv_pmsgUse = (Message*) setShowAnimationsPtr; - } - - public unsafe void SendSetShowAnimations(RemoteAnimation[] arAnimations) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetShowAnimations(out _priv_portUse, out _priv_pmsgUse, arAnimations); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetHideAnimations( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteAnimation[] arAnimations) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - BlobInfo blobInfo = new BlobInfo(_priv_portUse, (uint) sizeof (RemoteWaitCursor.Msg4_SetHideAnimations)); - RENDERHANDLE[] renderHandleArray = MarshalHelper.CreateRenderHandleArray(arAnimations.Length); - for (int index = 0; index < arAnimations.Length; ++index) - renderHandleArray[index] = arAnimations[index].RenderHandle; - BLOBREF blobref = blobInfo.Add(renderHandleArray); - uint adjustedTotalSize = blobInfo.AdjustedTotalSize; - RemoteWaitCursor.Msg4_SetHideAnimations* setHideAnimationsPtr = (RemoteWaitCursor.Msg4_SetHideAnimations*) _priv_portUse.AllocMessageBuffer(adjustedTotalSize); - setHideAnimationsPtr->_priv_size = adjustedTotalSize; - setHideAnimationsPtr->_priv_msgid = 4U; - setHideAnimationsPtr->arAnimations = blobref; - blobInfo.Attach((Message*) setHideAnimationsPtr); - setHideAnimationsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setHideAnimationsPtr, ref RemoteWaitCursor.s_priv_ByteOrder_Msg4_SetHideAnimations, typeof (RemoteWaitCursor.Msg4_SetHideAnimations), 0, 0); - _priv_pmsgUse = (Message*) setHideAnimationsPtr; - } - - public unsafe void SendSetHideAnimations(RemoteAnimation[] arAnimations) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetHideAnimations(out _priv_portUse, out _priv_pmsgUse, arAnimations); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteWaitCursor CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteWaitCursor(port, handle, true); - } - - public static RemoteWaitCursor CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteWaitCursor(port, handle, false); - } - - protected RemoteWaitCursor(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteWaitCursor(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteWaitCursor && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg5_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg0_Show - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg1_Hide - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg2_SetVisuals - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF arVisuals; - } - - [ComVisible(false)] - private struct Msg3_SetShowAnimations - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF arAnimations; - } - - [ComVisible(false)] - private struct Msg4_SetHideAnimations - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public BLOBREF arAnimations; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteWindow.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteWindow.cs index ff910ae..b67f825 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteWindow.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteWindow.cs @@ -10,226 +10,226 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering { - internal class RemoteWindow : RemoteObject - { - private static ushort[] s_priv_ByteOrder_Msg0_SetBackgroundColor; - private static ushort[] s_priv_ByteOrder_Msg1_SetOutlineMarkedColor; - private static ushort[] s_priv_ByteOrder_Msg2_SetOutlineAllColor; - private static ushort[] s_priv_ByteOrder_Msg3_ChangeDataBits; - private static ushort[] s_priv_ByteOrder_Msg5_SetRoot; - - protected RemoteWindow() + internal class RemoteWindow : RemoteObject { + private static ushort[] s_priv_ByteOrder_Msg0_SetBackgroundColor; + private static ushort[] s_priv_ByteOrder_Msg1_SetOutlineMarkedColor; + private static ushort[] s_priv_ByteOrder_Msg2_SetOutlineAllColor; + private static ushort[] s_priv_ByteOrder_Msg3_ChangeDataBits; + private static ushort[] s_priv_ByteOrder_Msg5_SetRoot; + + protected RemoteWindow() + { + } + + public unsafe void BuildSetBackgroundColor( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ColorF clrBack) + { + 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(RemoteWindow.Msg0_SetBackgroundColor); + RemoteWindow.Msg0_SetBackgroundColor* setBackgroundColorPtr = (RemoteWindow.Msg0_SetBackgroundColor*)_priv_portUse.AllocMessageBuffer(size); + setBackgroundColorPtr->_priv_size = size; + setBackgroundColorPtr->_priv_msgid = 0U; + setBackgroundColorPtr->clrBack = clrBack; + setBackgroundColorPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setBackgroundColorPtr, ref RemoteWindow.s_priv_ByteOrder_Msg0_SetBackgroundColor, typeof(RemoteWindow.Msg0_SetBackgroundColor), 0, 0); + _priv_pmsgUse = (Message*)setBackgroundColorPtr; + } + + public unsafe void SendSetBackgroundColor(ColorF clrBack) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetBackgroundColor(out _priv_portUse, out _priv_pmsgUse, clrBack); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetOutlineMarkedColor( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ColorF clr) + { + 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(RemoteWindow.Msg1_SetOutlineMarkedColor); + RemoteWindow.Msg1_SetOutlineMarkedColor* outlineMarkedColorPtr = (RemoteWindow.Msg1_SetOutlineMarkedColor*)_priv_portUse.AllocMessageBuffer(size); + outlineMarkedColorPtr->_priv_size = size; + outlineMarkedColorPtr->_priv_msgid = 1U; + outlineMarkedColorPtr->clr = clr; + outlineMarkedColorPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)outlineMarkedColorPtr, ref RemoteWindow.s_priv_ByteOrder_Msg1_SetOutlineMarkedColor, typeof(RemoteWindow.Msg1_SetOutlineMarkedColor), 0, 0); + _priv_pmsgUse = (Message*)outlineMarkedColorPtr; + } + + public unsafe void SendSetOutlineMarkedColor(ColorF clr) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetOutlineMarkedColor(out _priv_portUse, out _priv_pmsgUse, clr); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetOutlineAllColor( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + ColorF clr) + { + 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(RemoteWindow.Msg2_SetOutlineAllColor); + RemoteWindow.Msg2_SetOutlineAllColor* setOutlineAllColorPtr = (RemoteWindow.Msg2_SetOutlineAllColor*)_priv_portUse.AllocMessageBuffer(size); + setOutlineAllColorPtr->_priv_size = size; + setOutlineAllColorPtr->_priv_msgid = 2U; + setOutlineAllColorPtr->clr = clr; + setOutlineAllColorPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)setOutlineAllColorPtr, ref RemoteWindow.s_priv_ByteOrder_Msg2_SetOutlineAllColor, typeof(RemoteWindow.Msg2_SetOutlineAllColor), 0, 0); + _priv_pmsgUse = (Message*)setOutlineAllColorPtr; + } + + public unsafe void SendSetOutlineAllColor(ColorF clr) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetOutlineAllColor(out _priv_portUse, out _priv_pmsgUse, clr); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildChangeDataBits( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + uint nValue, + uint nMask) + { + 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(RemoteWindow.Msg3_ChangeDataBits); + RemoteWindow.Msg3_ChangeDataBits* msg3ChangeDataBitsPtr = (RemoteWindow.Msg3_ChangeDataBits*)_priv_portUse.AllocMessageBuffer(size); + msg3ChangeDataBitsPtr->_priv_size = size; + msg3ChangeDataBitsPtr->_priv_msgid = 3U; + msg3ChangeDataBitsPtr->nValue = nValue; + msg3ChangeDataBitsPtr->nMask = nMask; + msg3ChangeDataBitsPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg3ChangeDataBitsPtr, ref RemoteWindow.s_priv_ByteOrder_Msg3_ChangeDataBits, typeof(RemoteWindow.Msg3_ChangeDataBits), 0, 0); + _priv_pmsgUse = (Message*)msg3ChangeDataBitsPtr; + } + + public unsafe void SendChangeDataBits(uint nValue, uint nMask) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildChangeDataBits(out _priv_portUse, out _priv_pmsgUse, nValue, nMask); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetRoot( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + RemoteVisual visRoot) + { + Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); + _priv_portUse = this.m_renderPort; + _priv_portUse.ValidateHandle(this.m_renderHandle); + if (visRoot != null) + _priv_portUse.ValidateHandleOrNull(visRoot.RenderHandle); + uint size = (uint)sizeof(RemoteWindow.Msg5_SetRoot); + RemoteWindow.Msg5_SetRoot* msg5SetRootPtr = (RemoteWindow.Msg5_SetRoot*)_priv_portUse.AllocMessageBuffer(size); + msg5SetRootPtr->_priv_size = size; + msg5SetRootPtr->_priv_msgid = 5U; + msg5SetRootPtr->visRoot = visRoot != null ? visRoot.RenderHandle : RENDERHANDLE.NULL; + msg5SetRootPtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg5SetRootPtr, ref RemoteWindow.s_priv_ByteOrder_Msg5_SetRoot, typeof(RemoteWindow.Msg5_SetRoot), 0, 0); + _priv_pmsgUse = (Message*)msg5SetRootPtr; + } + + public unsafe void SendSetRoot(RemoteVisual visRoot) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetRoot(out _priv_portUse, out _priv_pmsgUse, visRoot); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteWindow CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteWindow(port, handle, true); + + public static RemoteWindow CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteWindow(port, handle, false); + } + + protected RemoteWindow(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteWindow(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteWindow && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg0_SetBackgroundColor + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public ColorF clrBack; + } + + [ComVisible(false)] + private struct Msg1_SetOutlineMarkedColor + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public ColorF clr; + } + + [ComVisible(false)] + private struct Msg2_SetOutlineAllColor + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public ColorF clr; + } + + [ComVisible(false)] + private struct Msg3_ChangeDataBits + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint nValue; + public uint nMask; + } + + [ComVisible(false)] + private struct Msg5_SetRoot + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE visRoot; + } } - - public unsafe void BuildSetBackgroundColor( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ColorF clrBack) - { - 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 (RemoteWindow.Msg0_SetBackgroundColor); - RemoteWindow.Msg0_SetBackgroundColor* setBackgroundColorPtr = (RemoteWindow.Msg0_SetBackgroundColor*) _priv_portUse.AllocMessageBuffer(size); - setBackgroundColorPtr->_priv_size = size; - setBackgroundColorPtr->_priv_msgid = 0U; - setBackgroundColorPtr->clrBack = clrBack; - setBackgroundColorPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setBackgroundColorPtr, ref RemoteWindow.s_priv_ByteOrder_Msg0_SetBackgroundColor, typeof (RemoteWindow.Msg0_SetBackgroundColor), 0, 0); - _priv_pmsgUse = (Message*) setBackgroundColorPtr; - } - - public unsafe void SendSetBackgroundColor(ColorF clrBack) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetBackgroundColor(out _priv_portUse, out _priv_pmsgUse, clrBack); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetOutlineMarkedColor( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ColorF clr) - { - 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 (RemoteWindow.Msg1_SetOutlineMarkedColor); - RemoteWindow.Msg1_SetOutlineMarkedColor* outlineMarkedColorPtr = (RemoteWindow.Msg1_SetOutlineMarkedColor*) _priv_portUse.AllocMessageBuffer(size); - outlineMarkedColorPtr->_priv_size = size; - outlineMarkedColorPtr->_priv_msgid = 1U; - outlineMarkedColorPtr->clr = clr; - outlineMarkedColorPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) outlineMarkedColorPtr, ref RemoteWindow.s_priv_ByteOrder_Msg1_SetOutlineMarkedColor, typeof (RemoteWindow.Msg1_SetOutlineMarkedColor), 0, 0); - _priv_pmsgUse = (Message*) outlineMarkedColorPtr; - } - - public unsafe void SendSetOutlineMarkedColor(ColorF clr) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetOutlineMarkedColor(out _priv_portUse, out _priv_pmsgUse, clr); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetOutlineAllColor( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - ColorF clr) - { - 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 (RemoteWindow.Msg2_SetOutlineAllColor); - RemoteWindow.Msg2_SetOutlineAllColor* setOutlineAllColorPtr = (RemoteWindow.Msg2_SetOutlineAllColor*) _priv_portUse.AllocMessageBuffer(size); - setOutlineAllColorPtr->_priv_size = size; - setOutlineAllColorPtr->_priv_msgid = 2U; - setOutlineAllColorPtr->clr = clr; - setOutlineAllColorPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) setOutlineAllColorPtr, ref RemoteWindow.s_priv_ByteOrder_Msg2_SetOutlineAllColor, typeof (RemoteWindow.Msg2_SetOutlineAllColor), 0, 0); - _priv_pmsgUse = (Message*) setOutlineAllColorPtr; - } - - public unsafe void SendSetOutlineAllColor(ColorF clr) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetOutlineAllColor(out _priv_portUse, out _priv_pmsgUse, clr); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildChangeDataBits( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - uint nValue, - uint nMask) - { - 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 (RemoteWindow.Msg3_ChangeDataBits); - RemoteWindow.Msg3_ChangeDataBits* msg3ChangeDataBitsPtr = (RemoteWindow.Msg3_ChangeDataBits*) _priv_portUse.AllocMessageBuffer(size); - msg3ChangeDataBitsPtr->_priv_size = size; - msg3ChangeDataBitsPtr->_priv_msgid = 3U; - msg3ChangeDataBitsPtr->nValue = nValue; - msg3ChangeDataBitsPtr->nMask = nMask; - msg3ChangeDataBitsPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg3ChangeDataBitsPtr, ref RemoteWindow.s_priv_ByteOrder_Msg3_ChangeDataBits, typeof (RemoteWindow.Msg3_ChangeDataBits), 0, 0); - _priv_pmsgUse = (Message*) msg3ChangeDataBitsPtr; - } - - public unsafe void SendChangeDataBits(uint nValue, uint nMask) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildChangeDataBits(out _priv_portUse, out _priv_pmsgUse, nValue, nMask); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetRoot( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - RemoteVisual visRoot) - { - Debug2.Throw(this.IsValid, "Non-static method call requires an instance"); - _priv_portUse = this.m_renderPort; - _priv_portUse.ValidateHandle(this.m_renderHandle); - if (visRoot != null) - _priv_portUse.ValidateHandleOrNull(visRoot.RenderHandle); - uint size = (uint) sizeof (RemoteWindow.Msg5_SetRoot); - RemoteWindow.Msg5_SetRoot* msg5SetRootPtr = (RemoteWindow.Msg5_SetRoot*) _priv_portUse.AllocMessageBuffer(size); - msg5SetRootPtr->_priv_size = size; - msg5SetRootPtr->_priv_msgid = 5U; - msg5SetRootPtr->visRoot = visRoot != null ? visRoot.RenderHandle : RENDERHANDLE.NULL; - msg5SetRootPtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg5SetRootPtr, ref RemoteWindow.s_priv_ByteOrder_Msg5_SetRoot, typeof (RemoteWindow.Msg5_SetRoot), 0, 0); - _priv_pmsgUse = (Message*) msg5SetRootPtr; - } - - public unsafe void SendSetRoot(RemoteVisual visRoot) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetRoot(out _priv_portUse, out _priv_pmsgUse, visRoot); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteWindow CreateFromHandle(RenderPort port, RENDERHANDLE handle) => new RemoteWindow(port, handle, true); - - public static RemoteWindow CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteWindow(port, handle, false); - } - - protected RemoteWindow(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteWindow(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteWindow && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg0_SetBackgroundColor - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public ColorF clrBack; - } - - [ComVisible(false)] - private struct Msg1_SetOutlineMarkedColor - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public ColorF clr; - } - - [ComVisible(false)] - private struct Msg2_SetOutlineAllColor - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public ColorF clr; - } - - [ComVisible(false)] - private struct Msg3_ChangeDataBits - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint nValue; - public uint nMask; - } - - [ComVisible(false)] - private struct Msg5_SetRoot - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE visRoot; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/ProtocolSplashRenderingXenon.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/ProtocolSplashRenderingXenon.cs index 41016f7..5aa7557 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/ProtocolSplashRenderingXenon.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/ProtocolSplashRenderingXenon.cs @@ -10,54 +10,54 @@ using System; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering.Xenon { - internal sealed class ProtocolSplashRenderingXenon : ProtocolInstance - { - private RENDERHANDLE _priv_remoteClass_XeDevice; - private RENDERHANDLE _priv_remoteClass_XAudSoundDevice; - - public static ProtocolSplashRenderingXenon Bind(RenderPort port) + internal sealed class ProtocolSplashRenderingXenon : ProtocolInstance { - Debug2.Validate(port != null, typeof (ArgumentNullException), nameof (port)); - ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Rendering::Xenon"); - if (protocolInstance != null) - { - ProtocolSplashRenderingXenon splashRenderingXenon = protocolInstance as ProtocolSplashRenderingXenon; - Debug2.Validate(splashRenderingXenon != null, typeof (InvalidOperationException), "protocol name collision"); - return splashRenderingXenon; - } - ProtocolSplashRenderingXenon splashRenderingXenon1 = new ProtocolSplashRenderingXenon(port); - port.BindProtocol((ProtocolInstance) splashRenderingXenon1); - return splashRenderingXenon1; + private RENDERHANDLE _priv_remoteClass_XeDevice; + private RENDERHANDLE _priv_remoteClass_XAudSoundDevice; + + public static ProtocolSplashRenderingXenon Bind(RenderPort port) + { + Debug2.Validate(port != null, typeof(ArgumentNullException), nameof(port)); + ProtocolInstance protocolInstance = port.LookUpProtocol("Splash::Rendering::Xenon"); + if (protocolInstance != null) + { + ProtocolSplashRenderingXenon splashRenderingXenon = protocolInstance as ProtocolSplashRenderingXenon; + Debug2.Validate(splashRenderingXenon != null, typeof(InvalidOperationException), "protocol name collision"); + return splashRenderingXenon; + } + ProtocolSplashRenderingXenon splashRenderingXenon1 = new ProtocolSplashRenderingXenon(port); + port.BindProtocol((ProtocolInstance)splashRenderingXenon1); + return splashRenderingXenon1; + } + + private ProtocolSplashRenderingXenon(RenderPort port) + : base(port, "Splash::Rendering::Xenon") + { + } + + protected override void Init() + { + RenderPort port = this.Port; + this._priv_remoteClass_XeDevice = port.InitRemoteClass("Splash::Rendering::Xenon::XeDevice"); + this._priv_remoteClass_XAudSoundDevice = port.InitRemoteClass("Splash::Rendering::Xenon::XAudSoundDevice"); + } + + internal RENDERHANDLE XeDevice_ClassHandle => this._priv_remoteClass_XeDevice; + + internal RENDERHANDLE XAudSoundDevice_ClassHandle => this._priv_remoteClass_XAudSoundDevice; + + internal RemoteXeDevice BuildRemoteXeDevice( + IRenderHandleOwner _priv_owner, + LocalDeviceCallback cb, + Size sizeScreenPxl) + { + return RemoteXeDevice.Create(this, _priv_owner, cb, sizeScreenPxl); + } + + internal RemoteXAudSoundDevice BuildRemoteXAudSoundDevice( + IRenderHandleOwner _priv_owner) + { + return RemoteXAudSoundDevice.Create(this, _priv_owner); + } } - - private ProtocolSplashRenderingXenon(RenderPort port) - : base(port, "Splash::Rendering::Xenon") - { - } - - protected override void Init() - { - RenderPort port = this.Port; - this._priv_remoteClass_XeDevice = port.InitRemoteClass("Splash::Rendering::Xenon::XeDevice"); - this._priv_remoteClass_XAudSoundDevice = port.InitRemoteClass("Splash::Rendering::Xenon::XAudSoundDevice"); - } - - internal RENDERHANDLE XeDevice_ClassHandle => this._priv_remoteClass_XeDevice; - - internal RENDERHANDLE XAudSoundDevice_ClassHandle => this._priv_remoteClass_XAudSoundDevice; - - internal RemoteXeDevice BuildRemoteXeDevice( - IRenderHandleOwner _priv_owner, - LocalDeviceCallback cb, - Size sizeScreenPxl) - { - return RemoteXeDevice.Create(this, _priv_owner, cb, sizeScreenPxl); - } - - internal RemoteXAudSoundDevice BuildRemoteXAudSoundDevice( - IRenderHandleOwner _priv_owner) - { - return RemoteXAudSoundDevice.Create(this, _priv_owner); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/RemoteXAudSoundDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/RemoteXAudSoundDevice.cs index 15adaeb..e0b62b2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/RemoteXAudSoundDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/RemoteXAudSoundDevice.cs @@ -10,144 +10,144 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering.Xenon { - internal class RemoteXAudSoundDevice : RemoteSoundDevice - { - private static ushort[] s_priv_ByteOrder_Msg6_Create; - private static ushort[] s_priv_ByteOrder_Msg4_SetMute; - private static ushort[] s_priv_ByteOrder_Msg5_SetVolume; - - protected RemoteXAudSoundDevice() + internal class RemoteXAudSoundDevice : RemoteSoundDevice { + private static ushort[] s_priv_ByteOrder_Msg6_Create; + private static ushort[] s_priv_ByteOrder_Msg4_SetMute; + private static ushort[] s_priv_ByteOrder_Msg5_SetVolume; + + protected RemoteXAudSoundDevice() + { + } + + public static unsafe RemoteXAudSoundDevice Create( + ProtocolSplashRenderingXenon _priv_protocolInstance, + IRenderHandleOwner _priv_owner) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE deviceClassHandle = _priv_protocolInstance.XAudSoundDevice_ClassHandle; + RemoteXAudSoundDevice remoteXaudSoundDevice = new RemoteXAudSoundDevice(port, _priv_owner); + uint num = (uint)sizeof(RemoteXAudSoundDevice.Msg6_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteXAudSoundDevice.Msg6_Create* msg6CreatePtr = (RemoteXAudSoundDevice.Msg6_Create*)pMem; + msg6CreatePtr->_priv_size = num; + msg6CreatePtr->_priv_msgid = 6U; + msg6CreatePtr->_priv_idObjectSubject = remoteXaudSoundDevice.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteXAudSoundDevice.s_priv_ByteOrder_Msg6_Create, typeof(RemoteXAudSoundDevice.Msg6_Create), 0, 0); + port.CreateRemoteObject(deviceClassHandle, remoteXaudSoundDevice.m_renderHandle, (Message*)msg6CreatePtr); + return remoteXaudSoundDevice; + } + + public unsafe void BuildSetMute( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + bool fMuted) + { + 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(RemoteXAudSoundDevice.Msg4_SetMute); + RemoteXAudSoundDevice.Msg4_SetMute* msg4SetMutePtr = (RemoteXAudSoundDevice.Msg4_SetMute*)_priv_portUse.AllocMessageBuffer(size); + msg4SetMutePtr->_priv_size = size; + msg4SetMutePtr->_priv_msgid = 4U; + msg4SetMutePtr->fMuted = fMuted ? uint.MaxValue : 0U; + msg4SetMutePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg4SetMutePtr, ref RemoteXAudSoundDevice.s_priv_ByteOrder_Msg4_SetMute, typeof(RemoteXAudSoundDevice.Msg4_SetMute), 0, 0); + _priv_pmsgUse = (Message*)msg4SetMutePtr; + } + + public unsafe void SendSetMute(bool fMuted) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetMute(out _priv_portUse, out _priv_pmsgUse, fMuted); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public unsafe void BuildSetVolume( + out RenderPort _priv_portUse, + out Message* _priv_pmsgUse, + float flVolume) + { + 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(RemoteXAudSoundDevice.Msg5_SetVolume); + RemoteXAudSoundDevice.Msg5_SetVolume* msg5SetVolumePtr = (RemoteXAudSoundDevice.Msg5_SetVolume*)_priv_portUse.AllocMessageBuffer(size); + msg5SetVolumePtr->_priv_size = size; + msg5SetVolumePtr->_priv_msgid = 5U; + msg5SetVolumePtr->flVolume = flVolume; + msg5SetVolumePtr->_priv_idObjectSubject = this.m_renderHandle; + if (_priv_portUse.ForeignByteOrder) + MarshalHelper.SwapByteOrder((byte*)msg5SetVolumePtr, ref RemoteXAudSoundDevice.s_priv_ByteOrder_Msg5_SetVolume, typeof(RemoteXAudSoundDevice.Msg5_SetVolume), 0, 0); + _priv_pmsgUse = (Message*)msg5SetVolumePtr; + } + + public unsafe void SendSetVolume(float flVolume) + { + RenderPort _priv_portUse; + Message* _priv_pmsgUse; + this.BuildSetVolume(out _priv_portUse, out _priv_pmsgUse, flVolume); + _priv_portUse.SendRemoteMessage(_priv_pmsgUse); + } + + public static RemoteXAudSoundDevice CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteXAudSoundDevice(port, handle, true); + } + + public static RemoteXAudSoundDevice CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteXAudSoundDevice(port, handle, false); + } + + protected RemoteXAudSoundDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteXAudSoundDevice(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteXAudSoundDevice && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg6_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + } + + [ComVisible(false)] + private struct Msg4_SetMute + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public uint fMuted; + } + + [ComVisible(false)] + private struct Msg5_SetVolume + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public float flVolume; + } } - - public static unsafe RemoteXAudSoundDevice Create( - ProtocolSplashRenderingXenon _priv_protocolInstance, - IRenderHandleOwner _priv_owner) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE deviceClassHandle = _priv_protocolInstance.XAudSoundDevice_ClassHandle; - RemoteXAudSoundDevice remoteXaudSoundDevice = new RemoteXAudSoundDevice(port, _priv_owner); - uint num = (uint) sizeof (RemoteXAudSoundDevice.Msg6_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteXAudSoundDevice.Msg6_Create* msg6CreatePtr = (RemoteXAudSoundDevice.Msg6_Create*) pMem; - msg6CreatePtr->_priv_size = num; - msg6CreatePtr->_priv_msgid = 6U; - msg6CreatePtr->_priv_idObjectSubject = remoteXaudSoundDevice.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteXAudSoundDevice.s_priv_ByteOrder_Msg6_Create, typeof (RemoteXAudSoundDevice.Msg6_Create), 0, 0); - port.CreateRemoteObject(deviceClassHandle, remoteXaudSoundDevice.m_renderHandle, (Message*) msg6CreatePtr); - return remoteXaudSoundDevice; - } - - public unsafe void BuildSetMute( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - bool fMuted) - { - 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 (RemoteXAudSoundDevice.Msg4_SetMute); - RemoteXAudSoundDevice.Msg4_SetMute* msg4SetMutePtr = (RemoteXAudSoundDevice.Msg4_SetMute*) _priv_portUse.AllocMessageBuffer(size); - msg4SetMutePtr->_priv_size = size; - msg4SetMutePtr->_priv_msgid = 4U; - msg4SetMutePtr->fMuted = fMuted ? uint.MaxValue : 0U; - msg4SetMutePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg4SetMutePtr, ref RemoteXAudSoundDevice.s_priv_ByteOrder_Msg4_SetMute, typeof (RemoteXAudSoundDevice.Msg4_SetMute), 0, 0); - _priv_pmsgUse = (Message*) msg4SetMutePtr; - } - - public unsafe void SendSetMute(bool fMuted) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetMute(out _priv_portUse, out _priv_pmsgUse, fMuted); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public unsafe void BuildSetVolume( - out RenderPort _priv_portUse, - out Message* _priv_pmsgUse, - float flVolume) - { - 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 (RemoteXAudSoundDevice.Msg5_SetVolume); - RemoteXAudSoundDevice.Msg5_SetVolume* msg5SetVolumePtr = (RemoteXAudSoundDevice.Msg5_SetVolume*) _priv_portUse.AllocMessageBuffer(size); - msg5SetVolumePtr->_priv_size = size; - msg5SetVolumePtr->_priv_msgid = 5U; - msg5SetVolumePtr->flVolume = flVolume; - msg5SetVolumePtr->_priv_idObjectSubject = this.m_renderHandle; - if (_priv_portUse.ForeignByteOrder) - MarshalHelper.SwapByteOrder((byte*) msg5SetVolumePtr, ref RemoteXAudSoundDevice.s_priv_ByteOrder_Msg5_SetVolume, typeof (RemoteXAudSoundDevice.Msg5_SetVolume), 0, 0); - _priv_pmsgUse = (Message*) msg5SetVolumePtr; - } - - public unsafe void SendSetVolume(float flVolume) - { - RenderPort _priv_portUse; - Message* _priv_pmsgUse; - this.BuildSetVolume(out _priv_portUse, out _priv_pmsgUse, flVolume); - _priv_portUse.SendRemoteMessage(_priv_pmsgUse); - } - - public static RemoteXAudSoundDevice CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteXAudSoundDevice(port, handle, true); - } - - public static RemoteXAudSoundDevice CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteXAudSoundDevice(port, handle, false); - } - - protected RemoteXAudSoundDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteXAudSoundDevice(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteXAudSoundDevice && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg6_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - } - - [ComVisible(false)] - private struct Msg4_SetMute - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public uint fMuted; - } - - [ComVisible(false)] - private struct Msg5_SetVolume - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public float flVolume; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/RemoteXeDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/RemoteXeDevice.cs index 51ae8f3..b5990d8 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/RemoteXeDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/Xenon/RemoteXeDevice.cs @@ -9,78 +9,78 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Protocols.Splash.Rendering.Xenon { - internal class RemoteXeDevice : RemoteDx9Device - { - private static ushort[] s_priv_ByteOrder_Msg11_Create; - - protected RemoteXeDevice() + internal class RemoteXeDevice : RemoteDx9Device { + private static ushort[] s_priv_ByteOrder_Msg11_Create; + + protected RemoteXeDevice() + { + } + + public static unsafe RemoteXeDevice Create( + ProtocolSplashRenderingXenon _priv_protocolInstance, + IRenderHandleOwner _priv_owner, + LocalDeviceCallback cb, + Size sizeScreenPxl) + { + RenderPort port = _priv_protocolInstance.Port; + RENDERHANDLE deviceClassHandle = _priv_protocolInstance.XeDevice_ClassHandle; + RemoteXeDevice remoteXeDevice = new RemoteXeDevice(port, _priv_owner); + uint num = (uint)sizeof(RemoteXeDevice.Msg11_Create); + // ISSUE: untyped stack allocation + byte* pMem = (byte*)__untypedstackalloc(1 * (int)num); + RemoteXeDevice.Msg11_Create* msg11CreatePtr = (RemoteXeDevice.Msg11_Create*)pMem; + msg11CreatePtr->_priv_size = num; + msg11CreatePtr->_priv_msgid = 11U; + msg11CreatePtr->_priv_objcb = cb.RenderHandle; + msg11CreatePtr->_priv_ctxcb = port.Session.LocalContext; + msg11CreatePtr->sizeScreenPxl = sizeScreenPxl; + msg11CreatePtr->_priv_idObjectSubject = remoteXeDevice.m_renderHandle; + if (port.ForeignByteOrder) + MarshalHelper.SwapByteOrder(pMem, ref RemoteXeDevice.s_priv_ByteOrder_Msg11_Create, typeof(RemoteXeDevice.Msg11_Create), 0, 0); + port.CreateRemoteObject(deviceClassHandle, remoteXeDevice.m_renderHandle, (Message*)msg11CreatePtr); + return remoteXeDevice; + } + + public static RemoteXeDevice CreateFromHandle( + RenderPort port, + RENDERHANDLE handle) + { + return new RemoteXeDevice(port, handle, true); + } + + public static RemoteXeDevice CreateFromExternalHandle( + RenderPort port, + RENDERHANDLE handle, + IRenderHandleOwner owner) + { + port.RegisterKnownHandle(owner, handle); + return new RemoteXeDevice(port, handle, false); + } + + protected RemoteXeDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) + : base(port, handle, fFreeOnDispose) + { + } + + protected RemoteXeDevice(RenderPort port, IRenderHandleOwner owner) + : base(port, owner) + { + } + + public override bool Equals(object other) => other is RemoteXeDevice && this.m_renderHandle == ((RemoteObject)other).m_renderHandle; + + public override int GetHashCode() => base.GetHashCode(); + + [ComVisible(false)] + private struct Msg11_Create + { + public uint _priv_size; + public uint _priv_msgid; + public RENDERHANDLE _priv_idObjectSubject; + public RENDERHANDLE _priv_objcb; + public ContextID _priv_ctxcb; + public Size sizeScreenPxl; + } } - - public static unsafe RemoteXeDevice Create( - ProtocolSplashRenderingXenon _priv_protocolInstance, - IRenderHandleOwner _priv_owner, - LocalDeviceCallback cb, - Size sizeScreenPxl) - { - RenderPort port = _priv_protocolInstance.Port; - RENDERHANDLE deviceClassHandle = _priv_protocolInstance.XeDevice_ClassHandle; - RemoteXeDevice remoteXeDevice = new RemoteXeDevice(port, _priv_owner); - uint num = (uint) sizeof (RemoteXeDevice.Msg11_Create); - // ISSUE: untyped stack allocation - byte* pMem = (byte*) __untypedstackalloc(1 * (int) num); - RemoteXeDevice.Msg11_Create* msg11CreatePtr = (RemoteXeDevice.Msg11_Create*) pMem; - msg11CreatePtr->_priv_size = num; - msg11CreatePtr->_priv_msgid = 11U; - msg11CreatePtr->_priv_objcb = cb.RenderHandle; - msg11CreatePtr->_priv_ctxcb = port.Session.LocalContext; - msg11CreatePtr->sizeScreenPxl = sizeScreenPxl; - msg11CreatePtr->_priv_idObjectSubject = remoteXeDevice.m_renderHandle; - if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref RemoteXeDevice.s_priv_ByteOrder_Msg11_Create, typeof (RemoteXeDevice.Msg11_Create), 0, 0); - port.CreateRemoteObject(deviceClassHandle, remoteXeDevice.m_renderHandle, (Message*) msg11CreatePtr); - return remoteXeDevice; - } - - public static RemoteXeDevice CreateFromHandle( - RenderPort port, - RENDERHANDLE handle) - { - return new RemoteXeDevice(port, handle, true); - } - - public static RemoteXeDevice CreateFromExternalHandle( - RenderPort port, - RENDERHANDLE handle, - IRenderHandleOwner owner) - { - port.RegisterKnownHandle(owner, handle); - return new RemoteXeDevice(port, handle, false); - } - - protected RemoteXeDevice(RenderPort port, RENDERHANDLE handle, bool fFreeOnDispose) - : base(port, handle, fFreeOnDispose) - { - } - - protected RemoteXeDevice(RenderPort port, IRenderHandleOwner owner) - : base(port, owner) - { - } - - public override bool Equals(object other) => other is RemoteXeDevice && this.m_renderHandle == ((RemoteObject) other).m_renderHandle; - - public override int GetHashCode() => base.GetHashCode(); - - [ComVisible(false)] - private struct Msg11_Create - { - public uint _priv_size; - public uint _priv_msgid; - public RENDERHANDLE _priv_idObjectSubject; - public RENDERHANDLE _priv_objcb; - public ContextID _priv_ctxcb; - public Size sizeScreenPxl; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Quaternion.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Quaternion.cs index ab09f78..11b9988 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Quaternion.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Quaternion.cs @@ -10,122 +10,122 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render { - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct Quaternion - { - private float m_x; - private float m_y; - private float m_z; - private float m_w; - public static readonly Quaternion Identity = new Quaternion(0.0f, 0.0f, 0.0f, 1f); - - public Quaternion(float x, float y, float z, float w) + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct Quaternion { - this.m_x = x; - this.m_y = y; - this.m_z = z; - this.m_w = w; + private float m_x; + private float m_y; + private float m_z; + private float m_w; + public static readonly Quaternion Identity = new Quaternion(0.0f, 0.0f, 0.0f, 1f); + + public Quaternion(float x, float y, float z, float w) + { + this.m_x = x; + this.m_y = y; + this.m_z = z; + this.m_w = w; + } + + public Quaternion(Vector3 vAxis, float flAngle) + { + vAxis.Normalize(); + float num1 = (float)Math.Sin(0.5 * (double)flAngle); + float num2 = (float)Math.Cos(0.5 * (double)flAngle); + this.m_x = vAxis.X * num1; + this.m_y = vAxis.Y * num1; + this.m_z = vAxis.Z * num1; + this.m_w = num2; + } + + public Quaternion(AxisAngle axisAngle) + : this(axisAngle.Axis, axisAngle.Angle) + { + } + + public float X + { + get => this.m_x; + set => this.m_x = value; + } + + public float Y + { + get => this.m_y; + set => this.m_y = value; + } + + public float Z + { + get => this.m_z; + set => this.m_z = value; + } + + public float W + { + get => this.m_w; + set => this.m_w = value; + } + + public bool IsIdentity => object.Equals((object)this, (object)Quaternion.Identity); + + public static Quaternion operator *(Quaternion q1, Quaternion q2) => new Quaternion() + { + m_x = (float)((double)q2.m_w * (double)q1.m_x + (double)q2.m_x * (double)q1.m_w + (double)q2.m_y * (double)q1.m_z - (double)q2.m_z * (double)q1.m_y), + m_y = (float)((double)q2.m_w * (double)q1.m_y - (double)q2.m_x * (double)q1.m_z + (double)q2.m_y * (double)q1.m_w + (double)q2.m_z * (double)q1.m_x), + m_z = (float)((double)q2.m_w * (double)q1.m_z + (double)q2.m_x * (double)q1.m_y - (double)q2.m_y * (double)q1.m_x + (double)q2.m_z * (double)q1.m_w), + m_w = (float)((double)q2.m_w * (double)q1.m_w - (double)q2.m_x * (double)q1.m_x - (double)q2.m_y * (double)q1.m_y - (double)q2.m_z * (double)q1.m_z) + }; + + public static Quaternion Multiply(Quaternion qLeft, Quaternion qRight) => qLeft * qRight; + + public override bool Equals(object obj) => obj is Quaternion quaternion && this == quaternion; + + public static bool operator ==(Quaternion left, Quaternion right) => Math2.WithinEpsilon(left.X, right.X) && Math2.WithinEpsilon(left.Y, right.Y) && Math2.WithinEpsilon(left.Z, right.Z) && Math2.WithinEpsilon(left.W, right.W); + + public static bool operator !=(Quaternion left, Quaternion right) => !(left == right); + + public AxisAngle ToAxisAngle() + { + this.Normalize(); + Vector3 vAxis; + float flAngle; + this.ToAxisAngle(out vAxis, out flAngle); + return vAxis.IsApproximate(Vector3.Zero) ? AxisAngle.Identity : new AxisAngle(vAxis, flAngle); + } + + internal void Normalize() + { + float flValue1 = (float)((double)this.m_x * (double)this.m_x + (double)this.m_y * (double)this.m_y + (double)this.m_z * (double)this.m_z + (double)this.m_w * (double)this.m_w); + if (Math2.WithinEpsilon(flValue1, 1f)) + return; + if ((double)flValue1 > 1.40129846432482E-45) + { + float num = (float)Math.Sqrt((double)flValue1); + this.m_x /= num; + this.m_y /= num; + this.m_z /= num; + this.m_w /= num; + } + else + { + this.m_x = 0.0f; + this.m_y = 0.0f; + this.m_z = 0.0f; + this.m_w = 0.0f; + } + } + + public override int GetHashCode() => this.X.GetHashCode() ^ this.Y.GetHashCode() ^ this.Z.GetHashCode() ^ this.W.GetHashCode(); + + public override string ToString() => base.ToString(); + + public void ToAxisAngle(out Vector3 vAxis, out float flAngle) + { + vAxis = new Vector3(this.m_x, this.m_y, this.m_z); + flAngle = (float)(2.0 * Math.Acos((double)this.m_w)); + } + + public bool IsApproximate(Quaternion q) => Math2.WithinEpsilon(this.m_x, q.m_x) && Math2.WithinEpsilon(this.m_y, q.m_y) && Math2.WithinEpsilon(this.m_z, q.m_z) && Math2.WithinEpsilon(this.m_w, q.m_w); } - - public Quaternion(Vector3 vAxis, float flAngle) - { - vAxis.Normalize(); - float num1 = (float) Math.Sin(0.5 * (double) flAngle); - float num2 = (float) Math.Cos(0.5 * (double) flAngle); - this.m_x = vAxis.X * num1; - this.m_y = vAxis.Y * num1; - this.m_z = vAxis.Z * num1; - this.m_w = num2; - } - - public Quaternion(AxisAngle axisAngle) - : this(axisAngle.Axis, axisAngle.Angle) - { - } - - public float X - { - get => this.m_x; - set => this.m_x = value; - } - - public float Y - { - get => this.m_y; - set => this.m_y = value; - } - - public float Z - { - get => this.m_z; - set => this.m_z = value; - } - - public float W - { - get => this.m_w; - set => this.m_w = value; - } - - public bool IsIdentity => object.Equals((object) this, (object) Quaternion.Identity); - - public static Quaternion operator *(Quaternion q1, Quaternion q2) => new Quaternion() - { - m_x = (float) ((double) q2.m_w * (double) q1.m_x + (double) q2.m_x * (double) q1.m_w + (double) q2.m_y * (double) q1.m_z - (double) q2.m_z * (double) q1.m_y), - m_y = (float) ((double) q2.m_w * (double) q1.m_y - (double) q2.m_x * (double) q1.m_z + (double) q2.m_y * (double) q1.m_w + (double) q2.m_z * (double) q1.m_x), - m_z = (float) ((double) q2.m_w * (double) q1.m_z + (double) q2.m_x * (double) q1.m_y - (double) q2.m_y * (double) q1.m_x + (double) q2.m_z * (double) q1.m_w), - m_w = (float) ((double) q2.m_w * (double) q1.m_w - (double) q2.m_x * (double) q1.m_x - (double) q2.m_y * (double) q1.m_y - (double) q2.m_z * (double) q1.m_z) - }; - - public static Quaternion Multiply(Quaternion qLeft, Quaternion qRight) => qLeft * qRight; - - public override bool Equals(object obj) => obj is Quaternion quaternion && this == quaternion; - - public static bool operator ==(Quaternion left, Quaternion right) => Math2.WithinEpsilon(left.X, right.X) && Math2.WithinEpsilon(left.Y, right.Y) && Math2.WithinEpsilon(left.Z, right.Z) && Math2.WithinEpsilon(left.W, right.W); - - public static bool operator !=(Quaternion left, Quaternion right) => !(left == right); - - public AxisAngle ToAxisAngle() - { - this.Normalize(); - Vector3 vAxis; - float flAngle; - this.ToAxisAngle(out vAxis, out flAngle); - return vAxis.IsApproximate(Vector3.Zero) ? AxisAngle.Identity : new AxisAngle(vAxis, flAngle); - } - - internal void Normalize() - { - float flValue1 = (float) ((double) this.m_x * (double) this.m_x + (double) this.m_y * (double) this.m_y + (double) this.m_z * (double) this.m_z + (double) this.m_w * (double) this.m_w); - if (Math2.WithinEpsilon(flValue1, 1f)) - return; - if ((double) flValue1 > 1.40129846432482E-45) - { - float num = (float) Math.Sqrt((double) flValue1); - this.m_x /= num; - this.m_y /= num; - this.m_z /= num; - this.m_w /= num; - } - else - { - this.m_x = 0.0f; - this.m_y = 0.0f; - this.m_z = 0.0f; - this.m_w = 0.0f; - } - } - - public override int GetHashCode() => this.X.GetHashCode() ^ this.Y.GetHashCode() ^ this.Z.GetHashCode() ^ this.W.GetHashCode(); - - public override string ToString() => base.ToString(); - - public void ToAxisAngle(out Vector3 vAxis, out float flAngle) - { - vAxis = new Vector3(this.m_x, this.m_y, this.m_z); - flAngle = (float) (2.0 * Math.Acos((double) this.m_w)); - } - - public bool IsApproximate(Quaternion q) => Math2.WithinEpsilon(this.m_x, q.m_x) && Math2.WithinEpsilon(this.m_y, q.m_y) && Math2.WithinEpsilon(this.m_z, q.m_z) && Math2.WithinEpsilon(this.m_w, q.m_w); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Rectangle.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Rectangle.cs index 687b698..9e61a82 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Rectangle.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Rectangle.cs @@ -8,197 +8,197 @@ using System; namespace Microsoft.Iris.Render { - [Serializable] - public struct Rectangle - { - private int m_x; - private int m_y; - private int m_width; - private int m_height; - public static readonly Rectangle Zero = new Rectangle(0, 0, 0, 0); - - public Rectangle(int x, int y, int width, int height) + [Serializable] + public struct Rectangle { - this.m_x = x; - this.m_y = y; - this.m_width = width; - this.m_height = height; + private int m_x; + private int m_y; + private int m_width; + private int m_height; + public static readonly Rectangle Zero = new Rectangle(0, 0, 0, 0); + + public Rectangle(int x, int y, int width, int height) + { + this.m_x = x; + this.m_y = y; + this.m_width = width; + this.m_height = height; + } + + public Rectangle(float x, float y, float width, float height) + { + this.m_x = (int)Math.Round((double)x); + this.m_y = (int)Math.Round((double)y); + this.m_width = (int)Math.Round((double)width); + this.m_height = (int)Math.Round((double)height); + } + + public Rectangle(Size extent) + : this(Point.Zero, extent) + { + } + + public Rectangle(Point offset, Size extent) + { + this.m_x = offset.X; + this.m_y = offset.Y; + this.m_width = extent.Width; + this.m_height = extent.Height; + } + + public int X + { + get => this.m_x; + set => this.m_x = value; + } + + public int Y + { + get => this.m_y; + set => this.m_y = value; + } + + public int Width + { + get => this.m_width; + set => this.m_width = value; + } + + public int Height + { + get => this.m_height; + set => this.m_height = value; + } + + public bool Contains(Point point) => this.Contains(point.X, point.Y); + + public static Rectangle Inflate(Rectangle rectangle, int x, int y) + { + Rectangle rectangle1 = rectangle; + rectangle1.Inflate(x, y); + return rectangle1; + } + + public static Rectangle Intersect(Rectangle left, Rectangle right) + { + int x = Math.Max(left.X, right.X); + int num1 = Math.Min(left.X + left.Width, right.X + right.Width); + int y = Math.Max(left.Y, right.Y); + int num2 = Math.Min(left.Y + left.Height, right.Y + right.Height); + return num1 >= x && num2 >= y ? new Rectangle(x, y, num1 - x, num2 - y) : Rectangle.Zero; + } + + public static Rectangle Union(Rectangle left, Rectangle right) + { + int x = Math.Min(left.X, right.X); + int num1 = Math.Max(left.X + left.Width, right.X + right.Width); + int y = Math.Min(left.Y, right.Y); + int num2 = Math.Max(left.Y + left.Height, right.Y + right.Height); + return new Rectangle(x, y, num1 - x, num2 - y); + } + + public override bool Equals(object obj) => obj is Rectangle rectangle && rectangle.X == this.X && (rectangle.Y == this.Y && rectangle.Width == this.Width) && rectangle.Height == this.Height; + + public static bool operator ==(Rectangle left, Rectangle right) => left.X == right.X && left.Y == right.Y && left.Width == right.Width && left.Height == right.Height; + + public static bool operator !=(Rectangle left, Rectangle right) => !(left == right); + + public override int GetHashCode() => this.X ^ (this.Y << 13 | (int)((uint)this.Y >> 19)) ^ (this.Width << 26 | (int)((uint)this.Width >> 6)) ^ (this.Height << 7 | (int)((uint)this.Height >> 25)); + + public override string ToString() => base.ToString(); + + public static Rectangle FromLTRB(int left, int top, int right, int bottom) => new Rectangle(left, top, right - left, bottom - top); + + public Point Location + { + get => new Point(this.X, this.Y); + set + { + this.X = value.X; + this.Y = value.Y; + } + } + + public Size Size + { + get => new Size(this.Width, this.Height); + set + { + this.Width = value.Width; + this.Height = value.Height; + } + } + + public int Left => this.X; + + public int Top => this.Y; + + public int Right => this.X + this.Width; + + public int Bottom => this.Y + this.Height; + + public bool IsEmpty => this.Height == 0 && this.Width == 0 && this.X == 0 && this.Y == 0; + + public int Area => this.Width * this.Height; + + public bool Contains(int x, int y) => this.X <= x && x < this.X + this.Width && this.Y <= y && y < this.Y + this.Height; + + public bool Contains(Rectangle rect) => this.X <= rect.X && rect.X + rect.Width <= this.X + this.Width && this.Y <= rect.Y && rect.Y + rect.Height <= this.Y + this.Height; + + public void Inflate(int width, int height) + { + this.X -= width; + this.Y -= height; + this.Width += 2 * width; + this.Height += 2 * height; + } + + public void Inflate(Size size) => this.Inflate(size.Width, size.Height); + + public static Rectangle Inflate(Rectangle source, Rectangle offset) => Rectangle.FromLTRB(source.Left - offset.Left, source.Top - offset.Top, source.Right + offset.Right, source.Bottom + offset.Bottom); + + public void Intersect(Rectangle rect) + { + Rectangle rectangle = Rectangle.Intersect(rect, this); + this.X = rectangle.X; + this.Y = rectangle.Y; + this.Width = rectangle.Width; + this.Height = rectangle.Height; + } + + public bool IntersectsWith(Rectangle rect) => this.Left < rect.Right && this.Top < rect.Bottom && this.Right > rect.Left && this.Bottom > rect.Top; + + public void Union(Rectangle rect) + { + Rectangle rectangle = Rectangle.Union(rect, this); + this.X = rectangle.X; + this.Y = rectangle.Y; + this.Width = rectangle.Width; + this.Height = rectangle.Height; + } + + public static Rectangle Offset(Rectangle rect, Point pos) + { + rect.Offset(pos); + return rect; + } + + public void Offset(Point pos) => this.Offset(pos.X, pos.Y); + + public static Rectangle Offset(Rectangle rect, int x, int y) + { + rect.Offset(x, y); + return rect; + } + + public void Offset(int x, int y) + { + this.X += x; + this.Y += y; + } + + public Point Center => new Point(this.X + this.Width / 2, this.Y + this.Height / 2); + + public bool IsZero => this.Height == 0 && this.Width == 0 && this.X == 0 && this.Y == 0; } - - public Rectangle(float x, float y, float width, float height) - { - this.m_x = (int) Math.Round((double) x); - this.m_y = (int) Math.Round((double) y); - this.m_width = (int) Math.Round((double) width); - this.m_height = (int) Math.Round((double) height); - } - - public Rectangle(Size extent) - : this(Point.Zero, extent) - { - } - - public Rectangle(Point offset, Size extent) - { - this.m_x = offset.X; - this.m_y = offset.Y; - this.m_width = extent.Width; - this.m_height = extent.Height; - } - - public int X - { - get => this.m_x; - set => this.m_x = value; - } - - public int Y - { - get => this.m_y; - set => this.m_y = value; - } - - public int Width - { - get => this.m_width; - set => this.m_width = value; - } - - public int Height - { - get => this.m_height; - set => this.m_height = value; - } - - public bool Contains(Point point) => this.Contains(point.X, point.Y); - - public static Rectangle Inflate(Rectangle rectangle, int x, int y) - { - Rectangle rectangle1 = rectangle; - rectangle1.Inflate(x, y); - return rectangle1; - } - - public static Rectangle Intersect(Rectangle left, Rectangle right) - { - int x = Math.Max(left.X, right.X); - int num1 = Math.Min(left.X + left.Width, right.X + right.Width); - int y = Math.Max(left.Y, right.Y); - int num2 = Math.Min(left.Y + left.Height, right.Y + right.Height); - return num1 >= x && num2 >= y ? new Rectangle(x, y, num1 - x, num2 - y) : Rectangle.Zero; - } - - public static Rectangle Union(Rectangle left, Rectangle right) - { - int x = Math.Min(left.X, right.X); - int num1 = Math.Max(left.X + left.Width, right.X + right.Width); - int y = Math.Min(left.Y, right.Y); - int num2 = Math.Max(left.Y + left.Height, right.Y + right.Height); - return new Rectangle(x, y, num1 - x, num2 - y); - } - - public override bool Equals(object obj) => obj is Rectangle rectangle && rectangle.X == this.X && (rectangle.Y == this.Y && rectangle.Width == this.Width) && rectangle.Height == this.Height; - - public static bool operator ==(Rectangle left, Rectangle right) => left.X == right.X && left.Y == right.Y && left.Width == right.Width && left.Height == right.Height; - - public static bool operator !=(Rectangle left, Rectangle right) => !(left == right); - - public override int GetHashCode() => this.X ^ (this.Y << 13 | (int) ((uint) this.Y >> 19)) ^ (this.Width << 26 | (int) ((uint) this.Width >> 6)) ^ (this.Height << 7 | (int) ((uint) this.Height >> 25)); - - public override string ToString() => base.ToString(); - - public static Rectangle FromLTRB(int left, int top, int right, int bottom) => new Rectangle(left, top, right - left, bottom - top); - - public Point Location - { - get => new Point(this.X, this.Y); - set - { - this.X = value.X; - this.Y = value.Y; - } - } - - public Size Size - { - get => new Size(this.Width, this.Height); - set - { - this.Width = value.Width; - this.Height = value.Height; - } - } - - public int Left => this.X; - - public int Top => this.Y; - - public int Right => this.X + this.Width; - - public int Bottom => this.Y + this.Height; - - public bool IsEmpty => this.Height == 0 && this.Width == 0 && this.X == 0 && this.Y == 0; - - public int Area => this.Width * this.Height; - - public bool Contains(int x, int y) => this.X <= x && x < this.X + this.Width && this.Y <= y && y < this.Y + this.Height; - - public bool Contains(Rectangle rect) => this.X <= rect.X && rect.X + rect.Width <= this.X + this.Width && this.Y <= rect.Y && rect.Y + rect.Height <= this.Y + this.Height; - - public void Inflate(int width, int height) - { - this.X -= width; - this.Y -= height; - this.Width += 2 * width; - this.Height += 2 * height; - } - - public void Inflate(Size size) => this.Inflate(size.Width, size.Height); - - public static Rectangle Inflate(Rectangle source, Rectangle offset) => Rectangle.FromLTRB(source.Left - offset.Left, source.Top - offset.Top, source.Right + offset.Right, source.Bottom + offset.Bottom); - - public void Intersect(Rectangle rect) - { - Rectangle rectangle = Rectangle.Intersect(rect, this); - this.X = rectangle.X; - this.Y = rectangle.Y; - this.Width = rectangle.Width; - this.Height = rectangle.Height; - } - - public bool IntersectsWith(Rectangle rect) => this.Left < rect.Right && this.Top < rect.Bottom && this.Right > rect.Left && this.Bottom > rect.Top; - - public void Union(Rectangle rect) - { - Rectangle rectangle = Rectangle.Union(rect, this); - this.X = rectangle.X; - this.Y = rectangle.Y; - this.Width = rectangle.Width; - this.Height = rectangle.Height; - } - - public static Rectangle Offset(Rectangle rect, Point pos) - { - rect.Offset(pos); - return rect; - } - - public void Offset(Point pos) => this.Offset(pos.X, pos.Y); - - public static Rectangle Offset(Rectangle rect, int x, int y) - { - rect.Offset(x, y); - return rect; - } - - public void Offset(int x, int y) - { - this.X += x; - this.Y += y; - } - - public Point Center => new Point(this.X + this.Width / 2, this.Y + this.Height / 2); - - public bool IsZero => this.Height == 0 && this.Width == 0 && this.X == 0 && this.Y == 0; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/RelativeSpace.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/RelativeSpace.cs index ff9be82..7b14798 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/RelativeSpace.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/RelativeSpace.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render { - public enum RelativeSpace - { - Min = 0, - Max = 1, - Global = 4, - } + public enum RelativeSpace + { + Min = 0, + Max = 1, + Global = 4, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Remote/ImageHeader.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Remote/ImageHeader.cs index d341a8b..666ae98 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Remote/ImageHeader.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Remote/ImageHeader.cs @@ -8,12 +8,12 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Remote { - [ComVisible(false)] - public struct ImageHeader - { - public Size sizeActualPxl; - public Size sizeOriginalPxl; - public int nStride; - public SurfaceFormat nFormat; - } + [ComVisible(false)] + public struct ImageHeader + { + public Size sizeActualPxl; + public Size sizeOriginalPxl; + public int nStride; + public SurfaceFormat nFormat; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Remote/SoundHeader.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Remote/SoundHeader.cs index e1bc3d3..aa64017 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Remote/SoundHeader.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Remote/SoundHeader.cs @@ -8,16 +8,16 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Remote { - [ComVisible(false)] - public struct SoundHeader - { - public ushort wFormatTag; - public ushort nChannels; - public uint nSamplesPerSec; - public uint nAvgBytesPerSec; - public ushort nBlockAlign; - public ushort wBitsPerSample; - public ushort cbExtraData; - public uint cbDataSize; - } + [ComVisible(false)] + public struct SoundHeader + { + public ushort wFormatTag; + public ushort nChannels; + public uint nSamplesPerSec; + public uint nAvgBytesPerSec; + public ushort nBlockAlign; + public ushort wBitsPerSample; + public ushort cbExtraData; + public uint cbDataSize; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderApi.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderApi.cs index 6777f75..3fba0a2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderApi.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderApi.cs @@ -11,45 +11,45 @@ using System; namespace Microsoft.Iris.Render { - public static class RenderApi - { - public static IDebug DebugModule + public static class RenderApi { - get => Debug2.Module; - set => Debug2.Module = value; - } + public static IDebug DebugModule + { + get => Debug2.Module; + set => Debug2.Module = value; + } - public static IRenderEngine CreateEngine( - EngineInfo engineInfo, - IRenderHost renderHost) - { - Debug2.Validate(engineInfo != null, typeof (ArgumentNullException), nameof (engineInfo)); - Debug2.Validate(renderHost != null, typeof (ArgumentNullException), nameof (renderHost)); - IRenderEngine renderEngine = (IRenderEngine) null; - if (engineInfo.Type == EngineType.Iris) - renderEngine = (IRenderEngine) new RenderEngine(engineInfo as IrisEngineInfo, renderHost); - return renderEngine; - } + public static IRenderEngine CreateEngine( + EngineInfo engineInfo, + IRenderHost renderHost) + { + Debug2.Validate(engineInfo != null, typeof(ArgumentNullException), nameof(engineInfo)); + Debug2.Validate(renderHost != null, typeof(ArgumentNullException), nameof(renderHost)); + IRenderEngine renderEngine = (IRenderEngine)null; + if (engineInfo.Type == EngineType.Iris) + renderEngine = (IRenderEngine)new RenderEngine(engineInfo as IrisEngineInfo, renderHost); + return renderEngine; + } - public static IRenderSession CreateSession( - RenderToken sessionToken, - IRenderHost renderHost) - { - Debug2.Validate(sessionToken != null, typeof (ArgumentNullException), nameof (sessionToken)); - Debug2.Validate(sessionToken.EngineInfo != null, typeof (ArgumentNullException), "sessionToken.EngineInfo"); - Debug2.Validate(renderHost != null, typeof (ArgumentNullException), nameof (renderHost)); - IRenderSession renderSession = (IRenderSession) null; - if (sessionToken.EngineInfo.Type == EngineType.Iris) - renderSession = (IRenderSession) new RenderSession((RenderEngine) null); - return renderSession; - } + public static IRenderSession CreateSession( + RenderToken sessionToken, + IRenderHost renderHost) + { + Debug2.Validate(sessionToken != null, typeof(ArgumentNullException), nameof(sessionToken)); + Debug2.Validate(sessionToken.EngineInfo != null, typeof(ArgumentNullException), "sessionToken.EngineInfo"); + Debug2.Validate(renderHost != null, typeof(ArgumentNullException), nameof(renderHost)); + IRenderSession renderSession = (IRenderSession)null; + if (sessionToken.EngineInfo.Type == EngineType.Iris) + renderSession = (IRenderSession)new RenderSession((RenderEngine)null); + return renderSession; + } - public static void InitializeForToolOnly() - { - EngineApi.InitArgs args = new EngineApi.InitArgs(MessageCookieLayout.Default, RenderEngine.AllocateContextId()); - EngineApi.IFC(EngineApi.SpInit(ref args)); - } + public static void InitializeForToolOnly() + { + EngineApi.InitArgs args = new EngineApi.InitArgs(MessageCookieLayout.Default, RenderEngine.AllocateContextId()); + EngineApi.IFC(EngineApi.SpInit(ref args)); + } - public static void ShutdownForToolOnly() => EngineApi.IFC(EngineApi.SpUninit()); - } + public static void ShutdownForToolOnly() => EngineApi.IFC(EngineApi.SpUninit()); + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderToken.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderToken.cs index d6cb2d6..bd67e2f 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderToken.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderToken.cs @@ -10,35 +10,35 @@ using System; namespace Microsoft.Iris.Render { - [Serializable] - public class RenderToken - { - private EngineInfo m_engineInfo; - private ContextID m_localContextId; - private ContextID m_destinationContextId; - private RENDERGROUP m_renderGroupId; - - internal RenderToken( - EngineInfo engineInfo, - ContextID localContextId, - ContextID destinationContextId, - RENDERGROUP renderGroupId) + [Serializable] + public class RenderToken { - Debug2.Validate(engineInfo != null, typeof (ArgumentNullException), nameof (engineInfo)); - Debug2.Validate(localContextId != ContextID.NULL, typeof (ArgumentNullException), nameof (localContextId)); - Debug2.Validate(destinationContextId != ContextID.NULL, typeof (ArgumentNullException), nameof (destinationContextId)); - this.m_engineInfo = engineInfo; - this.m_localContextId = localContextId; - this.m_destinationContextId = destinationContextId; - this.m_renderGroupId = renderGroupId; + private EngineInfo m_engineInfo; + private ContextID m_localContextId; + private ContextID m_destinationContextId; + private RENDERGROUP m_renderGroupId; + + internal RenderToken( + EngineInfo engineInfo, + ContextID localContextId, + ContextID destinationContextId, + RENDERGROUP renderGroupId) + { + Debug2.Validate(engineInfo != null, typeof(ArgumentNullException), nameof(engineInfo)); + Debug2.Validate(localContextId != ContextID.NULL, typeof(ArgumentNullException), nameof(localContextId)); + Debug2.Validate(destinationContextId != ContextID.NULL, typeof(ArgumentNullException), nameof(destinationContextId)); + this.m_engineInfo = engineInfo; + this.m_localContextId = localContextId; + this.m_destinationContextId = destinationContextId; + this.m_renderGroupId = renderGroupId; + } + + internal EngineInfo EngineInfo => this.m_engineInfo; + + internal ContextID LocalContextId => this.m_localContextId; + + internal ContextID DestinationContextId => this.m_destinationContextId; + + internal RENDERGROUP RenderGroupId => this.m_renderGroupId; } - - internal EngineInfo EngineInfo => this.m_engineInfo; - - internal ContextID LocalContextId => this.m_localContextId; - - internal ContextID DestinationContextId => this.m_destinationContextId; - - internal RENDERGROUP RenderGroupId => this.m_renderGroupId; - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SCurveInterpolation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SCurveInterpolation.cs index 8bcc27a..f309eb2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SCurveInterpolation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SCurveInterpolation.cs @@ -9,16 +9,16 @@ using System; namespace Microsoft.Iris.Render { - public sealed class SCurveInterpolation : AnimationInterpolation - { - private float m_weight; - - public SCurveInterpolation(float weight) + public sealed class SCurveInterpolation : AnimationInterpolation { - Debug2.Validate((double) weight > 0.0, typeof (ArgumentOutOfRangeException), "weight must be > 0"); - this.m_weight = weight; - } + private float m_weight; - internal float Weight => this.m_weight; - } + public SCurveInterpolation(float weight) + { + Debug2.Validate((double)weight > 0.0, typeof(ArgumentOutOfRangeException), "weight must be > 0"); + this.m_weight = weight; + } + + internal float Weight => this.m_weight; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SepiaElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SepiaElement.cs index e14d6fb..e9bc394 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SepiaElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SepiaElement.cs @@ -10,102 +10,102 @@ using System; namespace Microsoft.Iris.Render { - public class SepiaElement : EffectOperation - { - internal const string LightColorPropertyName = "LightColor"; - internal const string DarkColorPropertyName = "DarkColor"; - internal const string DesaturatePropertyName = "Desaturate"; - internal const string TonePropertyName = "Tone"; - private ColorF m_lightColor; - private byte m_nLightColorID; - private ColorF m_darkColor; - private byte m_nDarkColorID; - private float m_flDesaturate; - private byte m_nDesaturateID; - private float m_flTone; - private byte m_nToneID; - - public SepiaElement( - string stName, - ColorF darkColor, - ColorF lightColor, - float flDesat, - float flTone) + public class SepiaElement : EffectOperation { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate((double) flDesat >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Desat is >= 0"); - Debug2.Validate((double) flTone >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for Tone is >= 0"); - this.m_typeOperation = EffectOperationType.Sepia; - this.m_lightColor = lightColor; - this.m_darkColor = darkColor; - this.m_flDesaturate = flDesat; - this.m_flTone = flTone; - this.m_stName = stName; + internal const string LightColorPropertyName = "LightColor"; + internal const string DarkColorPropertyName = "DarkColor"; + internal const string DesaturatePropertyName = "Desaturate"; + internal const string TonePropertyName = "Tone"; + private ColorF m_lightColor; + private byte m_nLightColorID; + private ColorF m_darkColor; + private byte m_nDarkColorID; + private float m_flDesaturate; + private byte m_nDesaturateID; + private float m_flTone; + private byte m_nToneID; + + public SepiaElement( + string stName, + ColorF darkColor, + ColorF lightColor, + float flDesat, + float flTone) + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate((double)flDesat >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Desat is >= 0"); + Debug2.Validate((double)flTone >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for Tone is >= 0"); + this.m_typeOperation = EffectOperationType.Sepia; + this.m_lightColor = lightColor; + this.m_darkColor = darkColor; + this.m_flDesaturate = flDesat; + this.m_flTone = flTone; + this.m_stName = stName; + } + + public SepiaElement(string stName) + { + this.m_typeOperation = EffectOperationType.Sepia; + this.m_lightColor = new ColorF(1f, 0.9f, 0.5f); + this.m_darkColor = new ColorF(0.2f, 0.05f, 0.0f); + this.m_flDesaturate = 0.5f; + this.m_flTone = 1f; + this.m_stName = stName; + } + + public SepiaElement() + : this((string)null) + { + } + + public ColorF LightColor + { + get => this.m_lightColor; + set => this.m_lightColor = value; + } + + internal byte LightColorID => this.m_nLightColorID; + + public ColorF DarkColor + { + get => this.m_darkColor; + set => this.m_darkColor = value; + } + + internal byte DarkColorID => this.m_nDarkColorID; + + public float Desaturate + { + get => this.m_flDesaturate; + set => this.m_flDesaturate = value; + } + + internal byte DesaturateID => this.m_nDesaturateID; + + public float Tone + { + get => this.m_flTone; + set => this.m_flTone = value; + } + + internal byte ToneID => this.m_nToneID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "LightColor", (byte)20, ref this.m_nLightColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "DarkColor", (byte)20, ref this.m_nDarkColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Desaturate", (byte)8, ref this.m_nDesaturateID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Tone", (byte)8, ref this.m_nToneID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("LightColor", EffectPropertyType.Color, (object)this.m_lightColor, this.m_nLightColorID, dictProperties) && this.GenerateProperty("DarkColor", EffectPropertyType.Color, (object)this.m_darkColor, this.m_nDarkColorID, dictProperties) && this.GenerateProperty("Desaturate", EffectPropertyType.Float, (object)this.m_flDesaturate, this.m_nDesaturateID, dictProperties) && this.GenerateProperty("Tone", EffectPropertyType.Float, (object)this.m_flTone, this.m_nToneID, dictProperties); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("LightColor", this.LightColorID, this.LightColor.ToVector4(), cacheKey); + this.GeneratePropertyCacheKey("DarkColor", this.DarkColorID, this.DarkColor.ToVector4(), cacheKey); + this.GeneratePropertyCacheKey("Desaturate", this.DesaturateID, this.Desaturate, cacheKey); + this.GeneratePropertyCacheKey("Tone", this.ToneID, this.Tone, cacheKey); + } } - - public SepiaElement(string stName) - { - this.m_typeOperation = EffectOperationType.Sepia; - this.m_lightColor = new ColorF(1f, 0.9f, 0.5f); - this.m_darkColor = new ColorF(0.2f, 0.05f, 0.0f); - this.m_flDesaturate = 0.5f; - this.m_flTone = 1f; - this.m_stName = stName; - } - - public SepiaElement() - : this((string) null) - { - } - - public ColorF LightColor - { - get => this.m_lightColor; - set => this.m_lightColor = value; - } - - internal byte LightColorID => this.m_nLightColorID; - - public ColorF DarkColor - { - get => this.m_darkColor; - set => this.m_darkColor = value; - } - - internal byte DarkColorID => this.m_nDarkColorID; - - public float Desaturate - { - get => this.m_flDesaturate; - set => this.m_flDesaturate = value; - } - - internal byte DesaturateID => this.m_nDesaturateID; - - public float Tone - { - get => this.m_flTone; - set => this.m_flTone = value; - } - - internal byte ToneID => this.m_nToneID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "LightColor", (byte) 20, ref this.m_nLightColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "DarkColor", (byte) 20, ref this.m_nDarkColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Desaturate", (byte) 8, ref this.m_nDesaturateID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Tone", (byte) 8, ref this.m_nToneID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("LightColor", EffectPropertyType.Color, (object) this.m_lightColor, this.m_nLightColorID, dictProperties) && this.GenerateProperty("DarkColor", EffectPropertyType.Color, (object) this.m_darkColor, this.m_nDarkColorID, dictProperties) && this.GenerateProperty("Desaturate", EffectPropertyType.Float, (object) this.m_flDesaturate, this.m_nDesaturateID, dictProperties) && this.GenerateProperty("Tone", EffectPropertyType.Float, (object) this.m_flTone, this.m_nToneID, dictProperties); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("LightColor", this.LightColorID, this.LightColor.ToVector4(), cacheKey); - this.GeneratePropertyCacheKey("DarkColor", this.DarkColorID, this.DarkColor.ToVector4(), cacheKey); - this.GeneratePropertyCacheKey("Desaturate", this.DesaturateID, this.Desaturate, cacheKey); - this.GeneratePropertyCacheKey("Tone", this.ToneID, this.Tone, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SessionActivateHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SessionActivateHandler.cs index 88d249b..ac290cb 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SessionActivateHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SessionActivateHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void SessionActivateHandler(bool fActive); + public delegate void SessionActivateHandler(bool fActive); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SessionConnectHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SessionConnectHandler.cs index 7c9c956..9e0c6fc 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SessionConnectHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SessionConnectHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void SessionConnectHandler(bool fIsConnected); + public delegate void SessionConnectHandler(bool fIsConnected); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SetFocusHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SetFocusHandler.cs index 2777eac..81fc12e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SetFocusHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SetFocusHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void SetFocusHandler(bool focused); + public delegate void SetFocusHandler(bool focused); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ShadowEdgePart.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ShadowEdgePart.cs index 9227a48..85e92dd 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ShadowEdgePart.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ShadowEdgePart.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render { - public struct ShadowEdgePart - { - public string ModuleName; - public string ResourceName; - public Inset SplitPoints; - } + public struct ShadowEdgePart + { + public string ModuleName; + public string ResourceName; + public Inset SplitPoints; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ShowHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ShowHandler.cs index 745dd83..9962a78 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ShowHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ShowHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void ShowHandler(bool fShow, bool fFirstShow); + public delegate void ShowHandler(bool fShow, bool fFirstShow); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SineInterpolation.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SineInterpolation.cs index 8061263..31230a6 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SineInterpolation.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SineInterpolation.cs @@ -6,7 +6,7 @@ namespace Microsoft.Iris.Render { - public sealed class SineInterpolation : AnimationInterpolation - { - } + public sealed class SineInterpolation : AnimationInterpolation + { + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Size.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Size.cs index 7d33f6b..cbb8e52 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Size.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Size.cs @@ -8,103 +8,103 @@ using System; namespace Microsoft.Iris.Render { - public struct Size - { - private int m_width; - private int m_height; - public static readonly Size Zero = new Size(0, 0); - public static readonly object ZeroBox = (object) Size.Zero; - - public Size(int width, int height) + public struct Size { - this.m_width = width; - this.m_height = height; + private int m_width; + private int m_height; + public static readonly Size Zero = new Size(0, 0); + public static readonly object ZeroBox = (object)Size.Zero; + + public Size(int width, int height) + { + this.m_width = width; + this.m_height = height; + } + + public Size(Point point) + { + this.m_width = point.X; + this.m_height = point.Y; + } + + public int Width + { + get => this.m_width; + set => this.m_width = value; + } + + public int Height + { + get => this.m_height; + set => this.m_height = value; + } + + public int GetDimension(Orientation orientation) => orientation != Orientation.Horizontal ? this.Height : this.Width; + + public void SetDimension(Orientation orientation, int value) + { + if (orientation == Orientation.Horizontal) + this.Width = value; + else + this.Height = value; + } + + public static Size operator +(Size left, Size right) => new Size(left.Width + right.Width, left.Height + right.Height); + + public static Size Add(Size left, Size right) => left + right; + + public static Size operator -(Size left, Size right) => new Size(left.Width - right.Width, left.Height - right.Height); + + public static Size Subtract(Size left, Size right) => left - right; + + public void Deflate(Size amount) + { + this.Width = Math.Max(0, this.Width - amount.Width); + this.Height = Math.Max(0, this.Height - amount.Height); + } + + public static bool operator ==(Size left, Size right) => left.Width == right.Width && left.Height == right.Height; + + public static bool operator !=(Size left, Size right) => !(left == right); + + public override bool Equals(object obj) => obj is Size size && size.Width == this.Width && size.Height == this.Height; + + public bool Equals(Size comp) => comp.Width == this.Width && comp.Height == this.Height; + + public override int GetHashCode() => this.Width ^ this.Height; + + public override string ToString() => base.ToString(); + + public Point ToPoint() => new Point(this.Width, this.Height); + + public static Size Min(Size sz1, Size sz2) => new Size(Math.Min(sz1.Width, sz2.Width), Math.Min(sz1.Height, sz2.Height)); + + public static Size Max(Size sz1, Size sz2) => new Size(Math.Max(sz1.Width, sz2.Width), Math.Max(sz1.Height, sz2.Height)); + + public bool IsZero => this.Equals(Size.Zero); + + public bool IsEmpty => this.Width == 0 || this.Height == 0; + + public static Size LargestFit(Size source, Size bounds) + { + float num = (float)source.Width / (float)source.Height; + Size size = new Size(bounds.Width, (int)Math.Ceiling((double)bounds.Width / (double)num)); + if (size.Height > bounds.Height) + size = new Size((int)Math.Ceiling((double)bounds.Height * (double)num), bounds.Height); + return size; + } + + public void Scale(float flScale) + { + this.Width = (int)((double)this.Width * (double)flScale); + this.Height = (int)((double)this.Height * (double)flScale); + } + + public static Size Scale(Size size, float flScale) + { + Size size1 = size; + size1.Scale(flScale); + return size1; + } } - - public Size(Point point) - { - this.m_width = point.X; - this.m_height = point.Y; - } - - public int Width - { - get => this.m_width; - set => this.m_width = value; - } - - public int Height - { - get => this.m_height; - set => this.m_height = value; - } - - public int GetDimension(Orientation orientation) => orientation != Orientation.Horizontal ? this.Height : this.Width; - - public void SetDimension(Orientation orientation, int value) - { - if (orientation == Orientation.Horizontal) - this.Width = value; - else - this.Height = value; - } - - public static Size operator +(Size left, Size right) => new Size(left.Width + right.Width, left.Height + right.Height); - - public static Size Add(Size left, Size right) => left + right; - - public static Size operator -(Size left, Size right) => new Size(left.Width - right.Width, left.Height - right.Height); - - public static Size Subtract(Size left, Size right) => left - right; - - public void Deflate(Size amount) - { - this.Width = Math.Max(0, this.Width - amount.Width); - this.Height = Math.Max(0, this.Height - amount.Height); - } - - public static bool operator ==(Size left, Size right) => left.Width == right.Width && left.Height == right.Height; - - public static bool operator !=(Size left, Size right) => !(left == right); - - public override bool Equals(object obj) => obj is Size size && size.Width == this.Width && size.Height == this.Height; - - public bool Equals(Size comp) => comp.Width == this.Width && comp.Height == this.Height; - - public override int GetHashCode() => this.Width ^ this.Height; - - public override string ToString() => base.ToString(); - - public Point ToPoint() => new Point(this.Width, this.Height); - - public static Size Min(Size sz1, Size sz2) => new Size(Math.Min(sz1.Width, sz2.Width), Math.Min(sz1.Height, sz2.Height)); - - public static Size Max(Size sz1, Size sz2) => new Size(Math.Max(sz1.Width, sz2.Width), Math.Max(sz1.Height, sz2.Height)); - - public bool IsZero => this.Equals(Size.Zero); - - public bool IsEmpty => this.Width == 0 || this.Height == 0; - - public static Size LargestFit(Size source, Size bounds) - { - float num = (float) source.Width / (float) source.Height; - Size size = new Size(bounds.Width, (int) Math.Ceiling((double) bounds.Width / (double) num)); - if (size.Height > bounds.Height) - size = new Size((int) Math.Ceiling((double) bounds.Height * (double) num), bounds.Height); - return size; - } - - public void Scale(float flScale) - { - this.Width = (int) ((double) this.Width * (double) flScale); - this.Height = (int) ((double) this.Height * (double) flScale); - } - - public static Size Scale(Size size, float flScale) - { - Size size1 = size; - size1.Scale(flScale); - return size1; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SizeChangedHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SizeChangedHandler.cs index 5d1152b..6eac4ed 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SizeChangedHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SizeChangedHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void SizeChangedHandler(); + public delegate void SizeChangedHandler(); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/Ds8SoundDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/Ds8SoundDevice.cs index 824e6e2..43aa3f5 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/Ds8SoundDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/Ds8SoundDevice.cs @@ -13,54 +13,54 @@ using System; namespace Microsoft.Iris.Render.Sound { - internal class Ds8SoundDevice : SoundDevice, IRenderHandleOwner - { - private IRenderWindow m_ownerWindow; - private RemoteDs8SoundDevice m_remoteDevice; - - internal Ds8SoundDevice(RenderSession ownerSession, IRenderWindow ownerWindow) - : base(ownerSession) + internal class Ds8SoundDevice : SoundDevice, IRenderHandleOwner { - Debug2.Validate(ownerWindow != null, typeof (ArgumentNullException), nameof (ownerWindow)); - this.m_ownerWindow = ownerWindow; - this.PostCreate(); + private IRenderWindow m_ownerWindow; + private RemoteDs8SoundDevice m_remoteDevice; + + internal Ds8SoundDevice(RenderSession ownerSession, IRenderWindow ownerWindow) + : base(ownerSession) + { + Debug2.Validate(ownerWindow != null, typeof(ArgumentNullException), nameof(ownerWindow)); + this.m_ownerWindow = ownerWindow; + this.PostCreate(); + } + + protected override void Dispose(bool inDispose) + { + try + { + if (this.m_remoteDevice == null) + return; + this.m_remoteDevice.Dispose(); + this.m_remoteDevice = (RemoteDs8SoundDevice)null; + } + finally + { + base.Dispose(inDispose); + } + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteDevice.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteDevice = (RemoteDs8SoundDevice)null; + + protected override SoundDeviceType DeviceType => SoundDeviceType.DirectSound8; + + protected override void CreateRemoteSoundDeviceImpl() => this.m_remoteDevice = this.Session.NtRenderingProtocol.INPROC_BuildRemoteDs8SoundDevice((IRenderHandleOwner)this, this.m_ownerWindow.WindowHandle); + + protected override void CreateExternalResourcesImpl() => this.m_remoteDevice.SendCreateExternalResources(); + + protected override void EvictExternalResourcesImpl() => this.m_remoteDevice.SendEvictExternalResources(); + + protected override void CreateRemoteSoundBufferImpl( + RENDERHANDLE handle, + SoundHeader info, + LocalSoundBufferCallback callback) + { + this.m_remoteDevice.SendCreateSoundBuffer(handle, info, callback); + } + + protected override void CreateRemoteSoundImpl(RENDERHANDLE handle, SoundBuffer soundBuffer) => this.m_remoteDevice.SendCreateSound(handle, soundBuffer.RemoteStub); } - - protected override void Dispose(bool inDispose) - { - try - { - if (this.m_remoteDevice == null) - return; - this.m_remoteDevice.Dispose(); - this.m_remoteDevice = (RemoteDs8SoundDevice) null; - } - finally - { - base.Dispose(inDispose); - } - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteDevice.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteDevice = (RemoteDs8SoundDevice) null; - - protected override SoundDeviceType DeviceType => SoundDeviceType.DirectSound8; - - protected override void CreateRemoteSoundDeviceImpl() => this.m_remoteDevice = this.Session.NtRenderingProtocol.INPROC_BuildRemoteDs8SoundDevice((IRenderHandleOwner) this, this.m_ownerWindow.WindowHandle); - - protected override void CreateExternalResourcesImpl() => this.m_remoteDevice.SendCreateExternalResources(); - - protected override void EvictExternalResourcesImpl() => this.m_remoteDevice.SendEvictExternalResources(); - - protected override void CreateRemoteSoundBufferImpl( - RENDERHANDLE handle, - SoundHeader info, - LocalSoundBufferCallback callback) - { - this.m_remoteDevice.SendCreateSoundBuffer(handle, info, callback); - } - - protected override void CreateRemoteSoundImpl(RENDERHANDLE handle, SoundBuffer soundBuffer) => this.m_remoteDevice.SendCreateSound(handle, soundBuffer.RemoteStub); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/Sound.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/Sound.cs index bef568e..52c7499 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/Sound.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/Sound.cs @@ -12,95 +12,95 @@ using System; namespace Microsoft.Iris.Render.Sound { - internal class Sound : - SharedRenderObject, - ISound, - ISharedRenderObject, - IRenderHandleOwner, - IActivatableObject, - IActivatable - { - public static readonly string PlayMethod = "Play"; - public static readonly string StopMethod = "Stop"; - private RemoteSound m_remoteSound; - private SoundBuffer m_bufferOwner; - - internal Sound(SoundBuffer buffer) + internal class Sound : + SharedRenderObject, + ISound, + ISharedRenderObject, + IRenderHandleOwner, + IActivatableObject, + IActivatable { - this.m_remoteSound = this.CreateRemoteObject(buffer); - this.m_bufferOwner = buffer; - } + public static readonly string PlayMethod = "Play"; + public static readonly string StopMethod = "Stop"; + private RemoteSound m_remoteSound; + private SoundBuffer m_bufferOwner; - protected override void Dispose(bool inDispose) - { - try - { - if (this.m_remoteSound != null) + internal Sound(SoundBuffer buffer) { - this.m_remoteSound.Dispose(); - this.m_remoteSound = (RemoteSound) null; + this.m_remoteSound = this.CreateRemoteObject(buffer); + this.m_bufferOwner = buffer; + } + + protected override void Dispose(bool inDispose) + { + try + { + if (this.m_remoteSound != null) + { + this.m_remoteSound.Dispose(); + this.m_remoteSound = (RemoteSound)null; + } + this.m_bufferOwner = (SoundBuffer)null; + } + finally + { + base.Dispose(inDispose); + } + } + + void ISound.Play() + { + if (!this.m_bufferOwner.IsContentLoaded) + this.m_bufferOwner.LoadContent(); + if (!this.m_bufferOwner.IsContentLoaded || !this.m_remoteSound.IsValid) + return; + this.m_remoteSound.SendPlay(); + } + + void ISound.Stop() + { + if (!this.m_bufferOwner.IsContentLoaded || !this.m_remoteSound.IsValid) + return; + this.m_remoteSound.SendStop(); + } + + private RemoteSound CreateRemoteObject(SoundBuffer buffer) + { + RemoteSound remoteSound = (RemoteSound)null; + RENDERHANDLE handle = buffer.Device.Session.AllocateRenderHandle((IRenderHandleOwner)this); + try + { + buffer.Device.CreateRemoteSound(handle, buffer); + remoteSound = buffer.Device.Session.BuildSoundFromHandle(handle); + return remoteSound; + } + finally + { + if (!remoteSound.IsValid) + buffer.Device.Session.FreeRenderHandle(handle); + } + } + + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteSound.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteSound = (RemoteSound)null; + + RENDERHANDLE IActivatableObject.GetObjectId() => this.m_remoteSound.RenderHandle; + + uint IActivatableObject.GetMethodId(string methodName) + { + if (methodName == Microsoft.Iris.Render.Sound.Sound.PlayMethod) + return 1; + if (methodName == Microsoft.Iris.Render.Sound.Sound.StopMethod) + return 2; + Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported method: {0}", (object)methodName); + return 0; + } + + protected enum ActivatableMethods : uint + { + Play = 1, + Stop = 2, } - this.m_bufferOwner = (SoundBuffer) null; - } - finally - { - base.Dispose(inDispose); - } } - - void ISound.Play() - { - if (!this.m_bufferOwner.IsContentLoaded) - this.m_bufferOwner.LoadContent(); - if (!this.m_bufferOwner.IsContentLoaded || !this.m_remoteSound.IsValid) - return; - this.m_remoteSound.SendPlay(); - } - - void ISound.Stop() - { - if (!this.m_bufferOwner.IsContentLoaded || !this.m_remoteSound.IsValid) - return; - this.m_remoteSound.SendStop(); - } - - private RemoteSound CreateRemoteObject(SoundBuffer buffer) - { - RemoteSound remoteSound = (RemoteSound) null; - RENDERHANDLE handle = buffer.Device.Session.AllocateRenderHandle((IRenderHandleOwner) this); - try - { - buffer.Device.CreateRemoteSound(handle, buffer); - remoteSound = buffer.Device.Session.BuildSoundFromHandle(handle); - return remoteSound; - } - finally - { - if (!remoteSound.IsValid) - buffer.Device.Session.FreeRenderHandle(handle); - } - } - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteSound.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteSound = (RemoteSound) null; - - RENDERHANDLE IActivatableObject.GetObjectId() => this.m_remoteSound.RenderHandle; - - uint IActivatableObject.GetMethodId(string methodName) - { - if (methodName == Microsoft.Iris.Render.Sound.Sound.PlayMethod) - return 1; - if (methodName == Microsoft.Iris.Render.Sound.Sound.StopMethod) - return 2; - Debug2.Validate(false, typeof (ArgumentException), (object) "Unsupported method: {0}", (object) methodName); - return 0; - } - - protected enum ActivatableMethods : uint - { - Play = 1, - Stop = 2, - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundBuffer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundBuffer.cs index 5b0874d..cc0f3b2 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundBuffer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundBuffer.cs @@ -11,154 +11,154 @@ using System; namespace Microsoft.Iris.Render.Sound { - internal class SoundBuffer : - SharedRenderObject, - ISoundBuffer, - ISharedRenderObject, - ISoundBufferCallback, - IRenderHandleOwner - { - private RemoteSoundBuffer m_remoteBuffer; - private SoundDevice m_device; - private ISoundData m_soundData; - private bool m_contentLoaded; - private DataBufferTracker m_tracker; - private SoundBuffer.SoundBufferLoadInfo m_loadInfo; - - internal SoundBuffer(SoundDevice device, ISoundData soundData) + internal class SoundBuffer : + SharedRenderObject, + ISoundBuffer, + ISharedRenderObject, + ISoundBufferCallback, + IRenderHandleOwner { - Debug2.Validate(soundData != null, typeof (ArgumentNullException), nameof (soundData)); - Debug2.Validate(soundData.Format == SoundDataFormat.PCM, typeof (ArgumentException), "Only PCM sound data is currently supported"); - Debug2.Validate(soundData.ChannelCount == 1U || soundData.ChannelCount == 2U, typeof (ArgumentException), "Only mono/stereo sound data is currently supported"); - Debug2.Validate(soundData.SampleSize == 8U || soundData.SampleSize == 16U, typeof (ArgumentException), "Only 8bps/16bps sound data is currently supported"); - Debug2.Validate(soundData.SampleCount > 0U, typeof (ArgumentException), "Insufficient sample data"); - Debug2.Validate(soundData.SampleCount % soundData.ChannelCount == 0U, typeof (ArgumentException), "Insufficient sample data"); - this.m_device = device; - this.m_soundData = soundData; - this.m_tracker = MessagingSession.Current.CreateDataBufferTracker((object) this); - this.m_remoteBuffer = this.CreateRemoteObject(); - this.LoadContent(); - } + private RemoteSoundBuffer m_remoteBuffer; + private SoundDevice m_device; + private ISoundData m_soundData; + private bool m_contentLoaded; + private DataBufferTracker m_tracker; + private SoundBuffer.SoundBufferLoadInfo m_loadInfo; - protected override void Dispose(bool inDispose) - { - try - { - if (inDispose) + internal SoundBuffer(SoundDevice device, ISoundData soundData) { - if (this.m_tracker != null) - MessagingSession.Current.ReturnDataBufferTracker(this.m_tracker); - if (this.m_remoteBuffer != null) - this.m_remoteBuffer.Dispose(); + Debug2.Validate(soundData != null, typeof(ArgumentNullException), nameof(soundData)); + Debug2.Validate(soundData.Format == SoundDataFormat.PCM, typeof(ArgumentException), "Only PCM sound data is currently supported"); + Debug2.Validate(soundData.ChannelCount == 1U || soundData.ChannelCount == 2U, typeof(ArgumentException), "Only mono/stereo sound data is currently supported"); + Debug2.Validate(soundData.SampleSize == 8U || soundData.SampleSize == 16U, typeof(ArgumentException), "Only 8bps/16bps sound data is currently supported"); + Debug2.Validate(soundData.SampleCount > 0U, typeof(ArgumentException), "Insufficient sample data"); + Debug2.Validate(soundData.SampleCount % soundData.ChannelCount == 0U, typeof(ArgumentException), "Insufficient sample data"); + this.m_device = device; + this.m_soundData = soundData; + this.m_tracker = MessagingSession.Current.CreateDataBufferTracker((object)this); + this.m_remoteBuffer = this.CreateRemoteObject(); + this.LoadContent(); } - this.m_tracker = (DataBufferTracker) null; - this.m_soundData = (ISoundData) null; - this.m_device = (SoundDevice) null; - this.m_remoteBuffer = (RemoteSoundBuffer) null; - } - finally - { - base.Dispose(inDispose); - } - } - internal SoundDevice Device => this.m_device; - - internal RemoteSoundBuffer RemoteStub => this.m_remoteBuffer; - - internal bool IsContentLoaded => this.m_contentLoaded; - - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteBuffer.RenderHandle; - - void IRenderHandleOwner.OnDisconnect() => this.m_remoteBuffer = (RemoteSoundBuffer) null; - - ISound ISoundBuffer.CreateSound(object objUser) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - Microsoft.Iris.Render.Sound.Sound sound = new Microsoft.Iris.Render.Sound.Sound(this); - sound.RegisterUsage(objUser); - return (ISound) sound; - } - - private RemoteSoundBuffer CreateRemoteObject() - { - RemoteSoundBuffer remoteSoundBuffer = (RemoteSoundBuffer) null; - SoundHeader info; - info.wFormatTag = (ushort) 1; - info.nChannels = (ushort) this.m_soundData.ChannelCount; - info.nSamplesPerSec = this.m_soundData.SampleRate; - info.nAvgBytesPerSec = this.m_soundData.SampleRate * (this.m_soundData.SampleSize / 8U) * this.m_soundData.ChannelCount; - info.nBlockAlign = (ushort) (this.m_soundData.ChannelCount * (this.m_soundData.SampleSize / 8U)); - info.wBitsPerSample = (ushort) this.m_soundData.SampleSize; - info.cbExtraData = (ushort) 0; - info.cbDataSize = this.m_soundData.SampleCount * (this.m_soundData.SampleSize / 8U); - RENDERHANDLE handle = this.m_device.Session.AllocateRenderHandle((IRenderHandleOwner) this); - try - { - this.m_device.CreateRemoteSoundBuffer(handle, info, this.m_device.Session.RenderingProtocol.LocalSoundBufferCallbackHandle); - remoteSoundBuffer = this.m_device.Session.BuildSoundBufferFromHandle(handle); - return remoteSoundBuffer; - } - finally - { - if (!remoteSoundBuffer.IsValid) - this.m_device.Session.FreeRenderHandle(handle); - } - } - - internal void LoadContent() - { - if (this.m_contentLoaded) - return; - IntPtr pData = this.m_soundData.AcquireContent(); - DataBuffer dataBuffer = (DataBuffer) null; - try - { - uint cbSize = this.m_soundData.SampleCount * (this.m_soundData.SampleSize / 8U); - dataBuffer = this.m_device.Session.BuildDataBuffer(pData, cbSize); - if (this.m_loadInfo == null) + protected override void Dispose(bool inDispose) { - this.m_loadInfo = new SoundBuffer.SoundBufferLoadInfo(); - this.m_loadInfo.loadCount = 0; - this.m_loadInfo.soundData = this.m_soundData; + try + { + if (inDispose) + { + if (this.m_tracker != null) + MessagingSession.Current.ReturnDataBufferTracker(this.m_tracker); + if (this.m_remoteBuffer != null) + this.m_remoteBuffer.Dispose(); + } + this.m_tracker = (DataBufferTracker)null; + this.m_soundData = (ISoundData)null; + this.m_device = (SoundDevice)null; + this.m_remoteBuffer = (RemoteSoundBuffer)null; + } + finally + { + base.Dispose(inDispose); + } } - ++this.m_loadInfo.loadCount; - this.m_tracker.Track(dataBuffer, new DataBufferTracker.CleanupEventHandler(SoundBuffer.OnDataBufferConsumed), (object) this.m_loadInfo); - dataBuffer.Commit(); - if (this.m_remoteBuffer.IsValid) - this.m_remoteBuffer.SendLoadSoundData(dataBuffer.RemoteStub); - this.m_contentLoaded = true; - } - finally - { - if (!this.m_contentLoaded) - this.m_tracker.Release(dataBuffer, DataBufferTracker.Users.Valid); - } - } - private static void OnDataBufferConsumed(object sender, DataBufferTracker.CleanupEventArgs args) - { - SoundBuffer.SoundBufferLoadInfo contextData = (SoundBuffer.SoundBufferLoadInfo) args.ContextData; - --contextData.loadCount; - if (contextData.loadCount != 0) - return; - contextData.soundData.ReleaseContent(); - contextData.soundData = (ISoundData) null; - } + internal SoundDevice Device => this.m_device; - void ISoundBufferCallback.OnSoundBufferLost(RENDERHANDLE target) => this.m_contentLoaded = false; + internal RemoteSoundBuffer RemoteStub => this.m_remoteBuffer; - void ISoundBufferCallback.OnSoundBufferReady(RENDERHANDLE target) - { - if (this.m_contentLoaded) - return; - this.LoadContent(); - } + internal bool IsContentLoaded => this.m_contentLoaded; - private class SoundBufferLoadInfo - { - public int loadCount; - public ISoundData soundData; + RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteBuffer.RenderHandle; + + void IRenderHandleOwner.OnDisconnect() => this.m_remoteBuffer = (RemoteSoundBuffer)null; + + ISound ISoundBuffer.CreateSound(object objUser) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + Microsoft.Iris.Render.Sound.Sound sound = new Microsoft.Iris.Render.Sound.Sound(this); + sound.RegisterUsage(objUser); + return (ISound)sound; + } + + private RemoteSoundBuffer CreateRemoteObject() + { + RemoteSoundBuffer remoteSoundBuffer = (RemoteSoundBuffer)null; + SoundHeader info; + info.wFormatTag = (ushort)1; + info.nChannels = (ushort)this.m_soundData.ChannelCount; + info.nSamplesPerSec = this.m_soundData.SampleRate; + info.nAvgBytesPerSec = this.m_soundData.SampleRate * (this.m_soundData.SampleSize / 8U) * this.m_soundData.ChannelCount; + info.nBlockAlign = (ushort)(this.m_soundData.ChannelCount * (this.m_soundData.SampleSize / 8U)); + info.wBitsPerSample = (ushort)this.m_soundData.SampleSize; + info.cbExtraData = (ushort)0; + info.cbDataSize = this.m_soundData.SampleCount * (this.m_soundData.SampleSize / 8U); + RENDERHANDLE handle = this.m_device.Session.AllocateRenderHandle((IRenderHandleOwner)this); + try + { + this.m_device.CreateRemoteSoundBuffer(handle, info, this.m_device.Session.RenderingProtocol.LocalSoundBufferCallbackHandle); + remoteSoundBuffer = this.m_device.Session.BuildSoundBufferFromHandle(handle); + return remoteSoundBuffer; + } + finally + { + if (!remoteSoundBuffer.IsValid) + this.m_device.Session.FreeRenderHandle(handle); + } + } + + internal void LoadContent() + { + if (this.m_contentLoaded) + return; + IntPtr pData = this.m_soundData.AcquireContent(); + DataBuffer dataBuffer = (DataBuffer)null; + try + { + uint cbSize = this.m_soundData.SampleCount * (this.m_soundData.SampleSize / 8U); + dataBuffer = this.m_device.Session.BuildDataBuffer(pData, cbSize); + if (this.m_loadInfo == null) + { + this.m_loadInfo = new SoundBuffer.SoundBufferLoadInfo(); + this.m_loadInfo.loadCount = 0; + this.m_loadInfo.soundData = this.m_soundData; + } + ++this.m_loadInfo.loadCount; + this.m_tracker.Track(dataBuffer, new DataBufferTracker.CleanupEventHandler(SoundBuffer.OnDataBufferConsumed), (object)this.m_loadInfo); + dataBuffer.Commit(); + if (this.m_remoteBuffer.IsValid) + this.m_remoteBuffer.SendLoadSoundData(dataBuffer.RemoteStub); + this.m_contentLoaded = true; + } + finally + { + if (!this.m_contentLoaded) + this.m_tracker.Release(dataBuffer, DataBufferTracker.Users.Valid); + } + } + + private static void OnDataBufferConsumed(object sender, DataBufferTracker.CleanupEventArgs args) + { + SoundBuffer.SoundBufferLoadInfo contextData = (SoundBuffer.SoundBufferLoadInfo)args.ContextData; + --contextData.loadCount; + if (contextData.loadCount != 0) + return; + contextData.soundData.ReleaseContent(); + contextData.soundData = (ISoundData)null; + } + + void ISoundBufferCallback.OnSoundBufferLost(RENDERHANDLE target) => this.m_contentLoaded = false; + + void ISoundBufferCallback.OnSoundBufferReady(RENDERHANDLE target) + { + if (this.m_contentLoaded) + return; + this.LoadContent(); + } + + private class SoundBufferLoadInfo + { + public int loadCount; + public ISoundData soundData; + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundDevice.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundDevice.cs index 43729fd..d49b74a 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundDevice.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundDevice.cs @@ -12,118 +12,118 @@ using System; namespace Microsoft.Iris.Render.Sound { - internal abstract class SoundDevice : RenderObject, ISoundDevice - { - private RenderSession m_ownerSession; - private bool m_isValid; - - internal SoundDevice(RenderSession ownerSession) + internal abstract class SoundDevice : RenderObject, ISoundDevice { - this.m_ownerSession = ownerSession; - this.m_isValid = false; + private RenderSession m_ownerSession; + private bool m_isValid; + + internal SoundDevice(RenderSession ownerSession) + { + this.m_ownerSession = ownerSession; + this.m_isValid = false; + } + + protected void PostCreate() + { + this.CreateRemoteSoundDevice(); + this.m_isValid = true; + } + + protected override void Dispose(bool inDispose) + { + try + { + this.m_ownerSession = (RenderSession)null; + } + finally + { + base.Dispose(inDispose); + } + } + + SoundDeviceType ISoundDevice.DeviceType => this.DeviceType; + + bool ISoundDevice.Mute + { + get + { + Debug2.Validate(this.DeviceType == SoundDeviceType.XAudio, typeof(InvalidOperationException), "Only supported on XAudio"); + return false; + } + set => Debug2.Validate(this.DeviceType == SoundDeviceType.XAudio, typeof(InvalidOperationException), "Only supported on XAudio"); + } + + float ISoundDevice.Volume + { + get + { + Debug2.Validate(this.DeviceType == SoundDeviceType.XAudio, typeof(InvalidOperationException), "Only supported on XAudio"); + return 0.0f; + } + set => Debug2.Validate(this.DeviceType == SoundDeviceType.XAudio, typeof(InvalidOperationException), "Only supported on XAudio"); + } + + internal RenderSession Session => this.m_ownerSession; + + internal bool IsValid => this.m_isValid; + + ISoundBuffer ISoundDevice.CreateSoundBuffer( + object objUser, + ISoundData soundData) + { + Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); + Debug2.Validate(soundData != null, typeof(ArgumentNullException), nameof(soundData)); + SoundBuffer soundBuffer = new SoundBuffer(this, soundData); + soundBuffer.RegisterUsage(objUser); + return (ISoundBuffer)soundBuffer; + } + + internal void Rebuild() + { + if (this.m_isValid) + this.EvictExternalResources(); + if (this.m_isValid) + return; + this.CreateExternalResources(); + } + + private void EvictExternalResources() + { + this.m_isValid = false; + this.EvictExternalResourcesImpl(); + } + + private void CreateExternalResources() + { + this.CreateExternalResourcesImpl(); + this.m_isValid = true; + } + + private void CreateRemoteSoundDevice() => this.CreateRemoteSoundDeviceImpl(); + + internal void CreateRemoteSoundBuffer( + RENDERHANDLE handle, + SoundHeader info, + LocalSoundBufferCallback callback) + { + this.CreateRemoteSoundBufferImpl(handle, info, callback); + } + + internal void CreateRemoteSound(RENDERHANDLE handle, SoundBuffer soundBuffer) => this.CreateRemoteSoundImpl(handle, soundBuffer); + + protected abstract SoundDeviceType DeviceType { get; } + + protected abstract void CreateRemoteSoundDeviceImpl(); + + protected abstract void CreateExternalResourcesImpl(); + + protected abstract void EvictExternalResourcesImpl(); + + protected abstract void CreateRemoteSoundBufferImpl( + RENDERHANDLE handle, + SoundHeader info, + LocalSoundBufferCallback callback); + + protected abstract void CreateRemoteSoundImpl(RENDERHANDLE handle, SoundBuffer soundBuffer); } - - protected void PostCreate() - { - this.CreateRemoteSoundDevice(); - this.m_isValid = true; - } - - protected override void Dispose(bool inDispose) - { - try - { - this.m_ownerSession = (RenderSession) null; - } - finally - { - base.Dispose(inDispose); - } - } - - SoundDeviceType ISoundDevice.DeviceType => this.DeviceType; - - bool ISoundDevice.Mute - { - get - { - Debug2.Validate(this.DeviceType == SoundDeviceType.XAudio, typeof (InvalidOperationException), "Only supported on XAudio"); - return false; - } - set => Debug2.Validate(this.DeviceType == SoundDeviceType.XAudio, typeof (InvalidOperationException), "Only supported on XAudio"); - } - - float ISoundDevice.Volume - { - get - { - Debug2.Validate(this.DeviceType == SoundDeviceType.XAudio, typeof (InvalidOperationException), "Only supported on XAudio"); - return 0.0f; - } - set => Debug2.Validate(this.DeviceType == SoundDeviceType.XAudio, typeof (InvalidOperationException), "Only supported on XAudio"); - } - - internal RenderSession Session => this.m_ownerSession; - - internal bool IsValid => this.m_isValid; - - ISoundBuffer ISoundDevice.CreateSoundBuffer( - object objUser, - ISoundData soundData) - { - Debug2.Validate(objUser != null, typeof (ArgumentNullException), nameof (objUser)); - Debug2.Validate(soundData != null, typeof (ArgumentNullException), nameof (soundData)); - SoundBuffer soundBuffer = new SoundBuffer(this, soundData); - soundBuffer.RegisterUsage(objUser); - return (ISoundBuffer) soundBuffer; - } - - internal void Rebuild() - { - if (this.m_isValid) - this.EvictExternalResources(); - if (this.m_isValid) - return; - this.CreateExternalResources(); - } - - private void EvictExternalResources() - { - this.m_isValid = false; - this.EvictExternalResourcesImpl(); - } - - private void CreateExternalResources() - { - this.CreateExternalResourcesImpl(); - this.m_isValid = true; - } - - private void CreateRemoteSoundDevice() => this.CreateRemoteSoundDeviceImpl(); - - internal void CreateRemoteSoundBuffer( - RENDERHANDLE handle, - SoundHeader info, - LocalSoundBufferCallback callback) - { - this.CreateRemoteSoundBufferImpl(handle, info, callback); - } - - internal void CreateRemoteSound(RENDERHANDLE handle, SoundBuffer soundBuffer) => this.CreateRemoteSoundImpl(handle, soundBuffer); - - protected abstract SoundDeviceType DeviceType { get; } - - protected abstract void CreateRemoteSoundDeviceImpl(); - - protected abstract void CreateExternalResourcesImpl(); - - protected abstract void EvictExternalResourcesImpl(); - - protected abstract void CreateRemoteSoundBufferImpl( - RENDERHANDLE handle, - SoundHeader info, - LocalSoundBufferCallback callback); - - protected abstract void CreateRemoteSoundImpl(RENDERHANDLE handle, SoundBuffer soundBuffer); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundHeader.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundHeader.cs index e02e98c..131f30d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundHeader.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Sound/SoundHeader.cs @@ -8,16 +8,16 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render.Sound { - [ComVisible(false)] - internal struct SoundHeader - { - public ushort wFormatTag; - public ushort nChannels; - public uint nSamplesPerSec; - public uint nAvgBytesPerSec; - public ushort nBlockAlign; - public ushort wBitsPerSample; - public ushort cbExtraData; - public uint cbDataSize; - } + [ComVisible(false)] + internal struct SoundHeader + { + public ushort wFormatTag; + public ushort nChannels; + public uint nSamplesPerSec; + public uint nAvgBytesPerSec; + public ushort nBlockAlign; + public ushort wBitsPerSample; + public ushort cbExtraData; + public uint cbDataSize; + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundCaps.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundCaps.cs index 1f3e882..840f189 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundCaps.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundCaps.cs @@ -8,8 +8,8 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render { - [StructLayout(LayoutKind.Sequential, Size = 1)] - public struct SoundCaps - { - } + [StructLayout(LayoutKind.Sequential, Size = 1)] + public struct SoundCaps + { + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundDataFormat.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundDataFormat.cs index 2651b25..46543d3 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundDataFormat.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundDataFormat.cs @@ -6,8 +6,8 @@ namespace Microsoft.Iris.Render { - public enum SoundDataFormat - { - PCM = 1, - } + public enum SoundDataFormat + { + PCM = 1, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundDeviceType.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundDeviceType.cs index 8b4b223..be66a6d 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundDeviceType.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SoundDeviceType.cs @@ -6,11 +6,11 @@ namespace Microsoft.Iris.Render { - public enum SoundDeviceType - { - None, - DirectSound8, - WaveAudio, - XAudio, - } + public enum SoundDeviceType + { + None, + DirectSound8, + WaveAudio, + XAudio, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SpotLight2DElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SpotLight2DElement.cs index 1c88d48..112d6ea 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SpotLight2DElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SpotLight2DElement.cs @@ -10,151 +10,151 @@ using System; namespace Microsoft.Iris.Render { - public class SpotLight2DElement : EffectInput - { - internal const string PositionPropertyName = "Position"; - internal const string DirectionAnglePropertyName = "DirectionAngle"; - internal const string LightColorPropertyName = "LightColor"; - internal const string AmbientColorPropertyName = "AmbientColor"; - internal const string InnerConeAnglePropertyName = "InnerConeAngle"; - internal const string OuterConeAnglePropertyName = "OuterConeAngle"; - internal const string IntensityPropertyName = "Intensity"; - internal const string AttenuationPropertyName = "Attenuation"; - private Vector3 m_vPosition; - private byte m_nPositionID; - private float m_flDirectionAngle; - private byte m_nDirectionAngleID; - private ColorF m_clrLight; - private byte m_nLightColorID; - private ColorF m_clrAmbient; - private byte m_nAmbientColorID; - private float m_flInnerConeAngle; - private byte m_nInnerConeAngleID; - private float m_flOuterConeAngle; - private byte m_nOuterConeAngleID; - private float m_flIntensity; - private byte m_nIntensityID; - private Vector3 m_vAttenuation; - private byte m_nAttenuationID; - - public SpotLight2DElement( - string stName, - Vector3 vPosition, - float flDirectionAngle, - ColorF clrLight, - ColorF clrAmbient, - float flInnerConeAngle, - float flOuterConeAngle, - float flIntensity, - Vector3 vAttenuation) - : this() + public class SpotLight2DElement : EffectInput { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - Debug2.Validate((double) flIntensity >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for flIntensity is [0..)"); - Debug2.Validate((double) flInnerConeAngle >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for flInnerConeAngle is [0..)"); - Debug2.Validate((double) flOuterConeAngle >= 0.0, typeof (ArgumentOutOfRangeException), "Valid range for flOuterConeAngle is [0..)"); - this.m_stName = stName; - this.m_vPosition = vPosition; - this.m_flDirectionAngle = flDirectionAngle; - this.m_clrLight = clrLight; - this.m_clrAmbient = clrAmbient; - this.m_flInnerConeAngle = flInnerConeAngle; - this.m_flOuterConeAngle = flOuterConeAngle; - this.m_flIntensity = flIntensity; - this.m_vAttenuation = vAttenuation; + internal const string PositionPropertyName = "Position"; + internal const string DirectionAnglePropertyName = "DirectionAngle"; + internal const string LightColorPropertyName = "LightColor"; + internal const string AmbientColorPropertyName = "AmbientColor"; + internal const string InnerConeAnglePropertyName = "InnerConeAngle"; + internal const string OuterConeAnglePropertyName = "OuterConeAngle"; + internal const string IntensityPropertyName = "Intensity"; + internal const string AttenuationPropertyName = "Attenuation"; + private Vector3 m_vPosition; + private byte m_nPositionID; + private float m_flDirectionAngle; + private byte m_nDirectionAngleID; + private ColorF m_clrLight; + private byte m_nLightColorID; + private ColorF m_clrAmbient; + private byte m_nAmbientColorID; + private float m_flInnerConeAngle; + private byte m_nInnerConeAngleID; + private float m_flOuterConeAngle; + private byte m_nOuterConeAngleID; + private float m_flIntensity; + private byte m_nIntensityID; + private Vector3 m_vAttenuation; + private byte m_nAttenuationID; + + public SpotLight2DElement( + string stName, + Vector3 vPosition, + float flDirectionAngle, + ColorF clrLight, + ColorF clrAmbient, + float flInnerConeAngle, + float flOuterConeAngle, + float flIntensity, + Vector3 vAttenuation) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + Debug2.Validate((double)flIntensity >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for flIntensity is [0..)"); + Debug2.Validate((double)flInnerConeAngle >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for flInnerConeAngle is [0..)"); + Debug2.Validate((double)flOuterConeAngle >= 0.0, typeof(ArgumentOutOfRangeException), "Valid range for flOuterConeAngle is [0..)"); + this.m_stName = stName; + this.m_vPosition = vPosition; + this.m_flDirectionAngle = flDirectionAngle; + this.m_clrLight = clrLight; + this.m_clrAmbient = clrAmbient; + this.m_flInnerConeAngle = flInnerConeAngle; + this.m_flOuterConeAngle = flOuterConeAngle; + this.m_flIntensity = flIntensity; + this.m_vAttenuation = vAttenuation; + } + + public SpotLight2DElement() + { + this.m_typeInput = EffectInputType.Spotlight2D; + this.m_vAttenuation = new Vector3(0.0f, 1f, 0.0f); + this.m_clrAmbient = new ColorF(0, 0, 0, 0); + } + + public Vector3 Position + { + get => this.m_vPosition; + set => this.m_vPosition = value; + } + + internal byte PositionID => this.m_nPositionID; + + public float DirectionAngle + { + get => this.m_flDirectionAngle; + set => this.m_flDirectionAngle = value; + } + + internal byte DirectionAngleID => this.m_nDirectionAngleID; + + public ColorF LightColor + { + get => this.m_clrLight; + set => this.m_clrLight = value; + } + + internal byte LightColorID => this.m_nLightColorID; + + public ColorF AmbientColor + { + get => this.m_clrAmbient; + set => this.m_clrAmbient = value; + } + + internal byte AmbientColorID => this.m_nAmbientColorID; + + public float InnerConeAngle + { + get => this.m_flInnerConeAngle; + set => this.m_flInnerConeAngle = value; + } + + internal byte InnerConeAngleID => this.m_nInnerConeAngleID; + + public float OuterConeAngle + { + get => this.m_flOuterConeAngle; + set => this.m_flOuterConeAngle = value; + } + + internal byte OuterConeAngleID => this.m_nOuterConeAngleID; + + public float Intensity + { + get => this.m_flIntensity; + set => this.m_flIntensity = value; + } + + internal byte IntensityID => this.m_nIntensityID; + + public Vector3 Attenuation + { + get => this.m_vAttenuation; + set => this.m_vAttenuation = value; + } + + internal byte AttenuationID => this.m_nAttenuationID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Position", (byte)16, ref this.m_nPositionID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "DirectionAngle", (byte)8, ref this.m_nDirectionAngleID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "LightColor", (byte)20, ref this.m_nLightColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "AmbientColor", (byte)20, ref this.m_nAmbientColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "InnerConeAngle", (byte)8, ref this.m_nInnerConeAngleID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "OuterConeAngle", (byte)8, ref this.m_nOuterConeAngleID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Intensity", (byte)8, ref this.m_nIntensityID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Attenuation", (byte)16, ref this.m_nAttenuationID, ref nNextUniqueID); + } + + internal override bool Process(Map dictProperties) => this.GenerateProperty("Position", EffectPropertyType.Vector3, (object)this.m_vPosition, this.m_nPositionID, dictProperties) && this.GenerateProperty("DirectionAngle", EffectPropertyType.Float, (object)this.m_flDirectionAngle, this.m_nDirectionAngleID, dictProperties) && (this.GenerateProperty("LightColor", EffectPropertyType.Color, (object)this.m_clrLight, this.m_nLightColorID, dictProperties) && this.GenerateProperty("AmbientColor", EffectPropertyType.Color, (object)this.m_clrAmbient, this.m_nAmbientColorID, dictProperties)) && (this.GenerateProperty("InnerConeAngle", EffectPropertyType.Float, (object)this.m_flInnerConeAngle, this.m_nInnerConeAngleID, dictProperties) && this.GenerateProperty("OuterConeAngle", EffectPropertyType.Float, (object)this.m_flOuterConeAngle, this.m_nOuterConeAngleID, dictProperties) && (this.GenerateProperty("Intensity", EffectPropertyType.Float, (object)this.m_flIntensity, this.m_nIntensityID, dictProperties) && this.GenerateProperty("Attenuation", EffectPropertyType.Vector3, (object)this.m_vAttenuation, this.m_nAttenuationID, dictProperties))); + + internal override void AddCacheKey(ByteBuilder cacheKey) + { + base.AddCacheKey(cacheKey); + this.GeneratePropertyCacheKey("Position", this.PositionID, this.Position, cacheKey); + this.GeneratePropertyCacheKey("DirectionAngle", this.DirectionAngleID, this.DirectionAngle, cacheKey); + this.GeneratePropertyCacheKey("LightColor", this.LightColorID, this.LightColor.ToVector4(), cacheKey); + this.GeneratePropertyCacheKey("AmbientColor", this.AmbientColorID, this.AmbientColor.ToVector4(), cacheKey); + this.GeneratePropertyCacheKey("InnerConeAngle", this.InnerConeAngleID, this.InnerConeAngle, cacheKey); + this.GeneratePropertyCacheKey("OuterConeAngle", this.OuterConeAngleID, this.OuterConeAngle, cacheKey); + this.GeneratePropertyCacheKey("Intensity", this.IntensityID, this.Intensity, cacheKey); + this.GeneratePropertyCacheKey("Attenuation", this.AttenuationID, this.Attenuation, cacheKey); + } } - - public SpotLight2DElement() - { - this.m_typeInput = EffectInputType.Spotlight2D; - this.m_vAttenuation = new Vector3(0.0f, 1f, 0.0f); - this.m_clrAmbient = new ColorF(0, 0, 0, 0); - } - - public Vector3 Position - { - get => this.m_vPosition; - set => this.m_vPosition = value; - } - - internal byte PositionID => this.m_nPositionID; - - public float DirectionAngle - { - get => this.m_flDirectionAngle; - set => this.m_flDirectionAngle = value; - } - - internal byte DirectionAngleID => this.m_nDirectionAngleID; - - public ColorF LightColor - { - get => this.m_clrLight; - set => this.m_clrLight = value; - } - - internal byte LightColorID => this.m_nLightColorID; - - public ColorF AmbientColor - { - get => this.m_clrAmbient; - set => this.m_clrAmbient = value; - } - - internal byte AmbientColorID => this.m_nAmbientColorID; - - public float InnerConeAngle - { - get => this.m_flInnerConeAngle; - set => this.m_flInnerConeAngle = value; - } - - internal byte InnerConeAngleID => this.m_nInnerConeAngleID; - - public float OuterConeAngle - { - get => this.m_flOuterConeAngle; - set => this.m_flOuterConeAngle = value; - } - - internal byte OuterConeAngleID => this.m_nOuterConeAngleID; - - public float Intensity - { - get => this.m_flIntensity; - set => this.m_flIntensity = value; - } - - internal byte IntensityID => this.m_nIntensityID; - - public Vector3 Attenuation - { - get => this.m_vAttenuation; - set => this.m_vAttenuation = value; - } - - internal byte AttenuationID => this.m_nAttenuationID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Position", (byte) 16, ref this.m_nPositionID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "DirectionAngle", (byte) 8, ref this.m_nDirectionAngleID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "LightColor", (byte) 20, ref this.m_nLightColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "AmbientColor", (byte) 20, ref this.m_nAmbientColorID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "InnerConeAngle", (byte) 8, ref this.m_nInnerConeAngleID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "OuterConeAngle", (byte) 8, ref this.m_nOuterConeAngleID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Intensity", (byte) 8, ref this.m_nIntensityID, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Attenuation", (byte) 16, ref this.m_nAttenuationID, ref nNextUniqueID); - } - - internal override bool Process(Map dictProperties) => this.GenerateProperty("Position", EffectPropertyType.Vector3, (object) this.m_vPosition, this.m_nPositionID, dictProperties) && this.GenerateProperty("DirectionAngle", EffectPropertyType.Float, (object) this.m_flDirectionAngle, this.m_nDirectionAngleID, dictProperties) && (this.GenerateProperty("LightColor", EffectPropertyType.Color, (object) this.m_clrLight, this.m_nLightColorID, dictProperties) && this.GenerateProperty("AmbientColor", EffectPropertyType.Color, (object) this.m_clrAmbient, this.m_nAmbientColorID, dictProperties)) && (this.GenerateProperty("InnerConeAngle", EffectPropertyType.Float, (object) this.m_flInnerConeAngle, this.m_nInnerConeAngleID, dictProperties) && this.GenerateProperty("OuterConeAngle", EffectPropertyType.Float, (object) this.m_flOuterConeAngle, this.m_nOuterConeAngleID, dictProperties) && (this.GenerateProperty("Intensity", EffectPropertyType.Float, (object) this.m_flIntensity, this.m_nIntensityID, dictProperties) && this.GenerateProperty("Attenuation", EffectPropertyType.Vector3, (object) this.m_vAttenuation, this.m_nAttenuationID, dictProperties))); - - internal override void AddCacheKey(ByteBuilder cacheKey) - { - base.AddCacheKey(cacheKey); - this.GeneratePropertyCacheKey("Position", this.PositionID, this.Position, cacheKey); - this.GeneratePropertyCacheKey("DirectionAngle", this.DirectionAngleID, this.DirectionAngle, cacheKey); - this.GeneratePropertyCacheKey("LightColor", this.LightColorID, this.LightColor.ToVector4(), cacheKey); - this.GeneratePropertyCacheKey("AmbientColor", this.AmbientColorID, this.AmbientColor.ToVector4(), cacheKey); - this.GeneratePropertyCacheKey("InnerConeAngle", this.InnerConeAngleID, this.InnerConeAngle, cacheKey); - this.GeneratePropertyCacheKey("OuterConeAngle", this.OuterConeAngleID, this.OuterConeAngle, cacheKey); - this.GeneratePropertyCacheKey("Intensity", this.IntensityID, this.Intensity, cacheKey); - this.GeneratePropertyCacheKey("Attenuation", this.AttenuationID, this.Attenuation, cacheKey); - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SurfaceFormat.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SurfaceFormat.cs index ac1e3c1..be9ed01 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SurfaceFormat.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SurfaceFormat.cs @@ -6,21 +6,21 @@ namespace Microsoft.Iris.Render { - public enum SurfaceFormat : uint - { - None = 0, - Bpp8 = 524288, // 0x00080000 - A8 = 557056, // 0x00088000 - Bpp16 = 1048576, // 0x00100000 - RGB16_555 = 1049941, // 0x00100555 - RGB16_565 = 1049957, // 0x00100565 - ARGB16_1555 = 1054037, // 0x00101555 - Bpp24 = 1572864, // 0x00180000 - RGB24 = 1575048, // 0x00180888 - Bpp32 = 2097152, // 0x00200000 - RGB32 = 2099336, // 0x00200888 - ARGB32 = 2132104, // 0x00208888 - YUY2 = 554696704, // 0x21100000 - External = 2147483648, // 0x80000000 - } + public enum SurfaceFormat : uint + { + None = 0, + Bpp8 = 524288, // 0x00080000 + A8 = 557056, // 0x00088000 + Bpp16 = 1048576, // 0x00100000 + RGB16_555 = 1049941, // 0x00100555 + RGB16_565 = 1049957, // 0x00100565 + ARGB16_1555 = 1054037, // 0x00101555 + Bpp24 = 1572864, // 0x00180000 + RGB24 = 1575048, // 0x00180888 + Bpp32 = 2097152, // 0x00200000 + RGB32 = 2099336, // 0x00200888 + ARGB32 = 2132104, // 0x00208888 + YUY2 = 554696704, // 0x21100000 + External = 2147483648, // 0x80000000 + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SurfaceFormatInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SurfaceFormatInfo.cs index 72a148a..cfb4a10 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SurfaceFormatInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SurfaceFormatInfo.cs @@ -6,38 +6,38 @@ namespace Microsoft.Iris.Render { - internal static class SurfaceFormatInfo - { - public static int GetBitsPerPixel(SurfaceFormat nFormat) => (int) ((uint) (nFormat & (SurfaceFormat) 16711680) >> 16); - - public static SurfaceFormat FromImageFormat(ImageFormat fmt) + internal static class SurfaceFormatInfo { - switch (fmt) - { - case ImageFormat.A8R8G8B8: - return SurfaceFormat.ARGB32; - case ImageFormat.X8R8G8B8: - return SurfaceFormat.RGB32; - case ImageFormat.A8: - return SurfaceFormat.A8; - default: - return SurfaceFormat.None; - } - } + public static int GetBitsPerPixel(SurfaceFormat nFormat) => (int)((uint)(nFormat & (SurfaceFormat)16711680) >> 16); - public static ImageFormat ToImageFormat(SurfaceFormat fmt) - { - switch (fmt) - { - case SurfaceFormat.A8: - return ImageFormat.A8; - case SurfaceFormat.RGB32: - return ImageFormat.X8R8G8B8; - case SurfaceFormat.ARGB32: - return ImageFormat.A8R8G8B8; - default: - return ImageFormat.None; - } + public static SurfaceFormat FromImageFormat(ImageFormat fmt) + { + switch (fmt) + { + case ImageFormat.A8R8G8B8: + return SurfaceFormat.ARGB32; + case ImageFormat.X8R8G8B8: + return SurfaceFormat.RGB32; + case ImageFormat.A8: + return SurfaceFormat.A8; + default: + return SurfaceFormat.None; + } + } + + public static ImageFormat ToImageFormat(SurfaceFormat fmt) + { + switch (fmt) + { + case SurfaceFormat.A8: + return ImageFormat.A8; + case SurfaceFormat.RGB32: + return ImageFormat.X8R8G8B8; + case SurfaceFormat.ARGB32: + return ImageFormat.A8R8G8B8; + default: + return ImageFormat.None; + } + } } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SysCommandHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SysCommandHandler.cs index c3f0b53..86c3faa 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/SysCommandHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/SysCommandHandler.cs @@ -8,5 +8,5 @@ using System; namespace Microsoft.Iris.Render { - public delegate void SysCommandHandler(IntPtr uParam1, IntPtr uParam2); + public delegate void SysCommandHandler(IntPtr uParam1, IntPtr uParam2); } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/TrackerBase.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/TrackerBase.cs index 6e0d5cd..8ca694e 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/TrackerBase.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/TrackerBase.cs @@ -11,182 +11,182 @@ using System.Runtime.InteropServices; namespace Microsoft.Iris.Render { - public abstract class TrackerBase - { - private static readonly TrackerBase.ObjectTest s_testAll = new TrackerBase.ObjectTest(TrackerBase.AllObjectTest); - private static readonly TrackerBase.ObjectTest s_testDead = new TrackerBase.ObjectTest(TrackerBase.DeadObjectTest); - private static readonly TrackerBase.ObjectTest s_testObject = new TrackerBase.ObjectTest(TrackerBase.SpecificObjectTest); - private Map m_tblObjects; - - ~TrackerBase() => this.Dispose(false); - - public void Dispose() + public abstract class TrackerBase { - GC.SuppressFinalize((object) this); - this.Dispose(true); - } + private static readonly TrackerBase.ObjectTest s_testAll = new TrackerBase.ObjectTest(TrackerBase.AllObjectTest); + private static readonly TrackerBase.ObjectTest s_testDead = new TrackerBase.ObjectTest(TrackerBase.DeadObjectTest); + private static readonly TrackerBase.ObjectTest s_testObject = new TrackerBase.ObjectTest(TrackerBase.SpecificObjectTest); + private Map m_tblObjects; - protected virtual void Dispose(bool fInDispose) => this.RemoveObjects(TrackerBase.s_testAll); + ~TrackerBase() => this.Dispose(false); - public bool IsEmpty => this.m_tblObjects.Count == 0; - - public ArrayList LiveObjects - { - get - { - ArrayList arrayList = new ArrayList(); - lock (this) + public void Dispose() { - if (this.m_tblObjects != null) - { - foreach (KeyValueEntry tblObject in this.m_tblObjects) + GC.SuppressFinalize((object)this); + this.Dispose(true); + } + + protected virtual void Dispose(bool fInDispose) => this.RemoveObjects(TrackerBase.s_testAll); + + public bool IsEmpty => this.m_tblObjects.Count == 0; + + public ArrayList LiveObjects + { + get { - object target = tblObject.Value.Target; - if (target != null) - arrayList.Add(target); + ArrayList arrayList = new ArrayList(); + lock (this) + { + if (this.m_tblObjects != null) + { + foreach (KeyValueEntry tblObject in this.m_tblObjects) + { + object target = tblObject.Value.Target; + if (target != null) + arrayList.Add(target); + } + } + } + return arrayList; } - } } - return arrayList; - } - } - public void AddObject(object key, object value) - { - lock (this) - { - if (this.m_tblObjects == null) - this.SetupObjectTable(); - this.m_tblObjects[key] = GCHandle.Alloc(value, GCHandleType.Weak); - } - } - - public void RemoveKey(object key) - { - lock (this) - { - GCHandle gcHandle; - if (!this.m_tblObjects.TryGetValue(key, out gcHandle)) + public void AddObject(object key, object value) { - Debug2.Validate(false, typeof (InvalidOperationException), "Unable to find object with key " + key); - } - else - { - gcHandle.Free(); - this.m_tblObjects.Remove(key); - } - } - } - - public void RemoveKeys(TrackerBase.KeyTest keyTest) - { - lock (this) - { - if (this.m_tblObjects == null) - return; - ArrayList arrayList = (ArrayList) null; - foreach (string key in this.m_tblObjects.Keys) - { - if (keyTest == null || keyTest(key)) - { - if (arrayList == null) - arrayList = new ArrayList(); - arrayList.Add((object) key); - } - } - if (arrayList == null) - return; - foreach (object key in arrayList) - this.RemoveKey(key); - } - } - - public void RemoveObject(object objRemove) => this.RemoveObjects(TrackerBase.s_testObject, objRemove); - - public void RemoveDeadObjects() => this.RemoveObjects(TrackerBase.s_testDead); - - public void RemoveAllObjects() => this.RemoveObjects(TrackerBase.s_testAll); - - public void RemoveObjects(TrackerBase.ObjectTest test) => this.RemoveObjects(test, (object) null); - - public void RemoveObjects(TrackerBase.ObjectTest test, object objParam) - { - lock (this) - { - if (this.m_tblObjects == null) - return; - ArrayList arrayList = (ArrayList) null; - foreach (KeyValueEntry tblObject in this.m_tblObjects) - { - GCHandle gcHandle = tblObject.Value; - object target = gcHandle.Target; - if (target == null || test(target, objParam)) - { - if (arrayList == null) - arrayList = new ArrayList(); - object key = tblObject.Key; - arrayList.Add(key); - gcHandle.Free(); - } - } - if (arrayList == null) - return; - foreach (object key in arrayList) - this.m_tblObjects.Remove(key); - } - } - - public object Find(object key) - { - object obj = (object) null; - lock (this) - { - if (this.m_tblObjects != null) - { - GCHandle gcHandle; - if (this.m_tblObjects.TryGetValue(key, out gcHandle)) - { - obj = gcHandle.Target; - if (obj == null) + lock (this) { - this.m_tblObjects.Remove(key); - gcHandle.Free(); + if (this.m_tblObjects == null) + this.SetupObjectTable(); + this.m_tblObjects[key] = GCHandle.Alloc(value, GCHandleType.Weak); } - } } - } - return obj; + + public void RemoveKey(object key) + { + lock (this) + { + GCHandle gcHandle; + if (!this.m_tblObjects.TryGetValue(key, out gcHandle)) + { + Debug2.Validate(false, typeof(InvalidOperationException), "Unable to find object with key " + key); + } + else + { + gcHandle.Free(); + this.m_tblObjects.Remove(key); + } + } + } + + public void RemoveKeys(TrackerBase.KeyTest keyTest) + { + lock (this) + { + if (this.m_tblObjects == null) + return; + ArrayList arrayList = (ArrayList)null; + foreach (string key in this.m_tblObjects.Keys) + { + if (keyTest == null || keyTest(key)) + { + if (arrayList == null) + arrayList = new ArrayList(); + arrayList.Add((object)key); + } + } + if (arrayList == null) + return; + foreach (object key in arrayList) + this.RemoveKey(key); + } + } + + public void RemoveObject(object objRemove) => this.RemoveObjects(TrackerBase.s_testObject, objRemove); + + public void RemoveDeadObjects() => this.RemoveObjects(TrackerBase.s_testDead); + + public void RemoveAllObjects() => this.RemoveObjects(TrackerBase.s_testAll); + + public void RemoveObjects(TrackerBase.ObjectTest test) => this.RemoveObjects(test, (object)null); + + public void RemoveObjects(TrackerBase.ObjectTest test, object objParam) + { + lock (this) + { + if (this.m_tblObjects == null) + return; + ArrayList arrayList = (ArrayList)null; + foreach (KeyValueEntry tblObject in this.m_tblObjects) + { + GCHandle gcHandle = tblObject.Value; + object target = gcHandle.Target; + if (target == null || test(target, objParam)) + { + if (arrayList == null) + arrayList = new ArrayList(); + object key = tblObject.Key; + arrayList.Add(key); + gcHandle.Free(); + } + } + if (arrayList == null) + return; + foreach (object key in arrayList) + this.m_tblObjects.Remove(key); + } + } + + public object Find(object key) + { + object obj = (object)null; + lock (this) + { + if (this.m_tblObjects != null) + { + GCHandle gcHandle; + if (this.m_tblObjects.TryGetValue(key, out gcHandle)) + { + obj = gcHandle.Target; + if (obj == null) + { + this.m_tblObjects.Remove(key); + gcHandle.Free(); + } + } + } + } + return obj; + } + + public bool ContainsKey(object key) + { + bool flag = false; + lock (this) + { + if (this.m_tblObjects != null) + flag = this.m_tblObjects.ContainsKey(key); + } + return flag; + } + + protected virtual void SetupObjectTable() + { + lock (this) + { + if (this.m_tblObjects != null) + return; + this.m_tblObjects = new Map(); + } + } + + private static bool AllObjectTest(object objSubject, object objParam) => true; + + private static bool DeadObjectTest(object objSubject, object objParam) => false; + + private static bool SpecificObjectTest(object objSubject, object objParam) => objSubject == objParam; + + public delegate bool ObjectTest(object objSubject, object objParam); + + public delegate bool KeyTest(string key); } - - public bool ContainsKey(object key) - { - bool flag = false; - lock (this) - { - if (this.m_tblObjects != null) - flag = this.m_tblObjects.ContainsKey(key); - } - return flag; - } - - protected virtual void SetupObjectTable() - { - lock (this) - { - if (this.m_tblObjects != null) - return; - this.m_tblObjects = new Map(); - } - } - - private static bool AllObjectTest(object objSubject, object objParam) => true; - - private static bool DeadObjectTest(object objSubject, object objParam) => false; - - private static bool SpecificObjectTest(object objSubject, object objParam) => objSubject == objParam; - - public delegate bool ObjectTest(object objSubject, object objParam); - - public delegate bool KeyTest(string key); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/TvFormat.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/TvFormat.cs index 3fbfe61..bb9d1f9 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/TvFormat.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/TvFormat.cs @@ -6,11 +6,11 @@ namespace Microsoft.Iris.Render { - public enum TvFormat - { - None, - Ntsc, - Pal, - Pal60, - } + public enum TvFormat + { + None, + Ntsc, + Pal, + Pal60, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ValueEventCondition.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ValueEventCondition.cs index 45b0adb..bd2a017 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/ValueEventCondition.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/ValueEventCondition.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render { - public enum ValueEventCondition : uint - { - RiseAbove, - RiseTo, - FallBelow, - FallTo, - Count, - } + public enum ValueEventCondition : uint + { + RiseAbove, + RiseTo, + FallBelow, + FallTo, + Count, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector2.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector2.cs index 7cb2172..ae90cb4 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector2.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector2.cs @@ -10,102 +10,102 @@ using System.Text; namespace Microsoft.Iris.Render { - [Serializable] - public struct Vector2 - { - private float m_x; - private float m_y; - public static readonly Vector2 Zero = new Vector2(0.0f, 0.0f); - public static readonly Vector2 UnitVector = new Vector2(1f, 1f); - - public Vector2(float x, float y) + [Serializable] + public struct Vector2 { - this.m_x = x; - this.m_y = y; + private float m_x; + private float m_y; + public static readonly Vector2 Zero = new Vector2(0.0f, 0.0f); + public static readonly Vector2 UnitVector = new Vector2(1f, 1f); + + public Vector2(float x, float y) + { + this.m_x = x; + this.m_y = y; + } + + internal Vector2(double x, double y) + : this((float)x, (float)y) + { + } + + public float X + { + get => this.m_x; + set => this.m_x = value; + } + + public float Y + { + get => this.m_y; + set => this.m_y = value; + } + + public static Vector2 operator +(Vector2 left, Vector2 right) => new Vector2(left.X + right.X, left.Y + right.Y); + + public static Vector2 Add(Vector2 left, Vector2 right) => left + right; + + public static Vector2 operator -(Vector2 left, Vector2 right) => new Vector2(left.X - right.X, left.Y - right.Y); + + public static Vector2 operator -(Vector2 left) => new Vector2(-left.X, -left.Y); + + public static Vector2 Subtract(Vector2 left, Vector2 right) => left - right; + + public static Vector2 operator *(Vector2 left, Vector2 right) => new Vector2(left.X * right.X, left.Y * right.Y); + + public static Vector2 Multiply(Vector2 left, Vector2 right) => left * right; + + public static Vector2 operator *(Vector2 vector, float scalar) => new Vector2(vector.X * scalar, vector.Y * scalar); + + public static Vector2 Multiply(Vector2 vector, float scalar) => vector * scalar; + + public static Vector2 operator /(Vector2 left, Vector2 right) => new Vector2(left.X / right.X, left.Y / right.Y); + + public static Vector2 Divide(Vector2 left, Vector2 right) => left / right; + + public static Vector2 operator /(Vector2 vector, float scalar) => new Vector2(vector.X / scalar, vector.Y / scalar); + + public static Vector2 Divide(Vector2 vector, float scalar) => vector / scalar; + + internal void Normalize() + { + float flValue1 = (float)((double)this.m_x * (double)this.m_x + (double)this.m_y * (double)this.m_y); + if (Math2.WithinEpsilon(flValue1, 1f)) + return; + if ((double)flValue1 > 1.40129846432482E-45) + { + float num = (float)Math.Sqrt((double)flValue1); + this.m_x /= num; + this.m_y /= num; + } + else + { + this.m_x = 0.0f; + this.m_y = 0.0f; + } + } + + public override bool Equals(object obj) => obj is Vector2 vector2 && this == vector2; + + public static bool operator ==(Vector2 left, Vector2 right) => (double)left.X == (double)right.X && (double)left.Y == (double)right.Y; + + public static bool operator !=(Vector2 left, Vector2 right) => !(left == right); + + public override int GetHashCode() => this.X.GetHashCode() ^ this.Y.GetHashCode(); + + public override string ToString() => base.ToString(); + + internal string ToDxShaderString() + { + StringBuilder stringBuilder = new StringBuilder(128); + stringBuilder.Append("{"); + stringBuilder.Append(this.X); + stringBuilder.Append(", "); + stringBuilder.Append(this.Y); + stringBuilder.Append("}"); + return stringBuilder.ToString(); + } + + public bool IsApproximate(Vector2 vector) => Math2.WithinEpsilon(this.m_x, vector.m_x) && Math2.WithinEpsilon(this.m_y, vector.m_y); } - - internal Vector2(double x, double y) - : this((float) x, (float) y) - { - } - - public float X - { - get => this.m_x; - set => this.m_x = value; - } - - public float Y - { - get => this.m_y; - set => this.m_y = value; - } - - public static Vector2 operator +(Vector2 left, Vector2 right) => new Vector2(left.X + right.X, left.Y + right.Y); - - public static Vector2 Add(Vector2 left, Vector2 right) => left + right; - - public static Vector2 operator -(Vector2 left, Vector2 right) => new Vector2(left.X - right.X, left.Y - right.Y); - - public static Vector2 operator -(Vector2 left) => new Vector2(-left.X, -left.Y); - - public static Vector2 Subtract(Vector2 left, Vector2 right) => left - right; - - public static Vector2 operator *(Vector2 left, Vector2 right) => new Vector2(left.X * right.X, left.Y * right.Y); - - public static Vector2 Multiply(Vector2 left, Vector2 right) => left * right; - - public static Vector2 operator *(Vector2 vector, float scalar) => new Vector2(vector.X * scalar, vector.Y * scalar); - - public static Vector2 Multiply(Vector2 vector, float scalar) => vector * scalar; - - public static Vector2 operator /(Vector2 left, Vector2 right) => new Vector2(left.X / right.X, left.Y / right.Y); - - public static Vector2 Divide(Vector2 left, Vector2 right) => left / right; - - public static Vector2 operator /(Vector2 vector, float scalar) => new Vector2(vector.X / scalar, vector.Y / scalar); - - public static Vector2 Divide(Vector2 vector, float scalar) => vector / scalar; - - internal void Normalize() - { - float flValue1 = (float) ((double) this.m_x * (double) this.m_x + (double) this.m_y * (double) this.m_y); - if (Math2.WithinEpsilon(flValue1, 1f)) - return; - if ((double) flValue1 > 1.40129846432482E-45) - { - float num = (float) Math.Sqrt((double) flValue1); - this.m_x /= num; - this.m_y /= num; - } - else - { - this.m_x = 0.0f; - this.m_y = 0.0f; - } - } - - public override bool Equals(object obj) => obj is Vector2 vector2 && this == vector2; - - public static bool operator ==(Vector2 left, Vector2 right) => (double) left.X == (double) right.X && (double) left.Y == (double) right.Y; - - public static bool operator !=(Vector2 left, Vector2 right) => !(left == right); - - public override int GetHashCode() => this.X.GetHashCode() ^ this.Y.GetHashCode(); - - public override string ToString() => base.ToString(); - - internal string ToDxShaderString() - { - StringBuilder stringBuilder = new StringBuilder(128); - stringBuilder.Append("{"); - stringBuilder.Append(this.X); - stringBuilder.Append(", "); - stringBuilder.Append(this.Y); - stringBuilder.Append("}"); - return stringBuilder.ToString(); - } - - public bool IsApproximate(Vector2 vector) => Math2.WithinEpsilon(this.m_x, vector.m_x) && Math2.WithinEpsilon(this.m_y, vector.m_y); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector3.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector3.cs index 9796287..6229a33 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector3.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector3.cs @@ -10,125 +10,125 @@ using System.Text; namespace Microsoft.Iris.Render { - [Serializable] - public struct Vector3 - { - private float m_x; - private float m_y; - private float m_z; - public static readonly Vector3 Zero = new Vector3(0.0f, 0.0f, 0.0f); - public static readonly Vector3 UnitVector = new Vector3(1f, 1f, 1f); - - public Vector3(float x, float y, float z) + [Serializable] + public struct Vector3 { - this.m_x = x; - this.m_y = y; - this.m_z = z; + private float m_x; + private float m_y; + private float m_z; + public static readonly Vector3 Zero = new Vector3(0.0f, 0.0f, 0.0f); + public static readonly Vector3 UnitVector = new Vector3(1f, 1f, 1f); + + public Vector3(float x, float y, float z) + { + this.m_x = x; + this.m_y = y; + this.m_z = z; + } + + public Vector3(Vector3 value) + { + this.m_x = value.m_x; + this.m_y = value.m_y; + this.m_z = value.m_z; + } + + internal Vector3(double x, double y, double z) + : this((float)x, (float)y, (float)z) + { + } + + public float X + { + get => this.m_x; + set => this.m_x = value; + } + + public float Y + { + get => this.m_y; + set => this.m_y = value; + } + + public float Z + { + get => this.m_z; + set => this.m_z = value; + } + + public static Vector3 operator +(Vector3 left, Vector3 right) => new Vector3(left.X + right.X, left.Y + right.Y, left.Z + right.Z); + + public static Vector3 operator +(Vector3 vector, float scalar) => new Vector3(vector.X + scalar, vector.Y + scalar, vector.Z + scalar); + + public static Vector3 Add(Vector3 left, Vector3 right) => left + right; + + public static Vector3 operator -(Vector3 left, Vector3 right) => new Vector3(left.X - right.X, left.Y - right.Y, left.Z - right.Z); + + public static Vector3 operator -(Vector3 vector, float scalar) => new Vector3(vector.X - scalar, vector.Y - scalar, vector.Z - scalar); + + public static Vector3 operator -(Vector3 left) => new Vector3(-left.X, -left.Y, -left.Z); + + public static Vector3 Subtract(Vector3 left, Vector3 right) => left - right; + + public static Vector3 operator *(Vector3 left, Vector3 right) => new Vector3(left.X * right.X, left.Y * right.Y, left.Z * right.Z); + + public static Vector3 Multiply(Vector3 left, Vector3 right) => left * right; + + public static Vector3 operator *(Vector3 vector, float scalar) => new Vector3(vector.X * scalar, vector.Y * scalar, vector.Z * scalar); + + public static Vector3 Multiply(Vector3 vector, float scalar) => vector * scalar; + + public static Vector3 operator /(Vector3 left, Vector3 right) => new Vector3(left.X / right.X, left.Y / right.Y, left.Z / right.Z); + + public static Vector3 Divide(Vector3 left, Vector3 right) => left / right; + + public static Vector3 operator /(Vector3 vector, float scalar) => new Vector3(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); + + public static Vector3 Divide(Vector3 vector, float scalar) => vector / scalar; + + internal void Normalize() + { + float flValue1 = (float)((double)this.m_x * (double)this.m_x + (double)this.m_y * (double)this.m_y + (double)this.m_z * (double)this.m_z); + if (Math2.WithinEpsilon(flValue1, 1f)) + return; + if ((double)flValue1 > 1.40129846432482E-45) + { + float num = (float)Math.Sqrt((double)flValue1); + this.m_x /= num; + this.m_y /= num; + this.m_z /= num; + } + else + { + this.m_x = 0.0f; + this.m_y = 0.0f; + this.m_z = 0.0f; + } + } + + public override bool Equals(object obj) => obj is Vector3 vector3 && this == vector3; + + public static bool operator ==(Vector3 left, Vector3 right) => (double)left.X == (double)right.X && (double)left.Y == (double)right.Y && (double)left.Z == (double)right.Z; + + public static bool operator !=(Vector3 left, Vector3 right) => !(left == right); + + public override int GetHashCode() => this.X.GetHashCode() ^ this.Y.GetHashCode() ^ this.Z.GetHashCode(); + + public override string ToString() => base.ToString(); + + internal string ToDxShaderString() + { + StringBuilder stringBuilder = new StringBuilder(128); + stringBuilder.Append("{"); + stringBuilder.Append(this.X); + stringBuilder.Append(", "); + stringBuilder.Append(this.Y); + stringBuilder.Append(", "); + stringBuilder.Append(this.Z); + stringBuilder.Append("}"); + return stringBuilder.ToString(); + } + + public bool IsApproximate(Vector3 vector) => Math2.WithinEpsilon(this.m_x, vector.m_x) && Math2.WithinEpsilon(this.m_y, vector.m_y) && Math2.WithinEpsilon(this.m_z, vector.m_z); } - - public Vector3(Vector3 value) - { - this.m_x = value.m_x; - this.m_y = value.m_y; - this.m_z = value.m_z; - } - - internal Vector3(double x, double y, double z) - : this((float) x, (float) y, (float) z) - { - } - - public float X - { - get => this.m_x; - set => this.m_x = value; - } - - public float Y - { - get => this.m_y; - set => this.m_y = value; - } - - public float Z - { - get => this.m_z; - set => this.m_z = value; - } - - public static Vector3 operator +(Vector3 left, Vector3 right) => new Vector3(left.X + right.X, left.Y + right.Y, left.Z + right.Z); - - public static Vector3 operator +(Vector3 vector, float scalar) => new Vector3(vector.X + scalar, vector.Y + scalar, vector.Z + scalar); - - public static Vector3 Add(Vector3 left, Vector3 right) => left + right; - - public static Vector3 operator -(Vector3 left, Vector3 right) => new Vector3(left.X - right.X, left.Y - right.Y, left.Z - right.Z); - - public static Vector3 operator -(Vector3 vector, float scalar) => new Vector3(vector.X - scalar, vector.Y - scalar, vector.Z - scalar); - - public static Vector3 operator -(Vector3 left) => new Vector3(-left.X, -left.Y, -left.Z); - - public static Vector3 Subtract(Vector3 left, Vector3 right) => left - right; - - public static Vector3 operator *(Vector3 left, Vector3 right) => new Vector3(left.X * right.X, left.Y * right.Y, left.Z * right.Z); - - public static Vector3 Multiply(Vector3 left, Vector3 right) => left * right; - - public static Vector3 operator *(Vector3 vector, float scalar) => new Vector3(vector.X * scalar, vector.Y * scalar, vector.Z * scalar); - - public static Vector3 Multiply(Vector3 vector, float scalar) => vector * scalar; - - public static Vector3 operator /(Vector3 left, Vector3 right) => new Vector3(left.X / right.X, left.Y / right.Y, left.Z / right.Z); - - public static Vector3 Divide(Vector3 left, Vector3 right) => left / right; - - public static Vector3 operator /(Vector3 vector, float scalar) => new Vector3(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); - - public static Vector3 Divide(Vector3 vector, float scalar) => vector / scalar; - - internal void Normalize() - { - float flValue1 = (float) ((double) this.m_x * (double) this.m_x + (double) this.m_y * (double) this.m_y + (double) this.m_z * (double) this.m_z); - if (Math2.WithinEpsilon(flValue1, 1f)) - return; - if ((double) flValue1 > 1.40129846432482E-45) - { - float num = (float) Math.Sqrt((double) flValue1); - this.m_x /= num; - this.m_y /= num; - this.m_z /= num; - } - else - { - this.m_x = 0.0f; - this.m_y = 0.0f; - this.m_z = 0.0f; - } - } - - public override bool Equals(object obj) => obj is Vector3 vector3 && this == vector3; - - public static bool operator ==(Vector3 left, Vector3 right) => (double) left.X == (double) right.X && (double) left.Y == (double) right.Y && (double) left.Z == (double) right.Z; - - public static bool operator !=(Vector3 left, Vector3 right) => !(left == right); - - public override int GetHashCode() => this.X.GetHashCode() ^ this.Y.GetHashCode() ^ this.Z.GetHashCode(); - - public override string ToString() => base.ToString(); - - internal string ToDxShaderString() - { - StringBuilder stringBuilder = new StringBuilder(128); - stringBuilder.Append("{"); - stringBuilder.Append(this.X); - stringBuilder.Append(", "); - stringBuilder.Append(this.Y); - stringBuilder.Append(", "); - stringBuilder.Append(this.Z); - stringBuilder.Append("}"); - return stringBuilder.ToString(); - } - - public bool IsApproximate(Vector3 vector) => Math2.WithinEpsilon(this.m_x, vector.m_x) && Math2.WithinEpsilon(this.m_y, vector.m_y) && Math2.WithinEpsilon(this.m_z, vector.m_z); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector4.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector4.cs index f0c88a1..ba31690 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector4.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Vector4.cs @@ -10,126 +10,126 @@ using System.Text; namespace Microsoft.Iris.Render { - [Serializable] - public struct Vector4 - { - private float m_x; - private float m_y; - private float m_z; - private float m_w; - public static readonly Vector4 Zero = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); - public static readonly Vector4 UnitVector = new Vector4(1f, 1f, 1f, 1f); - - public Vector4(float x, float y, float z, float w) + [Serializable] + public struct Vector4 { - this.m_x = x; - this.m_y = y; - this.m_z = z; - this.m_w = w; + private float m_x; + private float m_y; + private float m_z; + private float m_w; + public static readonly Vector4 Zero = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + public static readonly Vector4 UnitVector = new Vector4(1f, 1f, 1f, 1f); + + public Vector4(float x, float y, float z, float w) + { + this.m_x = x; + this.m_y = y; + this.m_z = z; + this.m_w = w; + } + + internal Vector4(double x, double y, double z, double w) + : this((float)x, (float)y, (float)z, (float)w) + { + } + + public float X + { + get => this.m_x; + set => this.m_x = value; + } + + public float Y + { + get => this.m_y; + set => this.m_y = value; + } + + public float Z + { + get => this.m_z; + set => this.m_z = value; + } + + public float W + { + get => this.m_w; + set => this.m_w = value; + } + + public static Vector4 operator +(Vector4 left, Vector4 right) => new Vector4(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); + + public static Vector4 Add(Vector4 left, Vector4 right) => left + right; + + public static Vector4 operator -(Vector4 left, Vector4 right) => new Vector4(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); + + public static Vector4 operator -(Vector4 left) => new Vector4(-left.X, -left.Y, -left.Z, -left.W); + + public static Vector4 Subtract(Vector4 left, Vector4 right) => left - right; + + public static Vector4 operator *(Vector4 left, Vector4 right) => new Vector4(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); + + public static Vector4 Multiply(Vector4 left, Vector4 right) => left * right; + + public static Vector4 operator *(Vector4 vector, float scalar) => new Vector4(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar); + + public static Vector4 Multiply(Vector4 vector, float scalar) => vector * scalar; + + public static Vector4 operator /(Vector4 left, Vector4 right) => new Vector4(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); + + public static Vector4 Divide(Vector4 left, Vector4 right) => left / right; + + public static Vector4 operator /(Vector4 vector, float scalar) => new Vector4(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); + + public static Vector4 Divide(Vector4 vector, float scalar) => vector / scalar; + + internal void Normalize() + { + float flValue1 = (float)((double)this.m_x * (double)this.m_x + (double)this.m_y * (double)this.m_y + (double)this.m_z * (double)this.m_z + (double)this.m_w * (double)this.m_w); + if (Math2.WithinEpsilon(flValue1, 1f)) + return; + if ((double)flValue1 > 1.40129846432482E-45) + { + float num = (float)Math.Sqrt((double)flValue1); + this.m_x /= num; + this.m_y /= num; + this.m_z /= num; + this.m_w /= num; + } + else + { + this.m_x = 0.0f; + this.m_y = 0.0f; + this.m_z = 0.0f; + this.m_w = 0.0f; + } + } + + public override bool Equals(object obj) => obj is Vector4 vector4 && this == vector4; + + public static bool operator ==(Vector4 left, Vector4 right) => (double)left.X == (double)right.X && (double)left.Y == (double)right.Y && (double)left.Z == (double)right.Z && (double)left.W == (double)right.W; + + public static bool operator !=(Vector4 left, Vector4 right) => !(left == right); + + public override int GetHashCode() => this.X.GetHashCode() ^ this.Y.GetHashCode() ^ this.Z.GetHashCode() ^ this.W.GetHashCode(); + + public override string ToString() => base.ToString(); + + internal string ToDxShaderString() + { + StringBuilder stringBuilder = new StringBuilder(128); + stringBuilder.Append("{"); + stringBuilder.Append(this.X); + stringBuilder.Append(", "); + stringBuilder.Append(this.Y); + stringBuilder.Append(", "); + stringBuilder.Append(this.Z); + stringBuilder.Append(", "); + stringBuilder.Append(this.W); + stringBuilder.Append("}"); + return stringBuilder.ToString(); + } + + public bool IsApproximate(Vector4 vector) => Math2.WithinEpsilon(this.m_x, vector.m_x) && Math2.WithinEpsilon(this.m_y, vector.m_y) && Math2.WithinEpsilon(this.m_z, vector.m_z) && Math2.WithinEpsilon(this.m_w, vector.m_w); } - - internal Vector4(double x, double y, double z, double w) - : this((float) x, (float) y, (float) z, (float) w) - { - } - - public float X - { - get => this.m_x; - set => this.m_x = value; - } - - public float Y - { - get => this.m_y; - set => this.m_y = value; - } - - public float Z - { - get => this.m_z; - set => this.m_z = value; - } - - public float W - { - get => this.m_w; - set => this.m_w = value; - } - - public static Vector4 operator +(Vector4 left, Vector4 right) => new Vector4(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); - - public static Vector4 Add(Vector4 left, Vector4 right) => left + right; - - public static Vector4 operator -(Vector4 left, Vector4 right) => new Vector4(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); - - public static Vector4 operator -(Vector4 left) => new Vector4(-left.X, -left.Y, -left.Z, -left.W); - - public static Vector4 Subtract(Vector4 left, Vector4 right) => left - right; - - public static Vector4 operator *(Vector4 left, Vector4 right) => new Vector4(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); - - public static Vector4 Multiply(Vector4 left, Vector4 right) => left * right; - - public static Vector4 operator *(Vector4 vector, float scalar) => new Vector4(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar); - - public static Vector4 Multiply(Vector4 vector, float scalar) => vector * scalar; - - public static Vector4 operator /(Vector4 left, Vector4 right) => new Vector4(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); - - public static Vector4 Divide(Vector4 left, Vector4 right) => left / right; - - public static Vector4 operator /(Vector4 vector, float scalar) => new Vector4(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); - - public static Vector4 Divide(Vector4 vector, float scalar) => vector / scalar; - - internal void Normalize() - { - float flValue1 = (float) ((double) this.m_x * (double) this.m_x + (double) this.m_y * (double) this.m_y + (double) this.m_z * (double) this.m_z + (double) this.m_w * (double) this.m_w); - if (Math2.WithinEpsilon(flValue1, 1f)) - return; - if ((double) flValue1 > 1.40129846432482E-45) - { - float num = (float) Math.Sqrt((double) flValue1); - this.m_x /= num; - this.m_y /= num; - this.m_z /= num; - this.m_w /= num; - } - else - { - this.m_x = 0.0f; - this.m_y = 0.0f; - this.m_z = 0.0f; - this.m_w = 0.0f; - } - } - - public override bool Equals(object obj) => obj is Vector4 vector4 && this == vector4; - - public static bool operator ==(Vector4 left, Vector4 right) => (double) left.X == (double) right.X && (double) left.Y == (double) right.Y && (double) left.Z == (double) right.Z && (double) left.W == (double) right.W; - - public static bool operator !=(Vector4 left, Vector4 right) => !(left == right); - - public override int GetHashCode() => this.X.GetHashCode() ^ this.Y.GetHashCode() ^ this.Z.GetHashCode() ^ this.W.GetHashCode(); - - public override string ToString() => base.ToString(); - - internal string ToDxShaderString() - { - StringBuilder stringBuilder = new StringBuilder(128); - stringBuilder.Append("{"); - stringBuilder.Append(this.X); - stringBuilder.Append(", "); - stringBuilder.Append(this.Y); - stringBuilder.Append(", "); - stringBuilder.Append(this.Z); - stringBuilder.Append(", "); - stringBuilder.Append(this.W); - stringBuilder.Append("}"); - return stringBuilder.ToString(); - } - - public bool IsApproximate(Vector4 vector) => Math2.WithinEpsilon(this.m_x, vector.m_x) && Math2.WithinEpsilon(this.m_y, vector.m_y) && Math2.WithinEpsilon(this.m_z, vector.m_z) && Math2.WithinEpsilon(this.m_w, vector.m_w); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/VideoElement.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/VideoElement.cs index 5617b57..af8b474 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/VideoElement.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/VideoElement.cs @@ -10,46 +10,46 @@ using System; namespace Microsoft.Iris.Render { - public class VideoElement : EffectInput - { - internal const string VideoPropertyName = "Video"; - private Microsoft.Iris.Render.VideoStream m_videoStream; - private byte m_nVideoStreamID; - - public VideoElement(string stName, IVideoStream videoStream) - : this() + public class VideoElement : EffectInput { - Debug2.Validate(!string.IsNullOrEmpty(stName), typeof (ArgumentException), nameof (stName)); - this.m_stName = stName; - this.m_videoStream = videoStream as Microsoft.Iris.Render.VideoStream; + internal const string VideoPropertyName = "Video"; + private Microsoft.Iris.Render.VideoStream m_videoStream; + private byte m_nVideoStreamID; + + public VideoElement(string stName, IVideoStream videoStream) + : this() + { + Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); + this.m_stName = stName; + this.m_videoStream = videoStream as Microsoft.Iris.Render.VideoStream; + } + + public VideoElement() => this.m_typeInput = EffectInputType.Video; + + public IVideoStream VideoStream + { + get => (IVideoStream)this.m_videoStream; + set => this.m_videoStream = value as Microsoft.Iris.Render.VideoStream; + } + + internal byte VideoStreamID => this.m_nVideoStreamID; + + internal override int PreProcessProperties( + Map dictionary, + ref byte nNextUniqueID) + { + int num = base.PreProcessProperties(dictionary, ref nNextUniqueID); + this.AddEffectProperty(dictionary, "Video"); + this.m_nVideoStreamID = nNextUniqueID++; + return num; + } + + internal override bool Process(Map dictProperties) + { + if (!this.GenerateProperty("Video", EffectPropertyType.Video, (object)this.VideoStream, this.m_nVideoStreamID, dictProperties)) + return false; + dictProperties[this.GeneratePropertyPath("Video")].IsDynamic = true; + return true; + } } - - public VideoElement() => this.m_typeInput = EffectInputType.Video; - - public IVideoStream VideoStream - { - get => (IVideoStream) this.m_videoStream; - set => this.m_videoStream = value as Microsoft.Iris.Render.VideoStream; - } - - internal byte VideoStreamID => this.m_nVideoStreamID; - - internal override int PreProcessProperties( - Map dictionary, - ref byte nNextUniqueID) - { - int num = base.PreProcessProperties(dictionary, ref nNextUniqueID); - this.AddEffectProperty(dictionary, "Video"); - this.m_nVideoStreamID = nNextUniqueID++; - return num; - } - - internal override bool Process(Map dictProperties) - { - if (!this.GenerateProperty("Video", EffectPropertyType.Video, (object) this.VideoStream, this.m_nVideoStreamID, dictProperties)) - return false; - dictProperties[this.GeneratePropertyPath("Video")].IsDynamic = true; - return true; - } - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/VideoStream.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/VideoStream.cs index db5c3f2..a76e6d7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/VideoStream.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/VideoStream.cs @@ -13,125 +13,125 @@ using System.Threading; namespace Microsoft.Iris.Render { - internal sealed class VideoStream : - SharedResource, - IVideoPoolNotification, - IVideoStream, - ISharedRenderObject, - ISurfaceContentOwner - { - private static int s_idxNextUnique = 100; - private GraphicsDevice m_device; - private Surface m_surfaceScene; - private VideoPool m_poolScene; - private int m_nUniqueID; - private Size m_sizeTargetPxl; - private Size m_sizeAspectRatio; - - public VideoStream(RenderSession session, GraphicsDevice device) - : base(session) + internal sealed class VideoStream : + SharedResource, + IVideoPoolNotification, + IVideoStream, + ISharedRenderObject, + ISurfaceContentOwner { - Debug2.Validate(device != null, typeof (ArgumentNullException), "must pass a valid device"); - this.m_device = device; - this.Initialize(); - } + private static int s_idxNextUnique = 100; + private GraphicsDevice m_device; + private Surface m_surfaceScene; + private VideoPool m_poolScene; + private int m_nUniqueID; + private Size m_sizeTargetPxl; + private Size m_sizeAspectRatio; - private void Initialize() - { - this.m_nUniqueID = Interlocked.Increment(ref VideoStream.s_idxNextUnique); - this.m_poolScene = new VideoPool(this.m_device, (IVideoPoolNotification) this); - this.m_surfaceScene = new Surface((SurfacePool) this.m_poolScene, (ISurfaceContentOwner) this, Size.Zero); - this.m_surfaceScene.RegisterUsage((object) this); - IEffectTemplate effectTemplate = this.m_session.CreateEffectTemplate((object) this, "EmptyVideo"); - ColorElement colorElement = new ColorElement("ColorFill", ColorF.FromArgb((int) byte.MaxValue, 0, 0, 0)); - effectTemplate.Build((EffectInput) colorElement); - IEffect instance = effectTemplate.CreateInstance((object) this); - this.m_poolScene.Effect = (Effect) instance; - instance.UnregisterUsage((object) this); - effectTemplate.UnregisterUsage((object) this); - RemoteDynamicSurfaceFactory.SendCreateVideoInstance(this.m_session.RenderingProtocol, this.m_nUniqueID, this.m_session.RenderingPort.MessagingProtocol.Context_ClassHandle, RemoteDevice.CreateFromHandle(this.m_device.RemoteDevice.Port, this.m_device.RemoteDevice.RenderHandle), this.m_surfaceScene.RemoteStub, this.m_poolScene.RemoteVideoStub); - } - - protected override void Dispose(bool fInDispose) - { - if (fInDispose) - { - if (this.m_poolScene != null) + public VideoStream(RenderSession session, GraphicsDevice device) + : base(session) { - this.m_surfaceScene.UnregisterUsage((object) this); - this.m_surfaceScene = (Surface) null; - this.m_poolScene.Dispose(); - this.m_poolScene = (VideoPool) null; + Debug2.Validate(device != null, typeof(ArgumentNullException), "must pass a valid device"); + this.m_device = device; + this.Initialize(); } - RemoteDynamicSurfaceFactory.SendCloseInstance(this.m_session.RenderingProtocol, this.m_nUniqueID); - } - this.m_device = (GraphicsDevice) null; - base.Dispose(fInDispose); + + private void Initialize() + { + this.m_nUniqueID = Interlocked.Increment(ref VideoStream.s_idxNextUnique); + this.m_poolScene = new VideoPool(this.m_device, (IVideoPoolNotification)this); + this.m_surfaceScene = new Surface((SurfacePool)this.m_poolScene, (ISurfaceContentOwner)this, Size.Zero); + this.m_surfaceScene.RegisterUsage((object)this); + IEffectTemplate effectTemplate = this.m_session.CreateEffectTemplate((object)this, "EmptyVideo"); + ColorElement colorElement = new ColorElement("ColorFill", ColorF.FromArgb((int)byte.MaxValue, 0, 0, 0)); + effectTemplate.Build((EffectInput)colorElement); + IEffect instance = effectTemplate.CreateInstance((object)this); + this.m_poolScene.Effect = (Effect)instance; + instance.UnregisterUsage((object)this); + effectTemplate.UnregisterUsage((object)this); + RemoteDynamicSurfaceFactory.SendCreateVideoInstance(this.m_session.RenderingProtocol, this.m_nUniqueID, this.m_session.RenderingPort.MessagingProtocol.Context_ClassHandle, RemoteDevice.CreateFromHandle(this.m_device.RemoteDevice.Port, this.m_device.RemoteDevice.RenderHandle), this.m_surfaceScene.RemoteStub, this.m_poolScene.RemoteVideoStub); + } + + protected override void Dispose(bool fInDispose) + { + if (fInDispose) + { + if (this.m_poolScene != null) + { + this.m_surfaceScene.UnregisterUsage((object)this); + this.m_surfaceScene = (Surface)null; + this.m_poolScene.Dispose(); + this.m_poolScene = (VideoPool)null; + } + RemoteDynamicSurfaceFactory.SendCloseInstance(this.m_session.RenderingProtocol, this.m_nUniqueID); + } + this.m_device = (GraphicsDevice)null; + base.Dispose(fInDispose); + } + + public void InvalidateClients() + { + if (this.InvalidateContentEvent == null) + return; + this.InvalidateContentEvent(); + } + + public void NotifySourceChanged(Size sizeTargetPxl, Size sizeAspectRatio) + { + bool flag = false; + if (this.m_sizeTargetPxl != sizeTargetPxl) + { + this.m_sizeTargetPxl = sizeTargetPxl; + flag = true; + } + if (this.m_sizeAspectRatio != sizeAspectRatio) + { + this.m_sizeAspectRatio = sizeAspectRatio; + flag = true; + } + if (!flag) + return; + this.InvalidateClients(); + } + + public void OnSurfaceDisposed(Surface surface) + { + if (this.m_surfaceScene != surface) + return; + this.m_surfaceScene = (Surface)null; + } + + public void OnRestoreContent(Surface surface) + { + } + + public int StreamID => this.m_nUniqueID; + + public float ContentOverscan + { + get => this.m_poolScene.ContentOverscan; + set + { + Debug2.Validate((double)value >= 0.0 && (double)value <= 0.5, typeof(ArgumentException), "Valid range for content overscan is [0, .5]"); + if (Math2.WithinEpsilon(this.m_poolScene.ContentOverscan, value)) + return; + this.m_poolScene.ContentOverscan = value; + this.InvalidateClients(); + } + } + + public int ContentAspectWidth => this.m_sizeAspectRatio.Width; + + public int ContentAspectHeight => this.m_sizeAspectRatio.Height; + + public int ContentHeight => this.m_sizeTargetPxl.Height; + + public int ContentWidth => this.m_sizeTargetPxl.Width; + + public event InvalidateContentHandler InvalidateContentEvent; + + internal Surface Surface => this.m_surfaceScene; + + protected override void OnUsageChange(bool fUsed) => this.InvalidateClients(); } - - public void InvalidateClients() - { - if (this.InvalidateContentEvent == null) - return; - this.InvalidateContentEvent(); - } - - public void NotifySourceChanged(Size sizeTargetPxl, Size sizeAspectRatio) - { - bool flag = false; - if (this.m_sizeTargetPxl != sizeTargetPxl) - { - this.m_sizeTargetPxl = sizeTargetPxl; - flag = true; - } - if (this.m_sizeAspectRatio != sizeAspectRatio) - { - this.m_sizeAspectRatio = sizeAspectRatio; - flag = true; - } - if (!flag) - return; - this.InvalidateClients(); - } - - public void OnSurfaceDisposed(Surface surface) - { - if (this.m_surfaceScene != surface) - return; - this.m_surfaceScene = (Surface) null; - } - - public void OnRestoreContent(Surface surface) - { - } - - public int StreamID => this.m_nUniqueID; - - public float ContentOverscan - { - get => this.m_poolScene.ContentOverscan; - set - { - Debug2.Validate((double) value >= 0.0 && (double) value <= 0.5, typeof (ArgumentException), "Valid range for content overscan is [0, .5]"); - if (Math2.WithinEpsilon(this.m_poolScene.ContentOverscan, value)) - return; - this.m_poolScene.ContentOverscan = value; - this.InvalidateClients(); - } - } - - public int ContentAspectWidth => this.m_sizeAspectRatio.Width; - - public int ContentAspectHeight => this.m_sizeAspectRatio.Height; - - public int ContentHeight => this.m_sizeTargetPxl.Height; - - public int ContentWidth => this.m_sizeTargetPxl.Width; - - public event InvalidateContentHandler InvalidateContentEvent; - - internal Surface Surface => this.m_surfaceScene; - - protected override void OnUsageChange(bool fUsed) => this.InvalidateClients(); - } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/VisualOrder.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/VisualOrder.cs index a0231b0..7db5b5c 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/VisualOrder.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/VisualOrder.cs @@ -6,12 +6,12 @@ namespace Microsoft.Iris.Render { - public enum VisualOrder - { - Any, - Before, - After, - First, - Last, - } + public enum VisualOrder + { + Any, + Before, + After, + First, + Last, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowOptions.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowOptions.cs index 1ae62b4..c104393 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowOptions.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowOptions.cs @@ -8,21 +8,21 @@ using System; namespace Microsoft.Iris.Render { - [Flags] - public enum WindowOptions - { - EnableCursor = 1, - TrackMouseIdle = 2, - NativeScreensaver = 4, - PreventInterruption = 8, - MaximizeExclusive = 16, // 0x00000010 - LockMouseActive = 32, // 0x00000020 - FreeformResize = 64, // 0x00000040 - ShowFormShadow = 128, // 0x00000080 - StartCentered = 256, // 0x00000100 - StartInWorkArea = 512, // 0x00000200 - MouseleaveOnIdle = 1024, // 0x00000400 - RespectStartupSettings = 2048, // 0x00000800 - MaximizeFullScreen = 4096, // 0x00001000 - } + [Flags] + public enum WindowOptions + { + EnableCursor = 1, + TrackMouseIdle = 2, + NativeScreensaver = 4, + PreventInterruption = 8, + MaximizeExclusive = 16, // 0x00000010 + LockMouseActive = 32, // 0x00000020 + FreeformResize = 64, // 0x00000040 + ShowFormShadow = 128, // 0x00000080 + StartCentered = 256, // 0x00000100 + StartInWorkArea = 512, // 0x00000200 + MouseleaveOnIdle = 1024, // 0x00000400 + RespectStartupSettings = 2048, // 0x00000800 + MaximizeFullScreen = 4096, // 0x00001000 + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowState.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowState.cs index 4c305e0..c7506d0 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowState.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowState.cs @@ -6,10 +6,10 @@ namespace Microsoft.Iris.Render { - public enum WindowState - { - Normal, - Minimized, - Maximized, - } + public enum WindowState + { + Normal, + Minimized, + Maximized, + } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowStateChangedHandler.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowStateChangedHandler.cs index 6ec019c..0f2a4c1 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowStateChangedHandler.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/WindowStateChangedHandler.cs @@ -6,5 +6,5 @@ namespace Microsoft.Iris.Render { - public delegate void WindowStateChangedHandler(bool fUnplanned); + public delegate void WindowStateChangedHandler(bool fUnplanned); } diff --git a/UIX.RenderApi.Skia/System/Collections/Generic/HashHelpers.cs b/UIX.RenderApi.Skia/System/Collections/Generic/HashHelpers.cs index b4c3cb3..78d2946 100644 --- a/UIX.RenderApi.Skia/System/Collections/Generic/HashHelpers.cs +++ b/UIX.RenderApi.Skia/System/Collections/Generic/HashHelpers.cs @@ -6,10 +6,10 @@ namespace System.Collections.Generic { - internal class HashHelpers - { - internal static readonly int[] s_primes = new int[72] + internal class HashHelpers { + internal static readonly int[] s_primes = new int[72] + { 3, 7, 11, @@ -82,37 +82,37 @@ namespace System.Collections.Generic 4999559, 5999471, 7199369 - }; + }; - internal static bool IsPrime(int candidate) - { - if ((candidate & 1) == 0) - return candidate == 2; - int num = (int) Math.Sqrt((double) candidate); - for (int index = 3; index <= num; index += 2) - { - if (candidate % index == 0) - return false; - } - return true; - } + internal static bool IsPrime(int candidate) + { + if ((candidate & 1) == 0) + return candidate == 2; + int num = (int)Math.Sqrt((double)candidate); + for (int index = 3; index <= num; index += 2) + { + if (candidate % index == 0) + return false; + } + return true; + } - internal static int GetPrime(int min) - { - if (min < 0) - throw new ArgumentException(nameof (min)); - for (int index = 0; index < HashHelpers.s_primes.Length; ++index) - { - int prime = HashHelpers.s_primes[index]; - if (prime >= min) - return prime; - } - for (int candidate = min | 1; candidate < int.MaxValue; candidate += 2) - { - if (HashHelpers.IsPrime(candidate)) - return candidate; - } - return min; + internal static int GetPrime(int min) + { + if (min < 0) + throw new ArgumentException(nameof(min)); + for (int index = 0; index < HashHelpers.s_primes.Length; ++index) + { + int prime = HashHelpers.s_primes[index]; + if (prime >= min) + return prime; + } + for (int candidate = min | 1; candidate < int.MaxValue; candidate += 2) + { + if (HashHelpers.IsPrime(candidate)) + return candidate; + } + return min; + } } - } } diff --git a/UIX.RenderApi.Skia/Vector.cs b/UIX.RenderApi.Skia/Vector.cs index 2682ee6..c26ca3d 100644 --- a/UIX.RenderApi.Skia/Vector.cs +++ b/UIX.RenderApi.Skia/Vector.cs @@ -9,192 +9,192 @@ using System.Collections; public class Vector : IVector { - private const int k_defaultCapacity = 4; - private static object[] s_emptyArray = new object[0]; - private object[] _items; - private int _size; + private const int k_defaultCapacity = 4; + private static object[] s_emptyArray = new object[0]; + private object[] _items; + private int _size; - public Vector() => this._items = Vector.s_emptyArray; + public Vector() => this._items = Vector.s_emptyArray; - public Vector(int capacity) => this._items = new object[capacity]; + public Vector(int capacity) => this._items = new object[capacity]; - public Vector(IEnumerable collection) - { - if (collection is ICollection collection1) + public Vector(IEnumerable collection) { - int count = collection1.Count; - this._items = new object[count]; - collection1.CopyTo((Array) this._items, 0); - this._size = count; - } - else - { - this._size = 0; - this._items = new object[4]; - foreach (object obj in collection) - this.Add(obj); - } - } - - public Vector(IVector list) - { - int count = list.Count; - this._size = count; - this._items = new object[count]; - for (int index = 0; index < count; ++index) - this._items[index] = list[index]; - } - - public int Capacity - { - get => this._items.Length; - set - { - if (value == this._items.Length) - return; - if (value > 0) - { - object[] objArray = new object[value]; - if (this._size > 0) - Array.Copy((Array) this._items, 0, (Array) objArray, 0, this._size); - this._items = objArray; - } - else - this._items = Vector.s_emptyArray; - } - } - - public int Count => this._size; - - public object this[int index] - { - get => this._items[index]; - set => this._items[index] = value; - } - - object IVector.this[int index] => this[index]; - - public void Add(object item) - { - if (this._size == this._items.Length) - this.EnsureCapacity(this._size + 1); - this._items[this._size++] = item; - } - - public void Clear() - { - Array.Clear((Array) this._items, 0, this._size); - this._size = 0; - } - - public bool Contains(object item) => Array.IndexOf(this._items, item, 0, this._size) >= 0; - - public void CopyTo(Array array, int index) - { - if (this._items == null) - return; - try - { - Array.Copy((Array) this._items, 0, array, index, this._size); - } - catch (ArrayTypeMismatchException ex) - { - throw new ArgumentException((string) null); - } - } - - public void ExpandTo(int count) - { - if (this.Count >= count) - return; - this.EnsureCapacity(count); - this._size = count; - } - - public Vector.Enumerator GetEnumerator() => new Vector.Enumerator(this); - - public int IndexOf(object item) => Array.IndexOf(this._items, item, 0, this._size); - - public void Insert(int index, object item) - { - if (this._size == this._items.Length) - this.EnsureCapacity(this._size + 1); - if (index < this._size) - Array.Copy((Array) this._items, index, (Array) this._items, index + 1, this._size - index); - this._items[index] = item; - ++this._size; - } - - public bool Remove(object item) - { - int index = this.IndexOf(item); - if (index < 0) - return false; - this.RemoveAt(index); - return true; - } - - public void RemoveAt(int index) - { - --this._size; - if (index < this._size) - Array.Copy((Array) this._items, index + 1, (Array) this._items, index, this._size - index); - this._items[this._size] = (object) null; - } - - public void RemoveRange(int index, int count) - { - if (count <= 0) - return; - this._size -= count; - if (index < this._size) - Array.Copy((Array) this._items, index + count, (Array) this._items, index, this._size - index); - Array.Clear((Array) this._items, this._size, count); - } - - public void Sort() => this.Sort(0, this.Count, (IComparer) null); - - public void Sort(IComparer comparer) => this.Sort(0, this.Count, comparer); - - public void Sort(int index, int count, IComparer comparer) => Array.Sort((Array) this._items, index, count, comparer); - - public object[] ToArray() - { - object[] objArray = new object[this._size]; - Array.Copy((Array) this._items, 0, (Array) objArray, 0, this._size); - return objArray; - } - - public void TrimExcess() - { - if (this._size >= (int) ((double) this._items.Length * 0.9)) - return; - this.Capacity = this._size; - } - - private void EnsureCapacity(int minItemCount) - { - if (this._items.Length >= minItemCount) - return; - int num = this._items.Length == 0 ? 4 : this._items.Length * 2; - if (num < minItemCount) - num = minItemCount; - this.Capacity = num; - } - - public struct Enumerator - { - private Vector _list; - private int _index; - - internal Enumerator(Vector list) - { - this._list = list; - this._index = -1; + if (collection is ICollection collection1) + { + int count = collection1.Count; + this._items = new object[count]; + collection1.CopyTo((Array)this._items, 0); + this._size = count; + } + else + { + this._size = 0; + this._items = new object[4]; + foreach (object obj in collection) + this.Add(obj); + } } - public bool MoveNext() => ++this._index < this._list._size; + public Vector(IVector list) + { + int count = list.Count; + this._size = count; + this._items = new object[count]; + for (int index = 0; index < count; ++index) + this._items[index] = list[index]; + } - public object Current => this._list[this._index]; - } + public int Capacity + { + get => this._items.Length; + set + { + if (value == this._items.Length) + return; + if (value > 0) + { + object[] objArray = new object[value]; + if (this._size > 0) + Array.Copy((Array)this._items, 0, (Array)objArray, 0, this._size); + this._items = objArray; + } + else + this._items = Vector.s_emptyArray; + } + } + + public int Count => this._size; + + public object this[int index] + { + get => this._items[index]; + set => this._items[index] = value; + } + + object IVector.this[int index] => this[index]; + + public void Add(object item) + { + if (this._size == this._items.Length) + this.EnsureCapacity(this._size + 1); + this._items[this._size++] = item; + } + + public void Clear() + { + Array.Clear((Array)this._items, 0, this._size); + this._size = 0; + } + + public bool Contains(object item) => Array.IndexOf(this._items, item, 0, this._size) >= 0; + + public void CopyTo(Array array, int index) + { + if (this._items == null) + return; + try + { + Array.Copy((Array)this._items, 0, array, index, this._size); + } + catch (ArrayTypeMismatchException ex) + { + throw new ArgumentException((string)null); + } + } + + public void ExpandTo(int count) + { + if (this.Count >= count) + return; + this.EnsureCapacity(count); + this._size = count; + } + + public Vector.Enumerator GetEnumerator() => new Vector.Enumerator(this); + + public int IndexOf(object item) => Array.IndexOf(this._items, item, 0, this._size); + + public void Insert(int index, object item) + { + if (this._size == this._items.Length) + this.EnsureCapacity(this._size + 1); + if (index < this._size) + Array.Copy((Array)this._items, index, (Array)this._items, index + 1, this._size - index); + this._items[index] = item; + ++this._size; + } + + public bool Remove(object item) + { + int index = this.IndexOf(item); + if (index < 0) + return false; + this.RemoveAt(index); + return true; + } + + public void RemoveAt(int index) + { + --this._size; + if (index < this._size) + Array.Copy((Array)this._items, index + 1, (Array)this._items, index, this._size - index); + this._items[this._size] = (object)null; + } + + public void RemoveRange(int index, int count) + { + if (count <= 0) + return; + this._size -= count; + if (index < this._size) + Array.Copy((Array)this._items, index + count, (Array)this._items, index, this._size - index); + Array.Clear((Array)this._items, this._size, count); + } + + public void Sort() => this.Sort(0, this.Count, (IComparer)null); + + public void Sort(IComparer comparer) => this.Sort(0, this.Count, comparer); + + public void Sort(int index, int count, IComparer comparer) => Array.Sort((Array)this._items, index, count, comparer); + + public object[] ToArray() + { + object[] objArray = new object[this._size]; + Array.Copy((Array)this._items, 0, (Array)objArray, 0, this._size); + return objArray; + } + + public void TrimExcess() + { + if (this._size >= (int)((double)this._items.Length * 0.9)) + return; + this.Capacity = this._size; + } + + private void EnsureCapacity(int minItemCount) + { + if (this._items.Length >= minItemCount) + return; + int num = this._items.Length == 0 ? 4 : this._items.Length * 2; + if (num < minItemCount) + num = minItemCount; + this.Capacity = num; + } + + public struct Enumerator + { + private Vector _list; + private int _index; + + internal Enumerator(Vector list) + { + this._list = list; + this._index = -1; + } + + public bool MoveNext() => ++this._index < this._list._size; + + public object Current => this._list[this._index]; + } } diff --git a/UIX.RenderApi.Skia/Vector`1.cs b/UIX.RenderApi.Skia/Vector`1.cs index 0a2f2ce..a1f471b 100644 --- a/UIX.RenderApi.Skia/Vector`1.cs +++ b/UIX.RenderApi.Skia/Vector`1.cs @@ -9,192 +9,192 @@ using System.Collections; public class Vector : IVector { - private const int k_defaultCapacity = 4; - private static A[] s_emptyArray = new A[0]; - private A[] _items; - private int _size; + private const int k_defaultCapacity = 4; + private static A[] s_emptyArray = new A[0]; + private A[] _items; + private int _size; - public Vector() => this._items = Vector.s_emptyArray; + public Vector() => this._items = Vector.s_emptyArray; - public Vector(int capacity) => this._items = new A[capacity]; + public Vector(int capacity) => this._items = new A[capacity]; - public Vector(IEnumerable collection) - { - if (collection is ICollection collection1) + public Vector(IEnumerable collection) { - int count = collection1.Count; - this._items = new A[count]; - collection1.CopyTo((Array) this._items, 0); - this._size = count; - } - else - { - this._size = 0; - this._items = new A[4]; - foreach (A a in collection) - this.Add(a); - } - } - - public Vector(IVector list) - { - int count = list.Count; - this._size = count; - this._items = new A[count]; - for (int index = 0; index < count; ++index) - this._items[index] = (A) list[index]; - } - - public int Capacity - { - get => this._items.Length; - set - { - if (value == this._items.Length) - return; - if (value > 0) - { - A[] aArray = new A[value]; - if (this._size > 0) - Array.Copy((Array) this._items, 0, (Array) aArray, 0, this._size); - this._items = aArray; - } - else - this._items = Vector.s_emptyArray; - } - } - - public int Count => this._size; - - public A this[int index] - { - get => this._items[index]; - set => this._items[index] = value; - } - - object IVector.this[int index] => (object) this[index]; - - public void Add(A item) - { - if (this._size == this._items.Length) - this.EnsureCapacity(this._size + 1); - this._items[this._size++] = item; - } - - public void Clear() - { - Array.Clear((Array) this._items, 0, this._size); - this._size = 0; - } - - public bool Contains(A item) => Array.IndexOf(this._items, item, 0, this._size) >= 0; - - public void CopyTo(Array array, int index) - { - if (this._items == null) - return; - try - { - Array.Copy((Array) this._items, 0, array, index, this._size); - } - catch (ArrayTypeMismatchException ex) - { - throw new ArgumentException((string) null); - } - } - - public void ExpandTo(int count) - { - if (this.Count >= count) - return; - this.EnsureCapacity(count); - this._size = count; - } - - public Vector.Enumerator GetEnumerator() => new Vector.Enumerator(this); - - public int IndexOf(A item) => Array.IndexOf(this._items, item, 0, this._size); - - public void Insert(int index, A item) - { - if (this._size == this._items.Length) - this.EnsureCapacity(this._size + 1); - if (index < this._size) - Array.Copy((Array) this._items, index, (Array) this._items, index + 1, this._size - index); - this._items[index] = item; - ++this._size; - } - - public bool Remove(A item) - { - int index = this.IndexOf(item); - if (index < 0) - return false; - this.RemoveAt(index); - return true; - } - - public void RemoveAt(int index) - { - --this._size; - if (index < this._size) - Array.Copy((Array) this._items, index + 1, (Array) this._items, index, this._size - index); - this._items[this._size] = default (A); - } - - public void RemoveRange(int index, int count) - { - if (count <= 0) - return; - this._size -= count; - if (index < this._size) - Array.Copy((Array) this._items, index + count, (Array) this._items, index, this._size - index); - Array.Clear((Array) this._items, this._size, count); - } - - public void Sort() => this.Sort(0, this.Count, (IComparer) null); - - public void Sort(IComparer comparer) => this.Sort(0, this.Count, comparer); - - public void Sort(int index, int count, IComparer comparer) => Array.Sort((Array) this._items, index, count, comparer); - - public A[] ToArray() - { - A[] aArray = new A[this._size]; - Array.Copy((Array) this._items, 0, (Array) aArray, 0, this._size); - return aArray; - } - - public void TrimExcess() - { - if (this._size >= (int) ((double) this._items.Length * 0.9)) - return; - this.Capacity = this._size; - } - - private void EnsureCapacity(int minItemCount) - { - if (this._items.Length >= minItemCount) - return; - int num = this._items.Length == 0 ? 4 : this._items.Length * 2; - if (num < minItemCount) - num = minItemCount; - this.Capacity = num; - } - - public struct Enumerator - { - private Vector _list; - private int _index; - - internal Enumerator(Vector list) - { - this._list = list; - this._index = -1; + if (collection is ICollection collection1) + { + int count = collection1.Count; + this._items = new A[count]; + collection1.CopyTo((Array)this._items, 0); + this._size = count; + } + else + { + this._size = 0; + this._items = new A[4]; + foreach (A a in collection) + this.Add(a); + } } - public bool MoveNext() => ++this._index < this._list._size; + public Vector(IVector list) + { + int count = list.Count; + this._size = count; + this._items = new A[count]; + for (int index = 0; index < count; ++index) + this._items[index] = (A)list[index]; + } - public A Current => this._list[this._index]; - } + public int Capacity + { + get => this._items.Length; + set + { + if (value == this._items.Length) + return; + if (value > 0) + { + A[] aArray = new A[value]; + if (this._size > 0) + Array.Copy((Array)this._items, 0, (Array)aArray, 0, this._size); + this._items = aArray; + } + else + this._items = Vector.s_emptyArray; + } + } + + public int Count => this._size; + + public A this[int index] + { + get => this._items[index]; + set => this._items[index] = value; + } + + object IVector.this[int index] => (object)this[index]; + + public void Add(A item) + { + if (this._size == this._items.Length) + this.EnsureCapacity(this._size + 1); + this._items[this._size++] = item; + } + + public void Clear() + { + Array.Clear((Array)this._items, 0, this._size); + this._size = 0; + } + + public bool Contains(A item) => Array.IndexOf(this._items, item, 0, this._size) >= 0; + + public void CopyTo(Array array, int index) + { + if (this._items == null) + return; + try + { + Array.Copy((Array)this._items, 0, array, index, this._size); + } + catch (ArrayTypeMismatchException ex) + { + throw new ArgumentException((string)null); + } + } + + public void ExpandTo(int count) + { + if (this.Count >= count) + return; + this.EnsureCapacity(count); + this._size = count; + } + + public Vector.Enumerator GetEnumerator() => new Vector.Enumerator(this); + + public int IndexOf(A item) => Array.IndexOf(this._items, item, 0, this._size); + + public void Insert(int index, A item) + { + if (this._size == this._items.Length) + this.EnsureCapacity(this._size + 1); + if (index < this._size) + Array.Copy((Array)this._items, index, (Array)this._items, index + 1, this._size - index); + this._items[index] = item; + ++this._size; + } + + public bool Remove(A item) + { + int index = this.IndexOf(item); + if (index < 0) + return false; + this.RemoveAt(index); + return true; + } + + public void RemoveAt(int index) + { + --this._size; + if (index < this._size) + Array.Copy((Array)this._items, index + 1, (Array)this._items, index, this._size - index); + this._items[this._size] = default(A); + } + + public void RemoveRange(int index, int count) + { + if (count <= 0) + return; + this._size -= count; + if (index < this._size) + Array.Copy((Array)this._items, index + count, (Array)this._items, index, this._size - index); + Array.Clear((Array)this._items, this._size, count); + } + + public void Sort() => this.Sort(0, this.Count, (IComparer)null); + + public void Sort(IComparer comparer) => this.Sort(0, this.Count, comparer); + + public void Sort(int index, int count, IComparer comparer) => Array.Sort((Array)this._items, index, count, comparer); + + public A[] ToArray() + { + A[] aArray = new A[this._size]; + Array.Copy((Array)this._items, 0, (Array)aArray, 0, this._size); + return aArray; + } + + public void TrimExcess() + { + if (this._size >= (int)((double)this._items.Length * 0.9)) + return; + this.Capacity = this._size; + } + + private void EnsureCapacity(int minItemCount) + { + if (this._items.Length >= minItemCount) + return; + int num = this._items.Length == 0 ? 4 : this._items.Length * 2; + if (num < minItemCount) + num = minItemCount; + this.Capacity = num; + } + + public struct Enumerator + { + private Vector _list; + private int _index; + + internal Enumerator(Vector list) + { + this._list = list; + this._index = -1; + } + + public bool MoveNext() => ++this._index < this._list._size; + + public A Current => this._list[this._index]; + } }