Browse Source

Platform: fix Sdl2Application::setSwapInterval(0) + setMinLoopPeriod().

It thought VSync was enabled even when it was set to 0. Also clarified
the docs a bit.
pull/415/head
Vladimír Vondruš 6 years ago
parent
commit
9d5064c857
  1. 3
      doc/changelog.dox
  2. 3
      src/Magnum/Platform/Sdl2Application.cpp
  3. 3
      src/Magnum/Platform/Sdl2Application.h

3
doc/changelog.dox

@ -185,6 +185,9 @@ See also:
@cpp #include <SDL_main.h> @ce, causing iOS builds to fail to initialize. @cpp #include <SDL_main.h> @ce, causing iOS builds to fail to initialize.
The include got added back and initialization failures are reported with The include got added back and initialization failures are reported with
more information now. more information now.
- Calling @ref Platform::Sdl2Application::setSwapInterval() with @cpp 0 @ce
caused @ref Platform::Sdl2Application::setMinimalLoopPeriod() "setMinimalLoopPeriod()"
to be ignored even though Vsync was in fact not enabled.
@subsection changelog-latest-deprecated Deprecated APIs @subsection changelog-latest-deprecated Deprecated APIs

3
src/Magnum/Platform/Sdl2Application.cpp

@ -719,7 +719,8 @@ bool Sdl2Application::setSwapInterval(const Int interval) {
return false; return false;
} }
_flags |= Flag::VSyncEnabled; if(interval) _flags |= Flag::VSyncEnabled;
else _flags &= ~Flag::VSyncEnabled;
return true; return true;
} }

3
src/Magnum/Platform/Sdl2Application.h

@ -822,7 +822,8 @@ class Sdl2Application {
* *
* This setting reduces the main loop frequency in case VSync is * This setting reduces the main loop frequency in case VSync is
* not/cannot be enabled or no drawing is done. Default is @cpp 0 @ce * not/cannot be enabled or no drawing is done. Default is @cpp 0 @ce
* (i.e. looping at maximum frequency). * (i.e. looping at maximum frequency). If the application is drawing
* on the screen and VSync is enabled, this setting is ignored.
* @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten", * @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten",
* the browser is managing the frequency instead. * the browser is managing the frequency instead.
* @see @ref setSwapInterval() * @see @ref setSwapInterval()

Loading…
Cancel
Save