Browse Source

whitespace.

pull/1935/head
Dan Walmsley 8 years ago
parent
commit
f2bd597329
  1. 3
      src/Avalonia.OpenGL/EglDisplay.cs
  2. 1
      src/Avalonia.OpenGL/EglGlPlatformFeature.cs
  3. 3
      src/Avalonia.OpenGL/EglGlPlatformSurface.cs
  4. 2
      src/Avalonia.OpenGL/EglInterface.cs
  5. 2
      src/Avalonia.OpenGL/GlInterface.cs
  6. 7
      src/Skia/Avalonia.Skia/GlRenderTarget.cs
  7. 3
      src/Windows/Avalonia.Win32/Win32GlManager.cs

3
src/Avalonia.OpenGL/EglDisplay.cs

@ -3,6 +3,7 @@ using System.ComponentModel;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Avalonia.Platform.Interop; using Avalonia.Platform.Interop;
using static Avalonia.OpenGL.EglConsts; using static Avalonia.OpenGL.EglConsts;
namespace Avalonia.OpenGL namespace Avalonia.OpenGL
{ {
public class EglDisplay : IGlDisplay public class EglDisplay : IGlDisplay
@ -201,6 +202,4 @@ namespace Avalonia.OpenGL
} }
} }
} }
} }

1
src/Avalonia.OpenGL/EglGlPlatformFeature.cs

@ -3,7 +3,6 @@ using Avalonia.Logging;
namespace Avalonia.OpenGL namespace Avalonia.OpenGL
{ {
public class EglGlPlatformFeature : IWindowingPlatformGlFeature public class EglGlPlatformFeature : IWindowingPlatformGlFeature
{ {
public IGlDisplay Display { get; set; } public IGlDisplay Display { get; set; }

3
src/Avalonia.OpenGL/EglGlPlatformSurface.cs

@ -10,13 +10,11 @@ namespace Avalonia.OpenGL
// TODO: Change to PixelSize struct once https://github.com/AvaloniaUI/Avalonia/pull/1889 is merged // TODO: Change to PixelSize struct once https://github.com/AvaloniaUI/Avalonia/pull/1889 is merged
System.Drawing.Size PixelSize { get; } System.Drawing.Size PixelSize { get; }
double Scaling { get; } double Scaling { get; }
} }
private readonly EglDisplay _display; private readonly EglDisplay _display;
private readonly IGlContext _context; private readonly IGlContext _context;
private readonly IEglWindowGlPlatformSurfaceInfo _info; private readonly IEglWindowGlPlatformSurfaceInfo _info;
public EglGlPlatformSurface(EglDisplay display, IGlContext context, IEglWindowGlPlatformSurfaceInfo info) public EglGlPlatformSurface(EglDisplay display, IGlContext context, IEglWindowGlPlatformSurfaceInfo info)
{ {
@ -79,3 +77,4 @@ namespace Avalonia.OpenGL
} }
} }
} }

2
src/Avalonia.OpenGL/EglInterface.cs

@ -33,7 +33,6 @@ namespace Avalonia.OpenGL
return (s, o) => dyn.GetProcAddress(lib, s, o); return (s, o) => dyn.GetProcAddress(lib, s, o);
} }
// ReSharper disable UnassignedGetOnlyAutoProperty // ReSharper disable UnassignedGetOnlyAutoProperty
public delegate IntPtr EglGetDisplay(IntPtr nativeDisplay); public delegate IntPtr EglGetDisplay(IntPtr nativeDisplay);
[EntryPoint("eglGetDisplay")] [EntryPoint("eglGetDisplay")]
@ -90,6 +89,5 @@ namespace Avalonia.OpenGL
public EglGetConfigAttrib GetConfigAttrib { get; } public EglGetConfigAttrib GetConfigAttrib { get; }
// ReSharper restore UnassignedGetOnlyAutoProperty // ReSharper restore UnassignedGetOnlyAutoProperty
} }
} }

2
src/Avalonia.OpenGL/GlInterface.cs

