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.
*/
#include <stdio.h>
#include <Screen.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)
return NULL;
@ -17,27 +19,28 @@ instanciate_gl_renderer(BGLView *view, ulong options, BGLDispatcher *dispatcher)
BWindow *window = view->Window();
if (!window)
return NULL;
BScreen screen(window);
if (!screen.IsValid())
return NULL;
accelerant_device_info adi;
if (screen.GetDeviceInfo(&adi) !=B_OK)
return NULL;
fprintf(stderr, "Accelerant device info:\n"
" version: %ud\n"
" name: %s\n"
" chipset: %s\n"
" serial#: %s\n", (unsigned int) adi.version, adi.name, adi.chipset, adi.serial_no);
" version: %ud\n"
" name: %s\n"
" chipset: %s\n"
" serial#: %s\n",
(unsigned int) adi.version, adi.name, adi.chipset, adi.serial_no);
flush(stderr);
// Check the view is attached to a screen driven by a NVidia chip:
if (strncmp(adi.name, "Nvidia", 6) == 0) {
// return new NVidiaHardwareRenderer(view, options, dispatcher);
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.
*/
@ -9,45 +9,47 @@
#include <Screen.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) {
printf("view = NULL!\n");
return NULL;
}
BWindow *window = view->Window();
BWindow* window = view->Window();
if (!window) {
printf("view's window = NULL!\n");
return NULL;
}
BScreen screen(window);
if (!screen.IsValid()) {
printf("Failed to get window's screen!\n");
return NULL;
}
accelerant_device_info adi;
if (screen.GetDeviceInfo(&adi) != B_OK) {
printf("screen.GetDeviceInfo() failed!\n");
return NULL;
}
printf("Accelerant device info:\n"
" version: %ud\n"
" name: %s\n"
" chipset: %s\n"
" serial#: %s\n", (unsigned int) adi.version, adi.name, adi.chipset, adi.serial_no);
" version: %ud\n"
" name: %s\n"
" chipset: %s\n"
" 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:
if (strcasecmp(adi.chipset, "radeon") == 0 ||
strcasecmp(adi.chipset, "radeon") == 0) {
// return new RadeonHardwareRenderer(view, options, dispatcher);
return NULL;
}
// We can't be a renderer for this view, sorry.
return NULL;
}