Merge remote-tracking branch 'origin/main' into develop
This commit is contained in:
Коммит
35cd69f491
|
@ -114,14 +114,16 @@ Task("ANGLE")
|
|||
{
|
||||
if (Skip(arch)) return;
|
||||
|
||||
var d = CONFIGURATION.ToLower() == "release" ? "" : "debug/";
|
||||
|
||||
RunProcess (vcpkg, $"install angle:{arch}-uwp");
|
||||
|
||||
var outDir = OUTPUT_PATH.Combine(arch);
|
||||
EnsureDirectoryExists(outDir);
|
||||
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{arch}-uwp/bin/libEGL.dll"), outDir);
|
||||
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{arch}-uwp/bin/libEGL.pdb"), outDir);
|
||||
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{arch}-uwp/bin/libGLESv2.dll"), outDir);
|
||||
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{arch}-uwp/bin/libGLESv2.pdb"), outDir);
|
||||
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{arch}-uwp/{d}bin/libEGL.dll"), outDir);
|
||||
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{arch}-uwp/{d}bin/libEGL.pdb"), outDir);
|
||||
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{arch}-uwp/{d}bin/libGLESv2.dll"), outDir);
|
||||
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{arch}-uwp/{d}bin/libGLESv2.pdb"), outDir);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -33,8 +33,16 @@ namespace SkiaSharp.Views.UWP
|
|||
|
||||
private bool enableRenderLoop;
|
||||
|
||||
private double lastCompositionScaleX = 0.0;
|
||||
private double lastCompositionScaleY = 0.0;
|
||||
|
||||
private bool pendingSizeChange = false;
|
||||
|
||||
public AngleSwapChainPanel()
|
||||
{
|
||||
lastCompositionScaleX = CompositionScaleX;
|
||||
lastCompositionScaleY = CompositionScaleY;
|
||||
|
||||
glesContext = null;
|
||||
|
||||
renderLoopWorker = null;
|
||||
|
@ -148,6 +156,17 @@ namespace SkiaSharp.Views.UWP
|
|||
|
||||
private void OnCompositionChanged(SwapChainPanel sender, object args)
|
||||
{
|
||||
if (lastCompositionScaleX == CompositionScaleX &&
|
||||
lastCompositionScaleY == CompositionScaleY)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lastCompositionScaleX = CompositionScaleX;
|
||||
lastCompositionScaleY = CompositionScaleY;
|
||||
|
||||
pendingSizeChange = true;
|
||||
|
||||
ContentsScale = CompositionScaleX;
|
||||
|
||||
DestroyRenderSurface();
|
||||
|
@ -157,6 +176,8 @@ namespace SkiaSharp.Views.UWP
|
|||
|
||||
private void OnSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
pendingSizeChange = true;
|
||||
|
||||
EnsureRenderSurface();
|
||||
Invalidate();
|
||||
}
|
||||
|
@ -189,6 +210,15 @@ namespace SkiaSharp.Views.UWP
|
|||
return;
|
||||
|
||||
glesContext.MakeCurrent();
|
||||
|
||||
if (pendingSizeChange)
|
||||
{
|
||||
pendingSizeChange = false;
|
||||
|
||||
if (!EnableRenderLoop)
|
||||
glesContext.SwapBuffers();
|
||||
}
|
||||
|
||||
glesContext.GetSurfaceDimensions(out var panelWidth, out var panelHeight);
|
||||
glesContext.SetViewportSize(panelWidth, panelHeight);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using SkiaSharp.Views.UWP.Interop;
|
||||
|
||||
|
@ -14,9 +15,10 @@ namespace SkiaSharp.Views.GlesInterop
|
|||
{
|
||||
internal class GlesContext : IDisposable
|
||||
{
|
||||
private static EGLDisplay eglDisplay = Egl.EGL_NO_DISPLAY;
|
||||
|
||||
private bool isDisposed = false;
|
||||
|
||||
private EGLDisplay eglDisplay;
|
||||
private EGLContext eglContext;
|
||||
private EGLSurface eglSurface;
|
||||
private EGLConfig eglConfig;
|
||||
|
@ -24,10 +26,10 @@ namespace SkiaSharp.Views.GlesInterop
|
|||
public GlesContext()
|
||||
{
|
||||
eglConfig = Egl.EGL_NO_CONFIG;
|
||||
eglDisplay = Egl.EGL_NO_DISPLAY;
|
||||
eglContext = Egl.EGL_NO_CONTEXT;
|
||||
eglSurface = Egl.EGL_NO_SURFACE;
|
||||
|
||||
InitializeDisplay();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
|
@ -139,24 +141,10 @@ namespace SkiaSharp.Views.GlesInterop
|
|||
Initialize();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
private void InitializeDisplay()
|
||||
{
|
||||
int[] configAttributes = new[]
|
||||
{
|
||||
Egl.EGL_RED_SIZE, 8,
|
||||
Egl.EGL_GREEN_SIZE, 8,
|
||||
Egl.EGL_BLUE_SIZE, 8,
|
||||
Egl.EGL_ALPHA_SIZE, 8,
|
||||
Egl.EGL_DEPTH_SIZE, 8,
|
||||
Egl.EGL_STENCIL_SIZE, 8,
|
||||
Egl.EGL_NONE
|
||||
};
|
||||
|
||||
int[] contextAttributes = new[]
|
||||
{
|
||||
Egl.EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
Egl.EGL_NONE
|
||||
};
|
||||
if (eglDisplay != Egl.EGL_NO_DISPLAY)
|
||||
return;
|
||||
|
||||
int[] defaultDisplayAttributes = new[]
|
||||
{
|
||||
|
@ -242,6 +230,26 @@ namespace SkiaSharp.Views.GlesInterop
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
int[] configAttributes = new[]
|
||||
{
|
||||
Egl.EGL_RED_SIZE, 8,
|
||||
Egl.EGL_GREEN_SIZE, 8,
|
||||
Egl.EGL_BLUE_SIZE, 8,
|
||||
Egl.EGL_ALPHA_SIZE, 8,
|
||||
Egl.EGL_DEPTH_SIZE, 8,
|
||||
Egl.EGL_STENCIL_SIZE, 8,
|
||||
Egl.EGL_NONE
|
||||
};
|
||||
|
||||
int[] contextAttributes = new[]
|
||||
{
|
||||
Egl.EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
Egl.EGL_NONE
|
||||
};
|
||||
|
||||
EGLDisplay[] configs = new EGLDisplay[1];
|
||||
if ((Egl.eglChooseConfig(eglDisplay, configAttributes, configs, configs.Length, out int numConfigs) == Egl.EGL_FALSE) || (numConfigs == 0))
|
||||
|
@ -264,12 +272,6 @@ namespace SkiaSharp.Views.GlesInterop
|
|||
Egl.eglDestroyContext(eglDisplay, eglContext);
|
||||
eglContext = Egl.EGL_NO_CONTEXT;
|
||||
}
|
||||
|
||||
if (eglDisplay != Egl.EGL_NO_DISPLAY)
|
||||
{
|
||||
Egl.eglTerminate(eglDisplay);
|
||||
eglDisplay = Egl.EGL_NO_DISPLAY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace SkiaSharp.Views.UWP
|
|||
|
||||
glInfo = default;
|
||||
|
||||
context?.AbandonContext(true);
|
||||
context?.AbandonContext(false);
|
||||
context?.Dispose();
|
||||
context = null;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче