opengl add-ons: Style cleanup

This commit is contained in:
Alexander von Gluck IV 2012-01-29 09:59:39 -06:00
parent 40ea55295d
commit 9fabc0f6da
2 changed files with 30 additions and 25 deletions

View File

@ -1,15 +1,17 @@
/* /*
* Copyright 2006, Haiku. All rights reserved. * Copyright 2006-2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include <stdio.h> #include <stdio.h>
#include <Screen.h> #include <Screen.h>
#include <GLRenderer.h> #include <GLRenderer.h>
extern "C" _EXPORT BGLRenderer *
instanciate_gl_renderer(BGLView *view, ulong options, BGLDispatcher *dispatcher) extern "C" _EXPORT BGLRenderer*
instanciate_gl_renderer(BGLView* view, ulong options, BGLDispatcher* dispatcher)
{ {
if (!view) if (!view)
return NULL; return NULL;
@ -17,27 +19,28 @@ instanciate_gl_renderer(BGLView *view, ulong options, BGLDispatcher *dispatcher)
BWindow *window = view->Window(); BWindow *window = view->Window();
if (!window) if (!window)
return NULL; return NULL;
BScreen screen(window); BScreen screen(window);
if (!screen.IsValid()) if (!screen.IsValid())
return NULL; return NULL;
accelerant_device_info adi; accelerant_device_info adi;
if (screen.GetDeviceInfo(&adi) !=B_OK) if (screen.GetDeviceInfo(&adi) !=B_OK)
return NULL; return NULL;
fprintf(stderr, "Accelerant device info:\n" fprintf(stderr, "Accelerant device info:\n"
" version: %ud\n" " version: %ud\n"
" name: %s\n" " name: %s\n"
" chipset: %s\n" " chipset: %s\n"
" serial#: %s\n", (unsigned int) adi.version, adi.name, adi.chipset, adi.serial_no); " serial#: %s\n",
(unsigned int) adi.version, adi.name, adi.chipset, adi.serial_no);
flush(stderr); flush(stderr);
// Check the view is attached to a screen driven by a NVidia chip: // Check the view is attached to a screen driven by a NVidia chip:
if (strncmp(adi.name, "Nvidia", 6) == 0) { if (strncmp(adi.name, "Nvidia", 6) == 0) {
// return new NVidiaHardwareRenderer(view, options, dispatcher); // return new NVidiaHardwareRenderer(view, options, dispatcher);
return NULL; return NULL;
} }
return NULL; return NULL;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2006, Haiku. All rights reserved. * Copyright 2006-2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@ -9,45 +9,47 @@
#include <Screen.h> #include <Screen.h>
#include <GLRenderer.h> #include <GLRenderer.h>
extern "C" _EXPORT BGLRenderer *
instanciate_gl_renderer(BGLView *view, ulong options, BGLDispatcher *dispatcher) extern "C" _EXPORT BGLRenderer*
instanciate_gl_renderer(BGLView* view, ulong options, BGLDispatcher* dispatcher)
{ {
if (!view) { if (!view) {
printf("view = NULL!\n"); printf("view = NULL!\n");
return NULL; return NULL;
} }
BWindow *window = view->Window(); BWindow* window = view->Window();
if (!window) { if (!window) {
printf("view's window = NULL!\n"); printf("view's window = NULL!\n");
return NULL; return NULL;
} }
BScreen screen(window); BScreen screen(window);
if (!screen.IsValid()) { if (!screen.IsValid()) {
printf("Failed to get window's screen!\n"); printf("Failed to get window's screen!\n");
return NULL; return NULL;
} }
accelerant_device_info adi; accelerant_device_info adi;
if (screen.GetDeviceInfo(&adi) != B_OK) { if (screen.GetDeviceInfo(&adi) != B_OK) {
printf("screen.GetDeviceInfo() failed!\n"); printf("screen.GetDeviceInfo() failed!\n");
return NULL; return NULL;
} }
printf("Accelerant device info:\n" printf("Accelerant device info:\n"
" version: %ud\n" " version: %ud\n"
" name: %s\n" " name: %s\n"
" chipset: %s\n" " chipset: %s\n"
" serial#: %s\n", (unsigned int) adi.version, adi.name, adi.chipset, adi.serial_no); " serial#: %s\n",
(unsigned int) adi.version, adi.name, adi.chipset, adi.serial_no);
// Check the view is attached to a screen driven by a Radeon chip: // Check the view is attached to a screen driven by a Radeon chip:
if (strcasecmp(adi.chipset, "radeon") == 0 || if (strcasecmp(adi.chipset, "radeon") == 0 ||
strcasecmp(adi.chipset, "radeon") == 0) { strcasecmp(adi.chipset, "radeon") == 0) {
// return new RadeonHardwareRenderer(view, options, dispatcher); // return new RadeonHardwareRenderer(view, options, dispatcher);
return NULL; return NULL;
} }
// We can't be a renderer for this view, sorry. // We can't be a renderer for this view, sorry.
return NULL; return NULL;
} }