ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/protate.c
(Generate patch)

Comparing ray/src/px/protate.c (file contents):
Revision 2.7 by greg, Sat Feb 22 02:07:27 2003 UTC vs.
Revision 2.10 by greg, Fri Apr 30 20:29:24 2004 UTC

# Line 21 | Line 21 | int    xres, yres;                     /* input resolution */
21   int     correctorder = 0;               /* order correction? */
22   int     ccw = 0;                        /* rotate CCW? */
23  
24 < #ifdef BIGMEM
25 < char    buf[1<<22];                     /* output buffer */
26 < #else
24 > #ifdef SMLMEM
25   char    buf[1<<20];                     /* output buffer */
26 + #else
27 + char    buf[1<<22];                     /* output buffer */
28   #endif
29  
30   int     nrows;                          /* number of rows output at once */
# Line 34 | Line 34 | int    nrows;                          /* number of rows output at once */
34   char    *progname;
35  
36   short   ordertab[4][2] = {
37 <        {0,XDECR}, {XDECR,XDECR|YDECR}, {XDECR|YDECR,YDECR}, {YDECR,0}
37 >        {0,0}, {XDECR,XDECR|YDECR}, {XDECR|YDECR,YDECR}, {YDECR,XDECR}
38   };
39  
40  
41 < int
42 < neworder()              /* return corrected order */
41 > static int neworder(void);
42 > static void rotatecw(FILE *fp);
43 > static void rotateccw(FILE *fp);
44 >
45 >
46 >
47 > static int
48 > neworder(void)          /* return corrected order */
49   {
50 +        static short    ordercw[8];
51          register int    i;
52  
53          if (correctorder)
54                  return(order);
55 <        for (i = 4; i--; )
56 <                if ((order&~YMAJOR) == ordertab[i][ccw])
57 <                        return(ordertab[i][1-ccw] | ((order&YMAJOR)^YMAJOR));
55 >        if (!ordercw[0]) {
56 >                ordercw[YMAJOR|YDECR] = 0;
57 >                ordercw[0] = YMAJOR|XDECR;
58 >                ordercw[YMAJOR|XDECR] = XDECR|YDECR;
59 >                ordercw[XDECR|YDECR] = YMAJOR|YDECR;
60 >                ordercw[YMAJOR|XDECR|YDECR] = XDECR;
61 >                ordercw[XDECR] = YMAJOR;
62 >                ordercw[YMAJOR] = YDECR;
63 >                ordercw[YDECR] = YMAJOR|XDECR|YDECR;
64 >        }
65 >        if (!ccw)
66 >                return(ordercw[order]);
67 >        for (i = 8; i--; )
68 >                if (ordercw[i] == order)
69 >                        return(i);
70          fputs("Order botch!\n", stderr);
71          exit(2);
72   }
73  
74 <
75 < main(argc, argv)
76 < int     argc;
77 < char    *argv[];
74 > int
75 > main(
76 >        int     argc,
77 >        char    *argv[]
78 > )
79   {
80          static char     picfmt[LPICFMT+1] = PICFMT;
81          int     rval;
# Line 118 | Line 138 | userr:
138   }
139  
140  
141 < rotatecw(fp)                    /* rotate picture clockwise */
142 < FILE    *fp;
141 > static void
142 > rotatecw(                       /* rotate picture clockwise */
143 >        FILE    *fp
144 > )
145   {
146          register COLR   *inln;
147          register int    xoff, inx, iny;
# Line 154 | Line 176 | FILE   *fp;
176   }
177  
178  
179 < rotateccw(fp)                   /* rotate picture counter-clockwise */
180 < FILE    *fp;
179 > static void
180 > rotateccw(                      /* rotate picture counter-clockwise */
181 >        FILE    *fp
182 > )
183   {
184          register COLR   *inln;
185          register int    xoff, inx, iny;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines