[haiku-commits] haiku: hrev43693 - src/kits/opengl

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 26 Jan 2012 16:31:15 +0100 (CET)

hrev43693 adds 1 changeset to branch 'master'
old head: 24b921a0ca7251bb8e66c0ed3ddf8e0513b932e8
new head: a42877a6e46dfef684c1c8f2a560275972de0cd8

----------------------------------------------------------------------------

a42877a: opengl: Header / whitespace cleanup
  
  * I received the ok via email from Brain Paul at mesa to
    relicense the GLDispatcher sources to MIT + him as the
    author.
  * Update include ordering
  * Remove HAIKU_TARGET_PLATFORM_HAIKU ifdefs for boot options

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev43693
Commit:      a42877a6e46dfef684c1c8f2a560275972de0cd8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a42877a
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Thu Jan 26 15:27:31 2012 UTC

----------------------------------------------------------------------------

6 files changed, 59 insertions(+), 87 deletions(-)
src/kits/opengl/GLDispatcher.cpp     |   63 ++++++++----------------------
src/kits/opengl/GLDispatcher.h       |   17 +++++---
src/kits/opengl/GLRenderer.cpp       |   20 +++++-----
src/kits/opengl/GLRendererRoster.cpp |   36 ++++++-----------
src/kits/opengl/GLRendererRoster.h   |    7 +++-
src/kits/opengl/GLView.cpp           |    3 +-

----------------------------------------------------------------------------

diff --git a/src/kits/opengl/GLDispatcher.cpp b/src/kits/opengl/GLDispatcher.cpp
index 953339b..a222b7f 100644
--- a/src/kits/opengl/GLDispatcher.cpp
+++ b/src/kits/opengl/GLDispatcher.cpp
@@ -1,39 +1,13 @@
-
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
 /*
- * Authors:
- *   Brian Paul <brian@xxxxxxxxxxxxxxxxxxxx>
+ * Copyright 2000-2012 Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
  *
+ * Authors:
+ *             Brian Paul <brian.e.paul@xxxxxxxxx>
  */
 
-extern "C" {
 
+extern "C" {
 #include "glapi.h"
 #if __GNUC__ > 2
 // New Mesa
@@ -41,36 +15,33 @@ extern "C" {
 #include "glapitable.h"
 #endif
 
+
 /*
  * NOTE: this file portion implements C-based dispatch of the OpenGL 
entrypoints
  * (glAccum, glBegin, etc).
  * This code IS NOT USED if we're compiling on an x86 system and using
  * the glapi_x86.S assembly code.
  */
-
 #if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM))
 
 #define KEYWORD1 PUBLIC
-
 #define KEYWORD2
-
 #define NAME(func) gl##func
 
 #define DISPATCH(func, args, msg)                                      \
-   const struct _glapi_table *dispatch;                                        
\
-   dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
-   (dispatch->func) args
+       const struct _glapi_table *dispatch;                                    
\
+       dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
+       (dispatch->func) args
 
 #define RETURN_DISPATCH(func, args, msg)                               \
-   const struct _glapi_table *dispatch;                                        
\
-   dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
-   return (dispatch->func) args
-
-
-#endif /* USE_X86_ASM */
+       const struct _glapi_table *dispatch;                                    
\
+       dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
+       return (dispatch->func) args
 
+#endif
 }
 
+
 /* NOTE: this file portion implement a thin OpenGL entrypoints dispatching
        C++ wrapper class
  */
@@ -81,10 +52,12 @@ BGLDispatcher::BGLDispatcher()
 {
 }
 
+
 BGLDispatcher::~BGLDispatcher()
 {
 }
 
+
 status_t
 BGLDispatcher::CheckTable(const struct _glapi_table *table)
 {
@@ -92,12 +65,10 @@ BGLDispatcher::CheckTable(const struct _glapi_table *table)
        return B_OK;
 }
 
+
 status_t
 BGLDispatcher::SetTable(struct _glapi_table *table)
 {
        _glapi_set_dispatch(table);
        return B_OK;
 }
-
-
-
diff --git a/src/kits/opengl/GLDispatcher.h b/src/kits/opengl/GLDispatcher.h
index 146921a..bb8a4c0 100644
--- a/src/kits/opengl/GLDispatcher.h
+++ b/src/kits/opengl/GLDispatcher.h
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2000-2012 Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Brian Paul <brian.e.paul@xxxxxxxxx>
+ */
 #ifndef GLDISPATCHER_H
 #define GLDISPATCHER_H
 
@@ -12,6 +19,7 @@ extern "C" {
 #include "glapi.h"
 }
 
+
 class BGLDispatcher
 {
                // Private unimplemented copy constructors
@@ -26,7 +34,8 @@ class BGLDispatcher
                void *                                  CurrentContext();
 
                struct _glapi_table *   Table();
-               status_t                                CheckTable(const struct 
_glapi_table *dispatch = NULL);
+               status_t                                CheckTable(
+                                                                       const 
struct _glapi_table *dispatch = NULL);
                status_t                                SetTable(struct 
_glapi_table *dispatch);
                uint32                                  TableSize();
 
@@ -37,6 +46,7 @@ class BGLDispatcher
                uint32                                  OffsetOf(const char 
*functionName);
 };
 
+
 // Inlines methods
 inline void BGLDispatcher::SetCurrentContext(void * context)
 {
@@ -87,8 +97,3 @@ inline uint32 BGLDispatcher::OffsetOf(const char 
*functionName)
 
 
 #endif // GLDISPATCHER_H
-
-
-
-
-
diff --git a/src/kits/opengl/GLRenderer.cpp b/src/kits/opengl/GLRenderer.cpp
index c902085..39399b2 100644
--- a/src/kits/opengl/GLRenderer.cpp
+++ b/src/kits/opengl/GLRenderer.cpp
@@ -4,13 +4,15 @@
  */
 
 
-#include "GLDispatcher.h"
 #include "GLRenderer.h"
 
+#include "GLDispatcher.h"
+
 
 BGLRenderer::BGLRenderer(BGLView *view, ulong glOptions,
-               BGLDispatcher *dispatcher)
-       : fRefCount(1),
+       BGLDispatcher *dispatcher)
+       :
+       fRefCount(1),
        fView(view),
        fOptions(glOptions),
        fDispatcher(dispatcher)
@@ -24,7 +26,7 @@ BGLRenderer::~BGLRenderer()
 }
 
 
-void 
+void
 BGLRenderer::Acquire()
 {
        atomic_add(&fRefCount, 1);
@@ -39,13 +41,13 @@ BGLRenderer::Release()
 }
 
 
-void 
+void
 BGLRenderer::LockGL()
 {
 }
 
 
-void 
+void
 BGLRenderer::UnlockGL()
 {
 }
@@ -77,20 +79,19 @@ BGLRenderer::CopyPixelsIn(BBitmap *source, BPoint dest)
 }
 
 
