Fixes spacing for "for", "while", "switch" and "if"

Also moved && and || to ends of lines instead of start.
Fixed misc vertical alignments and some { needed newlining.
This commit is contained in:
Matthew Parlane
2014-03-11 00:30:55 +13:00
parent 4591464486
commit 31cfc73a09
189 changed files with 1250 additions and 1159 deletions

View File

@ -179,7 +179,7 @@ namespace Clipper
if (mask != 0)
{
for(int i = 0; i < 3; i += 3)
for (int i = 0; i < 3; i += 3)
{
int vlist[2][2*6+1];
int *inlist = vlist[0], *outlist = vlist[1];
@ -273,7 +273,7 @@ namespace Clipper
bool backface;
if(!CullTest(v0, v1, v2, backface))
if (!CullTest(v0, v1, v2, backface))
return;
int indices[NUM_INDICES] = { 0, 1, 2, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG,
@ -296,10 +296,10 @@ namespace Clipper
ClipTriangle(indices, numIndices);
for(int i = 0; i+3 <= numIndices; i+=3)
for (int i = 0; i+3 <= numIndices; i+=3)
{
_assert_(i < NUM_INDICES);
if(indices[i] != SKIP_FLAG)
if (indices[i] != SKIP_FLAG)
{
PerspectiveDivide(Vertices[indices[i]]);
PerspectiveDivide(Vertices[indices[i+1]]);
@ -339,7 +339,7 @@ namespace Clipper
ClipLine(indices);
if(indices[0] != SKIP_FLAG)
if (indices[0] != SKIP_FLAG)
{
OutputVertexData *v0 = Vertices[indices[0]];
OutputVertexData *v1 = Vertices[indices[1]];
@ -353,16 +353,16 @@ namespace Clipper
float screenDx = 0;
float screenDy = 0;
if(fabsf(dx) > fabsf(dy))
if (fabsf(dx) > fabsf(dy))
{
if(dx > 0)
if (dx > 0)
screenDy = bpmem.lineptwidth.linesize / -12.0f;
else
screenDy = bpmem.lineptwidth.linesize / 12.0f;
}
else
{
if(dy > 0)
if (dy > 0)
screenDx = bpmem.lineptwidth.linesize / 12.0f;
else
screenDx = bpmem.lineptwidth.linesize / -12.0f;
@ -389,7 +389,7 @@ namespace Clipper
mask &= CalcClipMask(v1);
mask &= CalcClipMask(v2);
if(mask)
if (mask)
{
INCSTAT(swstats.thisFrame.numTrianglesRejected)
return false;

View File

@ -84,7 +84,7 @@ s32 GetMaxTextureLod(u32 texmap)
u8 mip = maxLod >> 4;
u8 fract = maxLod & 0xf;
if(fract)
if (fract)
++mip;
return (s32)mip;

View File

@ -34,7 +34,7 @@ namespace EfbCopy
INFO_LOG(VIDEO, "xfbaddr: %x, fbwidth: %i, fbheight: %i, source: (%i, %i, %i, %i), Gamma %f",
xfbAddr, fbWidth, fbHeight, sourceRc.top, sourceRc.left, sourceRc.bottom, sourceRc.right, Gamma);
if(!g_SWVideoConfig.bBypassXFB)
if (!g_SWVideoConfig.bBypassXFB)
{
EfbInterface::yuv422_packed* xfb_in_ram = (EfbInterface::yuv422_packed *) Memory::GetPointer(xfbAddr);

View File

@ -552,7 +552,7 @@ namespace EfbInterface
// Like CopyToXFB, but we copy directly into the opengl colour texture without going via Gamecube main memory or doing a yuyv conversion
void BypassXFB(u8* texture, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma) {
if(fbWidth*fbHeight > 640*568) {
if (fbWidth*fbHeight > 640*568) {
ERROR_LOG(VIDEO, "Framebuffer is too large: %ix%i", fbWidth, fbHeight);
return;
}

View File

@ -139,7 +139,7 @@ void DecodeStandard(u32 bufferSize)
DebugUtil::OnObjectBegin();
}
#endif
switch(Cmd)
switch (Cmd)
{
case GX_NOP:
break;
@ -250,7 +250,7 @@ bool CommandRunnable(u32 iBufferSize)
u8 Cmd = DataPeek8(0);
u32 minSize = 1;
switch(Cmd)
switch (Cmd)
{
case GX_LOAD_CP_REG: //0x08
minSize = 6;

View File

@ -87,7 +87,7 @@ inline int iround(float x)
int t;
t = (int)x;
if((x - t) >= 0.5)
if ((x - t) >= 0.5)
return t + 1;
return t;
@ -149,7 +149,7 @@ inline void Draw(s32 x, s32 y, s32 xi, s32 yi)
// colors
for (unsigned int i = 0; i < bpmem.genMode.numcolchans; i++)
{
for(int comp = 0; comp < 4; comp++)
for (int comp = 0; comp < 4; comp++)
{
u16 color = (u16)ColorSlopes[i][comp].GetValue(dx, dy);
@ -299,7 +299,7 @@ void BuildBlock(s32 blockX, s32 blockY)
{
int stageOdd = i&1;
TwoTevStageOrders &order = bpmem.tevorders[i >> 1];
if(order.getEnable(stageOdd))
if (order.getEnable(stageOdd))
{
u32 texmap = order.getTexMap(stageOdd);
u32 texcoord = order.getTexCoord(stageOdd);
@ -384,15 +384,15 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
if (!bpmem.genMode.zfreeze || !g_SWVideoConfig.bZFreeze)
InitSlope(&ZSlope, v0->screenPosition[2], v1->screenPosition[2], v2->screenPosition[2], fltdx31, fltdx12, fltdy12, fltdy31);
for(unsigned int i = 0; i < bpmem.genMode.numcolchans; i++)
for (unsigned int i = 0; i < bpmem.genMode.numcolchans; i++)
{
for(int comp = 0; comp < 4; comp++)
for (int comp = 0; comp < 4; comp++)
InitSlope(&ColorSlopes[i][comp], v0->color[i][comp], v1->color[i][comp], v2->color[i][comp], fltdx31, fltdx12, fltdy12, fltdy31);
}
for(unsigned int i = 0; i < bpmem.genMode.numtexgens; i++)
for (unsigned int i = 0; i < bpmem.genMode.numtexgens; i++)
{
for(int comp = 0; comp < 3; comp++)
for (int comp = 0; comp < 3; comp++)
InitSlope(&TexSlopes[i][comp], v0->texCoords[i][comp] * w[0], v1->texCoords[i][comp] * w[1], v2->texCoords[i][comp] * w[2], fltdx31, fltdx12, fltdy12, fltdy31);
}
@ -406,14 +406,14 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
s32 C3 = DY31 * X3 - DX31 * Y3;
// Correct for fill convention
if(DY12 < 0 || (DY12 == 0 && DX12 > 0)) C1++;
if(DY23 < 0 || (DY23 == 0 && DX23 > 0)) C2++;
if(DY31 < 0 || (DY31 == 0 && DX31 > 0)) C3++;
if (DY12 < 0 || (DY12 == 0 && DX12 > 0)) C1++;
if (DY23 < 0 || (DY23 == 0 && DX23 > 0)) C2++;
if (DY31 < 0 || (DY31 == 0 && DX31 > 0)) C3++;
// Loop through blocks
for(s32 y = miny; y < maxy; y += BLOCK_SIZE)
for (s32 y = miny; y < maxy; y += BLOCK_SIZE)
{
for(s32 x = minx; x < maxx; x += BLOCK_SIZE)
for (s32 x = minx; x < maxx; x += BLOCK_SIZE)
{
// Corners of block
s32 x0 = x << 4;
@ -441,17 +441,17 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
int c = (c00 << 0) | (c10 << 1) | (c01 << 2) | (c11 << 3);
// Skip block when outside an edge
if(a == 0x0 || b == 0x0 || c == 0x0)
if (a == 0x0 || b == 0x0 || c == 0x0)
continue;
BuildBlock(x, y);
// Accept whole block when totally covered
if(a == 0xF && b == 0xF && c == 0xF)
if (a == 0xF && b == 0xF && c == 0xF)
{
for(s32 iy = 0; iy < BLOCK_SIZE; iy++)
for (s32 iy = 0; iy < BLOCK_SIZE; iy++)
{
for(s32 ix = 0; ix < BLOCK_SIZE; ix++)
for (s32 ix = 0; ix < BLOCK_SIZE; ix++)
{
Draw(x + ix, y + iy, ix, iy);
}
@ -463,15 +463,15 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
s32 CY2 = C2 + DX23 * y0 - DY23 * x0;
s32 CY3 = C3 + DX31 * y0 - DY31 * x0;
for(s32 iy = 0; iy < BLOCK_SIZE; iy++)
for (s32 iy = 0; iy < BLOCK_SIZE; iy++)
{
s32 CX1 = CY1;
s32 CX2 = CY2;
s32 CX3 = CY3;
for(s32 ix = 0; ix < BLOCK_SIZE; ix++)
for (s32 ix = 0; ix < BLOCK_SIZE; ix++)
{
if(CX1 > 0 && CX2 > 0 && CX3 > 0)
if (CX1 > 0 && CX2 > 0 && CX3 > 0)
{
Draw(x + ix, y + iy, ix, iy);
}

View File

@ -160,7 +160,7 @@ void SWRenderer::swapColorTexture() {
void SWRenderer::UpdateColorTexture(EfbInterface::yuv422_packed *xfb, u32 fbWidth, u32 fbHeight)
{
if(fbWidth*fbHeight > 640*568) {
if (fbWidth*fbHeight > 640*568) {
ERROR_LOG(VIDEO, "Framebuffer is too large: %ix%i", fbWidth, fbHeight);
return;
}

View File

@ -223,7 +223,7 @@ void VideoSoftware::Video_EndField()
}
if (!g_SWVideoConfig.bHwRasterizer)
{
if(!g_SWVideoConfig.bBypassXFB)
if (!g_SWVideoConfig.bBypassXFB)
{
EfbInterface::yuv422_packed *xfb = (EfbInterface::yuv422_packed *) Memory::GetPointer(s_beginFieldArgs.xfbAddr);

View File

@ -22,7 +22,7 @@ void SetupUnit::Init(u8 primitiveType)
void SetupUnit::SetupVertex()
{
switch(m_PrimType)
switch (m_PrimType)
{
case GX_DRAW_QUADS:
SetupQuad();

View File

@ -126,7 +126,7 @@ inline s16 Clamp1024(s16 in)
void Tev::SetRasColor(int colorChan, int swaptable)
{
switch(colorChan)
switch (colorChan)
{
case 0: // Color0
{
@ -209,7 +209,7 @@ void Tev::DrawColorCompare(TevStageCombiner::ColorCombiner &cc)
InputRegType InputReg;
switch(cmp) {
switch (cmp) {
case TEVCMP_R8_GT:
{
a = *m_ColorInputLUT[cc.a][RED_INP] & 0xff;
@ -336,7 +336,7 @@ void Tev::DrawAlphaCompare(TevStageCombiner::AlphaCombiner &ac)
InputRegType InputReg;
switch(cmp) {
switch (cmp) {
case TEVCMP_R8_GT:
{
a = m_AlphaInputLUT[ac.a][RED_C] & 0xff;
@ -415,7 +415,7 @@ void Tev::DrawAlphaCompare(TevStageCombiner::AlphaCombiner &ac)
static bool AlphaCompare(int alpha, int ref, int comp)
{
switch(comp) {
switch (comp) {
case ALPHACMP_ALWAYS: return true;
case ALPHACMP_NEVER: return false;
case ALPHACMP_LEQUAL: return alpha <= ref;
@ -497,7 +497,7 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t)
bias[2] = indirect.bias&4?biasValue:0;
// format
switch(indirect.fmt)
switch (indirect.fmt)
{
case ITF_8:
indcoord[0] = indmap[TextureSampler::ALP_SMP] + bias[0];
@ -756,7 +756,7 @@ void Tev::Draw()
}
if(bpmem.fogRange.Base.Enabled)
if (bpmem.fogRange.Base.Enabled)
{
// TODO: This is untested and should definitely be checked against real hw.
// - No idea if offset is really normalized against the viewport width or against the projection matrix or yet something else

View File

@ -261,7 +261,7 @@ void EncodeRGBA6(u8 *dst, u8 *src, u32 format)
u32 readStride = 3;
u8 *dstBlockStart = dst;
switch(format)
switch (format)
{
case GX_TF_I4:
SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
@ -498,7 +498,7 @@ void EncodeRGBA6halfscale(u8 *dst, u8 *src, u32 format)
u32 readStride = 6;
u8 *dstBlockStart = dst;
switch(format)
switch (format)
{
case GX_TF_I4:
SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
@ -732,7 +732,7 @@ void EncodeRGB8(u8 *dst, u8 *src, u32 format)
u32 readStride = 3;
u8 *dstBlockStart = dst;
switch(format)
switch (format)
{
case GX_TF_I4:
SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
@ -947,7 +947,7 @@ void EncodeRGB8halfscale(u8 *dst, u8 *src, u32 format)
u32 readStride = 6;
u8 *dstBlockStart = dst;
switch(format)
switch (format)
{
case GX_TF_I4:
SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
@ -1177,7 +1177,7 @@ void EncodeZ24(u8 *dst, u8 *src, u32 format)
u32 readStride = 3;
u8 *dstBlockStart = dst;
switch(format)
switch (format)
{
case GX_TF_Z8:
SetBlockDimensions(3, 2, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
@ -1282,7 +1282,7 @@ void EncodeZ24halfscale(u8 *dst, u8 *src, u32 format)
u8 r, g, b;
u8 *dstBlockStart = dst;
switch(format)
switch (format)
{
case GX_TF_Z8:
SetBlockDimensions(3, 2, sBlkCount, tBlkCount, sBlkSize, tBlkSize);