Use explicit modifiers for iOS code.

This commit is contained in:
Jarl Gullberg 2017-07-28 12:06:13 +02:00
parent e7620a11b4
commit 016799060a
No known key found for this signature in database
GPG key ID: 750FF6F6BDA72D23
8 changed files with 64 additions and 66 deletions

View file

@ -9,7 +9,7 @@ namespace OpenTK.Graphics.ES11
public sealed partial class GL : GraphicsBindingsBase public sealed partial class GL : GraphicsBindingsBase
{ {
#if IPHONE #if IPHONE
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; private const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
#else #else
private const string Library = "GLESv1_CM"; private const string Library = "GLESv1_CM";
#endif #endif

View file

@ -38,7 +38,7 @@ namespace OpenTK.Graphics.ES20
public sealed partial class GL : GraphicsBindingsBase public sealed partial class GL : GraphicsBindingsBase
{ {
#if IPHONE #if IPHONE
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; private const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
#else #else
private const string Library = "libGLESv2.dll"; private const string Library = "libGLESv2.dll";
#endif #endif

View file

@ -38,7 +38,7 @@ namespace OpenTK.Graphics.ES30
public sealed partial class GL : GraphicsBindingsBase public sealed partial class GL : GraphicsBindingsBase
{ {
#if IPHONE #if IPHONE
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; private const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
#else #else
private const string Library = "libGLESv2.dll"; private const string Library = "libGLESv2.dll";
#endif #endif

View file

@ -86,25 +86,25 @@ namespace OpenTK
#endif #endif
// System.Xml.XmlIgnoreAttribute // System.Xml.XmlIgnoreAttribute
class XmlIgnoreAttribute : Attribute internal class XmlIgnoreAttribute : Attribute
{ {
} }
// System.ComponentModel.EditorBrowrableAttribute // System.ComponentModel.EditorBrowrableAttribute
class EditorBrowsableAttribute : Attribute internal class EditorBrowsableAttribute : Attribute
{ {
public EditorBrowsableAttribute(EditorBrowsableState state) { } public EditorBrowsableAttribute(EditorBrowsableState state) { }
} }
// System.ComponentModel.EditorBrowsableState // System.ComponentModel.EditorBrowsableState
enum EditorBrowsableState internal enum EditorBrowsableState
{ {
Always = 0, Always = 0,
Never = 1, Never = 1,
Advanced = 2, Advanced = 2,
} }
class RegistryKey internal class RegistryKey
{ {
public RegistryKey OpenSubKey(string name) public RegistryKey OpenSubKey(string name)
{ {
@ -117,14 +117,14 @@ namespace OpenTK
} }
} }
class Registry internal class Registry
{ {
public static readonly RegistryKey LocalMachine = new RegistryKey(); public static readonly RegistryKey LocalMachine = new RegistryKey();
} }
public struct PointF : IEquatable<PointF> public struct PointF : IEquatable<PointF>
{ {
float x, y; private float x, y;
/// <summary> /// <summary>
/// Constructs a new PointF instance. /// Constructs a new PointF instance.
@ -265,7 +265,7 @@ namespace OpenTK
public struct SizeF : IEquatable<SizeF> public struct SizeF : IEquatable<SizeF>
{ {
float width, height; private float width, height;
/// <summary> /// <summary>
/// Constructs a new SizeF instance. /// Constructs a new SizeF instance.
@ -397,8 +397,8 @@ namespace OpenTK
public struct RectangleF : IEquatable<RectangleF> public struct RectangleF : IEquatable<RectangleF>
{ {
PointF location; private PointF location;
SizeF size; private SizeF size;
/// <summary> /// <summary>
/// Constructs a new RectangleF instance. /// Constructs a new RectangleF instance.
@ -625,7 +625,7 @@ namespace OpenTK
public sealed class Icon : IDisposable public sealed class Icon : IDisposable
{ {
IntPtr handle; private IntPtr handle;
public Icon(Icon icon, int width, int height) public Icon(Icon icon, int width, int height)
{ {
@ -665,8 +665,8 @@ namespace OpenTK
public sealed class Bitmap : Image public sealed class Bitmap : Image
{ {
int width; private int width;
int height; private int height;
public Bitmap() { } public Bitmap() { }
@ -1549,7 +1549,7 @@ namespace OpenTK
} }
} }
sealed class BitmapData internal sealed class BitmapData
{ {
internal BitmapData(int width, int height, int stride) internal BitmapData(int width, int height, int stride)
{ {
@ -1564,7 +1564,7 @@ namespace OpenTK
public int Stride { get; private set; } public int Stride { get; private set; }
} }
enum ImageLockMode internal enum ImageLockMode
{ {
ReadOnly, ReadOnly,
WriteOnly, WriteOnly,
@ -1572,16 +1572,16 @@ namespace OpenTK
UserInputBuffer UserInputBuffer
} }
enum PixelFormat internal enum PixelFormat
{ {
Format32bppArgb Format32bppArgb
} }
enum ImageFormat { internal enum ImageFormat {
Png Png
} }
sealed class SystemEvents internal sealed class SystemEvents
{ {
public static event EventHandler DisplaySettingsChanged; public static event EventHandler DisplaySettingsChanged;
} }
@ -1590,7 +1590,7 @@ namespace OpenTK
// Need a different namespace to avoid clash with OpenTK.Graphics. // Need a different namespace to avoid clash with OpenTK.Graphics.
namespace OpenTK.Minimal namespace OpenTK.Minimal
{ {
sealed class Graphics : IDisposable internal sealed class Graphics : IDisposable
{ {
public static Graphics FromImage(OpenTK.Image img) public static Graphics FromImage(OpenTK.Image img)
{ {

View file

@ -5,9 +5,9 @@ using OpenTK.Platform;
namespace OpenTK.Platform.iPhoneOS namespace OpenTK.Platform.iPhoneOS
{ {
class AndroidDisplayDeviceDriver : IDisplayDeviceDriver internal class AndroidDisplayDeviceDriver : IDisplayDeviceDriver
{ {
static DisplayDevice dev; private static DisplayDevice dev;
static AndroidDisplayDeviceDriver() static AndroidDisplayDeviceDriver()
{ {
dev = new DisplayDevice(); dev = new DisplayDevice();

View file

@ -34,7 +34,7 @@ using OpenTK.Graphics;
namespace OpenTK.Platform.iPhoneOS 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) public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
{ {

View file

@ -30,7 +30,7 @@ using ES30 = OpenTK.Graphics.ES30;
namespace OpenTK.Platform.iPhoneOS namespace OpenTK.Platform.iPhoneOS
{ {
sealed class GLCalls { internal sealed class GLCalls {
public delegate void glBindFramebuffer(All target, int framebuffer); public delegate void glBindFramebuffer(All target, int framebuffer);
public delegate void glBindRenderbuffer(All target, int renderbuffer); public delegate void glBindRenderbuffer(All target, int renderbuffer);
public delegate void glDeleteFramebuffers(int n, ref int framebuffers); public delegate void glDeleteFramebuffers(int n, ref int framebuffers);
@ -69,7 +69,7 @@ namespace OpenTK.Platform.iPhoneOS
throw new ArgumentException("api"); throw new ArgumentException("api");
} }
static GLCalls CreateES1() private static GLCalls CreateES1()
{ {
return new GLCalls() { return new GLCalls() {
BindFramebuffer = (t, f) => ES11.GL.Oes.BindFramebuffer(t, f), 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() { return new GLCalls() {
BindFramebuffer = (t, f) => ES20.GL.BindFramebuffer((ES20.FramebufferTarget) t, f), 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() { return new GLCalls() {
BindFramebuffer = (t, f) => ES30.GL.BindFramebuffer((ES30.FramebufferTarget) t, f), 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 Suspend ();
void Resume (); void Resume ();
@ -135,12 +135,12 @@ namespace OpenTK.Platform.iPhoneOS
} }
[Register] [Register]
class CADisplayLinkTimeSource : NSObject, ITimeSource { internal class CADisplayLinkTimeSource : NSObject, ITimeSource {
const string selectorName = "runIteration:"; private const string selectorName = "runIteration:";
static Selector selRunIteration = new Selector (selectorName); private static Selector selRunIteration = new Selector (selectorName);
iPhoneOSGameView view; private iPhoneOSGameView view;
CADisplayLink displayLink; private CADisplayLink displayLink;
public CADisplayLinkTimeSource (iPhoneOSGameView view, int frameInterval) public CADisplayLinkTimeSource (iPhoneOSGameView view, int frameInterval)
{ {
@ -177,18 +177,17 @@ namespace OpenTK.Platform.iPhoneOS
[Export (selectorName)] [Export (selectorName)]
[Preserve (Conditional = true)] [Preserve (Conditional = true)]
void RunIteration (NSObject parameter) private void RunIteration (NSObject parameter)
{ {
view.RunIteration (null); view.RunIteration (null);
} }
} }
class NSTimerTimeSource : ITimeSource { internal class NSTimerTimeSource : ITimeSource {
private TimeSpan timeout;
private NSTimer timer;
TimeSpan timeout; private iPhoneOSGameView view;
NSTimer timer;
iPhoneOSGameView view;
public NSTimerTimeSource (iPhoneOSGameView view, double updatesPerSecond) public NSTimerTimeSource (iPhoneOSGameView view, double updatesPerSecond)
{ {
@ -227,19 +226,19 @@ namespace OpenTK.Platform.iPhoneOS
public class iPhoneOSGameView : UIView, IGameWindow public class iPhoneOSGameView : UIView, IGameWindow
{ {
bool suspended; private bool suspended;
bool disposed; private bool disposed;
int framebuffer, renderbuffer; private int framebuffer, renderbuffer;
GLCalls gl; private GLCalls gl;
ITimeSource timesource; private ITimeSource timesource;
System.Diagnostics.Stopwatch stopwatch; private System.Diagnostics.Stopwatch stopwatch;
TimeSpan prevUpdateTime; private TimeSpan prevUpdateTime;
TimeSpan prevRenderTime; private TimeSpan prevRenderTime;
IWindowInfo windowInfo = Utilities.CreateDummyWindowInfo(); private IWindowInfo windowInfo = Utilities.CreateDummyWindowInfo();
[Export("initWithCoder:")] [Export("initWithCoder:")]
public iPhoneOSGameView(NSCoder coder) public iPhoneOSGameView(NSCoder coder)
@ -261,7 +260,7 @@ namespace OpenTK.Platform.iPhoneOS
return new Class (typeof (CAEAGLLayer)); return new Class (typeof (CAEAGLLayer));
} }
void AssertValid() private void AssertValid()
{ {
if (disposed) if (disposed)
{ {
@ -269,7 +268,7 @@ namespace OpenTK.Platform.iPhoneOS
} }
} }
void AssertContext() private void AssertContext()
{ {
if (GraphicsContext == null) if (GraphicsContext == null)
{ {
@ -277,7 +276,7 @@ namespace OpenTK.Platform.iPhoneOS
} }
} }
EAGLRenderingAPI api; private EAGLRenderingAPI api;
public EAGLRenderingAPI ContextRenderingApi { public EAGLRenderingAPI ContextRenderingApi {
get { get {
AssertValid(); AssertValid();
@ -315,7 +314,7 @@ namespace OpenTK.Platform.iPhoneOS
} }
} }
bool retainedBacking; private bool retainedBacking;
public bool LayerRetainsBacking { public bool LayerRetainsBacking {
get { get {
AssertValid(); AssertValid();
@ -331,7 +330,7 @@ namespace OpenTK.Platform.iPhoneOS
} }
} }
NSString colorFormat; private NSString colorFormat;
public NSString LayerColorFormat { public NSString LayerColorFormat {
get { get {
AssertValid(); AssertValid();
@ -357,7 +356,7 @@ namespace OpenTK.Platform.iPhoneOS
public bool AutoResize {get; set;} public bool AutoResize {get; set;}
UIViewController GetViewController() private UIViewController GetViewController()
{ {
UIResponder r = this; UIResponder r = this;
while (r != null) { while (r != null) {
@ -505,7 +504,7 @@ namespace OpenTK.Platform.iPhoneOS
set {throw new NotSupportedException();} set {throw new NotSupportedException();}
} }
Size size; private Size size;
public Size Size { public Size Size {
get { get {
AssertValid(); AssertValid();
@ -648,7 +647,7 @@ namespace OpenTK.Platform.iPhoneOS
CreateFrameBuffer(eaglLayer); CreateFrameBuffer(eaglLayer);
} }
void CreateFrameBuffer(CAEAGLLayer eaglLayer) private void CreateFrameBuffer(CAEAGLLayer eaglLayer)
{ {
int oldRenderbuffer = 1; int oldRenderbuffer = 1;
gl.GetInteger(All.RenderbufferBindingOes, out oldRenderbuffer); gl.GetInteger(All.RenderbufferBindingOes, out oldRenderbuffer);
@ -773,8 +772,8 @@ namespace OpenTK.Platform.iPhoneOS
GraphicsContext.SwapBuffers(); GraphicsContext.SwapBuffers();
} }
WeakReference frameBufferWindow; private WeakReference frameBufferWindow;
WeakReference frameBufferLayer; private WeakReference frameBufferLayer;
public void Run() public void Run()
{ {
@ -832,7 +831,7 @@ namespace OpenTK.Platform.iPhoneOS
Start (); Start ();
} }
void Start () private void Start ()
{ {
prevUpdateTime = TimeSpan.Zero; prevUpdateTime = TimeSpan.Zero;
prevRenderTime = TimeSpan.Zero; prevRenderTime = TimeSpan.Zero;
@ -850,7 +849,7 @@ namespace OpenTK.Platform.iPhoneOS
OnUnload(EventArgs.Empty); OnUnload(EventArgs.Empty);
} }
void Suspend () private void Suspend ()
{ {
if (timesource != null) if (timesource != null)
{ {
@ -860,7 +859,7 @@ namespace OpenTK.Platform.iPhoneOS
suspended = true; suspended = true;
} }
void Resume () private void Resume ()
{ {
if (timesource != null) if (timesource != null)
{ {
@ -950,8 +949,8 @@ namespace OpenTK.Platform.iPhoneOS
} }
} }
FrameEventArgs updateEventArgs = new FrameEventArgs(); private FrameEventArgs updateEventArgs = new FrameEventArgs();
FrameEventArgs renderEventArgs = new FrameEventArgs(); private FrameEventArgs renderEventArgs = new FrameEventArgs();
internal void RunIteration (NSTimer timer) internal void RunIteration (NSTimer timer)
{ {

View file

@ -13,8 +13,7 @@ using OpenGLES;
using OpenTK.Graphics; using OpenTK.Graphics;
namespace OpenTK.Platform.iPhoneOS { namespace OpenTK.Platform.iPhoneOS {
internal class iPhoneOSGraphicsContext : EmbeddedGraphicsContext
class iPhoneOSGraphicsContext : EmbeddedGraphicsContext
{ {
public EAGLContext EAGLContext {get; private set;} public EAGLContext EAGLContext {get; private set;}