diff --git a/src/SFML/Window/DRM/DRMContext.cpp b/src/SFML/Window/DRM/DRMContext.cpp index caa73a989..071a69d5d 100644 --- a/src/SFML/Window/DRM/DRMContext.cpp +++ b/src/SFML/Window/DRM/DRMContext.cpp @@ -683,7 +683,7 @@ void DRMContext::display() //////////////////////////////////////////////////////////// void DRMContext::setVerticalSyncEnabled(bool enabled) { - eglCheck(eglSwapInterval(m_display, enabled ? 1 : 0)); + eglCheck(eglSwapInterval(m_display, enabled)); } diff --git a/src/SFML/Window/EglContext.cpp b/src/SFML/Window/EglContext.cpp index 41aebd634..e11d7ebfe 100644 --- a/src/SFML/Window/EglContext.cpp +++ b/src/SFML/Window/EglContext.cpp @@ -253,7 +253,7 @@ void EglContext::display() //////////////////////////////////////////////////////////// void EglContext::setVerticalSyncEnabled(bool enabled) { - eglCheck(eglSwapInterval(m_display, enabled ? 1 : 0)); + eglCheck(eglSwapInterval(m_display, enabled)); } diff --git a/src/SFML/Window/Unix/CursorImpl.cpp b/src/SFML/Window/Unix/CursorImpl.cpp index 1cfcbf29c..e8cc13f2d 100644 --- a/src/SFML/Window/Unix/CursorImpl.cpp +++ b/src/SFML/Window/Unix/CursorImpl.cpp @@ -120,14 +120,14 @@ bool CursorImpl::loadFromPixelsMonochrome(const std::uint8_t* pixels, Vector2u s const std::size_t bitIndex = i % 8; // Turn on pixel that are not transparent - const std::uint8_t opacity = pixels[pixelIndex * 4 + 3] > 0 ? 1 : 0; + const std::uint8_t opacity = pixels[pixelIndex * 4 + 3] > 0; mask[byteIndex] |= static_cast(opacity << bitIndex); // Choose between black/background & white/foreground color for each pixel, // based on the pixel color intensity: on average, if a channel is "active" // at 50%, the bit is white. const int intensity = (pixels[pixelIndex * 4 + 0] + pixels[pixelIndex * 4 + 1] + pixels[pixelIndex * 4 + 2]) / 3; - const std::uint8_t bit = intensity > 128 ? 1 : 0; + const std::uint8_t bit = intensity > 128; data[byteIndex] |= static_cast(bit << bitIndex); } } diff --git a/src/SFML/Window/Unix/GlxContext.cpp b/src/SFML/Window/Unix/GlxContext.cpp index d38e51441..34b874827 100644 --- a/src/SFML/Window/Unix/GlxContext.cpp +++ b/src/SFML/Window/Unix/GlxContext.cpp @@ -263,15 +263,15 @@ void GlxContext::setVerticalSyncEnabled(bool enabled) // which would require us to link in an additional library if (SF_GLAD_GLX_EXT_swap_control) { - glXSwapIntervalEXT(m_display.get(), m_pbuffer ? m_pbuffer : m_window, enabled ? 1 : 0); + glXSwapIntervalEXT(m_display.get(), m_pbuffer ? m_pbuffer : m_window, enabled); } else if (SF_GLAD_GLX_MESA_swap_control) { - result = glXSwapIntervalMESA(enabled ? 1 : 0); + result = glXSwapIntervalMESA(enabled); } else if (SF_GLAD_GLX_SGI_swap_control) { - result = glXSwapIntervalSGI(enabled ? 1 : 0); + result = glXSwapIntervalSGI(enabled); } else { diff --git a/src/SFML/Window/Unix/WindowImplX11.cpp b/src/SFML/Window/Unix/WindowImplX11.cpp index 05c587c21..03adf679d 100644 --- a/src/SFML/Window/Unix/WindowImplX11.cpp +++ b/src/SFML/Window/Unix/WindowImplX11.cpp @@ -1019,7 +1019,7 @@ void WindowImplX11::setIcon(Vector2u size, const std::uint8_t* pixels) { if (i * 8 + k < size.x) { - const std::uint8_t opacity = (pixels[(i * 8 + k + j * size.x) * 4 + 3] > 0) ? 1 : 0; + const std::uint8_t opacity = pixels[(i * 8 + k + j * size.x) * 4 + 3] > 0; maskPixels[i + j * pitch] |= static_cast(opacity << k); } } diff --git a/src/SFML/Window/Win32/WglContext.cpp b/src/SFML/Window/Win32/WglContext.cpp index ac9d8325e..76bee925e 100644 --- a/src/SFML/Window/Win32/WglContext.cpp +++ b/src/SFML/Window/Win32/WglContext.cpp @@ -237,7 +237,7 @@ void WglContext::setVerticalSyncEnabled(bool enabled) if (SF_GLAD_WGL_EXT_swap_control) { - if (wglSwapIntervalEXT(enabled ? 1 : 0) == FALSE) + if (wglSwapIntervalEXT(enabled) == FALSE) err() << "Setting vertical sync failed: " << getErrorString(GetLastError()) << std::endl; } else diff --git a/src/SFML/Window/macOS/SFContext.mm b/src/SFML/Window/macOS/SFContext.mm index 29a023100..c03b25058 100644 --- a/src/SFML/Window/macOS/SFContext.mm +++ b/src/SFML/Window/macOS/SFContext.mm @@ -146,7 +146,7 @@ void SFContext::display() void SFContext::setVerticalSyncEnabled(bool enabled) { const AutoreleasePool pool; - const GLint swapInterval = enabled ? 1 : 0; + const GLint swapInterval = enabled; [m_context setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; }