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

Comparing ray/src/px/psign.c (file contents):
Revision 2.7 by greg, Thu Jun 18 16:14:43 1992 UTC vs.
Revision 2.11 by greg, Wed Jul 8 13:58:10 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 66 | Line 66 | int  nlines, maxline;                  /* text dimensions */
66   int  maxwidth;                          /* maximum line width (dvi) */
67  
68   extern char  *getenv();
69 extern char  *malloc(), *calloc();
69  
70  
71   main(argc, argv)
# Line 110 | Line 109 | char  *argv[];
109                                  goto unkopt;
110                          }
111                          break;
112 +                case 'x':                       /* x resolution */
113 +                        xsiz = atoi(argv[++an])*SSS;
114 +                        break;
115 +                case 'y':
116 +                        ysiz = atoi(argv[++an])*SSS;
117 +                        break;
118                  case 'h':                       /* height of characters */
119                          cheight = atoi(argv[++an])*SSS;
120                          break;
# Line 152 | Line 157 | unkopt:
157  
158   makemap()                       /* create the bit map */
159   {
160 <        cwidth = cheight/aspect + 0.5;
160 >        double  pictaspect;
161 >        
162          if (direct == 'r' || direct == 'l') {
163 <                xsiz = (long)maxwidth*cwidth >> 8;
164 <                ysiz = nlines*cheight;
163 >                if (xsiz <= 0) {
164 >                        cwidth = cheight/aspect + 0.5;
165 >                        xsiz = (long)maxwidth*cwidth >> 8;
166 >                        ysiz = nlines*cheight;
167 >                } else if (aspect > FTINY) {
168 >                        if (ysiz <= 0)
169 >                                ysiz = cheight*nlines;
170 >                        pictaspect = 256*nlines*aspect/maxwidth;
171 >                        if (pictaspect*xsiz < ysiz)
172 >                                ysiz = pictaspect*xsiz + 0.5;
173 >                        else
174 >                                xsiz = ysiz/pictaspect + 0.5;
175 >                        cheight = ysiz/nlines;
176 >                        cwidth = cheight/aspect + 0.5;
177 >                } else {
178 >                        if (ysiz <= 0)
179 >                                ysiz = cheight*nlines;
180 >                        pictaspect = (double)ysiz/xsiz;
181 >                        aspect = pictaspect*maxwidth/(256*nlines);
182 >                        cheight = ysiz/nlines;
183 >                        cwidth = cheight/aspect + 0.5;
184 >                }
185          } else {                        /* reverse orientation */
186 <                xsiz = nlines*cheight;
187 <                ysiz = (long)maxwidth*cwidth >> 8;
186 >                if (ysiz <= 0) {
187 >                        cwidth = cheight/aspect + 0.5;
188 >                        xsiz = nlines*cheight;
189 >                        ysiz = (long)maxwidth*cwidth >> 8;
190 >                } else if (aspect > FTINY) {
191 >                        if (xsiz <= 0)
192 >                                xsiz = cheight*nlines;
193 >                        pictaspect = maxwidth/(256*nlines*aspect);
194 >                        if (pictaspect*xsiz < ysiz)
195 >                                ysiz = pictaspect*xsiz + 0.5;
196 >                        else
197 >                                xsiz = ysiz/pictaspect + 0.5;
198 >                        cheight = xsiz/nlines;
199 >                        cwidth = cheight/aspect + 0.5;
200 >                } else {
201 >                        if (xsiz <= 0)
202 >                                xsiz = cheight*nlines;
203 >                        pictaspect = (double)ysiz/xsiz;
204 >                        aspect = maxwidth/(256*nlines*pictaspect);
205 >                        cheight = xsiz/nlines;
206 >                        cwidth = cheight/aspect + 0.5;
207 >                }
208          }
209          if (xsiz % SSS)
210                  xsiz += SSS - xsiz%SSS;
211          if (ysiz % SSS)
212                  ysiz += SSS - ysiz%SSS;
213          xdim = (xsiz+7)/8;
214 <        ourbitmap = (BYTE *)calloc(ysiz, xdim);
214 >        ourbitmap = (BYTE *)bmalloc(ysiz*xdim);
215          if (ourbitmap == NULL)
216                  error(SYSTEM, "Out of memory in makemap");
217 +        bzero((char *)ourbitmap, ysiz*xdim);
218   }
219  
220  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines