[Bf-blender-cvs] [c005ef9] soc-2014-viewport_context: Cleanup: style

Campbell Barton noreply at git.blender.org
Thu Jul 24 14:21:12 CEST 2014


Commit: c005ef9fe746df5be291561f38490b15eec41fa8
Author: Campbell Barton
Date:   Thu Jul 24 22:19:29 2014 +1000
Branches: soc-2014-viewport_context
https://developer.blender.org/rBc005ef9fe746df5be291561f38490b15eec41fa8

Cleanup: style

===================================================================

M	intern/ghost/intern/GHOST_Context.cpp
M	intern/ghost/intern/GHOST_Context.h
M	intern/ghost/intern/GHOST_ContextCGL.h
M	intern/ghost/intern/GHOST_ContextCGL.mm
M	intern/ghost/intern/GHOST_ContextEGL.cpp
M	intern/ghost/intern/GHOST_ContextEGL.h
M	intern/ghost/intern/GHOST_ContextGLX.cpp
M	intern/ghost/intern/GHOST_ContextGLX.h
M	intern/ghost/intern/GHOST_ContextNone.cpp
M	intern/ghost/intern/GHOST_ContextNone.h
M	intern/ghost/intern/GHOST_ContextWGL.cpp
M	intern/ghost/intern/GHOST_ContextWGL.h

===================================================================

diff --git a/intern/ghost/intern/GHOST_Context.cpp b/intern/ghost/intern/GHOST_Context.cpp
index 346ceb3..d5c6f2c 100644
--- a/intern/ghost/intern/GHOST_Context.cpp
+++ b/intern/ghost/intern/GHOST_Context.cpp
@@ -41,8 +41,7 @@
 #include <cstring>
 
 