-
 void
 BGLRenderer::FrameResized(float width, float height)
 {
 }
 
 
-void 
+void
 BGLRenderer::DirectConnected(direct_buffer_info *info)
 {
 }
 
 
-void 
+void
 BGLRenderer::EnableDirectMode(bool enabled)
 {
 }
@@ -101,4 +102,3 @@ status_t BGLRenderer::_Reserved_Renderer_1(int32 n, void 
*p) { return B_ERROR; }
 status_t BGLRenderer::_Reserved_Renderer_2(int32 n, void *p) { return B_ERROR; 
}
 status_t BGLRenderer::_Reserved_Renderer_3(int32 n, void *p) { return B_ERROR; 
}
 status_t BGLRenderer::_Reserved_Renderer_4(int32 n, void *p) { return B_ERROR; 
}
-
diff --git a/src/kits/opengl/GLRendererRoster.cpp 
b/src/kits/opengl/GLRendererRoster.cpp
index dad5302..abd5ae7 100644
--- a/src/kits/opengl/GLRendererRoster.cpp
+++ b/src/kits/opengl/GLRendererRoster.cpp
@@ -1,10 +1,11 @@
 /*
- * Copyright 2006, Haiku, Inc. All Rights Reserved.
+ * Copyright 2006-2012 Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
  */
 
+
 #include <driver_settings.h>
 #include <image.h>
 #include <safemode_defs.h>
@@ -20,13 +21,8 @@
 #include <string.h>
 
 
-#ifdef HAIKU_TARGET_PLATFORM_HAIKU
 extern "C" status_t _kern_get_safemode_option(const char *parameter,
-        char *buffer, size_t *_bufferSize);
-#else
-extern "C" status_t _kget_safemode_option_(const char *parameter,
-        char *buffer, size_t *_bufferSize);
-#endif
+       char *buffer, size_t *_bufferSize);
 
 
 GLRendererRoster::GLRendererRoster(BGLView *view, ulong options)
@@ -39,24 +35,16 @@ GLRendererRoster::GLRendererRoster(BGLView *view, ulong 
options)
        char parameter[32];
        size_t parameterLength = sizeof(parameter);
 
