summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexLoader.cpp
diff options
context:
space:
mode:
authorRohit Nirmal <rohitnirmal9@gmail.com>2014-09-06 01:24:03 -0500
committerRohit Nirmal <rohitnirmal9@gmail.com>2014-09-06 09:49:27 -0500
commit629ceaf2b115ffe6b7d315a78d1f4eeb4dede1ef (patch)
treefd1f74c7268f2dc164ec92d9a0dc8c2a39267b52 /Source/Core/VideoCommon/VertexLoader.cpp
parent1ecb318bcca6dc0120316dcd6d5a0f5aa69c55bd (diff)
Split some parts of UpdateBoundingBox into multiple lines. Also,
fix issues causing failure on Lint.
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoader.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexLoader.cpp117
1 files changed, 105 insertions, 12 deletions
diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp
index 6ca9a04da1..a227b6da52 100644
--- a/Source/Core/VideoCommon/VertexLoader.cpp
+++ b/Source/Core/VideoCommon/VertexLoader.cpp
@@ -374,10 +374,41 @@ static void LOADERDECL UpdateBoundingBox()
{
m = (p1.x - p0.x) ? ((p1.y - p0.y) / (p1.x - p0.x)) : highNum;
c = p0.y - (m * p0.x);
- if (i0 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = std::min(s, top); bottom = std::max(s, bottom); }
- if (i0 & 2) { s = (s32)((-c / m) + roundUp); if (s >= 0 && s <= 607) top = 0; left = std::min(s, left); right = std::max(s, right); }
- if (i0 & 4) { s = (s32)((m * 607) + c + roundUp); if (s >= 0 && s <= 479) right = 607; top = std::min(s, top); bottom = std::max(s, bottom); }
- if (i0 & 8) { s = (s32)(((479 - c) / m) + roundUp); if (s >= 0 && s <= 607) bottom = 479; left = std::min(s, left); right = std::max(s, right); }
+ if (i0 & 1)
+ {
+ s = (s32)(c + roundUp);
+ if (s >= 0 && s <= 479)
+ left = 0;
+ top = std::min(s, top);
+ bottom = std::max(s, bottom);
+ }
+
+ if (i0 & 2)
+ {
+ s = (s32)((-c / m) + roundUp);
+ if (s >= 0 && s <= 607)
+ top = 0;
+ left = std::min(s, left);
+ right = std::max(s, right);
+ }
+
+ if (i0 & 4)
+ {
+ s = (s32)((m * 607) + c + roundUp);
+ if (s >= 0 && s <= 479)
+ right = 607;
+ top = std::min(s, top);
+ bottom = std::max(s, bottom);
+ }
+
+ if (i0 & 8)
+ {
+ s = (s32)(((479 - c) / m) + roundUp);
+ if (s >= 0 && s <= 607)
+ bottom = 479;
+ left = std::min(s, left);
+ right = std::max(s, right);
+ }
}
// Only check other lines if we are dealing with a triangle
@@ -388,10 +419,41 @@ static void LOADERDECL UpdateBoundingBox()
{
m = (p2.x - p1.x) ? ((p2.y - p1.y) / (p2.x - p1.x)) : highNum;
c = p1.y - (m * p1.x);
- if (i1 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = std::min(s, top); bottom = std::max(s, bottom); }
- if (i1 & 2) { s = (s32)((-c / m) + roundUp); if (s >= 0 && s <= 607) top = 0; left = std::min(s, left); right = std::max(s, right); }
- if (i1 & 4) { s = (s32)((m * 607) + c + roundUp); if (s >= 0 && s <= 479) right = 607; top = std::min(s, top); bottom = std::max(s, bottom); }
- if (i1 & 8) { s = (s32)(((479 - c) / m) + roundUp); if (s >= 0 && s <= 607) bottom = 479; left = std::min(s, left); right = std::max(s, right); }
+ if (i1 & 1)
+ {
+ s = (s32)(c + roundUp);
+ if (s >= 0 && s <= 479)
+ left = 0;
+ top = std::min(s, top);
+ bottom = std::max(s, bottom);
+ }
+
+ if (i1 & 2)
+ {
+ s = (s32)((-c / m) + roundUp);
+ if (s >= 0 && s <= 607)
+ top = 0;
+ left = std::min(s, left);
+ right = std::max(s, right);
+ }
+
+ if (i1 & 4)
+ {
+ s = (s32)((m * 607) + c + roundUp);
+ if (s >= 0 && s <= 479)
+ right = 607;
+ top = std::min(s, top);
+ bottom = std::max(s, bottom);
+ }
+
+ if (i1 & 8)
+ {
+ s = (s32)(((479 - c) / m) + roundUp);
+ if (s >= 0 && s <= 607)
+ bottom = 479;
+ left = std::min(s, left);
+ right = std::max(s, right);
+ }
}
// Third line intersects
@@ -399,10 +461,41 @@ static void LOADERDECL UpdateBoundingBox()
{
m = (p2.x - p0.x) ? ((p2.y - p0.y) / (p2.x - p0.x)) : highNum;
c = p0.y - (m * p0.x);
- if (i2 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = std::min(s, top); bottom = std::max(s, bottom); }
- if (i2 & 2) { s = (s32)((-c / m) + roundUp); if (s >= 0 && s <= 607) top = 0; left = std::min(s, left); right = std::max(s, right); }
- if (i2 & 4) { s = (s32)((m * 607) + c + roundUp); if (s >= 0 && s <= 479) right = 607; top = std::min(s, top); bottom = std::max(s, bottom); }
- if (i2 & 8) { s = (s32)(((479 - c) / m) + roundUp); if (s >= 0 && s <= 607) bottom = 479; left = std::min(s, left); right = std::max(s, right); }
+ if (i2 & 1)
+ {
+ s = (s32)(c + roundUp);
+ if (s >= 0 && s <= 479)
+ left = 0;
+ top = std::min(s, top);
+ bottom = std::max(s, bottom);
+ }
+
+ if (i2 & 2)
+ {
+ s = (s32)((-c / m) + roundUp);
+ if (s >= 0 && s <= 607)
+ top = 0;
+ left = std::min(s, left);
+ right = std::max(s, right);
+ }
+
+ if (i2 & 4)
+ {
+ s = (s32)((m * 607) + c + roundUp);
+ if (s >= 0 && s <= 479)
+ right = 607;
+ top = std::min(s, top);
+ bottom = std::max(s, bottom);
+ }
+
+ if (i2 & 8)
+ {
+ s = (s32)(((479 - c) / m) + roundUp);
+ if (s >= 0 && s <= 607)
+ bottom = 479;
+ left = std::min(s, left);
+ right = std::max(s, right);
+ }
}
}