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);
}
/* winsys hooks */
@@ -251,8 +252,7 @@ GalliumContext::GalliumContext(ulong options)
CALLED();
// Make all contexts a known value
context_id i;
for (i = 0; i < CONTEXT_MAX; i++)
for (context_id i = 0; i < CONTEXT_MAX; i++)
fContext[i] = NULL;
CreateScreen();
@@ -267,8 +267,7 @@ GalliumContext::~GalliumContext()
// Destroy our contexts
pipe_mutex_lock(fMutex);
uint32 i;
for (i = 0; i < CONTEXT_MAX; i++)
for (context_id i = 0; i < CONTEXT_MAX; i++)
DestroyContext(i);
pipe_mutex_unlock(fMutex);
@@ -457,8 +456,7 @@ GalliumContext::CreateContext(Bitmap *bitmap)
context_id contextNext = -1;
pipe_mutex_lock(fMutex);
context_id i;
for (i = 0; i < CONTEXT_MAX; i++) {
for (context_id i = 0; i < CONTEXT_MAX; i++) {
if (fContext[i] == NULL) {
fContext[i] = context;
contextNext = i;
@@ -558,7 +556,7 @@ status_t
GalliumContext::SwapBuffers(context_id contextID)
{
CALLED();
pipe_mutex_lock(fMutex);
struct hgl_context *context = fContext[contextID];
pipe_mutex_unlock(fMutex);
@@ -75,7 +75,7 @@ SoftwareRenderer::SoftwareRenderer(BGLView *view, ulong options,
fHeight = (GLint)b.IntegerHeight();
fNewWidth = fWidth;
fNewHeight = fHeight;
_AllocateBitmap();
// Initialize the first "Haiku Software GL Pipe" context
@@ -116,8 +116,10 @@ SoftwareRenderer::LockGL()
BAutolock lock(fInfoLocker);
if (fDirectModeEnabled && fInfo != NULL) {
fNewWidth = fInfo->window_bounds.right - fInfo->window_bounds.left;// + 1;
fNewHeight = fInfo->window_bounds.bottom - fInfo->window_bounds.top;// + 1;
fNewWidth = fInfo->window_bounds.right - fInfo->window_bounds.left;
// + 1;
fNewHeight = fInfo->window_bounds.bottom - fInfo->window_bounds.top;
// + 1;
}
if (fBitmap && cs == fColorSpace && fNewWidth == fWidth
@@ -153,7 +155,7 @@ SoftwareRenderer::SwapBuffers(bool vsync)
// CALLED();
if (!fBitmap)
return;
BScreen screen(GLView()->Window());
fContextObj->SwapBuffers(fContextID);