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.11 by greg, Wed Feb 8 04:18:13 2012 UTC

# Line 7 | Line 7 | static const char      RCSid[] = "$Id$";
7   *      2/26/88
8   */
9  
10 + #include "platform.h"
11   #include "standard.h"
12  
13   #include "color.h"
# Line 21 | Line 22 | int    xres, yres;                     /* input resolution */
22   int     correctorder = 0;               /* order correction? */
23   int     ccw = 0;                        /* rotate CCW? */
24  
25 < #ifdef BIGMEM
25 < char    buf[1<<22];                     /* output buffer */
26 < #else
25 > #ifdef SMLMEM
26   char    buf[1<<20];                     /* output buffer */
27 + #else
28 + char    buf[1<<22];                     /* output buffer */
29   #endif
30  
31   int     nrows;                          /* number of rows output at once */
# Line 34 | Line 35 | int    nrows;                          /* number of rows output at once */
35   char    *progname;
36  
37   short   ordertab[4][2] = {
38 <        {0,XDECR}, {XDECR,XDECR|YDECR}, {XDECR|YDECR,YDECR}, {YDECR,0}
38 >        {0,0}, {XDECR,XDECR|YDECR}, {XDECR|YDECR,YDECR}, {YDECR,XDECR}
39   };
40  
41  
42 < int
43 < neworder()              /* return corrected order */
42 > static int neworder(void);
43 > static void rotatecw(FILE *fp);
44 > static void rotateccw(FILE *fp);
45 >
46 >
47 >
48 > static int
49 > neworder(void)          /* return corrected order */
50   {
51 +        static short    ordercw[8];
52          register int    i;
53  
54          if (correctorder)
55                  return(order);
56 <        for (i = 4; i--; )
57 <                if ((order&~YMAJOR) == ordertab[i][ccw])
58 <                        return(ordertab[i][1-ccw] | ((order&YMAJOR)^YMAJOR));
56 >        if (!ordercw[0]) {
57 >                ordercw[YMAJOR|YDECR] = 0;
58 >                ordercw[0] = YMAJOR|XDECR;
59 >                ordercw[YMAJOR|XDECR] = XDECR|YDECR;
60 >                ordercw[XDECR|YDECR] = YMAJOR|YDECR;
61 >                ordercw[YMAJOR|XDECR|YDECR] = XDECR;
62 >                ordercw[XDECR] = YMAJOR;
63 >                ordercw[YMAJOR] = YDECR;
64 >                ordercw[YDECR] = YMAJOR|XDECR|YDECR;
65 >        }
66 >        if (!ccw)
67 >                return(ordercw[order]);
68 >        for (i = 8; i--; )
69 >                if (ordercw[i] == order)
70 >                        return(i);
71          fputs("Order botch!\n", stderr);
72          exit(2);
73   }
74  
75 <
76 < main(argc, argv)
77 < int     argc;
78 < char    *argv[];
75 > int
76 > main(
77 >        int     argc,
78 >        char    *argv[]
79 > )
80   {
81          static char     picfmt[LPICFMT+1] = PICFMT;
82          int     rval;
83          FILE    *fin;
84  
85 +        SET_DEFAULT_BINARY();
86 +        SET_FILE_BINARY(stdout);
87 +
88          progname = argv[0];
89  
90          while (argc > 2 && argv[1][0] == '-') {
# Line 118 | Line 142 | userr:
142   }
143  
144  
145 < rotatecw(fp)                    /* rotate picture clockwise */
146 < FILE    *fp;
145 > static void
146 > rotatecw(                       /* rotate picture clockwise */
147 >        FILE    *fp
148 > )
149   {
150          register COLR   *inln;
151          register int    xoff, inx, iny;
# Line 154 | Line 180 | FILE   *fp;
180   }
181  
182  
183 < rotateccw(fp)                   /* rotate picture counter-clockwise */
184 < FILE    *fp;
183 > static void
184 > rotateccw(                      /* rotate picture counter-clockwise */
185 >        FILE    *fp
186 > )
187   {
188          register COLR   *inln;
189          register int    xoff, inx, iny;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines