Files
Xune/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Gradient.cs
T

116 lines
3.8 KiB
C#
Raw Normal View History

2021-07-11 22:59:29 -05:00
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Graphics.Gradient
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using Microsoft.Iris.Render.Common;
using Microsoft.Iris.Render.Internal;
using Microsoft.Iris.Render.Protocol;
using Microsoft.Iris.Render.Protocols.Splash.Rendering;
using System;
namespace Microsoft.Iris.Render.Graphics
{
2021-07-11 23:04:40 -05:00
internal class Gradient : SharedRenderObject, IGradient, ISharedRenderObject, IRenderHandleOwner
2021-07-11 22:59:29 -05:00
{
2021-07-11 23:04:40 -05:00
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;
2021-07-11 23:07:04 -05:00
RENDERHANDLE renderhandle = renderingPort.AllocHandle(this);
2021-07-11 23:04:40 -05:00
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();
2021-07-11 23:07:04 -05:00
this.m_remoteGradient = null;
2021-07-11 23:04:40 -05:00
}
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
{
2021-07-11 23:07:04 -05:00
if (m_flOffset == (double)value)
2021-07-11 23:04:40 -05:00
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;
2021-07-11 23:07:04 -05:00
void IRenderHandleOwner.OnDisconnect() => this.m_remoteGradient = null;
2021-07-11 23:04:40 -05:00
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;
}
}
2021-07-11 22:59:29 -05:00
}
}