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.9 by schorsch, Sun Mar 28 20:33:14 2004 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 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   static int neworder(void);
43   static void rotatecw(FILE *fp);
44   static void rotateccw(FILE *fp);
# Line 46 | Line 48 | static void rotateccw(FILE *fp);
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   }
# Line 66 | Line 81 | main(
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines