aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/render/mitrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/render/mitrap.c')
-rw-r--r--xorg-server/render/mitrap.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/xorg-server/render/mitrap.c b/xorg-server/render/mitrap.c
index 445f23630..17b6dcd1c 100644
--- a/xorg-server/render/mitrap.c
+++ b/xorg-server/render/mitrap.c
@@ -35,45 +35,47 @@
#include "mipict.h"
static xFixed
-miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
+miLineFixedX(xLineFixed * l, xFixed y, Bool ceil)
{
- xFixed dx = l->p2.x - l->p1.x;
- xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
- xFixed dy = l->p2.y - l->p1.y;
+ xFixed dx = l->p2.x - l->p1.x;
+ xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
+ xFixed dy = l->p2.y - l->p1.y;
+
if (ceil)
- ex += (dy - 1);
+ ex += (dy - 1);
return l->p1.x + (xFixed) (ex / dy);
}
void
-miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box)
+miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box)
{
box->y1 = MAXSHORT;
box->y2 = MINSHORT;
box->x1 = MAXSHORT;
box->x2 = MINSHORT;
- for (; ntrap; ntrap--, traps++)
- {
- INT16 x1, y1, x2, y2;
+ for (; ntrap; ntrap--, traps++) {
+ INT16 x1, y1, x2, y2;
+
+ if (!xTrapezoidValid(traps))
+ continue;
+ y1 = xFixedToInt(traps->top);
+ if (y1 < box->y1)
+ box->y1 = y1;
+
+ y2 = xFixedToInt(xFixedCeil(traps->bottom));
+ if (y2 > box->y2)
+ box->y2 = y2;
+
+ x1 = xFixedToInt(min(miLineFixedX(&traps->left, traps->top, FALSE),
+ miLineFixedX(&traps->left, traps->bottom, FALSE)));
+ if (x1 < box->x1)
+ box->x1 = x1;
- if (!xTrapezoidValid(traps))
- continue;
- y1 = xFixedToInt (traps->top);
- if (y1 < box->y1)
- box->y1 = y1;
-
- y2 = xFixedToInt (xFixedCeil (traps->bottom));
- if (y2 > box->y2)
- box->y2 = y2;
-
- x1 = xFixedToInt (min (miLineFixedX (&traps->left, traps->top, FALSE),
- miLineFixedX (&traps->left, traps->bottom, FALSE)));
- if (x1 < box->x1)
- box->x1 = x1;
-
- x2 = xFixedToInt (xFixedCeil (max (miLineFixedX (&traps->right, traps->top, TRUE),
- miLineFixedX (&traps->right, traps->bottom, TRUE))));
- if (x2 > box->x2)
- box->x2 = x2;
+ x2 = xFixedToInt(xFixedCeil
+ (max
+ (miLineFixedX(&traps->right, traps->top, TRUE),
+ miLineFixedX(&traps->right, traps->bottom, TRUE))));
+ if (x2 > box->x2)
+ box->x2 = x2;
}
}