From 1931919e2e05ac044c1c02df2abeb8f6f843040d Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Fri, 28 Jul 2017 12:08:57 +0200 Subject: [PATCH] Use explicit modifiers for Android code. --- .../Android/AndroidDisplayDeviceDriver.cs | 4 +- src/OpenTK/Platform/Android/AndroidFactory.cs | 2 +- .../Platform/Android/AndroidGameView.cs | 98 +++++++++---------- .../Android/AndroidGraphicsContext.cs | 9 +- src/OpenTK/Platform/Android/GLCalls.cs | 2 +- 5 files changed, 57 insertions(+), 58 deletions(-) diff --git a/src/OpenTK/Platform/Android/AndroidDisplayDeviceDriver.cs b/src/OpenTK/Platform/Android/AndroidDisplayDeviceDriver.cs index 7125ec7f..93fd32d5 100644 --- a/src/OpenTK/Platform/Android/AndroidDisplayDeviceDriver.cs +++ b/src/OpenTK/Platform/Android/AndroidDisplayDeviceDriver.cs @@ -9,9 +9,9 @@ using System; namespace OpenTK.Platform.Android { - class AndroidDisplayDeviceDriver : IDisplayDeviceDriver + internal class AndroidDisplayDeviceDriver : IDisplayDeviceDriver { - static DisplayDevice dev; + private static DisplayDevice dev; static AndroidDisplayDeviceDriver () { dev = new DisplayDevice (); diff --git a/src/OpenTK/Platform/Android/AndroidFactory.cs b/src/OpenTK/Platform/Android/AndroidFactory.cs index 7b405458..4f0bc5c1 100644 --- a/src/OpenTK/Platform/Android/AndroidFactory.cs +++ b/src/OpenTK/Platform/Android/AndroidFactory.cs @@ -10,7 +10,7 @@ using OpenTK.Graphics; namespace OpenTK.Platform.Android { - sealed class AndroidFactory : PlatformFactoryBase + internal sealed class AndroidFactory : PlatformFactoryBase { public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { diff --git a/src/OpenTK/Platform/Android/AndroidGameView.cs b/src/OpenTK/Platform/Android/AndroidGameView.cs index 1786a59f..0cf2dd06 100644 --- a/src/OpenTK/Platform/Android/AndroidGameView.cs +++ b/src/OpenTK/Platform/Android/AndroidGameView.cs @@ -32,28 +32,28 @@ namespace OpenTK.Platform.Android [Register ("opentk_1_1/platform/android/AndroidGameView")] public partial class AndroidGameView : GameViewBase, ISurfaceHolderCallback { - bool disposed; - System.Timers.Timer timer; - Java.Util.Timer j_timer; - ISurfaceHolder mHolder; - GLCalls gl; - AndroidWindow windowInfo; - Object ticking = new Object (); - bool stopped = true; - bool renderOn = false; - bool sizeChanged = false; - bool requestRender = false; - bool autoSetContextOnRenderFrame = true; - bool renderOnUIThread = true; - bool callMakeCurrent = false; - CancellationTokenSource source; - Task renderTask; - Thread renderingThread; - ManualResetEvent pauseSignal; - global::Android.Graphics.Rect surfaceRect; - Size size; - System.Diagnostics.Stopwatch stopWatch; - double tick = 0; + private bool disposed; + private System.Timers.Timer timer; + private Java.Util.Timer j_timer; + private ISurfaceHolder mHolder; + private GLCalls gl; + private AndroidWindow windowInfo; + private Object ticking = new Object (); + private bool stopped = true; + private bool renderOn = false; + private bool sizeChanged = false; + private bool requestRender = false; + private bool autoSetContextOnRenderFrame = true; + private bool renderOnUIThread = true; + private bool callMakeCurrent = false; + private CancellationTokenSource source; + private Task renderTask; + private Thread renderingThread; + private ManualResetEvent pauseSignal; + private global::Android.Graphics.Rect surfaceRect; + private Size size; + private System.Diagnostics.Stopwatch stopWatch; + private double tick = 0; [Register (".ctor", "(Landroid/content/Context;)V", "")] public AndroidGameView (Context context) : base (context) @@ -202,7 +202,7 @@ namespace OpenTK.Platform.Android GraphicsContext.SwapBuffers (); } - double updates; + private double updates; public override void Run () { EnsureUndisposed (); @@ -248,18 +248,18 @@ namespace OpenTK.Platform.Android ResumeThread (); } - void LoadInternal (EventArgs e) + private void LoadInternal (EventArgs e) { OnLoad (e); } - void UnloadInternal (EventArgs e) + private void UnloadInternal (EventArgs e) { OnUnload (e); DestroyFrameBuffer (); } - void RenderFrameInternal (FrameEventArgs e) + private void RenderFrameInternal (FrameEventArgs e) { #if TIMING Mark (); @@ -301,7 +301,7 @@ namespace OpenTK.Platform.Android } #endif - void UpdateFrameInternal (FrameEventArgs e) + private void UpdateFrameInternal (FrameEventArgs e) { if (!ReadyToRender) return; @@ -309,19 +309,19 @@ namespace OpenTK.Platform.Android OnUpdateFrame (e); } - void EnsureUndisposed () + private void EnsureUndisposed () { if (disposed) throw new ObjectDisposedException (""); } - void AssertContext () + private void AssertContext () { if (GraphicsContext == null) throw new InvalidOperationException ("Operation requires a GraphicsContext, which hasn't been created yet."); } - void CreateSurface() + private void CreateSurface() { if (GraphicsContext == null) { @@ -337,13 +337,13 @@ namespace OpenTK.Platform.Android MakeCurrent(); } - void DestroySurface() + private void DestroySurface() { log("DestroySurface"); windowInfo.DestroySurface(); } - void CreateContext () + private void CreateContext () { log ("CreateContext"); @@ -354,7 +354,7 @@ namespace OpenTK.Platform.Android GraphicsContext = new GraphicsContext(GraphicsMode, WindowInfo, (int)ContextRenderingApi, 0, GraphicsContextFlags.Embedded); } - void DestroyContext () + private void DestroyContext () { if (GraphicsContext != null) { GraphicsContext.Dispose (); @@ -362,11 +362,11 @@ namespace OpenTK.Platform.Android } } - int restartCounter = 0; + private int restartCounter = 0; public int RenderThreadRestartRetries { get; set; } public Exception RenderThreadException; - void StartThread () + private void StartThread () { log ("StartThread"); @@ -441,7 +441,7 @@ namespace OpenTK.Platform.Android }); } - void StopThread () + private void StopThread () { log ("StopThread"); restartCounter = 0; @@ -458,7 +458,7 @@ namespace OpenTK.Platform.Android if (stopWatch != null) stopWatch.Stop (); } - void PauseThread () + private void PauseThread () { log ("PauseThread"); restartCounter = 0; @@ -469,7 +469,7 @@ namespace OpenTK.Platform.Android renderOn = false; } - void ResumeThread () + private void ResumeThread () { log ("ResumeThread"); restartCounter = 0; @@ -483,19 +483,19 @@ namespace OpenTK.Platform.Android } } - bool ReadyToRender { + private bool ReadyToRender { get { return windowInfo.HasSurface && renderOn && !stopped; } } - DateTime prevUpdateTime; - DateTime prevRenderTime; - DateTime curUpdateTime; - DateTime curRenderTime; - FrameEventArgs updateEventArgs = new FrameEventArgs(); - FrameEventArgs renderEventArgs = new FrameEventArgs(); + private DateTime prevUpdateTime; + private DateTime prevRenderTime; + private DateTime curUpdateTime; + private DateTime curRenderTime; + private FrameEventArgs updateEventArgs = new FrameEventArgs(); + private FrameEventArgs renderEventArgs = new FrameEventArgs(); // this method is called on the main thread if RenderOnUIThread is true - void RunIteration (CancellationToken token) + private void RunIteration (CancellationToken token) { if (token.IsCancellationRequested) return; @@ -558,7 +558,7 @@ namespace OpenTK.Platform.Android } } - GLCalls GLCalls { + private GLCalls GLCalls { get { if (gl == null || gl.Version != ContextRenderingApi) gl = GLCalls.GetGLCalls (ContextRenderingApi); @@ -566,7 +566,7 @@ namespace OpenTK.Platform.Android } } - IGraphicsContext Context { + private IGraphicsContext Context { get { return GraphicsContext; } } @@ -588,7 +588,7 @@ namespace OpenTK.Platform.Android } } - GLVersion api; + private GLVersion api; public GLVersion ContextRenderingApi { get { diff --git a/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs b/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs index c5a809e4..7f528521 100644 --- a/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs +++ b/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs @@ -16,8 +16,7 @@ using OpenTK.Graphics; using OpenTK.Platform.Egl; namespace OpenTK.Platform.Android { - - class AndroidGraphicsContext : EglContext + internal class AndroidGraphicsContext : EglContext { public AndroidGraphicsContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext, int major, int minor, GraphicsContextFlags flags) @@ -39,8 +38,8 @@ namespace OpenTK.Platform.Android { public class AndroidWindow : IWindowInfo, IDisposable { - bool disposed; - WeakReference refHolder; + private bool disposed; + private WeakReference refHolder; private EglWindowInfo eglWindowInfo; // Get native window from surface @@ -136,7 +135,7 @@ namespace OpenTK.Platform.Android { GC.SuppressFinalize (this); } - void Dispose (bool disposing) + private void Dispose (bool disposing) { if (!disposed) { diff --git a/src/OpenTK/Platform/Android/GLCalls.cs b/src/OpenTK/Platform/Android/GLCalls.cs index 78b15432..ca4c3ae0 100644 --- a/src/OpenTK/Platform/Android/GLCalls.cs +++ b/src/OpenTK/Platform/Android/GLCalls.cs @@ -19,7 +19,7 @@ using ES30 = OpenTK.Graphics.ES30; namespace OpenTK { - sealed class GLCalls + internal sealed class GLCalls { public GLVersion Version;