aboutsummaryrefslogtreecommitdiffstatsci
path: root/Backends/CairoBackend/src/EglBackend.cs
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2022-07-17 20:26:28 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2022-07-17 20:26:28 +0200
commit9d786ab096ed36ea384e03ee5cea498790e31eec (patch)
treeadee54b5b90a35238d5794e9ffd3ebcf65798a06 /Backends/CairoBackend/src/EglBackend.cs
parent57daad000aa31c7bcfa1f76b90d40da5a21da041 (diff)
wip
Diffstat (limited to 'Backends/CairoBackend/src/EglBackend.cs')
-rw-r--r--Backends/CairoBackend/src/EglBackend.cs21
1 files changed, 18 insertions, 3 deletions
diff --git a/Backends/CairoBackend/src/EglBackend.cs b/Backends/CairoBackend/src/EglBackend.cs
index 909c3cd9..073793e7 100644
--- a/Backends/CairoBackend/src/EglBackend.cs
+++ b/Backends/CairoBackend/src/EglBackend.cs
@@ -7,11 +7,13 @@ namespace Crow.CairoBackend
{
public class EglBackend : CairoBackendBase {
EGLDevice device;
+ GLSurface winSurf;
/// <summary>
/// Create a new generic backend bound to the application surface
/// </summary>
/// <param name="width">backend surface width</param>
/// <param name="height">backend surface height</param>
+ /// <param name="nativeWindoPointer"></param>
public EglBackend (int width, int height, IntPtr nativeWindoPointer)
: base (width, height, nativeWindoPointer) {
if (nativeWindoPointer == IntPtr.Zero) {
@@ -32,7 +34,9 @@ namespace Crow.CairoBackend
Glfw3.SwapInterval (0);
device = new EGLDevice (Glfw3.GetEGLDisplay (), Glfw3.GetEGLContext (hWin));
- surf = new GLSurface (device, Glfw3.GetEGLSurface (hWin), width, height);
+ //surf = new GLTextureSurface (device, width, height);
+ surf = new ImageSurface (Format.ARGB32, width, height);
+ winSurf = new GLSurface (device, Glfw3.GetEGLSurface (hWin), width, height);
}
/// <summary>
/// Create a new offscreen backend, used in perfTests
@@ -61,9 +65,20 @@ namespace Crow.CairoBackend
}
public override void FlushUIFrame(IContext ctx)
{
- base.FlushUIFrame (ctx);
- (surf as GLSurface).SwapBuffers ();
+ base.FlushUIFrame (ctx);
+ surf.Flush();
+ using (Context gr = new Context (winSurf)) {
+ gr.SetSource (surf);
+ gr.Paint();
+ }
+ winSurf.SwapBuffers ();
+ }
+ public override void ResizeMainSurface(int width, int height)
+ {
+ base.ResizeMainSurface(width, height);
+ winSurf?.Dispose();
+ winSurf = new GLSurface (device, Glfw3.GetEGLSurface (hWin), width, height);
}
}
}