mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
Split some parts of UpdateBoundingBox into multiple lines. Also,
fix issues causing failure on Lint.
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user