mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 18:45:36 +00:00
Return readonly IList<> instead of copying arrays of data.
This commit is contained in:
parent
0c0acfbf75
commit
038e140e41
|
@ -30,13 +30,14 @@ namespace OpenTK
|
||||||
#region --- Fields ---
|
#region --- Fields ---
|
||||||
|
|
||||||
DisplayResolution current_resolution, original_resolution;
|
DisplayResolution current_resolution, original_resolution;
|
||||||
List<DisplayResolution> available_resolutions = new List<DisplayResolution>();
|
readonly List<DisplayResolution> available_resolutions = new List<DisplayResolution>();
|
||||||
|
readonly IList<DisplayResolution> available_resolutions_readonly;
|
||||||
bool primary;
|
bool primary;
|
||||||
|
|
||||||
static List<DisplayDevice> available_displays = new List<DisplayDevice>();
|
static readonly List<DisplayDevice> available_displays = new List<DisplayDevice>();
|
||||||
static object display_lock = new object();
|
static readonly IList<DisplayDevice> available_displays_readonly;
|
||||||
|
static readonly object display_lock = new object();
|
||||||
static DisplayDevice primary_display;
|
static DisplayDevice primary_display;
|
||||||
//static FadeEffect effect = new FadeEffect();
|
|
||||||
|
|
||||||
static Platform.IDisplayDeviceDriver implementation;
|
static Platform.IDisplayDeviceDriver implementation;
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ namespace OpenTK
|
||||||
static DisplayDevice()
|
static DisplayDevice()
|
||||||
{
|
{
|
||||||
implementation = Platform.Factory.Default.CreateDisplayDeviceDriver();
|
implementation = Platform.Factory.Default.CreateDisplayDeviceDriver();
|
||||||
|
available_displays_readonly = available_displays.AsReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal DisplayDevice(DisplayResolution currentResolution, bool primary,
|
internal DisplayDevice(DisplayResolution currentResolution, bool primary,
|
||||||
|
@ -65,6 +67,8 @@ namespace OpenTK
|
||||||
if (primary)
|
if (primary)
|
||||||
primary_display = this;
|
primary_display = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
available_resolutions_readonly = available_resolutions.AsReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -155,21 +159,14 @@ namespace OpenTK
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public DisplayResolution[] AvailableResolutions
|
#region public IList<DisplayResolution> AvailableResolutions
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an array of OpenTK.DisplayResolution objects, which describe all available resolutions
|
/// Gets the list of <see cref="DisplayResolution"/> objects available on this device.
|
||||||
/// for this device.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DisplayResolution[] AvailableResolutions
|
public IList<DisplayResolution> AvailableResolutions
|
||||||
{
|
{
|
||||||
get
|
get { return available_resolutions_readonly; }
|
||||||
{
|
|
||||||
lock (display_lock)
|
|
||||||
{
|
|
||||||
return available_resolutions.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -242,20 +239,14 @@ namespace OpenTK
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public static DisplayDevice[] AvailableDisplays
|
#region public static IList<DisplayDevice> AvailableDisplays
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an array of OpenTK.DisplayDevice objects, which describe all available display devices.
|
/// Gets the list of available <see cref="DisplayDevice"/> objects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static DisplayDevice[] AvailableDisplays
|
public static IList<DisplayDevice> AvailableDisplays
|
||||||
{
|
{
|
||||||
get
|
get { return available_displays_readonly; }
|
||||||
{
|
|
||||||
lock (display_lock)
|
|
||||||
{
|
|
||||||
return available_displays.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue