summaryrefslogtreecommitdiff
path: root/do_traps.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-15 13:00:22 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-15 13:04:52 -0700
commit2900d7a7e7929414268cb142bf00c57d370e1396 (patch)
tree4c19cc7b6d5e440a32bf7579db3ef8d3112ffad9 /do_traps.c
parentf021fe33579e75bd19e7b5784858be14c3e3c4b6 (diff)
Variable scope reductions as recommended by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'do_traps.c')
-rw-r--r--do_traps.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/do_traps.c b/do_traps.c
index 1c33ab0..b1b3e2b 100644
--- a/do_traps.c
+++ b/do_traps.c
@@ -31,7 +31,7 @@ static GC pgc;
int
InitTrapezoids(XParms xp, Parms p, int64_t reps)
{
- int i, numPoints;
+ int numPoints;
int rows;
int x, y;
int size, skew;
@@ -48,7 +48,7 @@ InitTrapezoids(XParms xp, Parms p, int64_t reps)
rows = 0;
skew = size;
- for (i = 0; i != p->objects; i++, curPoint += NUM_POINTS) {
+ for (int i = 0; i != p->objects; i++, curPoint += NUM_POINTS) {
curPoint[0].x = x - skew;
curPoint[0].y = y;
curPoint[1].x = x - skew + size;
@@ -80,12 +80,9 @@ InitTrapezoids(XParms xp, Parms p, int64_t reps)
void
DoTrapezoids(XParms xp, Parms p, int64_t reps)
{
- int i, j;
- XPoint *curPoint;
-
- for (i = 0; i != reps; i++) {
- curPoint = points;
- for (j = 0; j != p->objects; j++) {
+ for (int i = 0; i != reps; i++) {
+ XPoint *curPoint = points;
+ for (int j = 0; j != p->objects; j++) {
XFillPolygon(xp->d, xp->w, pgc, curPoint, NUM_POINTS, Convex,
CoordModeOrigin);
curPoint += NUM_POINTS;
@@ -120,7 +117,7 @@ static Picture mask;
int
InitFixedTraps(XParms xp, Parms p, int64_t reps)
{
- int i, numTraps;
+ int numTraps;
int rows;
int x, y;
int size, skew;
@@ -202,7 +199,7 @@ InitFixedTraps(XParms xp, Parms p, int64_t reps)
if (width == 0)
width = size;
- for (i = 0; i != p->objects; i++, curTrap ++) {
+ for (int i = 0; i != p->objects; i++, curTrap ++) {
curTrap->top.y = XDoubleToFixed (y);
curTrap->top.left = XDoubleToFixed (x - skew);
curTrap->top.right = XDoubleToFixed (x - skew + width);
@@ -232,7 +229,6 @@ InitFixedTraps(XParms xp, Parms p, int64_t reps)
void
DoFixedTraps(XParms xp, Parms p, int64_t reps)
{
- int i;
Picture white, black, src, dst;
white = XftDrawSrcPicture (aadraw, &aawhite);
@@ -240,7 +236,7 @@ DoFixedTraps(XParms xp, Parms p, int64_t reps)
dst = XftDrawPicture (aadraw);
src = black;
- for (i = 0; i != reps; i++) {
+ for (int i = 0; i != reps; i++) {
XRenderFillRectangle (xp->d, PictOpSrc, mask, &transparent,
0, 0, WIDTH, HEIGHT);
XRenderAddTraps (xp->d, mask, 0, 0, traps, p->objects);
@@ -266,7 +262,7 @@ EndFixedTraps (XParms xp, Parms p)
int
InitFixedTrapezoids(XParms xp, Parms p, int64_t reps)
{
- int i, numTraps;
+ int numTraps;
int rows;
int x, y;
int size, skew;
@@ -330,7 +326,7 @@ InitFixedTrapezoids(XParms xp, Parms p, int64_t reps)
return 0;
}
- for (i = 0; i != p->objects; i++, curTrap ++) {
+ for (int i = 0; i != p->objects; i++, curTrap++) {
curTrap->top = XDoubleToFixed (y);
curTrap->bottom = XDoubleToFixed (y + size);
curTrap->left.p1.x = XDoubleToFixed (x - skew);
@@ -366,7 +362,6 @@ InitFixedTrapezoids(XParms xp, Parms p, int64_t reps)
void
DoFixedTrapezoids(XParms xp, Parms p, int64_t reps)
{
- int i;
Picture white, black, src, dst;
white = XftDrawSrcPicture (aadraw, &aawhite);
@@ -374,7 +369,7 @@ DoFixedTrapezoids(XParms xp, Parms p, int64_t reps)
dst = XftDrawPicture (aadraw);
src = black;
- for (i = 0; i != reps; i++) {
+ for (int i = 0; i != reps; i++) {
XRenderCompositeTrapezoids (xp->d, PictOpOver, src, dst, maskFormat,
0, 0, trapezoids, p->objects);
if (src == black)