[Bf-blender-cvs] [0b36780fb4d] master: Revert "Cleanup: Cleanup: style, use braces for GHOST (X11/SDL)"
Campbell Barton
noreply at git.blender.org
Tue Jun 4 03:37:19 CEST 2019
Commit: 0b36780fb4d88eab0ebab585fb2aa3147d2e99fc
Author: Campbell Barton
Date: Tue Jun 4 11:35:28 2019 +1000
Branches: master
https://developer.blender.org/rB0b36780fb4d88eab0ebab585fb2aa3147d2e99fc
Revert "Cleanup: Cleanup: style, use braces for GHOST (X11/SDL)"
This reverts commit 935c9ab0de1ce3d36f93ce5aeee5d0f82d6f2591.
Clang-tidy was making unrelated *fixes*.
===================================================================
M intern/ghost/intern/GHOST_C-api.cpp
M intern/ghost/intern/GHOST_Context.cpp
M intern/ghost/intern/GHOST_ContextEGL.cpp
M intern/ghost/intern/GHOST_ContextGLX.cpp
M intern/ghost/intern/GHOST_ContextSDL.cpp
M intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
M intern/ghost/intern/GHOST_DisplayManagerX11.cpp
M intern/ghost/intern/GHOST_DropTargetX11.cpp
M intern/ghost/intern/GHOST_EventDragnDrop.h
M intern/ghost/intern/GHOST_EventKey.h
M intern/ghost/intern/GHOST_EventPrinter.cpp
M intern/ghost/intern/GHOST_EventString.h
M intern/ghost/intern/GHOST_NDOFManager.cpp
M intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
M intern/ghost/intern/GHOST_System.cpp
M intern/ghost/intern/GHOST_SystemNULL.h
M intern/ghost/intern/GHOST_SystemPathsUnix.cpp
M intern/ghost/intern/GHOST_SystemSDL.cpp
M intern/ghost/intern/GHOST_SystemX11.cpp
M intern/ghost/intern/GHOST_TimerManager.cpp
M intern/ghost/intern/GHOST_Window.cpp
M intern/ghost/intern/GHOST_Window.h
M intern/ghost/intern/GHOST_WindowManager.cpp
M intern/ghost/intern/GHOST_WindowSDL.cpp
M intern/ghost/intern/GHOST_WindowX11.cpp
M intern/ghost/test/gears/GHOST_C-Test.c
M intern/ghost/test/gears/GHOST_Test.cpp
M intern/ghost/test/multitest/EventToBuf.c
M intern/ghost/test/multitest/MultiTest.c
===================================================================
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 986b2abf302..ef653c114e8 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -181,12 +181,10 @@ GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
GHOST_IWindow *window = NULL;
bool bstereoVisual;
- if (stereoVisual) {
+ if (stereoVisual)
bstereoVisual = true;
- }
- else {
+ else
bstereoVisual = false;
- }
system->beginFullScreen(*setting, &window, bstereoVisual);
@@ -697,9 +695,8 @@ GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehandle)
{
GHOST_TSuccess result = GHOST_kFailure;
- if (((GHOST_Rect *)rectanglehandle)->isEmpty()) {
+ if (((GHOST_Rect *)rectanglehandle)->isEmpty())
result = GHOST_kSuccess;
- }
return result;
}
@@ -708,9 +705,8 @@ GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
{
GHOST_TSuccess result = GHOST_kFailure;
- if (((GHOST_Rect *)rectanglehandle)->isValid()) {
+ if (((GHOST_Rect *)rectanglehandle)->isValid())
result = GHOST_kSuccess;
- }
return result;
}
@@ -739,9 +735,8 @@ GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
{
GHOST_TSuccess result = GHOST_kFailure;
- if (((GHOST_Rect *)rectanglehandle)->isInside(x, y)) {
+ if (((GHOST_Rect *)rectanglehandle)->isInside(x, y))
result = GHOST_kSuccess;
- }
return result;
}
@@ -777,9 +772,8 @@ GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
{
GHOST_TSuccess result = GHOST_kFailure;
- if (((GHOST_Rect *)rectanglehandle)->clip(*(GHOST_Rect *)anotherrectanglehandle)) {
+ if (((GHOST_Rect *)rectanglehandle)->clip(*(GHOST_Rect *)anotherrectanglehandle))
result = GHOST_kSuccess;
- }
return result;
}
@@ -817,9 +811,8 @@ void GHOST_UseWindowFocus(int use_focus)
float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
- if (window) {
+ if (window)
return window->getNativePixelSize();
- }
return 1.0f;
}
diff --git a/intern/ghost/intern/GHOST_Context.cpp b/intern/ghost/intern/GHOST_Context.cpp
index 2d53c5df08e..0d167209909 100644
--- a/intern/ghost/intern/GHOST_Context.cpp
+++ b/intern/ghost/intern/GHOST_Context.cpp
@@ -129,9 +129,8 @@ bool win32_chk(bool result, const char *file, int line, const char *text)
SetLastError(NO_ERROR);
- if (count != 0) {
+ if (count != 0)
LocalFree(formattedMsg);
- }
}
return result;
diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 0772117e5aa..d4eeda2a9ef 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -236,26 +236,23 @@ GHOST_ContextEGL::~GHOST_ContextEGL()
bindAPI(m_api);
if (m_context != EGL_NO_CONTEXT) {
- if (m_context == ::eglGetCurrentContext()) {
+ if (m_context == ::eglGetCurrentContext())
EGL_CHK(::eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
- }
if (m_context != m_sharedContext || m_sharedCount == 1) {
assert(m_sharedCount > 0);
m_sharedCount--;
- if (m_sharedCount == 0) {
+ if (m_sharedCount == 0)
m_sharedContext = EGL_NO_CONTEXT;
- }
EGL_CHK(::eglDestroyContext(m_display, m_context));
}
}
- if (m_surface != EGL_NO_SURFACE) {
+ if (m_surface != EGL_NO_SURFACE)
EGL_CHK(::eglDestroySurface(m_display, m_surface));
- }
EGL_CHK(::eglTerminate(m_display));
}
@@ -320,9 +317,8 @@ GHOST_TSuccess GHOST_ContextEGL::releaseDrawingContext()
void GHOST_ContextEGL::initContextEGLEW()
{
- if (GLEW_CHK(eglewInit(m_display)) != GLEW_OK) {
+ if (GLEW_CHK(eglewInit(m_display)) != GLEW_OK)
fprintf(stderr, "Warning! EGLEW failed to initialize properly.\n");
- }
}
static const std::string &api_string(EGLenum api)
@@ -340,9 +336,8 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
std::vector<EGLint> attrib_list;
EGLint num_config = 0;
- if (m_stereoVisual) {
+ if (m_stereoVisual)
fprintf(stderr, "Warning! Stereo OpenGL ES contexts are not supported.\n");
- }
m_stereoVisual = false; // It doesn't matter what the Window wants.
@@ -367,27 +362,23 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
m_display = ::eglGetDisplay(m_nativeDisplay);
- if (!EGL_CHK(m_display != EGL_NO_DISPLAY)) {
+ if (!EGL_CHK(m_display != EGL_NO_DISPLAY))
return GHOST_kFailure;
- }
EGLint egl_major, egl_minor;
- if (!EGL_CHK(::eglInitialize(m_display, &egl_major, &egl_minor))) {
+ if (!EGL_CHK(::eglInitialize(m_display, &egl_major, &egl_minor)))
goto error;
- }
fprintf(stderr, "EGL Version %d.%d\n", egl_major, egl_minor);
- if (!EGL_CHK(::eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT))) {
+ if (!EGL_CHK(::eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)))
goto error;
- }
initContextEGLEW();
- if (!bindAPI(m_api)) {
+ if (!bindAPI(m_api))
goto error;
- }
// build attribute list
@@ -447,20 +438,17 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
EGLConfig config;
- if (!EGL_CHK(::eglChooseConfig(m_display, &(attrib_list[0]), &config, 1, &num_config))) {
+ if (!EGL_CHK(::eglChooseConfig(m_display, &(attrib_list[0]), &config, 1, &num_config)))
goto error;
- }
// A common error is to assume that ChooseConfig worked because it returned EGL_TRUE
- if (num_config != 1) { // num_config should be exactly 1
+ if (num_config != 1) // num_config should be exactly 1
goto error;
- }
m_surface = ::eglCreateWindowSurface(m_display, config, m_nativeWindow, NULL);
- if (!EGL_CHK(m_surface != EGL_NO_SURFACE)) {
+ if (!EGL_CHK(m_surface != EGL_NO_SURFACE))
goto error;
- }
attrib_list.clear();
@@ -500,10 +488,9 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
}
}
else {
- if (m_contextProfileMask != 0) {
+ if (m_contextProfileMask != 0)
fprintf(
stderr, "Warning! Cannot select profile for %s contexts.", api_string(m_api).c_str());
- }
}
if (m_api == EGL_OPENGL_API || EGLEW_VERSION_1_5) {
@@ -560,19 +547,16 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
m_context = ::eglCreateContext(m_display, config, m_sharedContext, &(attrib_list[0]));
- if (!EGL_CHK(m_context != EGL_NO_CONTEXT)) {
+ if (!EGL_CHK(m_context != EGL_NO_CONTEXT))
goto error;
- }
- if (m_sharedContext == EGL_NO_CONTEXT) {
+ if (m_sharedContext == EGL_NO_CONTEXT)
m_sharedContext = m_context;
- }
m_sharedCount++;
- if (!EGL_CHK(::eglMakeCurrent(m_display, m_surface, m_surface, m_context))) {
+ if (!EGL_CHK(::eglMakeCurrent(m_display, m_surface, m_surface, m_context)))
goto error;
- }
initContextGLEW();
@@ -582,9 +566,8 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
return GHOST_kSuccess;
error:
- if (prev_display != EGL_NO_DISPLAY) {
+ if (prev_display != EGL_NO_DISPLAY)
EGL_CHK(eglMakeCurrent(prev_display, prev_draw, prev_read, prev_context));
- }
return GHOST_kFailure;
}
diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp
index bfd98390d02..fac75f299fc 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -70,18 +70,16 @@ GHOST_ContextGLX::~GHOST_ContextGLX()
{
if (m_display != NULL) {
if (m_context != None) {
- if (m_window != 0 && m_context == ::glXGetCurrentContext()) {
+ if (m_window != 0 && m_context == ::glXGetCurrentContext())
::glXMakeCurrent(m_display, None, NULL);
- }
if (m_context != s_sharedContext || s_sharedCount == 1) {
assert(s_sharedCount > 0);
s_sharedCount--;
- if (s_sharedCount == 0) {
+ if (s_sharedCount == 0)
s_sharedContext = NULL;
- }
::glXDestroyContext(m_display, m_context);
}
@@ -179,43 +177,35 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
int profileBitES = m_contextProfileMask & GLX_CONTEXT_ES_PROFILE_BIT_EXT;
#endif
- if (!GLXEW_ARB_create_context_profile && profileBitCore) {
+ if (!GLXEW_ARB_create_context_profile && profileBitCore)
fprintf(stderr, "Warning! OpenGL core profile not available.\n");
- }
- if (!GLXEW_ARB_create_context_profile && profileBitCompat) {
+ if (!GLXEW_ARB_create_context_profile && profileBitCompat)
fprintf(stderr, "Warning! OpenGL compatibility profile not available.\n");
- }
#ifdef WITH_GLEW_ES
- if (!GLXEW_EXT_create_context_es_profile && profileBitES && m_contextMajorVersion == 1) {
+ if (!GLXEW_EXT_create_context_es_profile && profileBitES && m_contextMajorVersion == 1)
fprintf(stderr, "Warning! OpenGL ES profile not available.\n");
- }
- if (!GLXEW_EXT_create_context_es2_profile && profileBitES && m_contextMajorVersion == 2) {
+ if (!GLXEW_EXT_create_context_es2_profile && profileBitES && m_contextMajorVersion == 2)
fprintf(stderr, "Warning! OpenGL ES2 profile not available.\n");
- }
#endif
int profileMask = 0;
- if (GLXEW_ARB_create_context_profile && profileBitCore) {
+ if (GLXEW_ARB_create_context_profile && profileBitCore)
profileMask |= profileBitCore;
- }
- if (GLXEW_ARB_create_context_profile && profileBitCompat) {
+ if (GLXEW_ARB_create_context_profile && profileBitCompat)
profileMask |= profileBitCompat;
- }
#ifdef WITH_GLEW_ES
- if (GLXEW_EXT_create_context_es_profile && profileBitES) {
+ if (GLXEW_EXT_create_context_es_profile && profileBitES)
profileMask |= profileBitES;
- }
#endif
- if (profileMask != m_contextProfileMask) {
+ if (profileMask != m_contextProfileMask)
fprintf(stderr, "Warning! Ignoring untested OpenGL context profile mask bits.");
- }
/* max 10 attributes plus terminator */
int attribs
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list