Small improvement in video library access speed

This commit is contained in:
Terry MacDonald 2021-10-17 20:55:59 +13:00
parent 9f7db6db88
commit 2ee4c90c3c

View File

@ -469,14 +469,17 @@ namespace DisplayMagicianShared
// Create defaults for NVIDIA and AMD so that the JSON file can save properly // Create defaults for NVIDIA and AMD so that the JSON file can save properly
// (C# Structs populate with default values which mean that arrays start with null) // (C# Structs populate with default values which mean that arrays start with null)
if (VideoMode == VIDEO_MODE.NVIDIA && NVIDIALibrary.GetLibrary().IsInstalled)
{
NVIDIALibrary nvidiaLibrary = NVIDIALibrary.GetLibrary(); NVIDIALibrary nvidiaLibrary = NVIDIALibrary.GetLibrary();
AMDLibrary amdLibrary = AMDLibrary.GetLibrary();
WinLibrary winLibrary = WinLibrary.GetLibrary();
if (VideoMode == VIDEO_MODE.NVIDIA && nvidiaLibrary.IsInstalled)
{
if (nvidiaLibrary.IsInstalled) if (nvidiaLibrary.IsInstalled)
{ {
// Create the profile data from the current config // Create the profile data from the current config
_nvidiaDisplayConfig = nvidiaLibrary.GetActiveConfig(); _nvidiaDisplayConfig = nvidiaLibrary.GetActiveConfig();
_windowsDisplayConfig = WinLibrary.GetLibrary().GetActiveConfig(); _windowsDisplayConfig = winLibrary.GetActiveConfig();
_profileDisplayIdentifiers = nvidiaLibrary.GetCurrentDisplayIdentifiers(); _profileDisplayIdentifiers = nvidiaLibrary.GetCurrentDisplayIdentifiers();
// Now, since the ActiveProfile has changed, we need to regenerate screen positions // Now, since the ActiveProfile has changed, we need to regenerate screen positions
@ -491,12 +494,11 @@ namespace DisplayMagicianShared
} }
else if(VideoMode == VIDEO_MODE.AMD && AMDLibrary.GetLibrary().IsInstalled) else if(VideoMode == VIDEO_MODE.AMD && AMDLibrary.GetLibrary().IsInstalled)
{ {
AMDLibrary amdLibrary = AMDLibrary.GetLibrary();
if (amdLibrary.IsInstalled) if (amdLibrary.IsInstalled)
{ {
// Create the profile data from the current config // Create the profile data from the current config
_amdDisplayConfig = amdLibrary.GetActiveConfig(); _amdDisplayConfig = amdLibrary.GetActiveConfig();
_windowsDisplayConfig = WinLibrary.GetLibrary().GetActiveConfig(); _windowsDisplayConfig = winLibrary.GetActiveConfig();
_profileDisplayIdentifiers = amdLibrary.GetCurrentDisplayIdentifiers(); _profileDisplayIdentifiers = amdLibrary.GetCurrentDisplayIdentifiers();
// Now, since the ActiveProfile has changed, we need to regenerate screen positions // Now, since the ActiveProfile has changed, we need to regenerate screen positions
@ -511,7 +513,6 @@ namespace DisplayMagicianShared
} }
else if (VideoMode == VIDEO_MODE.WINDOWS) else if (VideoMode == VIDEO_MODE.WINDOWS)
{ {
WinLibrary winLibrary = WinLibrary.GetLibrary();
if (winLibrary.IsInstalled) if (winLibrary.IsInstalled)
{ {
// Create the profile data from the current config // Create the profile data from the current config
@ -535,14 +536,6 @@ namespace DisplayMagicianShared
} }
} }
/*public bool PerformPostLoadingTasks()
{
// First thing we do is to set up the Screens
//_screens = GetScreenPositions();
return true;
}*/
// ReSharper disable once FunctionComplexityOverflow // ReSharper disable once FunctionComplexityOverflow
// ReSharper disable once CyclomaticComplexity // ReSharper disable once CyclomaticComplexity