hackathon-dev #1
|
@ -21,7 +21,7 @@ inline static BYTE line_clip_outcode(INT32 x, INT32 y, INT32 xmin, INT32 ymin, I
|
||||||
|
|
||||||
static BOOL line_clip(PINT32 output, INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 xmin, INT32 ymin, INT32 xmax, INT32 ymax)
|
static BOOL line_clip(PINT32 output, INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 xmin, INT32 ymin, INT32 xmax, INT32 ymax)
|
||||||
{
|
{
|
||||||
BYTE outcode1, outcode2, tmpb;
|
BYTE outcode1, outcode2;
|
||||||
INT32 tmp;
|
INT32 tmp;
|
||||||
|
|
||||||
Log(LDEBUG, "clipping line from (%d, %d) to (%d, %d) against bounding box (%d, %d, %d, %d)", x1 >> 16, y1 >> 16, x2 >> 16, y2 >> 16,
|
Log(LDEBUG, "clipping line from (%d, %d) to (%d, %d) against bounding box (%d, %d, %d, %d)", x1 >> 16, y1 >> 16, x2 >> 16, y2 >> 16,
|
||||||
|
@ -51,9 +51,7 @@ static BOOL line_clip(PINT32 output, INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT
|
||||||
tmp = y1;
|
tmp = y1;
|
||||||
y1 = y2;
|
y1 = y2;
|
||||||
y2 = tmp;
|
y2 = tmp;
|
||||||
tmpb = outcode1;
|
outcode1 = outcode2; /* we don't reference outcode2 in the rest of the loop */
|
||||||
outcode1 = outcode2;
|
|
||||||
outcode2 = tmpb;
|
|
||||||
}
|
}
|
||||||
if (outcode1 & 0x8)
|
if (outcode1 & 0x8)
|
||||||
{
|
{
|
||||||
|
@ -78,6 +76,10 @@ static BOOL line_clip(PINT32 output, INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT
|
||||||
}
|
}
|
||||||
else if (outcode1 & 0x1)
|
else if (outcode1 & 0x1)
|
||||||
{
|
{
|
||||||
|
int term1 = y2 - y1;
|
||||||
|
int term2 = xmin - x1;
|
||||||
|
int term3 = x2 - x1;
|
||||||
|
Log(LDEBUG, "term1=%d term2=%d term3=%d", term1 >> 16, term2 >> 16, term3 >> 16);
|
||||||
tmp = (y2 - y1) * ((xmin - x1) / (x2 - x1));
|
tmp = (y2 - y1) * ((xmin - x1) / (x2 - x1));
|
||||||
y1 -= tmp;
|
y1 -= tmp;
|
||||||
x1 = xmin;
|
x1 = xmin;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user