|
|
|
@ -118,7 +118,7 @@ namespace Avalonia.Skia |
|
|
|
{ |
|
|
|
var gl = _context.GlInterface; |
|
|
|
|
|
|
|
var textures = new int[2]; |
|
|
|
Span<int> textures = stackalloc int[2]; |
|
|
|
fixed (int* ptex = textures) |
|
|
|
gl.GenTextures(2, ptex); |
|
|
|
_texture = textures[0]; |
|
|
|
@ -139,7 +139,6 @@ namespace Avalonia.Skia |
|
|
|
|
|
|
|
gl.FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _texture, 0); |
|
|
|
gl.BindTexture(GL_TEXTURE_2D, oldTexture); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -161,15 +160,15 @@ namespace Avalonia.Skia |
|
|
|
gl.GetIntegerv(GL_ACTIVE_TEXTURE, out var oldActive); |
|
|
|
|
|
|
|
gl.BindFramebuffer(GL_FRAMEBUFFER, _fbo); |
|
|
|
gl.BindTexture(GL_TEXTURE_2D, _frontBuffer); |
|
|
|
gl.ActiveTexture(GL_TEXTURE0); |
|
|
|
gl.BindTexture(GL_TEXTURE_2D, _frontBuffer); |
|
|
|
|
|
|
|
gl.CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, _bitmap.PixelSize.Width, |
|
|
|
_bitmap.PixelSize.Height); |
|
|
|
|
|
|
|
gl.BindFramebuffer(GL_FRAMEBUFFER, oldFbo); |
|
|
|
gl.BindTexture(GL_TEXTURE_2D, oldTexture); |
|
|
|
gl.ActiveTexture(oldActive); |
|
|
|
gl.BindTexture(GL_TEXTURE_2D, oldTexture); |
|
|
|
|
|
|
|
gl.Finish(); |
|
|
|
} |
|
|
|
@ -192,9 +191,8 @@ namespace Avalonia.Skia |
|
|
|
if(_disposed) |
|
|
|
return; |
|
|
|
_disposed = true; |
|
|
|
var tex = new[] { _texture, _frontBuffer }; |
|
|
|
fixed (int* ptex = tex) |
|
|
|
gl.DeleteTextures(2, ptex); |
|
|
|
var ptex = stackalloc[] { _texture, _frontBuffer }; |
|
|
|
gl.DeleteTextures(2, ptex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|