Browse Source

avalonia never resizes so use intptr for update rect.

tmp-winuicomp_with_manual_fbo
Dan Walmsley 6 years ago
parent
commit
75025a15c1
  1. 7
      src/Windows/Avalonia.Win32/Composition/CompositionHost.cs
  2. 12
      src/Windows/Avalonia.Win32/Composition/ICompositionDrawingSurfaceInterop.cs

7
src/Windows/Avalonia.Win32/Composition/CompositionHost.cs

@ -39,6 +39,7 @@ namespace Avalonia.Win32
private readonly IEglWindowGlPlatformSurfaceInfo _info;
private PixelSize _initialSize;
private readonly ICompositionDrawingSurfaceInterop _surfaceInterop;
private static Guid s_Iid = Guid.Parse("6f15aaf2-d208-4e89-9ab4-489535d34f9c");
public CompositionRenderTarget(EglDisplay display, EglContext context, ICompositionDrawingSurfaceInterop interopSurface, IEglWindowGlPlatformSurfaceInfo info) : base(display, context)
{
@ -56,13 +57,11 @@ namespace Avalonia.Win32
POINT lastSize;
public override IGlPlatformSurfaceRenderingSession BeginDraw()
{
var iid = Guid.Parse("6f15aaf2-d208-4e89-9ab4-489535d34f9c");
var updateRect = new RECT { right = _info.Size.Width, bottom = _info.Size.Height };
var offset = new POINT();
_surfaceInterop.BeginDraw(
ref updateRect,
ref iid,
IntPtr.Zero,
ref s_Iid,
out IntPtr texture, ref offset);
var surface = (_display as AngleWin32EglDisplay).WrapDirect3D11Texture(texture, offset.X, offset.Y, _info.Size.Width, _info.Size.Height);

12
src/Windows/Avalonia.Win32/Composition/ICompositionDrawingSurfaceInterop.cs

@ -25,7 +25,7 @@ namespace Windows.UI.Composition.Interop
[Guid("FD04E6E3-FE0C-4C3C-AB19-A07601A576EE")]
public interface ICompositionDrawingSurfaceInterop
{
void BeginDraw(ref RECT updateRect, ref Guid iid, out IntPtr updateObject, ref POINT point);
void BeginDraw(IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT point);
void EndDraw();
@ -51,9 +51,9 @@ namespace ABI.Windows.UI.Composition.Interop
{
[Guid("FD04E6E3-FE0C-4C3C-AB19-A07601A576EE")]
public struct Vftbl
public unsafe struct Vftbl
{
public delegate int _BeginDraw(IntPtr ThisPtr, ref RECT updateRect, ref Guid iid, out IntPtr updateObject, ref POINT updateOffset);
public delegate int _BeginDraw(IntPtr ThisPtr, IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT updateOffset);
public delegate int _EndDraw(IntPtr ThisPtr);
public delegate int _Resize(IntPtr ThisPtr, POINT sizePixels);
public delegate int _ResumeDraw(IntPtr ThisPtr);
@ -87,7 +87,7 @@ namespace ABI.Windows.UI.Composition.Interop
Marshal.StructureToPtr(AbiToProjectionVftable, AbiToProjectionVftablePtr, false);
}
private static int Do_Abi_BeginDraw(IntPtr ThisPtr, ref RECT updateRect, ref Guid iid, out IntPtr updateObject, ref POINT updateOffset)
private static int Do_Abi_BeginDraw(IntPtr ThisPtr, IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT updateOffset)
{
updateObject = IntPtr.Zero;
return 0;
@ -118,9 +118,9 @@ namespace ABI.Windows.UI.Composition.Interop
_obj = obj;
}
public void BeginDraw(ref RECT updateRect, ref Guid iid, out IntPtr updateObject, ref POINT point)
public void BeginDraw(IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT point)
{
Marshal.ThrowExceptionForHR(_obj.Vftbl.BeginDraw(ThisPtr, ref updateRect, ref iid, out updateObject, ref point));
Marshal.ThrowExceptionForHR(_obj.Vftbl.BeginDraw(ThisPtr, updateRect, ref iid, out updateObject, ref point));
}
public void EndDraw()

Loading…
Cancel
Save