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

Comparing ray/src/hd/rhd_x11.c (file contents):
Revision 3.44 by greg, Thu Sep 6 00:07:43 2012 UTC vs.
Revision 3.47 by greg, Fri Feb 12 00:53:56 2021 UTC

# Line 25 | Line 25 | static const char      RCSid[] = "$Id$";
25   #define RAYQLEN         50000           /* max. rays to queue before flush */
26   #endif
27  
28 #ifndef FEQ
29 #define FEQ(a,b)        ((a)-(b) <= FTINY && (a)-(b) >= -FTINY)
30 #endif
31
28   #define GAMMA           2.2             /* default gamma correction */
29  
30   #define FRAMESTATE(s)   (((s)&(ShiftMask|ControlMask))==(ShiftMask|ControlMask))
# Line 82 | Line 78 | static int mytmflags(void);
78   static void xnewcolr(int  ndx, int r, int g, int b);
79   static int getpixels(void);
80   static void freepixels(void);
81 < static unsigned long true_pixel(register uby8 rgb[3]);
81 > static unsigned long true_pixel(uby8 rgb[3]);
82   static void getevent(void);
83   static int ilclip(int dp[2][2], FVECT wp[2]);
84   static void draw3dline(FVECT wp[2]);
# Line 91 | Line 87 | static int moveview(int dx, int dy, int mov, int orb);
87   static void getframe(XButtonPressedEvent *ebut);
88   static void waitabit(void);
89   static void getmove(XButtonPressedEvent *ebut);
90 < static void getkey(register XKeyPressedEvent *ekey);
91 < static void fixwindow(register XExposeEvent *eexp);
92 < static void resizewindow(register XConfigureEvent *ersz);
90 > static void getkey(XKeyPressedEvent *ekey);
91 > static void fixwindow(XExposeEvent *eexp);
92 > static void resizewindow(XConfigureEvent *ersz);
93  
94  
95   static int
96   mytmflags(void)                 /* figure out tone mapping flags */
97   {
98          extern char     *progname;
99 <        register char   *cp, *tail;
99 >        char    *cp, *tail;
100                                          /* find basic name */
101          for (cp = tail = progname; *cp; cp++)
102                  if (*cp == '/')
# Line 116 | Line 112 | mytmflags(void)                        /* figure out tone mapping flags */
112   }
113  
114  
115 < extern void
115 > void
116   dev_open(                       /* initialize X11 driver */
117          char  *id
118   )
# Line 217 | Line 213 | dev_open(                      /* initialize X11 driver */
213   }
214  
215  
216 < extern void
216 > void
217   dev_close(void)                 /* close our display */
218   {
219          freepixels();
# Line 235 | Line 231 | dev_close(void)                        /* close our display */
231   }
232  
233  
234 < extern void
234 > void
235   dev_clear(void)                 /* clear our quadtree */
236   {
237          qtCompost(100);
# Line 245 | Line 241 | dev_clear(void)                        /* clear our quadtree */
241   }
242  
243  
244 < extern int
244 > int
245   dev_view(                       /* assign new driver view */
246          VIEW    *nv
247   )
# Line 264 | Line 260 | dev_view(                      /* assign new driver view */
260                  return(0);
261          }
262          if (nv != &odev.v) {
263 <                if (!FEQ(nv->horiz,odev.v.horiz) ||     /* resize window? */
264 <                                !FEQ(nv->vert,odev.v.vert)) {
263 >                if (!FABSEQ(nv->horiz,odev.v.horiz) ||  /* resize window? */
264 >                                !FABSEQ(nv->vert,odev.v.vert)) {
265                          int     dw = DisplayWidth(ourdisplay,ourscreen);
266                          int     dh = DisplayHeight(ourdisplay,ourscreen);
267  
# Line 293 | Line 289 | dev_view(                      /* assign new driver view */
289   }
290  
291  
292 < extern void
292 > void
293   dev_section(            /* add octree for geometry rendering */
294          char    *gfn,
295          char    *pfn
# Line 303 | Line 299 | dev_section(           /* add octree for geometry rendering */
299   }
300  
301  
302 < extern void
302 > void
303   dev_auxcom(             /* process an auxiliary command */
304          char    *cmd,
305          char    *args
# Line 314 | Line 310 | dev_auxcom(            /* process an auxiliary command */
310   }
311  
312  
313 < extern VIEW *
313 > VIEW *
314   dev_auxview(            /* return nth auxiliary view */
315          int     n,
316          int     hvres[2]
# Line 327 | Line 323 | dev_auxview(           /* return nth auxiliary view */
323   }
324  
325  
326 < extern int
326 > int
327   dev_input(void)                 /* get X11 input */
328   {
329          inpresflags = 0;
# Line 343 | Line 339 | dev_input(void)                        /* get X11 input */
339   }
340  
341  
342 < extern void
342 > void
343   dev_paintr(             /* fill a rectangle */
344          uby8    rgb[3],
345          int  xmin,
# Line 366 | Line 362 | dev_paintr(            /* fill a rectangle */
362   }
363  
364  
365 < extern int
365 > int
366   dev_flush(void)                 /* flush output */
367   {
368          qtUpdate();
# Line 399 | Line 395 | static int
395   getpixels(void)                         /* get the color map */
396   {
397          XColor  thiscolor;
398 <        register int  i, j;
398 >        int  i, j;
399  
400          if (ncolors > 0)
401                  return(ncolors);
# Line 464 | Line 460 | freepixels(void)                               /* free our pixels */
460  
461   static unsigned long
462   true_pixel(                     /* return true pixel value for color */
463 <        register uby8   rgb[3]
463 >        uby8    rgb[3]
464   )
465   {
466 <        register unsigned long  rval;
466 >        unsigned long  rval;
467  
468          rval = ourvinfo.red_mask*rgb[RED]/255 & ourvinfo.red_mask;
469          rval |= ourvinfo.green_mask*rgb[GRN]/255 & ourvinfo.green_mask;
# Line 506 | Line 502 | getevent(void)                 /* get next event */
502          case ButtonPress:
503                  if (FRAMESTATE(levptr(XButtonPressedEvent)->state))
504                          getframe(levptr(XButtonPressedEvent));
505 <                else
506 <                        getmove(levptr(XButtonPressedEvent));
505 >                else
506 >                        switch (levptr(XButtonPressedEvent)->button) {
507 >                        case Button4:           /* wheel up */
508 >                        case Button5:           /* wheel down */
509 >                                break;
510 >                        default:
511 >                                getmove(levptr(XButtonPressedEvent));
512 >                                break;
513 >                        }
514                  break;
515          }
516   }
# Line 594 | Line 597 | moveview(      /* move our view */
597          VIEW    nv;
598          FVECT   odir, v1;
599          double  d;
600 <        register int    li;
600 >        int     li;
601                                  /* start with old view */
602          nv = odev.v;
603                                  /* change view direction */
# Line 657 | Line 660 | getframe(                              /* get focus frame */
660                                          /* set frame for rendering */
661          if ((endx == startx) | (endy == starty))
662                  return;
663 <        if (endx < startx) {register int c = endx; endx = startx; startx = c;}
664 <        if (endy < starty) {register int c = endy; endy = starty; starty = c;}
663 >        if (endx < startx) {int c = endx; endx = startx; startx = c;}
664 >        if (endy < starty) {int c = endy; endy = starty; starty = c;}
665          sprintf(odev_args, "%.3f %.3f %.3f %.3f",
666                          (startx+.5)/odev.hres, 1.-(endy+.5)/odev.vres,
667                          (endx+.5)/odev.hres, 1.-(starty+.5)/odev.vres);
# Line 720 | Line 723 | getmove(                               /* get view change */
723  
724   static void
725   getkey(                         /* get input key */
726 <        register XKeyPressedEvent  *ekey
726 >        XKeyPressedEvent  *ekey
727   )
728   {
729          Window  rootw, childw;
# Line 802 | Line 805 | getkey(                                /* get input key */
805  
806   static void
807   fixwindow(                              /* repair damage to window */
808 <        register XExposeEvent  *eexp
808 >        XExposeEvent  *eexp
809   )
810   {
811          if (odev.hres == 0 || odev.vres == 0) { /* first exposure */
# Line 816 | Line 819 | fixwindow(                             /* repair damage to window */
819  
820   static void
821   resizewindow(                   /* resize window */
822 <        register XConfigureEvent  *ersz
822 >        XConfigureEvent  *ersz
823   )
824   {
825          if (ersz->width == odev.hres && ersz->height == odev.vres)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines