From 016799060a0c7134d00cb90823dc6fb84ac76040 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Fri, 28 Jul 2017 12:06:13 +0200 Subject: [PATCH] Use explicit modifiers for iOS code. --- src/OpenTK/Graphics/ES11/Helper.cs | 2 +- src/OpenTK/Graphics/ES20/Helper.cs | 2 +- src/OpenTK/Graphics/ES30/Helper.cs | 2 +- src/OpenTK/Minimal.cs | 36 ++++----- .../iPhoneOS/iPhoneDisplayDeviceDriver.cs | 4 +- src/OpenTK/Platform/iPhoneOS/iPhoneFactory.cs | 2 +- .../Platform/iPhoneOS/iPhoneOSGameView.cs | 79 +++++++++---------- .../iPhoneOS/iPhoneOSGraphicsContext.cs | 3 +- 8 files changed, 64 insertions(+), 66 deletions(-) diff --git a/src/OpenTK/Graphics/ES11/Helper.cs b/src/OpenTK/Graphics/ES11/Helper.cs index c4884ead..748d4d5b 100644 --- a/src/OpenTK/Graphics/ES11/Helper.cs +++ b/src/OpenTK/Graphics/ES11/Helper.cs @@ -9,7 +9,7 @@ namespace OpenTK.Graphics.ES11 public sealed partial class GL : GraphicsBindingsBase { #if IPHONE - const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; + private const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; #else private const string Library = "GLESv1_CM"; #endif diff --git a/src/OpenTK/Graphics/ES20/Helper.cs b/src/OpenTK/Graphics/ES20/Helper.cs index c71c438d..59905173 100644 --- a/src/OpenTK/Graphics/ES20/Helper.cs +++ b/src/OpenTK/Graphics/ES20/Helper.cs @@ -38,7 +38,7 @@ namespace OpenTK.Graphics.ES20 public sealed partial class GL : GraphicsBindingsBase { #if IPHONE - const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; + private const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; #else private const string Library = "libGLESv2.dll"; #endif diff --git a/src/OpenTK/Graphics/ES30/Helper.cs b/src/OpenTK/Graphics/ES30/Helper.cs index 514bdc8e..b26975a7 100644 --- a/src/OpenTK/Graphics/ES30/Helper.cs +++ b/src/OpenTK/Graphics/ES30/Helper.cs @@ -38,7 +38,7 @@ namespace OpenTK.Graphics.ES30 public sealed partial class GL : GraphicsBindingsBase { #if IPHONE - const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; + private const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; #else private const string Library = "libGLESv2.dll"; #endif diff --git a/src/OpenTK/Minimal.cs b/src/OpenTK/Minimal.cs index 66986613..03b5ae56 100644 --- a/src/OpenTK/Minimal.cs +++ b/src/OpenTK/Minimal.cs @@ -86,25 +86,25 @@ namespace OpenTK #endif // System.Xml.XmlIgnoreAttribute - class XmlIgnoreAttribute : Attribute + internal class XmlIgnoreAttribute : Attribute { } // System.ComponentModel.EditorBrowrableAttribute - class EditorBrowsableAttribute : Attribute + internal class EditorBrowsableAttribute : Attribute { public EditorBrowsableAttribute(EditorBrowsableState state) { } } // System.ComponentModel.EditorBrowsableState - enum EditorBrowsableState + internal enum EditorBrowsableState { Always = 0, Never = 1, Advanced = 2, } - class RegistryKey + internal class RegistryKey { public RegistryKey OpenSubKey(string name) { @@ -117,14 +117,14 @@ namespace OpenTK } } - class Registry + internal class Registry { public static readonly RegistryKey LocalMachine = new RegistryKey(); } public struct PointF : IEquatable { - float x, y; + private float x, y; /// /// Constructs a new PointF instance. @@ -265,7 +265,7 @@ namespace OpenTK public struct SizeF : IEquatable { - float width, height; + private float width, height; /// /// Constructs a new SizeF instance. @@ -397,8 +397,8 @@ namespace OpenTK public struct RectangleF : IEquatable { - PointF location; - SizeF size; + private PointF location; + private SizeF size; /// /// Constructs a new RectangleF instance. @@ -625,7 +625,7 @@ namespace OpenTK public sealed class Icon : IDisposable { - IntPtr handle; + private IntPtr handle; public Icon(Icon icon, int width, int height) { @@ -665,8 +665,8 @@ namespace OpenTK public sealed class Bitmap : Image { - int width; - int height; + private int width; + private int height; public Bitmap() { } @@ -1549,7 +1549,7 @@ namespace OpenTK } } - sealed class BitmapData + internal sealed class BitmapData { internal BitmapData(int width, int height, int stride) { @@ -1564,7 +1564,7 @@ namespace OpenTK public int Stride { get; private set; } } - enum ImageLockMode + internal enum ImageLockMode { ReadOnly, WriteOnly, @@ -1572,16 +1572,16 @@ namespace OpenTK UserInputBuffer } - enum PixelFormat + internal enum PixelFormat { Format32bppArgb } - enum ImageFormat { + internal enum ImageFormat { Png } - sealed class SystemEvents + internal sealed class SystemEvents { public static event EventHandler DisplaySettingsChanged; } @@ -1590,7 +1590,7 @@ namespace OpenTK // Need a different namespace to avoid clash with OpenTK.Graphics. namespace OpenTK.Minimal { - sealed class Graphics : IDisposable + internal sealed class Graphics : IDisposable { public static Graphics FromImage(OpenTK.Image img) { diff --git a/src/OpenTK/Platform/iPhoneOS/iPhoneDisplayDeviceDriver.cs b/src/OpenTK/Platform/iPhoneOS/iPhoneDisplayDeviceDriver.cs index c734ecc0..bf36c3a6 100644 --- a/src/OpenTK/Platform/iPhoneOS/iPhoneDisplayDeviceDriver.cs +++ b/src/OpenTK/Platform/iPhoneOS/iPhoneDisplayDeviceDriver.cs @@ -5,9 +5,9 @@ using OpenTK.Platform; namespace OpenTK.Platform.iPhoneOS { - 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/iPhoneOS/iPhoneFactory.cs b/src/OpenTK/Platform/iPhoneOS/iPhoneFactory.cs index 7887bfd2..bf7e9515 100644 --- a/src/OpenTK/Platform/iPhoneOS/iPhoneFactory.cs +++ b/src/OpenTK/Platform/iPhoneOS/iPhoneFactory.cs @@ -34,7 +34,7 @@ using OpenTK.Graphics; namespace OpenTK.Platform.iPhoneOS { - class iPhoneFactory : PlatformFactoryBase + internal class iPhoneFactory : 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/iPhoneOS/iPhoneOSGameView.cs b/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs index ecc58757..82c531a8 100644 --- a/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs +++ b/src/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs @@ -30,7 +30,7 @@ using ES30 = OpenTK.Graphics.ES30; namespace OpenTK.Platform.iPhoneOS { - sealed class GLCalls { + internal sealed class GLCalls { public delegate void glBindFramebuffer(All target, int framebuffer); public delegate void glBindRenderbuffer(All target, int renderbuffer); public delegate void glDeleteFramebuffers(int n, ref int framebuffers); @@ -69,7 +69,7 @@ namespace OpenTK.Platform.iPhoneOS throw new ArgumentException("api"); } - static GLCalls CreateES1() + private static GLCalls CreateES1() { return new GLCalls() { BindFramebuffer = (t, f) => ES11.GL.Oes.BindFramebuffer(t, f), @@ -88,7 +88,7 @@ namespace OpenTK.Platform.iPhoneOS }; } - static GLCalls CreateES2() + private static GLCalls CreateES2() { return new GLCalls() { BindFramebuffer = (t, f) => ES20.GL.BindFramebuffer((ES20.FramebufferTarget) t, f), @@ -107,7 +107,7 @@ namespace OpenTK.Platform.iPhoneOS }; } - static GLCalls CreateES3() + private static GLCalls CreateES3() { return new GLCalls() { BindFramebuffer = (t, f) => ES30.GL.BindFramebuffer((ES30.FramebufferTarget) t, f), @@ -127,7 +127,7 @@ namespace OpenTK.Platform.iPhoneOS } } - interface ITimeSource { + internal interface ITimeSource { void Suspend (); void Resume (); @@ -135,12 +135,12 @@ namespace OpenTK.Platform.iPhoneOS } [Register] - class CADisplayLinkTimeSource : NSObject, ITimeSource { - const string selectorName = "runIteration:"; - static Selector selRunIteration = new Selector (selectorName); + internal class CADisplayLinkTimeSource : NSObject, ITimeSource { + private const string selectorName = "runIteration:"; + private static Selector selRunIteration = new Selector (selectorName); - iPhoneOSGameView view; - CADisplayLink displayLink; + private iPhoneOSGameView view; + private CADisplayLink displayLink; public CADisplayLinkTimeSource (iPhoneOSGameView view, int frameInterval) { @@ -177,18 +177,17 @@ namespace OpenTK.Platform.iPhoneOS [Export (selectorName)] [Preserve (Conditional = true)] - void RunIteration (NSObject parameter) + private void RunIteration (NSObject parameter) { view.RunIteration (null); } } - class NSTimerTimeSource : ITimeSource { + internal class NSTimerTimeSource : ITimeSource { + private TimeSpan timeout; + private NSTimer timer; - TimeSpan timeout; - NSTimer timer; - - iPhoneOSGameView view; + private iPhoneOSGameView view; public NSTimerTimeSource (iPhoneOSGameView view, double updatesPerSecond) { @@ -227,19 +226,19 @@ namespace OpenTK.Platform.iPhoneOS public class iPhoneOSGameView : UIView, IGameWindow { - bool suspended; - bool disposed; + private bool suspended; + private bool disposed; - int framebuffer, renderbuffer; + private int framebuffer, renderbuffer; - GLCalls gl; + private GLCalls gl; - ITimeSource timesource; - System.Diagnostics.Stopwatch stopwatch; - TimeSpan prevUpdateTime; - TimeSpan prevRenderTime; + private ITimeSource timesource; + private System.Diagnostics.Stopwatch stopwatch; + private TimeSpan prevUpdateTime; + private TimeSpan prevRenderTime; - IWindowInfo windowInfo = Utilities.CreateDummyWindowInfo(); + private IWindowInfo windowInfo = Utilities.CreateDummyWindowInfo(); [Export("initWithCoder:")] public iPhoneOSGameView(NSCoder coder) @@ -261,7 +260,7 @@ namespace OpenTK.Platform.iPhoneOS return new Class (typeof (CAEAGLLayer)); } - void AssertValid() + private void AssertValid() { if (disposed) { @@ -269,7 +268,7 @@ namespace OpenTK.Platform.iPhoneOS } } - void AssertContext() + private void AssertContext() { if (GraphicsContext == null) { @@ -277,7 +276,7 @@ namespace OpenTK.Platform.iPhoneOS } } - EAGLRenderingAPI api; + private EAGLRenderingAPI api; public EAGLRenderingAPI ContextRenderingApi { get { AssertValid(); @@ -315,7 +314,7 @@ namespace OpenTK.Platform.iPhoneOS } } - bool retainedBacking; + private bool retainedBacking; public bool LayerRetainsBacking { get { AssertValid(); @@ -331,7 +330,7 @@ namespace OpenTK.Platform.iPhoneOS } } - NSString colorFormat; + private NSString colorFormat; public NSString LayerColorFormat { get { AssertValid(); @@ -357,7 +356,7 @@ namespace OpenTK.Platform.iPhoneOS public bool AutoResize {get; set;} - UIViewController GetViewController() + private UIViewController GetViewController() { UIResponder r = this; while (r != null) { @@ -505,7 +504,7 @@ namespace OpenTK.Platform.iPhoneOS set {throw new NotSupportedException();} } - Size size; + private Size size; public Size Size { get { AssertValid(); @@ -648,7 +647,7 @@ namespace OpenTK.Platform.iPhoneOS CreateFrameBuffer(eaglLayer); } - void CreateFrameBuffer(CAEAGLLayer eaglLayer) + private void CreateFrameBuffer(CAEAGLLayer eaglLayer) { int oldRenderbuffer = 1; gl.GetInteger(All.RenderbufferBindingOes, out oldRenderbuffer); @@ -773,8 +772,8 @@ namespace OpenTK.Platform.iPhoneOS GraphicsContext.SwapBuffers(); } - WeakReference frameBufferWindow; - WeakReference frameBufferLayer; + private WeakReference frameBufferWindow; + private WeakReference frameBufferLayer; public void Run() { @@ -832,7 +831,7 @@ namespace OpenTK.Platform.iPhoneOS Start (); } - void Start () + private void Start () { prevUpdateTime = TimeSpan.Zero; prevRenderTime = TimeSpan.Zero; @@ -850,7 +849,7 @@ namespace OpenTK.Platform.iPhoneOS OnUnload(EventArgs.Empty); } - void Suspend () + private void Suspend () { if (timesource != null) { @@ -860,7 +859,7 @@ namespace OpenTK.Platform.iPhoneOS suspended = true; } - void Resume () + private void Resume () { if (timesource != null) { @@ -950,8 +949,8 @@ namespace OpenTK.Platform.iPhoneOS } } - FrameEventArgs updateEventArgs = new FrameEventArgs(); - FrameEventArgs renderEventArgs = new FrameEventArgs(); + private FrameEventArgs updateEventArgs = new FrameEventArgs(); + private FrameEventArgs renderEventArgs = new FrameEventArgs(); internal void RunIteration (NSTimer timer) { diff --git a/src/OpenTK/Platform/iPhoneOS/iPhoneOSGraphicsContext.cs b/src/OpenTK/Platform/iPhoneOS/iPhoneOSGraphicsContext.cs index ee1a349d..bb47644f 100644 --- a/src/OpenTK/Platform/iPhoneOS/iPhoneOSGraphicsContext.cs +++ b/src/OpenTK/Platform/iPhoneOS/iPhoneOSGraphicsContext.cs @@ -13,8 +13,7 @@ using OpenGLES; using OpenTK.Graphics; namespace OpenTK.Platform.iPhoneOS { - - class iPhoneOSGraphicsContext : EmbeddedGraphicsContext + internal class iPhoneOSGraphicsContext : EmbeddedGraphicsContext { public EAGLContext EAGLContext {get; private set;}