Whitespace and formatting cleanups.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2832 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -74,7 +74,7 @@ TFB_PreInit (void)
|
|||||||
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
|
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
|
||||||
if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1))
|
if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1))
|
||||||
{
|
{
|
||||||
log_add (log_Fatal, "Could not initialize SDL: %s.", SDL_GetError());
|
log_add (log_Fatal, "Could not initialize SDL: %s.", SDL_GetError ());
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,8 @@ TFB_ReInitGraphics (int driver, int flags, int width, int height)
|
|||||||
int togglefullscreen = 0;
|
int togglefullscreen = 0;
|
||||||
char caption[200];
|
char caption[200];
|
||||||
|
|
||||||
if (GfxFlags == (flags ^ TFB_GFXFLAGS_FULLSCREEN) && driver == GraphicsDriver &&
|
if (GfxFlags == (flags ^ TFB_GFXFLAGS_FULLSCREEN) &&
|
||||||
|
driver == GraphicsDriver &&
|
||||||
width == ScreenWidthActual && height == ScreenHeightActual)
|
width == ScreenWidthActual && height == ScreenHeightActual)
|
||||||
{
|
{
|
||||||
togglefullscreen = 1;
|
togglefullscreen = 1;
|
||||||
@@ -97,17 +98,20 @@ TFB_ReInitGraphics (int driver, int flags, int width, int height)
|
|||||||
if (driver == TFB_GFXDRIVER_SDL_OPENGL)
|
if (driver == TFB_GFXDRIVER_SDL_OPENGL)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
result = TFB_GL_ConfigureVideo (driver, flags, width, height, togglefullscreen);
|
result = TFB_GL_ConfigureVideo (driver, flags, width, height,
|
||||||
|
togglefullscreen);
|
||||||
#else
|
#else
|
||||||
driver = TFB_GFXDRIVER_SDL_PURE;
|
driver = TFB_GFXDRIVER_SDL_PURE;
|
||||||
log_add (log_Warning, "OpenGL support not compiled in,"
|
log_add (log_Warning, "OpenGL support not compiled in,"
|
||||||
" so using pure SDL driver");
|
" so using pure SDL driver");
|
||||||
result = TFB_Pure_ConfigureVideo (driver, flags, width, height, togglefullscreen);
|
result = TFB_Pure_ConfigureVideo (driver, flags, width, height,
|
||||||
|
togglefullscreen);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = TFB_Pure_ConfigureVideo (driver, flags, width, height, togglefullscreen);
|
result = TFB_Pure_ConfigureVideo (driver, flags, width, height,
|
||||||
|
togglefullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf (caption, "The Ur-Quan Masters v%d.%d.%d%s",
|
sprintf (caption, "The Ur-Quan Masters v%d.%d.%d%s",
|
||||||
@@ -219,7 +223,8 @@ TFB_ProcessEvents ()
|
|||||||
{
|
{
|
||||||
int flags = GfxFlags ^ TFB_GFXFLAGS_FULLSCREEN;
|
int flags = GfxFlags ^ TFB_GFXFLAGS_FULLSCREEN;
|
||||||
FlushInput ();
|
FlushInput ();
|
||||||
TFB_ReInitGraphics (GraphicsDriver, flags, ScreenWidthActual, ScreenHeightActual);
|
TFB_ReInitGraphics (GraphicsDriver, flags, ScreenWidthActual,
|
||||||
|
ScreenHeightActual);
|
||||||
TFB_SwapBuffers (TFB_REDRAW_YES);
|
TFB_SwapBuffers (TFB_REDRAW_YES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,16 +270,16 @@ TFB_SwapBuffers (int force_full_redraw)
|
|||||||
last_fade_amount == 255 && last_transition_amount == 255)
|
last_fade_amount == 255 && last_transition_amount == 255)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (force_full_redraw == TFB_REDRAW_NO && (fade_amount != 255 || transition_amount != 255 ||
|
if (force_full_redraw == TFB_REDRAW_NO &&
|
||||||
|
(fade_amount != 255 || transition_amount != 255 ||
|
||||||
last_fade_amount != 255 || last_transition_amount != 255))
|
last_fade_amount != 255 || last_transition_amount != 255))
|
||||||
{
|
|
||||||
force_full_redraw = TFB_REDRAW_FADING;
|
force_full_redraw = TFB_REDRAW_FADING;
|
||||||
}
|
|
||||||
|
|
||||||
last_fade_amount = fade_amount;
|
last_fade_amount = fade_amount;
|
||||||
last_transition_amount = transition_amount;
|
last_transition_amount = transition_amount;
|
||||||
|
|
||||||
graphics_backend->preprocess (force_full_redraw, transition_amount, fade_amount);
|
graphics_backend->preprocess (force_full_redraw, transition_amount,
|
||||||
|
fade_amount);
|
||||||
graphics_backend->screen (TFB_SCREEN_MAIN, 255, NULL);
|
graphics_backend->screen (TFB_SCREEN_MAIN, 255, NULL);
|
||||||
|
|
||||||
if (transition_amount != 255)
|
if (transition_amount != 255)
|
||||||
@@ -305,7 +310,7 @@ TFB_SwapBuffers (int force_full_redraw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Probably ought to clean this away at some point. */
|
/* Probably ought to clean this away at some point. */
|
||||||
SDL_Surface*
|
SDL_Surface *
|
||||||
TFB_DisplayFormatAlpha (SDL_Surface *surface)
|
TFB_DisplayFormatAlpha (SDL_Surface *surface)
|
||||||
{
|
{
|
||||||
SDL_Surface* newsurf;
|
SDL_Surface* newsurf;
|
||||||
@@ -373,32 +378,32 @@ void TFB_BlitSurface (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
|
|||||||
|
|
||||||
srcx = srcrect->x;
|
srcx = srcrect->x;
|
||||||
w = srcrect->w;
|
w = srcrect->w;
|
||||||
if(srcx < 0)
|
if (srcx < 0)
|
||||||
{
|
{
|
||||||
w += srcx;
|
w += srcx;
|
||||||
dstrect->x -= srcx;
|
dstrect->x -= srcx;
|
||||||
srcx = 0;
|
srcx = 0;
|
||||||
}
|
}
|
||||||
maxw = src->w - srcx;
|
maxw = src->w - srcx;
|
||||||
if(maxw < w)
|
if (maxw < w)
|
||||||
w = maxw;
|
w = maxw;
|
||||||
|
|
||||||
srcy = srcrect->y;
|
srcy = srcrect->y;
|
||||||
h = srcrect->h;
|
h = srcrect->h;
|
||||||
if(srcy < 0)
|
if (srcy < 0)
|
||||||
{
|
{
|
||||||
h += srcy;
|
h += srcy;
|
||||||
dstrect->y -= srcy;
|
dstrect->y -= srcy;
|
||||||
srcy = 0;
|
srcy = 0;
|
||||||
}
|
}
|
||||||
maxh = src->h - srcy;
|
maxh = src->h - srcy;
|
||||||
if(maxh < h)
|
if (maxh < h)
|
||||||
h = maxh;
|
h = maxh;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
srcx = srcy = 0;
|
srcx = 0;
|
||||||
|
srcy = 0;
|
||||||
w = src->w;
|
w = src->w;
|
||||||
h = src->h;
|
h = src->h;
|
||||||
}
|
}
|
||||||
@@ -409,25 +414,25 @@ void TFB_BlitSurface (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
|
|||||||
int dx, dy;
|
int dx, dy;
|
||||||
|
|
||||||
dx = clip->x - dstrect->x;
|
dx = clip->x - dstrect->x;
|
||||||
if(dx > 0)
|
if (dx > 0)
|
||||||
{
|
{
|
||||||
w -= dx;
|
w -= dx;
|
||||||
dstrect->x += dx;
|
dstrect->x += dx;
|
||||||
srcx += dx;
|
srcx += dx;
|
||||||
}
|
}
|
||||||
dx = dstrect->x + w - clip->x - clip->w;
|
dx = dstrect->x + w - clip->x - clip->w;
|
||||||
if(dx > 0)
|
if (dx > 0)
|
||||||
w -= dx;
|
w -= dx;
|
||||||
|
|
||||||
dy = clip->y - dstrect->y;
|
dy = clip->y - dstrect->y;
|
||||||
if(dy > 0)
|
if (dy > 0)
|
||||||
{
|
{
|
||||||
h -= dy;
|
h -= dy;
|
||||||
dstrect->y += dy;
|
dstrect->y += dy;
|
||||||
srcy += dy;
|
srcy += dy;
|
||||||
}
|
}
|
||||||
dy = dstrect->y + h - clip->y - clip->h;
|
dy = dstrect->y + h - clip->y - clip->h;
|
||||||
if(dy > 0)
|
if (dy > 0)
|
||||||
h -= dy;
|
h -= dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -623,7 +628,8 @@ TFB_FlushGraphics () // Only call from main thread!!
|
|||||||
(current_fade == 255 && last_fade != 255) ||
|
(current_fade == 255 && last_fade != 255) ||
|
||||||
(current_transition == 255 && last_transition != 255))
|
(current_transition == 255 && last_transition != 255))
|
||||||
{
|
{
|
||||||
TFB_SwapBuffers (TFB_REDRAW_FADING); // if fading, redraw every frame
|
TFB_SwapBuffers (TFB_REDRAW_FADING);
|
||||||
|
// if fading, redraw every frame
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -812,11 +818,11 @@ TFB_FlushGraphics () // Only call from main thread!!
|
|||||||
r.y = TFB_BBox.clip.corner.y = DC.data.scissor.y;
|
r.y = TFB_BBox.clip.corner.y = DC.data.scissor.y;
|
||||||
r.w = TFB_BBox.clip.extent.width = DC.data.scissor.w;
|
r.w = TFB_BBox.clip.extent.width = DC.data.scissor.w;
|
||||||
r.h = TFB_BBox.clip.extent.height = DC.data.scissor.h;
|
r.h = TFB_BBox.clip.extent.height = DC.data.scissor.h;
|
||||||
SDL_SetClipRect(SDL_Screens[0], &r);
|
SDL_SetClipRect (SDL_Screens[0], &r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TFB_DRAWCOMMANDTYPE_SCISSORDISABLE:
|
case TFB_DRAWCOMMANDTYPE_SCISSORDISABLE:
|
||||||
SDL_SetClipRect(SDL_Screens[0], NULL);
|
SDL_SetClipRect (SDL_Screens[0], NULL);
|
||||||
TFB_BBox.clip.corner.x = 0;
|
TFB_BBox.clip.corner.x = 0;
|
||||||
TFB_BBox.clip.corner.y = 0;
|
TFB_BBox.clip.corner.y = 0;
|
||||||
TFB_BBox.clip.extent.width = ScreenWidth;
|
TFB_BBox.clip.extent.width = ScreenWidth;
|
||||||
@@ -842,7 +848,7 @@ TFB_FlushGraphics () // Only call from main thread!!
|
|||||||
|
|
||||||
dest.x = 0;
|
dest.x = 0;
|
||||||
dest.y = 0;
|
dest.y = 0;
|
||||||
SDL_BlitSurface(SDL_Screens[DC.data.copytoimage.srcBuffer],
|
SDL_BlitSurface (SDL_Screens[DC.data.copytoimage.srcBuffer],
|
||||||
&src, DC_image->NormalImg, &dest);
|
&src, DC_image->NormalImg, &dest);
|
||||||
UnlockMutex (DC_image->mutex);
|
UnlockMutex (DC_image->mutex);
|
||||||
break;
|
break;
|
||||||
@@ -861,14 +867,14 @@ TFB_FlushGraphics () // Only call from main thread!!
|
|||||||
TFB_BBox_RegisterPoint (src.x + src.w, src.y + src.h);
|
TFB_BBox_RegisterPoint (src.x + src.w, src.y + src.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_BlitSurface(SDL_Screens[DC.data.copy.srcBuffer], &src,
|
SDL_BlitSurface (SDL_Screens[DC.data.copy.srcBuffer], &src,
|
||||||
SDL_Screens[DC.data.copy.destBuffer], &dest);
|
SDL_Screens[DC.data.copy.destBuffer], &dest);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TFB_DRAWCOMMANDTYPE_DELETEIMAGE:
|
case TFB_DRAWCOMMANDTYPE_DELETEIMAGE:
|
||||||
{
|
{
|
||||||
TFB_Image *DC_image = (TFB_Image *)DC.data.deleteimage.image;
|
TFB_Image *DC_image = (TFB_Image *)DC.data.deleteimage.image;
|
||||||
TFB_DrawImage_Delete(DC_image);
|
TFB_DrawImage_Delete (DC_image);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TFB_DRAWCOMMANDTYPE_DELETEDATA:
|
case TFB_DRAWCOMMANDTYPE_DELETEDATA:
|
||||||
@@ -883,16 +889,20 @@ TFB_FlushGraphics () // Only call from main thread!!
|
|||||||
case TFB_DRAWCOMMANDTYPE_REINITVIDEO:
|
case TFB_DRAWCOMMANDTYPE_REINITVIDEO:
|
||||||
{
|
{
|
||||||
int oldDriver = GraphicsDriver;
|
int oldDriver = GraphicsDriver;
|
||||||
if (TFB_ReInitGraphics (DC.data.reinitvideo.driver, DC.data.reinitvideo.flags,
|
if (TFB_ReInitGraphics (DC.data.reinitvideo.driver,
|
||||||
|
DC.data.reinitvideo.flags,
|
||||||
DC.data.reinitvideo.width, DC.data.reinitvideo.height))
|
DC.data.reinitvideo.width, DC.data.reinitvideo.height))
|
||||||
{
|
{
|
||||||
log_add (log_Error, "Could not provide requested mode: "
|
log_add (log_Error, "Could not provide requested mode: "
|
||||||
"reverting to last known driver.");
|
"reverting to last known driver.");
|
||||||
if (TFB_ReInitGraphics (oldDriver, DC.data.reinitvideo.flags,
|
if (TFB_ReInitGraphics (oldDriver,
|
||||||
DC.data.reinitvideo.width, DC.data.reinitvideo.height))
|
DC.data.reinitvideo.flags,
|
||||||
|
DC.data.reinitvideo.width,
|
||||||
|
DC.data.reinitvideo.height))
|
||||||
{
|
{
|
||||||
log_add (log_Fatal, "Couldn't reinit at that point either."
|
log_add (log_Fatal,
|
||||||
" Your video has been somehow tied in knots.");
|
"Couldn't reinit at that point either. "
|
||||||
|
"Your video has been somehow tied in knots.");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -902,9 +912,7 @@ TFB_FlushGraphics () // Only call from main thread!!
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (livelock_deterrence)
|
if (livelock_deterrence)
|
||||||
{
|
|
||||||
Unlock_DCQ ();
|
Unlock_DCQ ();
|
||||||
}
|
|
||||||
|
|
||||||
TFB_SwapBuffers (TFB_REDRAW_NO);
|
TFB_SwapBuffers (TFB_REDRAW_NO);
|
||||||
RenderedFrames++;
|
RenderedFrames++;
|
||||||
|
|||||||
Reference in New Issue
Block a user