@ -9,7 +9,6 @@ namespace Avalonia.OpenGL
{ {
private readonly Func<string, bool, IntPtr> _getProcAddress; private readonly Func<string, bool, IntPtr> _getProcAddress;
public GlInterface(Func<string, bool, IntPtr> getProcAddress) : base(getProcAddress) public GlInterface(Func<string, bool, IntPtr> getProcAddress) : base(getProcAddress)
{ {
_getProcAddress = getProcAddress; _getProcAddress = getProcAddress;
@ -44,7 +43,6 @@ namespace Avalonia.OpenGL
[EntryPoint("glGetIntegerv")] [EntryPoint("glGetIntegerv")]
public GlGetIntegerv GetIntegerv { get; } public GlGetIntegerv GetIntegerv { get; }
// ReSharper restore UnassignedGetOnlyAutoProperty // ReSharper restore UnassignedGetOnlyAutoProperty
} }
} }

7
src/Skia/Avalonia.Skia/GlRenderTarget.cs

@ -5,6 +5,7 @@ using Avalonia.Platform;
using Avalonia.Rendering; using Avalonia.Rendering;
using SkiaSharp; using SkiaSharp;
using static Avalonia.OpenGL.GlConsts; using static Avalonia.OpenGL.GlConsts;
namespace Avalonia.Skia namespace Avalonia.Skia
{ {
public class GlRenderTarget : IRenderTarget public class GlRenderTarget : IRenderTarget
@ -26,8 +27,10 @@ namespace Avalonia.Skia
var disp = session.Display; var disp = session.Display;
var gl = disp.GlInterface; var gl = disp.GlInterface;
gl.GetIntegerv(GL_FRAMEBUFFER_BINDING, out var fb); gl.GetIntegerv(GL_FRAMEBUFFER_BINDING, out var fb);
var size = session.PixelSize; var size = session.PixelSize;
var scaling = session.Scaling; var scaling = session.Scaling;
GRBackendRenderTargetDesc desc = new GRBackendRenderTargetDesc GRBackendRenderTargetDesc desc = new GRBackendRenderTargetDesc
{ {
Width = size.Width, Width = size.Width,
@ -38,10 +41,12 @@ namespace Avalonia.Skia
Origin=GRSurfaceOrigin.BottomLeft, Origin=GRSurfaceOrigin.BottomLeft,
RenderTargetHandle = new IntPtr(fb) RenderTargetHandle = new IntPtr(fb)
}; };
gl.Viewport(0, 0, desc.Width, desc.Height); gl.Viewport(0, 0, desc.Width, desc.Height);
gl.ClearStencil(0); gl.ClearStencil(0);
gl.ClearColor(0, 0, 0, 0); gl.ClearColor(0, 0, 0, 0);
gl.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); gl.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
var surface = SKSurface.Create(_grContext, desc); var surface = SKSurface.Create(_grContext, desc);
var nfo = new DrawingContextImpl.CreateInfo var nfo = new DrawingContextImpl.CreateInfo
@ -52,13 +57,13 @@ namespace Avalonia.Skia
VisualBrushRenderer = visualBrushRenderer, VisualBrushRenderer = visualBrushRenderer,
DisableTextLcdRendering = true DisableTextLcdRendering = true
}; };
return new DrawingContextImpl(nfo, Disposable.Create(() => return new DrawingContextImpl(nfo, Disposable.Create(() =>
{ {
surface.Canvas.Flush(); surface.Canvas.Flush();
surface.Dispose(); surface.Dispose();
session.Dispose(); session.Dispose();
})); }));
} }
} }
} }

3
src/Windows/Avalonia.Win32/Win32GlManager.cs

@ -7,7 +7,8 @@ namespace Avalonia.Win32
/// <summary>This property is initialized if drawing platform requests OpenGL support</summary> /// <summary>This property is initialized if drawing platform requests OpenGL support</summary>
public static EglGlPlatformFeature EglFeature { get; private set; } public static EglGlPlatformFeature EglFeature { get; private set; }
private static bool s_attemptedToInitialize; private static bool s_attemptedToInitialize;
public static void Initialize() public static void Initialize()
{ {
AvaloniaLocator.CurrentMutable.Bind<IWindowingPlatformGlFeature>().ToFunc(() => AvaloniaLocator.CurrentMutable.Bind<IWindowingPlatformGlFeature>().ToFunc(() =>

Loading…
Cancel
Save