Repository: xbmc/xbmc
File: xbmc/platform/win32/WinRtUtil.cpp (C++)

Code before:

using namespace winrt::Windows::Graphics::Display;

#ifdef TARGET_WINDOWS_DESKTOP
extern HWND g_hWnd;
#endif

static constexpr std::string_view AdvancedColorKindToString(AdvancedColorKind kind)
{
  switch (kind)
  {
    case AdvancedColorKind::StandardDynamicRange:
      return "SDR";
    case AdvancedColorKind::WideColorGamut:
      return "WCG";
    case AdvancedColorKind::HighDynamicRange:
      return "HDR";
    default:
      return "unknown";
  }
}

static void LogAdvancedColorInfo(AdvancedColorInfo colorInfo)
{
  std::string availableAdvColorKind;
  std::array<AdvancedColorKind, 3> kinds{AdvancedColorKind::StandardDynamicRange,
                                         AdvancedColorKind::WideColorGamut,
                                         AdvancedColorKind::HighDynamicRange};

  for (auto kind : kinds)
  {
    if (colorInfo.IsAdvancedColorKindAvailable(kind))
      availableAdvColorKind.append(AdvancedColorKindToString(kind)).append(" ");
  }

  CLog::LogF(LOGDEBUG, "Current advanced color kind: {}, supported kinds: {}",
             AdvancedColorKindToString(colorInfo.CurrentAdvancedColorKind()),
             availableAdvColorKind);
}

HDR_STATUS CWinRtUtil::GetWindowsHDRStatus()
{
  DisplayInformation displayInformation{nullptr};

#ifdef TARGET_WINDOWS_STORE
  displayInformation = DisplayInformation::GetForCurrentView();

  if (!displayInformation)
  {
    CLog::LogF(LOGERROR, "unable to retrieve DisplayInformation.");
    return HDR_STATUS::HDR_UNKNOWN;

Review comment (suggestion):
```suggestion
  constexpr std::array<AdvancedColorKind, 3> kinds{AdvancedColorKind::StandardDynamicRange,
```

Code after:

using namespace winrt::Windows::Graphics::Display;

#ifdef TARGET_WINDOWS_DESKTOP
extern HWND g_hWnd;
#endif

static constexpr std::string_view AdvancedColorKindToString(AdvancedColorKind kind)
{
  switch (kind)
  {
    case AdvancedColorKind::StandardDynamicRange:
      return "SDR";
    case AdvancedColorKind::WideColorGamut:
      return "WCG";
    case AdvancedColorKind::HighDynamicRange:
      return "HDR";
    default:
      return "unknown";
  }
}

static void LogAdvancedColorInfo(AdvancedColorInfo colorInfo)
{
  std::string availableKinds;
  static constexpr std::array<AdvancedColorKind, 3> kinds{AdvancedColorKind::StandardDynamicRange,
                                                          AdvancedColorKind::WideColorGamut,
                                                          AdvancedColorKind::HighDynamicRange};

  for (const AdvancedColorKind& kind : kinds)
  {
    if (colorInfo.IsAdvancedColorKindAvailable(kind))
      availableKinds.append(AdvancedColorKindToString(kind)).append(" ");
  }

  CLog::LogF(LOGDEBUG, "Current advanced color kind: {}, supported kinds: {}",
             AdvancedColorKindToString(colorInfo.CurrentAdvancedColorKind()), availableKinds);
}

HDR_STATUS CWinRtUtil::GetWindowsHDRStatus()
{
  DisplayInformation displayInformation{nullptr};

#ifdef TARGET_WINDOWS_STORE
  displayInformation = DisplayInformation::GetForCurrentView();

  if (!displayInformation)
  {
    CLog::LogF(LOGERROR, "unable to retrieve DisplayInformation.");
    return HDR_STATUS::HDR_UNKNOWN;
  }