swpipe: General cleanup

* Ensure context_id type is used constantly
* Put typedef of var in for loops in statement
* Clean up a few lines over 80
* Thanks korli!
This commit is contained in:
Alexander von Gluck IV
2012-11-28 09:24:41 -06:00
parent b8bb5c500a
commit 47038ab6ef
2 changed files with 11 additions and 11 deletions
+5 -7
View File
@@ -135,6 +135,7 @@ round_up(unsigned n, unsigned multiple)
return (n + multiple - 1) & ~(multiple - 1); return (n + multiple - 1) & ~(multiple - 1);
} }
/* winsys hooks */ /* winsys hooks */
@@ -251,8 +252,7 @@ GalliumContext::GalliumContext(ulong options)
CALLED(); CALLED();
// Make all contexts a known value // Make all contexts a known value
context_id i; for (context_id i = 0; i < CONTEXT_MAX; i++)
for (i = 0; i < CONTEXT_MAX; i++)
fContext[i] = NULL; fContext[i] = NULL;
CreateScreen(); CreateScreen();
@@ -267,8 +267,7 @@ GalliumContext::~GalliumContext()
// Destroy our contexts // Destroy our contexts
pipe_mutex_lock(fMutex); pipe_mutex_lock(fMutex);
uint32 i; for (context_id i = 0; i < CONTEXT_MAX; i++)
for (i = 0; i < CONTEXT_MAX; i++)
DestroyContext(i); DestroyContext(i);
pipe_mutex_unlock(fMutex); pipe_mutex_unlock(fMutex);
@@ -457,8 +456,7 @@ GalliumContext::CreateContext(Bitmap *bitmap)
context_id contextNext = -1; context_id contextNext = -1;
pipe_mutex_lock(fMutex); pipe_mutex_lock(fMutex);
context_id i; for (context_id i = 0; i < CONTEXT_MAX; i++) {
for (i = 0; i < CONTEXT_MAX; i++) {
if (fContext[i] == NULL) { if (fContext[i] == NULL) {
fContext[i] = context; fContext[i] = context;
contextNext = i; contextNext = i;
@@ -558,7 +556,7 @@ status_t
GalliumContext::SwapBuffers(context_id contextID) GalliumContext::SwapBuffers(context_id contextID)
{ {
CALLED(); CALLED();
pipe_mutex_lock(fMutex); pipe_mutex_lock(fMutex);
struct hgl_context *context = fContext[contextID]; struct hgl_context *context = fContext[contextID];
pipe_mutex_unlock(fMutex); pipe_mutex_unlock(fMutex);
@@ -75,7 +75,7 @@ SoftwareRenderer::SoftwareRenderer(BGLView *view, ulong options,
fHeight = (GLint)b.IntegerHeight(); fHeight = (GLint)b.IntegerHeight();
fNewWidth = fWidth; fNewWidth = fWidth;
fNewHeight = fHeight; fNewHeight = fHeight;
_AllocateBitmap(); _AllocateBitmap();
// Initialize the first "Haiku Software GL Pipe" context // Initialize the first "Haiku Software GL Pipe" context
@@ -116,8 +116,10 @@ SoftwareRenderer::LockGL()
BAutolock lock(fInfoLocker); BAutolock lock(fInfoLocker);
if (fDirectModeEnabled && fInfo != NULL) { if (fDirectModeEnabled && fInfo != NULL) {
fNewWidth = fInfo->window_bounds.right - fInfo->window_bounds.left;// + 1; fNewWidth = fInfo->window_bounds.right - fInfo->window_bounds.left;
fNewHeight = fInfo->window_bounds.bottom - fInfo->window_bounds.top;// + 1; // + 1;
fNewHeight = fInfo->window_bounds.bottom - fInfo->window_bounds.top;
// + 1;
} }
if (fBitmap && cs == fColorSpace && fNewWidth == fWidth if (fBitmap && cs == fColorSpace && fNewWidth == fWidth
@@ -153,7 +155,7 @@ SoftwareRenderer::SwapBuffers(bool vsync)
// CALLED(); // CALLED();
if (!fBitmap) if (!fBitmap)
return; return;
BScreen screen(GLView()->Window()); BScreen screen(GLView()->Window());
fContextObj->SwapBuffers(fContextID); fContextObj->SwapBuffers(fContextID);