aboutsummaryrefslogtreecommitdiffstatsci
path: root/Backends/CairoBackend/src
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-11-25 04:11:52 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-11-25 04:11:52 +0100
commit20de4f3f7291c59a3d22a88f6934b2aaa3f7bb8f (patch)
treea43304efe316960bdab19af7d605ff9c3a12b283 /Backends/CairoBackend/src
parentb25ad7a6e15a7284e40407377a1624747ffe42e5 (diff)
vkvg backend nearly ok, refresh problem
Diffstat (limited to 'Backends/CairoBackend/src')
-rw-r--r--Backends/CairoBackend/src/EGLDevice.cs5
-rw-r--r--Backends/CairoBackend/src/GLDevice.cs12
-rw-r--r--Backends/CairoBackend/src/ImageBackend.cs6
3 files changed, 17 insertions, 6 deletions
diff --git a/Backends/CairoBackend/src/EGLDevice.cs b/Backends/CairoBackend/src/EGLDevice.cs
index d9296b74..ef3d5542 100644
--- a/Backends/CairoBackend/src/EGLDevice.cs
+++ b/Backends/CairoBackend/src/EGLDevice.cs
@@ -28,7 +28,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
-using Drawing2D;
namespace Crow.CairoBackend
{
@@ -39,9 +38,7 @@ namespace Crow.CairoBackend
{
SetThreadAware(threadAwayre);
}
- /*public override ISurface CreateSurface(int width, int height)
- => new ImageSurface (Format.ARGB32, width, height);
- public override ISurface CreateSurface (IntPtr nativeWindoPointer, int width, int height) {
+ /*public override ISurface CreateSurface (IntPtr nativeWindoPointer, int width, int height) {
return new GLSurface (this, Glfw.Glfw3.GetEGLSurface (nativeWindoPointer), width, height);
}*/
diff --git a/Backends/CairoBackend/src/GLDevice.cs b/Backends/CairoBackend/src/GLDevice.cs
index c7992b74..d90fe1a0 100644
--- a/Backends/CairoBackend/src/GLDevice.cs
+++ b/Backends/CairoBackend/src/GLDevice.cs
@@ -2,6 +2,9 @@
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
+using Drawing2D;
+using OpenGL;
+using static OpenGL.Gl;
namespace Crow.CairoBackend
{
@@ -11,6 +14,15 @@ namespace Crow.CairoBackend
public void SetThreadAware (bool value) {
NativeMethods.cairo_gl_device_set_thread_aware (handle, value ? 1 : 0);
}
+ public virtual ISurface CreateSurface(int width, int height) {
+ uint tex = GenTexture ();
+ BindTexture (TextureTarget.Texture2d, tex);
+ TexImage2D (TextureTarget.Texture2d, 0, InternalFormat.Rgb, width, height,
+ 0, PixelFormat.Rgb, PixelType.UnsignedByte, 0);
+ TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMagFilter, NEAREST);
+ TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMinFilter, NEAREST);
+ return new GLSurface (this, Content.ColorAlpha, tex, width, height);
+ }
}
}
diff --git a/Backends/CairoBackend/src/ImageBackend.cs b/Backends/CairoBackend/src/ImageBackend.cs
index e390ca98..7443b787 100644
--- a/Backends/CairoBackend/src/ImageBackend.cs
+++ b/Backends/CairoBackend/src/ImageBackend.cs
@@ -156,8 +156,10 @@ namespace Crow.CairoBackend
ctx.Dispose ();
clipping = null;
}
-
-
+ public void ResizeMainSurface (int width, int height)
+ {
+ surf.Resize (width, height);
+ }
#region IDispose implementation
bool isDisposed;
public void Dispose ()