Skip to content

Commit

Permalink
Remove duplicate VideoMode
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskr97 committed Oct 18, 2021
1 parent eaef76b commit 0a4a126
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/RageUtil/Graphics/RageDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1118,15 +1118,15 @@ RageDisplay::GetFrameTimingAdjustment(std::chrono::steady_clock::time_point now)
* bigger skip problems, so don't adjust.
*/

if (videoMode.isVsyncEnabled == false) {
if (window->getVideoMode().isVsyncEnabled == false) {
return 0;
}

if (IsPredictiveFrameLimit()) {
return 0;
}

const int iThisFPS = videoMode.refreshRate;
const int iThisFPS = window->getRefreshRate();

std::chrono::duration<float> dDelta = g_LastFrameDuration;
std::chrono::duration<float> dTimeIntoFrame = now - g_LastFrameEndedAt;
Expand Down
3 changes: 1 addition & 2 deletions src/RageUtil/Graphics/RageDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class RageDisplay
// Display State/Info related
[[nodiscard]] virtual auto GetApiDescription() const -> std::string = 0;
auto IsD3D() -> bool;
VideoMode getVideoMode() { return videoMode; }
VideoMode getVideoMode() { return window->getVideoMode(); }
int getRefreshRate() { return window->getRefreshRate(); } /** TODO(james): Exists for compat. Move in render pr.*/

virtual void GetDisplaySpecs(DisplaySpecs& out) const = 0;
Expand Down Expand Up @@ -479,7 +479,6 @@ class RageDisplay
* hint is set to GLFW_NO_API, then only an empty will be created.
*/
std::unique_ptr<GLFWWindowBackend> window;
VideoMode videoMode;
};

extern RageDisplay*
Expand Down
5 changes: 1 addition & 4 deletions src/RageUtil/Graphics/RageDisplay_OGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ std::string
RageDisplay_Legacy::Init(const VideoMode& p,
bool bAllowUnacceleratedRenderer)
{
this->videoMode = p;
window = std::make_unique<GLFWWindowBackend>(p);
window->registerOnFocusGain([]{ GameLoop::setGameFocused(true); });
window->registerOnFocusLost([]{ GameLoop::setGameFocused(false); });
Expand All @@ -479,8 +478,6 @@ RageDisplay_Legacy::Init(const VideoMode& p,
window->create();
window->setContext();

this->videoMode.refreshRate = window->getRefreshRate();

auto bIgnore = false;
auto sError = SetVideoMode(p, bIgnore);
if (!sError.empty())
Expand Down Expand Up @@ -869,7 +866,7 @@ RageDisplay_Legacy::EndFrame()

SetPresentTime(endTime);

FrameLimitAfterVsync(videoMode.refreshRate);
FrameLimitAfterVsync(this->window->getRefreshRate());

RageDisplay::EndFrame();
}
Expand Down

0 comments on commit 0a4a126

Please sign in to comment.