Standardized bracing-style and indentation

This commit is contained in:
Carl Worth 2002-10-01 04:37:42 +00:00
parent cf44ac0f7a
commit fe0606c763
6 changed files with 48 additions and 66 deletions

View file

@ -302,17 +302,15 @@ XrPathInterpret(XrPath *path, XrPathDirection dir, XrPathCallbacks *cb, void *cl
op_buf = (dir == XrPathDirectionForward) ? op_buf->next : op_buf->prev) op_buf = (dir == XrPathDirectionForward) ? op_buf->next : op_buf->prev)
{ {
int start, stop; int start, stop;
if (dir == XrPathDirectionForward) if (dir == XrPathDirectionForward) {
{
start = 0; start = 0;
stop = op_buf->num_ops; stop = op_buf->num_ops;
} else { } else {
start = op_buf->num_ops - 1; start = op_buf->num_ops - 1;
stop = -1; stop = -1;
} }
for (i=start; i != stop; i += step) for (i=start; i != stop; i += step) {
{
op = op_buf->op[i]; op = op_buf->op[i];
if (dir == XrPathDirectionReverse) { if (dir == XrPathDirectionReverse) {

View file

@ -65,8 +65,8 @@ XrPenInit(XrPen *pen, double radius, XrGState *gstate)
/* XXX: It would be nice to notice that the pen is already properly constructed. /* XXX: It would be nice to notice that the pen is already properly constructed.
However, this test would also have to account for possible changes in the transformation However, this test would also have to account for possible changes in the transformation
matrix. matrix.
if (pen->radius == radius && pen->tolerance == tolerance) if (pen->radius == radius && pen->tolerance == tolerance)
return XrErrorSuccess; return XrErrorSuccess;
*/ */
XrPenDeinit(pen); XrPenDeinit(pen);
} }
@ -252,10 +252,10 @@ _XrPenStrokeSplineHalf(XrPen *pen, XrSpline *spline, XrPenVertexFlag dir, XrPoly
int num_pts = spline->num_pts; int num_pts = spline->num_pts;
for (i=0; i < pen->num_vertices; i++) { for (i=0; i < pen->num_vertices; i++) {
if (pen->vertex[i].flag & dir) { if (pen->vertex[i].flag & dir) {
active = i; active = i;
break; break;
} }
} }
if (dir == XrPenVertexFlagForward) { if (dir == XrPenVertexFlagForward) {
@ -316,16 +316,16 @@ XrPenStrokeSpline(XrPen *pen, XrSpline *spline, double tolerance, XrTraps *traps
err = _XrPenStrokeSplineHalf(pen, spline, XrPenVertexFlagForward, &polygon); err = _XrPenStrokeSplineHalf(pen, spline, XrPenVertexFlagForward, &polygon);
if (err) if (err)
return err; return err;
err = _XrPenStrokeSplineHalf(pen, spline, XrPenVertexFlagReverse, &polygon); err = _XrPenStrokeSplineHalf(pen, spline, XrPenVertexFlagReverse, &polygon);
if (err) if (err)
return err; return err;
XrPolygonClose(&polygon); XrPolygonClose(&polygon);
XrTrapsTessellatePolygon(traps, &polygon, 1); XrTrapsTessellatePolygon(traps, &polygon, 1);
XrPolygonDeinit(&polygon); XrPolygonDeinit(&polygon);
return XrErrorSuccess; return XrErrorSuccess;
} }

View file

@ -44,8 +44,7 @@ XrStrokerStartDash (XrStroker *stroker)
int i = 0; int i = 0;
offset = gstate->dash_offset; offset = gstate->dash_offset;
while (offset >= gstate->dashes[i]) while (offset >= gstate->dashes[i]) {
{
offset -= gstate->dashes[i]; offset -= gstate->dashes[i];
on = 1-on; on = 1-on;
if (++i == gstate->ndashes) if (++i == gstate->ndashes)
@ -61,8 +60,7 @@ XrStrokerStepDash (XrStroker *stroker, double step)
{ {
XrGState *gstate = stroker->gstate; XrGState *gstate = stroker->gstate;
stroker->dash_remain -= step; stroker->dash_remain -= step;
if (stroker->dash_remain <= 0) if (stroker->dash_remain <= 0) {
{
stroker->dash_index++; stroker->dash_index++;
if (stroker->dash_index == gstate->ndashes) if (stroker->dash_index == gstate->ndashes)
stroker->dash_index = 0; stroker->dash_index = 0;
@ -128,13 +126,10 @@ _XrStrokerJoin(XrStroker *stroker, XrStrokeFace *in, XrStrokeFace *out)
return XrErrorSuccess; return XrErrorSuccess;
} }
if (clockwise) if (clockwise) {
{
inpt = &in->cw; inpt = &in->cw;
outpt = &out->cw; outpt = &out->cw;
} } else {
else
{
inpt = &in->ccw; inpt = &in->ccw;
outpt = &out->ccw; outpt = &out->ccw;
} }
@ -145,8 +140,7 @@ _XrStrokerJoin(XrStroker *stroker, XrStrokeFace *in, XrStrokeFace *out)
case XrLineJoinMiter: { case XrLineJoinMiter: {
XDouble c = in->vector.x * out->vector.x + in->vector.y * out->vector.y; XDouble c = in->vector.x * out->vector.x + in->vector.y * out->vector.y;
double ml = gstate->miter_limit; double ml = gstate->miter_limit;
if (2 <= ml * ml * (1 - c)) if (2 <= ml * ml * (1 - c)) {
{
XDouble x1, y1, x2, y2; XDouble x1, y1, x2, y2;
XDouble mx, my; XDouble mx, my;
XDouble dx1, dx2, dy1, dy2; XDouble dx1, dx2, dy1, dy2;
@ -381,8 +375,7 @@ XrStrokerAddEdgeDashed (void *closure, XPointFixed *p1, XPointFixed *p2)
mag = sqrt(vector.x * vector.x + vector.y * vector.y); mag = sqrt(vector.x * vector.x + vector.y * vector.y);
remain = mag; remain = mag;
fd1 = *p1; fd1 = *p1;
while (remain) while (remain) {
{
tmp = stroker->dash_remain; tmp = stroker->dash_remain;
if (tmp > remain) if (tmp > remain)
tmp = remain; tmp = remain;

View file

@ -302,17 +302,15 @@ XrPathInterpret(XrPath *path, XrPathDirection dir, XrPathCallbacks *cb, void *cl
op_buf = (dir == XrPathDirectionForward) ? op_buf->next : op_buf->prev) op_buf = (dir == XrPathDirectionForward) ? op_buf->next : op_buf->prev)
{ {
int start, stop; int start, stop;
if (dir == XrPathDirectionForward) if (dir == XrPathDirectionForward) {
{
start = 0; start = 0;
stop = op_buf->num_ops; stop = op_buf->num_ops;
} else { } else {
start = op_buf->num_ops - 1; start = op_buf->num_ops - 1;
stop = -1; stop = -1;
} }
for (i=start; i != stop; i += step) for (i=start; i != stop; i += step) {
{
op = op_buf->op[i]; op = op_buf->op[i];
if (dir == XrPathDirectionReverse) { if (dir == XrPathDirectionReverse) {

30
xrpen.c
View file

@ -65,8 +65,8 @@ XrPenInit(XrPen *pen, double radius, XrGState *gstate)
/* XXX: It would be nice to notice that the pen is already properly constructed. /* XXX: It would be nice to notice that the pen is already properly constructed.
However, this test would also have to account for possible changes in the transformation However, this test would also have to account for possible changes in the transformation
matrix. matrix.
if (pen->radius == radius && pen->tolerance == tolerance) if (pen->radius == radius && pen->tolerance == tolerance)
return XrErrorSuccess; return XrErrorSuccess;
*/ */
XrPenDeinit(pen); XrPenDeinit(pen);
} }
@ -252,10 +252,10 @@ _XrPenStrokeSplineHalf(XrPen *pen, XrSpline *spline, XrPenVertexFlag dir, XrPoly
int num_pts = spline->num_pts; int num_pts = spline->num_pts;
for (i=0; i < pen->num_vertices; i++) { for (i=0; i < pen->num_vertices; i++) {
if (pen->vertex[i].flag & dir) { if (pen->vertex[i].flag & dir) {
active = i; active = i;
break; break;
} }
} }
if (dir == XrPenVertexFlagForward) { if (dir == XrPenVertexFlagForward) {
@ -316,16 +316,16 @@ XrPenStrokeSpline(XrPen *pen, XrSpline *spline, double tolerance, XrTraps *traps
err = _XrPenStrokeSplineHalf(pen, spline, XrPenVertexFlagForward, &polygon); err = _XrPenStrokeSplineHalf(pen, spline, XrPenVertexFlagForward, &polygon);
if (err) if (err)
return err; return err;
err = _XrPenStrokeSplineHalf(pen, spline, XrPenVertexFlagReverse, &polygon); err = _XrPenStrokeSplineHalf(pen, spline, XrPenVertexFlagReverse, &polygon);
if (err) if (err)
return err; return err;
XrPolygonClose(&polygon); XrPolygonClose(&polygon);
XrTrapsTessellatePolygon(traps, &polygon, 1); XrTrapsTessellatePolygon(traps, &polygon, 1);
XrPolygonDeinit(&polygon); XrPolygonDeinit(&polygon);
return XrErrorSuccess; return XrErrorSuccess;
} }

View file

@ -44,8 +44,7 @@ XrStrokerStartDash (XrStroker *stroker)
int i = 0; int i = 0;
offset = gstate->dash_offset; offset = gstate->dash_offset;
while (offset >= gstate->dashes[i]) while (offset >= gstate->dashes[i]) {
{
offset -= gstate->dashes[i]; offset -= gstate->dashes[i];
on = 1-on; on = 1-on;
if (++i == gstate->ndashes) if (++i == gstate->ndashes)
@ -61,8 +60,7 @@ XrStrokerStepDash (XrStroker *stroker, double step)
{ {
XrGState *gstate = stroker->gstate; XrGState *gstate = stroker->gstate;
stroker->dash_remain -= step; stroker->dash_remain -= step;
if (stroker->dash_remain <= 0) if (stroker->dash_remain <= 0) {
{
stroker->dash_index++; stroker->dash_index++;
if (stroker->dash_index == gstate->ndashes) if (stroker->dash_index == gstate->ndashes)
stroker->dash_index = 0; stroker->dash_index = 0;
@ -128,13 +126,10 @@ _XrStrokerJoin(XrStroker *stroker, XrStrokeFace *in, XrStrokeFace *out)
return XrErrorSuccess; return XrErrorSuccess;
} }
if (clockwise) if (clockwise) {
{
inpt = &in->cw; inpt = &in->cw;
outpt = &out->cw; outpt = &out->cw;
} } else {
else
{
inpt = &in->ccw; inpt = &in->ccw;
outpt = &out->ccw; outpt = &out->ccw;
} }
@ -145,8 +140,7 @@ _XrStrokerJoin(XrStroker *stroker, XrStrokeFace *in, XrStrokeFace *out)
case XrLineJoinMiter: { case XrLineJoinMiter: {
XDouble c = in->vector.x * out->vector.x + in->vector.y * out->vector.y; XDouble c = in->vector.x * out->vector.x + in->vector.y * out->vector.y;
double ml = gstate->miter_limit; double ml = gstate->miter_limit;
if (2 <= ml * ml * (1 - c)) if (2 <= ml * ml * (1 - c)) {
{
XDouble x1, y1, x2, y2; XDouble x1, y1, x2, y2;
XDouble mx, my; XDouble mx, my;
XDouble dx1, dx2, dy1, dy2; XDouble dx1, dx2, dy1, dy2;
@ -381,8 +375,7 @@ XrStrokerAddEdgeDashed (void *closure, XPointFixed *p1, XPointFixed *p2)
mag = sqrt(vector.x * vector.x + vector.y * vector.y); mag = sqrt(vector.x * vector.x + vector.y * vector.y);
remain = mag; remain = mag;
fd1 = *p1; fd1 = *p1;
while (remain) while (remain) {
{
tmp = stroker->dash_remain; tmp = stroker->dash_remain;
if (tmp > remain) if (tmp > remain)
tmp = remain; tmp = remain;