-
-static const char* get_glew_error_message_string(GLenum error)
+static const char *get_glew_error_message_string(GLenum error)
 {
 	switch (error) {
 		case GLEW_OK: /* also GLEW_NO_ERROR */
@@ -77,8 +76,7 @@ static const char* get_glew_error_message_string(GLenum error)
 }
 
 
-
-static const char* get_glew_error_enum_string(GLenum error)
+static const char *get_glew_error_enum_string(GLenum error)
 {
 	switch (error) {
 		_CASE_CODE_RETURN_STR(GLEW_OK) /* also GLEW_NO_ERROR */
@@ -97,30 +95,24 @@ static const char* get_glew_error_enum_string(GLenum error)
 }
 
 
-
-GLenum glew_chk(GLenum error, const char* file, int line, const char* text)
+GLenum glew_chk(GLenum error, const char *file, int line, const char *text)
 {
 	if (error != GLEW_OK) {
-		const char* code = get_glew_error_enum_string(error);
-		const char* msg  = get_glew_error_message_string(error);
+		const char *code = get_glew_error_enum_string(error);
+		const char *msg  = get_glew_error_message_string(error);
 
 #ifndef NDEBUG
-		fprintf(
-			stderr,
-			"%s(%d):[%s] -> GLEW Error (0x%04X): %s: %s\n",
-			file,
-			line,
-			text,
-			error,
-			code ? code : "<no symbol>",
-			msg  ? msg  : "<no message>");
+		fprintf(stderr,
+		        "%s(%d):[%s] -> GLEW Error (0x%04X): %s: %s\n",
+		        file, line, text, error,
+		        code ? code : "<no symbol>",
+		        msg  ? msg  : "<no message>");
 #else
-		fprintf(
-			stderr,
-			"GLEW Error (%04X): %s: %s\n",
-			error,
-			code ? code : "<no symbol>",
-			msg  ? msg  : "<no message>");
+		fprintf(stderr,
+		        "GLEW Error (%04X): %s: %s\n",
+		        error,
+		        code ? code : "<no symbol>",
+		        msg  ? msg  : "<no message>");
 #endif
 	}
 
@@ -128,17 +120,16 @@ GLenum glew_chk(GLenum error, const char* file, int line, const char* text)
 }
 
 
-
 #ifdef _WIN32
 
-bool win32_chk(bool result, const char* file, int line, const char* text)
+bool win32_chk(bool result, const char *file, int line, const char *text)
 {
 	if (!result) {
 		LPTSTR formattedMsg = NULL;
 
 		DWORD error = GetLastError();
 
-		const char* msg;
+		const char *msg;
 
 		DWORD count = 0;
 
@@ -221,7 +212,6 @@ bool win32_chk(bool result, const char* file, int line, const char* text)
 #endif // _WIN32
 
 
-
 void GHOST_Context::initContextGLEW()
 {
 	mxDestroyContext(m_glewContext); // no-op if m_glewContext is NULL
@@ -234,7 +224,6 @@ void GHOST_Context::initContextGLEW()
 }
 
 
-
 void GHOST_Context::initClearGL()
 {
 	glClearColor(0.447, 0.447, 0.447, 0.000);
diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h
index b412491..a81720b 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -50,9 +50,9 @@ public:
 	 * \param numOfAASamples	Number of samples used for AA (zero if no AA)
 	 */
 	GHOST_Context(bool stereoVisual, GHOST_TUns16 numOfAASamples)
-		: m_stereoVisual  (stereoVisual)
-		, m_numOfAASamples(numOfAASamples)
-		, m_glewContext(NULL)
+	    : m_stereoVisual(stereoVisual),
+	      m_numOfAASamples(numOfAASamples),
+	      m_glewContext(NULL)
 	{}
 
 	/**
@@ -140,13 +140,13 @@ protected:
 	static void initClearGL();
 
 private:
-	GLEWContext* m_glewContext;
+	GLEWContext *m_glewContext;
 
 };
 
 
 
-GLenum glew_chk(GLenum error, const char* file, int line, const char* text);
+GLenum glew_chk(GLenum error, const char *file, int line, const char *text);
 
 #ifndef NDEBUG
 #  define GLEW_CHK(x) glew_chk((x), __FILE__, __LINE__, #x)
@@ -158,7 +158,7 @@ GLenum glew_chk(GLenum error, const char* file, int line, const char* text);
 
 #ifdef _WIN32
 
-bool win32_chk(bool result, const char* file = NULL, int line = 0, const char* text = NULL);
+bool win32_chk(bool result, const char *file = NULL, int line = 0, const char *text = NULL);
 
 #  ifndef NDEBUG
 #    define WIN32_CHK(x) win32_chk((x), __FILE__, __LINE__, #x)
diff --git a/intern/ghost/intern/GHOST_ContextCGL.h b/intern/ghost/intern/GHOST_ContextCGL.h
index 1ea9e28..d6e820a 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.h
+++ b/intern/ghost/intern/GHOST_ContextCGL.h
@@ -37,7 +37,7 @@
 
 //#define cglewGetContext() cglewContext
 //#include <GL/cglew.h>
-//extern "C" CGLEWContext* cglewContext;
+//extern "C" CGLEWContext *cglewContext;
 
 
 
@@ -64,16 +64,15 @@ public:
 	 * Constructor.
 	 */
 	GHOST_ContextCGL(
-		bool          stereoVisual,
-		GHOST_TUns16  numOfAASamples,
-		NSWindow     *window,
-		NSOpenGLView *openGLView,
-		int           contextProfileMask,
-		int           contextMajorVersion,
-		int           contextMinorVersion,
-		int           contextFlags,
-		int           contextResetNotificationStrategy
-	);
+	        bool stereoVisual,
+	        GHOST_TUns16 numOfAASamples,
+	        NSWindow *window,
+	        NSOpenGLView *openGLView,
+	        int contextProfileMask,
+	        int contextMajorVersion,
+	        int contextMinorVersion,
+	        int contextFlags,
+	        int contextResetNotificationStrategy);
 
 
 	/**
@@ -149,7 +148,7 @@ private:
 	/** The opgnGL drawing context */
 	NSOpenGLContext *m_openGLContext;
 	
-	//static CGLEWContext* s_cglewContext;
+	//static CGLEWContext *s_cglewContext;
 
 	/** The first created OpenGL context (for sharing display lists) */
 	static NSOpenGLContext *s_sharedOpenGLContext;	
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index f030b98..8d6075e 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -44,31 +44,29 @@
 
 
 
-NSOpenGLContext *GHOST_ContextCGL::s_sharedOpenGLContext = nil;	
+NSOpenGLContext *GHOST_ContextCGL::s_sharedOpenGLContext = nil;
 int              GHOST_ContextCGL::s_sharedCount         = 0;
 
 
-
 GHOST_ContextCGL::GHOST_ContextCGL(
-	bool          stereoVisual,
-	GHOST_TUns16  numOfAASamples,
-	NSWindow     *window,
-	NSOpenGLView *openGLView,
-	int           contextProfileMask,
-	int           contextMajorVersion,
-	int           contextMinorVersion,
-	int           contextFlags,
-	int           contextResetNotificationStrategy
-)
-	: GHOST_Context(stereoVisual, numOfAASamples)
-	, m_window    (window)
-	, m_openGLView(openGLView)
-	, m_contextProfileMask              (contextProfileMask)
-	, m_contextMajorVersion             (contextMajorVersion)
-	, m_contextMinorVersion             (contextMinorVersion)
-	, m_contextFlags                    (contextFlags)
-	, m_contextResetNotificationStrategy(contextResetNotificationStrategy)
-	, m_openGLContext(nil)
+        bool stereoVisual,
+        GHOST_TUns16  numOfAASamples,
+        NSWindow *window,
+        NSOpenGLView *openGLView,
+        int contextProfileMask,
+        int contextMajorVersion,
+        int contextMinorVersion,
+        int contextFlags,
+        int contextResetNotificationStrategy)
+    : GHOST_Context(stereoVisual, numOfAASamples),
+      m_window(window),
+      m_openGLView(openGLView),
+      m_contextProfileMask(contextProfileMask),
+      m_contextMajorVersion(contextMajorVersion),
+      m_contextMinorVersion(contextMinorVersion),
+      m_contextFlags(contextFlags),
+      m_contextResetNotificationStrategy(contextResetNotificationStrategy),
+      m_openGLContext(nil)
 {
 	assert(window != nil);
 	assert(openGLView != nil);
@@ -128,7 +126,7 @@ GHOST_TSuccess GHOST_ContextCGL::setSwapInterval(int interval)
 
 
 
-GHOST_TSuccess GHOST_ContextCGL::getSwapInterval(int& intervalOut)
+GHOST_TSuccess GHOST_ContextCGL::getSwapInterval(int &intervalOut)
 {
 	if (m_openGLContext != nil) {
 		GLint interval;
@@ -184,11 +182,11 @@ GHOST_TSuccess GHOST_ContextCGL::updateDrawingContext()
 
 
 static void makeAttribList(
-	std::vector<NSOpenGLPixelFormatAttribute>& attribs,
-	bool stereoVisual,
-	int  numOfAASamples,
-	bool needAlpha,
-	bool needStencil)
+        std::vector<NSOpenGLPixelFormatAttribute>& attribs,
+        bool stereoVisual,
+        int numOfAASamples,
+        bool needAlpha,
+        bool needStencil)
 {
 	// Pixel Format Attributes for the windowed NSOpenGLContext
 	attribs.push_back(NSOpenGLPFADoubleBuffer);
@@ -292,11 +290,10 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
 		[pixelFormat getValues:&actualSamples forAttribute:NSOpenGLPFASamples forVirtualScreen:0];
 
 		if (m_numOfAASamples != (GHOST_TUns16)actualSamples) {
-			fprintf(
-				stderr,
-				"Warning! Unable to find a multisample pixel format that supports exactly %d samples. Substituting one that uses %d samples.\n",
-				m_numOfAASamples,
-				actualSamples);
+			fprintf(stderr,
+			        "Warning! Unable to find a multisample pixel format that supports exactly %d samples. "
+			        "Substituting one that uses %d samples.\n",
+			        m_numOfAASamples, actualSamples);
 
 			m_numOfAASamples = (GHOST_TUns16)actualSamples;
 		}
diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 42cd87d..ec51790 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -40,12 +40,10 @@
 #include <cstdio>
 
 
+EGLEWContext *eglewContext = NULL;
 
-EGLEWContext* eglewContext = NULL;
 
-
-
-static const char* get_egl_error_enum_string(EGLenum error)
+static const char *get_egl_error_enum_string(EGLenum error)
 {
 	switch(error) {
 		_CASE_CODE_RETURN_STR(EGL_SUCCESS)
@@ -68,17 +66,19 @@ static const char* get_egl_error_enum_string(EGLenum error)
 	}
 }
 
-static const char* get_egl_error_message_string(EGLenum error)
+static const char *get_egl_error_message_string(EGLenum error)
 {
 	switch(error) {
 		case EGL_SUCCESS:
 			return "The last function succeeded without error.";
 
 		case EGL_NOT_INITIALIZED:
-			return "EGL is not initialized, or could not be initialized, for the specified EGL display connection.";
+			return ("EGL is not initialized, or could not be initialized, "
+			        "for the specified EGL display connection.");
 
 		case EGL_BAD_ACCESS:
-			return "EGL cannot access a requested resource (for exam

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list