-#ifdef HAIKU_TARGET_PLATFORM_HAIKU
-       if (_kern_get_safemode_option(B_SAFEMODE_SAFE_MODE, parameter, 
&parameterLength) == B_OK)
-#else
-       if (_kget_safemode_option_(B_SAFEMODE_SAFE_MODE, parameter, 
&parameterLength) == B_OK)
-#endif
-       {
+       if (_kern_get_safemode_option(B_SAFEMODE_SAFE_MODE,
+               parameter, &parameterLength) == B_OK) {
                if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, 
"on")
                        || !strcasecmp(parameter, "true") || 
!strcasecmp(parameter, "yes")
                        || !strcasecmp(parameter, "enable") || 
!strcmp(parameter, "1"))
                        fSafeMode = true;
        }
 
-#ifdef HAIKU_TARGET_PLATFORM_HAIKU
-       if (_kern_get_safemode_option(B_SAFEMODE_DISABLE_USER_ADD_ONS, 
parameter, &parameterLength) == B_OK)
-#else
-       if (_kget_safemode_option_(B_SAFEMODE_DISABLE_USER_ADD_ONS, parameter, 
&parameterLength) == B_OK)
-#endif
-       {
+       if (_kern_get_safemode_option(B_SAFEMODE_DISABLE_USER_ADD_ONS,
+               parameter, &parameterLength) == B_OK) {
                if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, 
"on")
                        || !strcasecmp(parameter, "true") || 
!strcasecmp(parameter, "yes")
                        || !strcasecmp(parameter, "enable") || 
!strcmp(parameter, "1"))
@@ -112,7 +100,8 @@ GLRendererRoster::AddDefaultPaths()
                B_SYSTEM_ADDONS_DIRECTORY,
        };
 
-       for (uint32 i = fSafeMode ? 4 : 0; i < sizeof(paths) / 
sizeof(paths[0]); i++) {
+       for (uint32 i = fSafeMode ? 4 : 0;
+               i < sizeof(paths) / sizeof(paths[0]); i++) {
                BPath path;
                status_t status = find_directory(paths[i], &path, true);
                if (status == B_OK && path.Append("opengl") == B_OK)
@@ -204,12 +193,14 @@ GLRendererRoster::CreateRenderer(const entry_ref& ref)
        if (image < B_OK)
                return image;
 
-       BGLRenderer *(*instantiate_renderer)(BGLView *view, ulong options, 
BGLDispatcher *dispatcher);
+       BGLRenderer *(*instantiate_renderer)
+               (BGLView *view, ulong options, BGLDispatcher *dispatcher);
 
        status = get_image_symbol(image, "instantiate_gl_renderer",
                B_SYMBOL_TYPE_TEXT, (void**)&instantiate_renderer);
        if (status == B_OK) {
-               BGLRenderer *renderer = instantiate_renderer(fView, fOptions, 
new BGLDispatcher());
+               BGLRenderer *renderer
+                       = instantiate_renderer(fView, fOptions, new 
BGLDispatcher());
                if (!renderer) {
                        unload_add_on(image);
                        return B_UNSUPPORTED;
@@ -226,4 +217,3 @@ GLRendererRoster::CreateRenderer(const entry_ref& ref)
 
        return status;
 }
-
diff --git a/src/kits/opengl/GLRendererRoster.h 
b/src/kits/opengl/GLRendererRoster.h
index b89bf42..33f23a6 100644
--- a/src/kits/opengl/GLRendererRoster.h
+++ b/src/kits/opengl/GLRendererRoster.h
@@ -1,13 +1,16 @@
 /*
- * Copyright 2006, Haiku, Inc. All Rights Reserved.
+ * Copyright 2006-2012, Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  */
 #ifndef _GLRENDERER_ROSTER_H
 #define _GLRENDERER_ROSTER_H
 
+
 #include <GLRenderer.h>
+
 #include <map>
 
+
 struct renderer_item {
        BGLRenderer     *renderer;
        entry_ref       ref;
@@ -17,6 +20,7 @@ struct renderer_item {
 
 typedef std::map<renderer_id, renderer_item> RendererMap;
 
+
 class GLRendererRoster {
        public:
                GLRendererRoster(BGLView *view, ulong options);
@@ -40,4 +44,5 @@ class GLRendererRoster {
 
 };
 
+
 #endif /* _GLRENDERER_ROSTER_H */
diff --git a/src/kits/opengl/GLView.cpp b/src/kits/opengl/GLView.cpp
index 55881ac..7556764 100644
--- a/src/kits/opengl/GLView.cpp
+++ b/src/kits/opengl/GLView.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2009, Haiku. All rights reserved.
+ * Copyright 2006-2012, Haiku. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -23,6 +23,7 @@
 #include "GLDispatcher.h"
 #include "GLRendererRoster.h"
 
+
 struct glview_direct_info {
        direct_buffer_info *direct_info;
        bool direct_connected;


Other related posts: