diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-11-25 04:11:52 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-11-25 04:11:52 +0100 |
| commit | 20de4f3f7291c59a3d22a88f6934b2aaa3f7bb8f (patch) | |
| tree | a43304efe316960bdab19af7d605ff9c3a12b283 /Backends/CairoBackend | |
| parent | b25ad7a6e15a7284e40407377a1624747ffe42e5 (diff) | |
vkvg backend nearly ok, refresh problem
Diffstat (limited to 'Backends/CairoBackend')
| -rw-r--r-- | Backends/CairoBackend/CairoBackend.csproj | 3 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/EGLDevice.cs | 5 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/GLDevice.cs | 12 | ||||
| -rw-r--r-- | Backends/CairoBackend/src/ImageBackend.cs | 6 |
4 files changed, 19 insertions, 7 deletions
diff --git a/Backends/CairoBackend/CairoBackend.csproj b/Backends/CairoBackend/CairoBackend.csproj index bc11bc47..986ad859 100644 --- a/Backends/CairoBackend/CairoBackend.csproj +++ b/Backends/CairoBackend/CairoBackend.csproj @@ -6,11 +6,12 @@ </PropertyGroup> <ItemGroup> - <Compile Include="src\**\*.cs" Exclude="src\NativeMethods-internal.cs"/> + <Compile Include="src\**\*.cs" Exclude="src\NativeMethods-internal.cs" /> </ItemGroup> <ItemGroup> <PackageReference Include="glfw-sharp" Version="$(GlfwSharpVersion)" /> + <PackageReference Include="OpenGL.Net" Version="0.8.4" /> <ProjectReference Include="..\..\Drawing2D\Drawing2D.csproj" /> </ItemGroup> 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 () |