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.37 by schorsch, Thu Jan 1 11:21:55 2004 UTC vs.
Revision 3.39 by greg, Fri Jan 21 00:52:59 2005 UTC

# Line 19 | Line 19 | static const char      RCSid[] = "$Id$";
19   #include "plocate.h"
20   #include "rhdisp.h"
21   #include "rhd_qtree.h"
22 < #include  "x11icon.h"
22 > #include "x11icon.h"
23  
24   #ifndef RAYQLEN
25   #define RAYQLEN         50000           /* max. rays to queue before flush */
# Line 54 | Line 54 | static const char      RCSid[] = "$Id$";
54  
55   struct driver   odev;                   /* global device driver structure */
56  
57 + TMstruct        *tmGlobal;              /* global tone-mapping structure */
58 +
59   char odev_args[64];                     /* command arguments */
60  
61   static XEvent  currentevent;            /* current event */
# Line 165 | Line 167 | dev_open(                      /* initialize X11 driver */
167                                  &myprims[BLU][CIEX],&myprims[BLU][CIEY],
168                                  &myprims[WHT][CIEX],&myprims[WHT][CIEY]) >= 6)
169                  dpri = myprims;
170 <        if (tmInit(mytmflags(), dpri, gamval) == NULL)
170 >        tmGlobal = tmInit(mytmflags(), dpri, gamval);
171 >        if (tmGlobal == NULL)
172                  error(SYSTEM, "not enough memory in dev_open");
173                                          /* open window */
174          ourwinattr.background_pixel = ourblack;
# Line 225 | Line 228 | dev_close(void)                        /* close our display */
228          XCloseDisplay(ourdisplay);
229          ourdisplay = NULL;
230          qtFreeLeaves();
231 <        tmDone(NULL);
231 >        tmDone(tmGlobal);
232          odev.v.type = 0;
233          odev.hres = odev.vres = 0;
234          odev.ifd = -1;
# Line 637 | Line 640 | getframe(                              /* get focus frame */
640   )
641   {
642          int     startx = ebut->x, starty = ebut->y;
643 <        int     endx, endy;
644 <
643 >        int     endx, endy, midx, midy;
644 >        FVECT   v1;
645 >        int     li;
646 >                                        /* get mouse drag */
647          XMaskEvent(ourdisplay, ButtonReleaseMask, levptr(XEvent));
648          endx = levptr(XButtonReleasedEvent)->x;
649          endy = levptr(XButtonReleasedEvent)->y;
650 <        if ((endx == startx) | (endy == starty)) {
651 <                XBell(ourdisplay, 0);
650 >        midx = (startx + endx) >> 1;
651 >        midy = (starty + endy) >> 1;
652 >                                        /* set focus distance */
653 >        if ((li = qtFindLeaf(midx, midy)) < 0)
654 >                return(0);              /* not on window */
655 >        VCOPY(v1, qtL.wp[li]);
656 >        odev.v.vdist = sqrt(dist2(odev.v.vp, v1));
657 >                                        /* set frame for rendering */
658 >        if ((endx == startx) | (endy == starty))
659                  return;
648        }
660          if (endx < startx) {register int c = endx; endx = startx; startx = c;}
661          if (endy < starty) {register int c = endy; endy = starty; starty = c;}
662          sprintf(odev_args, "%.3f %.3f %.3f %.3f",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines