diff --git a/aegisub/reporter/include/platform.h b/aegisub/reporter/include/platform.h index fb1b62fdf..097791ea4 100644 --- a/aegisub/reporter/include/platform.h +++ b/aegisub/reporter/include/platform.h @@ -287,22 +287,20 @@ public: #endif //@} + // Available video information. + enum VideoInfo { + VIDEO_RENDERER, ///< Renderer + VIDEO_VENDOR, ///< Vendor + VIDEO_VERSION ///< Version + }; + private: void Init(); - void GetVideoInfo(); + wxString GetVideoInfo(enum Platform::VideoInfo which); /// wxPlatformInfo struct. const wxPlatformInfo plat; /// wxLocale instance. wxLocale *locale; - - /// Video vendor - wxString vendor; - - /// Video renderer - wxString renderer; - - /// Video API/driver version - wxString version; }; diff --git a/aegisub/reporter/platform.cpp b/aegisub/reporter/platform.cpp index 56c1a02eb..0bc615d4e 100644 --- a/aegisub/reporter/platform.cpp +++ b/aegisub/reporter/platform.cpp @@ -65,26 +65,36 @@ Platform* Platform::GetPlatform() { void Platform::Init() { locale = new wxLocale(); locale->Init(); - GetVideoInfo(); } /** * @brief Gather video adapter information via OpenGL * */ -void Platform::GetVideoInfo() { +wxString Platform::GetVideoInfo(enum Platform::VideoInfo which) { int attList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 }; wxGLCanvas *glc = new wxGLCanvas(wxTheApp->GetTopWindow(), wxID_ANY, attList, wxDefaultPosition, wxDefaultSize); wxGLContext *ctx = new wxGLContext(glc, 0); wxGLCanvas &cr = *glc; ctx->SetCurrent(cr); - vendor = wxString(glGetString(GL_VENDOR)); - renderer = wxString(glGetString(GL_RENDERER)); - version = wxString(glGetString(GL_VERSION)); + wxString value; + + switch (which) { + case VIDEO_RENDERER: + value = wxString(glGetString(GL_RENDERER)); + break; + case VIDEO_VENDOR: + value = wxString(glGetString(GL_VENDOR)); + break; + case VIDEO_VERSION: + value = wxString(glGetString(GL_VERSION)); + } delete ctx; delete glc; + + return value; } wxString Platform::ArchName() { @@ -152,15 +162,15 @@ wxString Platform::DesktopEnvironment() { } wxString Platform::VideoVendor() { - return vendor; + return GetVideoInfo(VIDEO_VENDOR); } wxString Platform::VideoRenderer() { - return renderer; + return GetVideoInfo(VIDEO_RENDERER); } wxString Platform::VideoVersion() { - return version; + return GetVideoInfo(VIDEO_VERSION); } #ifdef __APPLE__