const int Y1 = iround(16.0f * v1.y);
This sets up Y1 as a 28.4 fixed point, with nearest rounding from the float value.
const int DX12 = X1 - X2;
Since X1 and X2 are fixed point, doesn't that mean DX12 is also a 28.4 fixed point?
const int FDX12 = DX12 << 4;
In that case, doesn't that mean FDX12 is actually 24.8 fixed point?
int minx = (min(X1, X2, X3) + 0xF) >> 4;
Here, minx is in integer coords, rounded up.
int C1 = DY12 * X1 - DX12 * Y1;
X1, Y1, DX12, and DY12 are all 28.4 fixed point. Doesn't that make C1 a 24.8 fixed point value (multiplying two 28.4s yields a 24.8, and subtraction doesn't change format)?
int CY1 = C1 + DX12 * (miny << 4) - DY12 * (minx << 4);
Okay, C1 is 24.8, DX12 is 28.4, (miny << 4) is 28.4, so after the multiply that becomes 24.8, so CY1 is 24.8.
int CX1 = CY1;
CX1 -= FDY12;
Hmm, so CX1 is 24.8, and FDY12 is 24.8, so this is consistent!
So I guess that all makes sense and is consistent, I just wanted to check because the description as using 28.4 fixed point, and the comments in the code, didn't jive with what the code _actually_ appeared to be doing. Do I understand correctly? Thanks!