-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
128 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Linq; | ||
|
||
using Avalonia.OpenGL.Egl; | ||
using Avalonia.OpenGL.Surfaces; | ||
|
||
namespace Avalonia.Android.OpenGL | ||
{ | ||
internal sealed class GlPlatformSurface : EglGlPlatformSurfaceBase | ||
{ | ||
private readonly EglPlatformOpenGlInterface _egl; | ||
private readonly IEglWindowGlPlatformSurfaceInfo _info; | ||
|
||
private GlPlatformSurface(EglPlatformOpenGlInterface egl, IEglWindowGlPlatformSurfaceInfo info) | ||
{ | ||
_egl = egl; | ||
_info = info; | ||
} | ||
|
||
public override IGlPlatformSurfaceRenderTarget CreateGlRenderTarget() => | ||
new GlRenderTarget(_egl, _info, _egl.CreateWindowSurface(_info.Handle)); | ||
|
||
public static GlPlatformSurface TryCreate(IEglWindowGlPlatformSurfaceInfo info) | ||
{ | ||
if (EglPlatformOpenGlInterface.TryCreate() is EglPlatformOpenGlInterface egl) | ||
{ | ||
return new GlPlatformSurface(egl, info); | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Avalonia.OpenGL.Egl; | ||
using Avalonia.OpenGL.Surfaces; | ||
|
||
namespace Avalonia.Android.OpenGL | ||
{ | ||
internal sealed class GlRenderTarget : EglPlatformSurfaceRenderTargetBase | ||
{ | ||
private readonly EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo _info; | ||
private readonly EglSurface _surface; | ||
|
||
public GlRenderTarget( | ||
EglPlatformOpenGlInterface egl, | ||
EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo info, | ||
EglSurface surface) | ||
: base(egl) | ||
{ | ||
_info = info; | ||
_surface = surface; | ||
} | ||
|
||
public override IGlPlatformSurfaceRenderingSession BeginDraw() => BeginDraw(_surface, _info); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Android/Avalonia.Android/Platform/SkiaPlatform/FramebufferManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Avalonia.Controls.Platform.Surfaces; | ||
using Avalonia.Platform; | ||
|
||
namespace Avalonia.Android.Platform.SkiaPlatform | ||
{ | ||
internal sealed class FramebufferManager : IFramebufferPlatformSurface | ||
{ | ||
private readonly TopLevelImpl _topLevel; | ||
|
||
public FramebufferManager(TopLevelImpl topLevel) | ||
{ | ||
_topLevel = topLevel; | ||
} | ||
|
||
public ILockedFramebuffer Lock() => new AndroidFramebuffer(_topLevel.InternalView.Holder.Surface); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters