[PD-cvs] pd/src desire.c,1.1.2.217.2.152,1.1.2.217.2.153

Mathieu Bouchard matju at users.sourceforge.net
Wed Jul 11 20:32:51 CEST 2007


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31269

Modified Files:
      Tag: desiredata
	desire.c 
Log Message:
cleanup


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.152
retrieving revision 1.1.2.217.2.153
diff -C2 -d -r1.1.2.217.2.152 -r1.1.2.217.2.153
*** desire.c	10 Jul 2007 23:35:00 -0000	1.1.2.217.2.152
--- desire.c	11 Jul 2007 18:32:46 -0000	1.1.2.217.2.153
***************
*** 1726,1730 ****
      t_template *elemtemplate;
      int elemsize, yonset, wonset, xonset, incr;
!     float xsum=0;
      if (elemtemplatesym == &s_float) return 0;
      if (array_getfields(elemtemplatesym, &elemtemplatecanvas,
--- 1726,1730 ----
      t_template *elemtemplate;
      int elemsize, yonset, wonset, xonset, incr;
!     //float xsum=0;
      if (elemtemplatesym == &s_float) return 0;
      if (array_getfields(elemtemplatesym, &elemtemplatecanvas,
***************
*** 1734,1745 ****
      if (array->n < 2000) incr=1; else incr = array->n/300;
      for (int i=0; i < array->n; i += incr) {
!         float usexloc, useyloc;
!         if (xonset>=0) usexloc = xloc + slot_cvttocoord(xfield, *(float *)&array->vec[elemsize*i+xonset]);
!         else usexloc = xloc + xsum, xsum += xinc;
!         useyloc = yloc + (yonset>=0 ? slot_cvttocoord(yfield, *(float *)&array->vec[elemsize*i+yonset]):0);
          int hit = 0;
  	/* hit = scalar_doclick((t_word *)&array->vec[elemsize*i],
              elemtemplate, 0, array, canvas, usexloc, useyloc, xpix, ypix, shift, alt, dbl, doit);*/
- 
  	if (hit) return hit;
      }
--- 1734,1743 ----
      if (array->n < 2000) incr=1; else incr = array->n/300;
      for (int i=0; i < array->n; i += incr) {
! 	//float usexloc = xonset>=0 ? xloc + slot_cvttocoord(xfield, *(float *)&array->vec[elemsize*i+xonset]) : xloc + xsum;
!         //if (xonset>=0) xsum += xinc;
!         //float useyloc = yloc + (yonset>=0 ? slot_cvttocoord(yfield, *(float *)&array->vec[elemsize*i+yonset]):0);
          int hit = 0;
  	/* hit = scalar_doclick((t_word *)&array->vec[elemsize*i],
              elemtemplate, 0, array, canvas, usexloc, useyloc, xpix, ypix, shift, alt, dbl, doit);*/
  	if (hit) return hit;
      }
***************
*** 3021,3027 ****
  
  t_int *vinlet_perform(t_int *w) {
!     t_vinlet *x = (t_vinlet *)(w[1]);
!     t_float *out = (t_float *)(w[2]);
!     int n = (int)(w[3]);
      t_float *in = x->read;
      while (n--) *out++ = *in++;
--- 3019,3025 ----
  
  t_int *vinlet_perform(t_int *w) {
!     t_vinlet *x = (t_vinlet *)w[1];
!     t_float *out = (t_float *)w[2];
!     int n = int(w[3]);
      t_float *in = x->read;
      while (n--) *out++ = *in++;
***************
*** 3033,3039 ****
  /* tb: vectorized */
  t_int *vinlet_perf8(t_int *w) {
!     t_vinlet *x = (t_vinlet *)(w[1]);
!     t_float *out = (t_float *)(w[2]);
!     int n = (int)(w[3]);
      t_float *in = x->read;
      for (; n; n -= 8, in += 8, out += 8) {
--- 3031,3037 ----
  /* tb: vectorized */
  t_int *vinlet_perf8(t_int *w) {
!     t_vinlet *x = (t_vinlet *)w[1];
!     t_float *out = (t_float *)w[2];
!     int n = int(w[3]);
      t_float *in = x->read;
      for (; n; n -= 8, in += 8, out += 8) {
***************
*** 3057,3063 ****
  
  static void vinlet_dsp(t_vinlet *x, t_signal **sp) {
-     t_signal *outsig;
      if (!x->buf) return; /* no buffer means we're not a signal inlet */
!     outsig = sp[0];
      if (x->directsignal) signal_setborrowed(sp[0], x->directsignal);
      else {
--- 3055,3060 ----
  
  static void vinlet_dsp(t_vinlet *x, t_signal **sp) {
      if (!x->buf) return; /* no buffer means we're not a signal inlet */
!     t_signal *outsig = sp[0];
      if (x->directsignal) signal_setborrowed(sp[0], x->directsignal);
      else {
***************
*** 3065,3069 ****
  	/* if the outsig->v is aligned the x->read will also be... */
  	if(vecsize&7) dsp_add(vinlet_perform, 3, x, outsig->v,vecsize);
! 	else if(SIMD_CHECK1(n,outsig->v))
  	     dsp_add(vinlet_perfsimd, 3, x, outsig->v,vecsize);
  	else dsp_add(vinlet_perf8,    3, x, outsig->v,vecsize);
--- 3062,3066 ----
  	/* if the outsig->v is aligned the x->read will also be... */
  	if(vecsize&7) dsp_add(vinlet_perform, 3, x, outsig->v,vecsize);
! 	else if(SIMD_CHECK1(outsig->n,outsig->v))
  	     dsp_add(vinlet_perfsimd, 3, x, outsig->v,vecsize);
  	else dsp_add(vinlet_perf8,    3, x, outsig->v,vecsize);
***************
*** 3249,3253 ****
  int voutlet_issignal(t_voutlet *x) {return x->buf!=0;}
  
!     /* LATER optimize for non-overlapped case where the "+=" isn't needed */
  t_int *voutlet_perform(t_int *w) {
      t_voutlet *x = (t_voutlet *)(w[1]);
--- 3246,3250 ----
  int voutlet_issignal(t_voutlet *x) {return x->buf!=0;}
  
! /* LATER optimize for non-overlapped case where the "+=" isn't needed */
  t_int *voutlet_perform(t_int *w) {
      t_voutlet *x = (t_voutlet *)(w[1]);
***************
*** 3267,3272 ****
  /* epilog code for blocking: write buffer to parent patch */
  static t_int *voutlet_doepilog(t_int *w) {
!     t_voutlet *x = (t_voutlet *)(w[1]);
!     t_float *out = (t_float *)(w[2]); /* IOhannes */
      t_float *in = x->empty;
      if (x->updown.downsample != x->updown.upsample)    out = x->updown.v; /* IOhannes */
--- 3264,3269 ----
  /* epilog code for blocking: write buffer to parent patch */
  static t_int *voutlet_doepilog(t_int *w) {
!     t_voutlet *x = (t_voutlet *)w[1];
!     t_float *out = (t_float *)w[2]; /* IOhannes */
      t_float *in = x->empty;
      if (x->updown.downsample != x->updown.upsample)    out = x->updown.v; /* IOhannes */
***************
*** 3279,3283 ****
  /* IOhannes { */
  static t_int *voutlet_doepilog_resampling(t_int *w) {
!     t_voutlet *x = (t_voutlet *)(w[1]);
      t_float *in  = x->empty;
      t_float *out = x->updown.v; /* IOhannes */
--- 3276,3280 ----
  /* IOhannes { */
  static t_int *voutlet_doepilog_resampling(t_int *w) {
!     t_voutlet *x = (t_voutlet *)w[1];
      t_float *in  = x->empty;
      t_float *out = x->updown.v; /* IOhannes */
***************
*** 3307,3317 ****
  
  static void voutlet_dsp(t_voutlet *x, t_signal **sp) {
-     t_signal *insig;
      if (!x->buf) return;
!     insig = sp[0];
      if (x->justcopyout) dsp_add_copy(insig->v, x->directsignal->v, insig->n);
      else if (x->directsignal) {
!         /* if we're just going to make the signal available on the
!            parent patch, hand it off to the parent signal. */
          /* this is done elsewhere--> sp[0]->refcount++; */
          signal_setborrowed(x->directsignal, sp[0]);
--- 3304,3312 ----
  
  static void voutlet_dsp(t_voutlet *x, t_signal **sp) {
      if (!x->buf) return;
!     t_signal *insig = sp[0];
      if (x->justcopyout) dsp_add_copy(insig->v, x->directsignal->v, insig->n);
      else if (x->directsignal) {
!         /* if we're just going to make the signal available on the parent patch, hand it off to the parent signal. */
          /* this is done elsewhere--> sp[0]->refcount++; */
          signal_setborrowed(x->directsignal, sp[0]);
***************
*** 3366,3370 ****
            /* IOhannes { */
            x->empty = x->buf + re_parentvecsize * epilogphase;
!           if (upsample * downsample == 1)
              dsp_add(voutlet_doepilog, 3, x, outsig->v, re_parentvecsize);
            else {
--- 3361,3365 ----
            /* IOhannes { */
            x->empty = x->buf + re_parentvecsize * epilogphase;
!           if (upsample*downsample==1)
              dsp_add(voutlet_doepilog, 3, x, outsig->v, re_parentvecsize);
            else {
***************
*** 3393,3405 ****
      x->endbuf = x->buf = (t_float *)getalignedbytes(0);
      x->bufsize = 0;
- 
      resample_init(&x->updown);
- 
      /* this should be though over: 
       * it might prove hard to provide consistency between labeled up- & downsampling methods
       * maybe indeces would be better...
!      *
!      * up till now we provide several upsampling methods and 1 single downsampling method (no filtering !)
!      */
      if (s){
        char c=*s->name;
--- 3388,3396 ----
      x->endbuf = x->buf = (t_float *)getalignedbytes(0);
      x->bufsize = 0;
      resample_init(&x->updown);
      /* this should be though over: 
       * it might prove hard to provide consistency between labeled up- & downsampling methods
       * maybe indeces would be better...
!      * up till now we provide several upsampling methods and 1 single downsampling method (no filtering !) */
      if (s){
        char c=*s->name;
***************
*** 3414,3418 ****
  }
  
- 
  static void voutlet_setup() {
      t_class *c = voutlet_class = class_new2("outlet",voutlet_new,voutlet_free,sizeof(t_voutlet),CLASS_NOINLET,"S");
--- 3405,3408 ----
***************
*** 3549,3556 ****
      goty = template_find_field(t,&s_y,&yonset,&ytype,&zz);
      if (goty && (ytype != DT_FLOAT)) goty = 0;
!     if (gotx) *(t_float *)(((char *)(x->v)) + xonset) +=
!             dx * (canvas_pixelstox(canvas, 1) - canvas_pixelstox(canvas, 0));
!     if (goty) *(t_float *)(((char *)(x->v)) + yonset) +=
!             dy * (canvas_pixelstoy(canvas, 1) - canvas_pixelstoy(canvas, 0));
      scalar_redraw(x, canvas);
  }*/
--- 3539,3544 ----
      goty = template_find_field(t,&s_y,&yonset,&ytype,&zz);
      if (goty && (ytype != DT_FLOAT)) goty = 0;
!     if (gotx) *(t_float *)(((char *)(x->v)) + xonset) += dx * (canvas_pixelstox(canvas, 1) - canvas_pixelstox(canvas, 0));
!     if (goty) *(t_float *)(((char *)(x->v)) + yonset) += dy * (canvas_pixelstoy(canvas, 1) - canvas_pixelstoy(canvas, 0));
      scalar_redraw(x, canvas);
  }*/
***************
*** 3653,3662 ****
  /*
  This file contains text objects you would put in a canvas to define a
! template.  Templates describe objects of type "array" (g_array.c) and
! "scalar" (g_scalar.c).
! */
! 
! /* the structure of a "struct" object (also the obsolete "gtemplate"
!    you get when using the name "template" in a box.) */
  struct t_gtemplate : t_object {
      t_template *t;
--- 3641,3646 ----
  /*
  This file contains text objects you would put in a canvas to define a
! template.  Templates describe objects of type "array" (g_array.c) and "scalar" (g_scalar.c). */
! /* the structure of a "struct" object (also the obsolete "gtemplate" you get when using the name "template" in a box.) */
  struct t_gtemplate : t_object {
      t_template *t;
***************
*** 3675,3684 ****
  /* there's a pre-defined "float" template.  LATER should we bind this to a symbol such as "pd-float"??? */
  
!     /* return true if two dataslot definitions match */
  static int dataslot_matches(t_dataslot *ds1, t_dataslot *ds2, int nametoo) {
!     return (!nametoo || ds1->name == ds2->name) &&
!         ds1->type == ds2->type &&
!             (ds1->type != DT_ARRAY ||
!                 ds1->arraytemplate == ds2->arraytemplate);
  }
  
--- 3659,3666 ----
  /* there's a pre-defined "float" template.  LATER should we bind this to a symbol such as "pd-float"??? */
  
! /* return true if two dataslot definitions match */
  static int dataslot_matches(t_dataslot *ds1, t_dataslot *ds2, int nametoo) {
!     return (!nametoo || ds1->name == ds2->name) && ds1->type == ds2->type &&
!             (ds1->type != DT_ARRAY || ds1->arraytemplate == ds2->arraytemplate);
  }
  
***************
*** 3717,3721 ****
          x->vec[oldn].name = newname;
          x->vec[oldn].arraytemplate = newarraytemplate;
!     bad: 
          argc -= 2; argv += 2;
      }
--- 3699,3703 ----
          x->vec[oldn].name = newname;
          x->vec[oldn].arraytemplate = newarraytemplate;
!     bad:
          argc -= 2; argv += 2;
      }
***************
*** 3773,3779 ****
      if (x1->n < x2->n) return 0;
      for (int i=x2->n; i < x1->n; i++)
!         if (x1->vec[i].type == DT_ARRAY ||
!             x1->vec[i].type == DT_LIST)
!                 return 0;
      if (x2->n > x1->n) post("add elements...");
      for (int i=0; i < x2->n; i++) if (!dataslot_matches(&x1->vec[i], &x2->vec[i], 1)) return 0;
--- 3755,3759 ----
      if (x1->n < x2->n) return 0;
      for (int i=x2->n; i < x1->n; i++)
!         if (x1->vec[i].type == DT_ARRAY || x1->vec[i].type == DT_LIST) return 0;
      if (x2->n > x1->n) post("add elements...");
      for (int i=0; i < x2->n; i++) if (!dataslot_matches(&x1->vec[i], &x2->vec[i], 1)) return 0;
***************
*** 3794,3799 ****
      for (int i=0; i<tto->n; i++) {
          if (conformaction[i] >= 0) {
!             /* we swap the two, in case it's an array or list, so that
!                when "wfrom" is deleted the old one gets cleaned up. */
              t_word wwas = wto[i];
              wto[i] = wfrom[conformaction[i]];
--- 3774,3778 ----
      for (int i=0; i<tto->n; i++) {
          if (conformaction[i] >= 0) {
!             /* we swap the two, in case it's an array or list, so that when "wfrom" is deleted the old one gets cleaned up. */
              t_word wwas = wto[i];
              wto[i] = wfrom[conformaction[i]];
***************
*** 3816,3821 ****
          x->t = tfrom->sym;
          gpointer_setcanvas(&gp, canvas, x);
!         /* Here we initialize to the new template, but array and list
!            elements will still belong to old template. */
          word_init(x->v, tto, &gp);
          template_conformwords(tfrom, tto, conformaction, scfrom->v, x->v);
--- 3795,3799 ----
          x->t = tfrom->sym;
          gpointer_setcanvas(&gp, canvas, x);
!         /* Here we initialize to the new template, but array and list elements will still belong to old template. */
          word_init(x->v, tto, &gp);
          template_conformwords(tfrom, tto, conformaction, scfrom->v, x->v);
***************
*** 3887,3891 ****
  	t_class *c = g->_class;
  	/* what's the purpose of the assignment here?... consult original code */
!         if (c==scalar_class)      g = template_conformscalar(tfrom, tto, conformaction, canvas, (t_scalar *)g);
          else if (c==canvas_class) template_conformcanvas(tfrom, tto,  conformaction, (t_canvas *)g);
          else if (c==garray_class) template_conformarray(tfrom, tto, conformaction, garray_getarray((t_garray *)g));
--- 3865,3869 ----
  	t_class *c = g->_class;
  	/* what's the purpose of the assignment here?... consult original code */
!         if      (c==scalar_class) g = template_conformscalar(tfrom, tto, conformaction, canvas, (t_scalar *)g);
          else if (c==canvas_class) template_conformcanvas(tfrom, tto,  conformaction, (t_canvas *)g);
          else if (c==garray_class) template_conformarray(tfrom, tto, conformaction, garray_getarray((t_garray *)g));
***************
*** 3929,3935 ****
  }
  
! t_template *template_findbyname(t_symbol *s) {
!     return (t_template *)pd_findbyclass(s, template_class);
! }
  
  t_canvas *template_findcanvas(t_template *t) {
--- 3907,3911 ----
  }
  
! t_template *template_findbyname(t_symbol *s) {return (t_template *)pd_findbyclass(s, template_class);}
  
  t_canvas *template_findcanvas(t_template *t) {
***************
*** 3990,3994 ****
      if (*x->sym->name) pd_unbind(x,x->sym);
      free(x->vec);
- 
  }
  
--- 3966,3969 ----
***************
*** 4315,4319 ****
                 have to allocate memory here. */
              for (int i=0; i<n; i++, f += 2) {
!                 pix[2*i  ] = canvas_xtopixels(canvas, basex + slot_getcoord(f, t, data, 1));
                  pix[2*i+1] = canvas_ytopixels(canvas, basey + slot_getcoord(f+1, t, data, 1));
              }
--- 4290,4294 ----
                 have to allocate memory here. */
              for (int i=0; i<n; i++, f += 2) {
!                 pix[2*i  ] = canvas_xtopixels(canvas, basex + slot_getcoord(f+0, t, data, 1));
                  pix[2*i+1] = canvas_ytopixels(canvas, basey + slot_getcoord(f+1, t, data, 1));
              }
***************
*** 4345,4354 ****
    t_template *t;
    t_gpointer gpointer;
- 
  } cm;
  
! /* LATER protect against the template changing or the scalar disappearing
!    probably by attaching a gpointer here ... */
! 
  #if 0
  static void curve_motion(void *z, t_floatarg dx, t_floatarg dy) {
--- 4320,4326 ----
    t_template *t;
    t_gpointer gpointer;
  } cm;
  
! /* LATER protect against the template changing or the scalar disappearing probably by attaching a gpointer here ... */
  #if 0
  static void curve_motion(void *z, t_floatarg dx, t_floatarg dy) {
***************
*** 4533,4541 ****
  static void plot_vis(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t, float basex, float basey, int tovis) {
      t_plot *x = (t_plot *)z;
!     int elemsize, yonset, wonset, xonset, i;
      t_canvas *elemtemplatecanvas;
      t_template *elemtemplate;
      t_symbol *elemtemplatesym;
!     float linewidth, xloc, xinc, yloc, style, usexloc, xsum, yval, vis, scalarvis;
      t_array *array;
      int nelem;
--- 4505,4513 ----
  static void plot_vis(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t, float basex, float basey, int tovis) {
      t_plot *x = (t_plot *)z;
!     int elemsize, yonset, wonset, xonset;
      t_canvas *elemtemplatecanvas;
      t_template *elemtemplate;
      t_symbol *elemtemplatesym;
!     float linewidth, xloc, xinc, yloc, style, xsum, yval, vis, scalarvis;
      t_array *array;
      int nelem;
***************
*** 4552,4564 ****
              float minyval = 1e20, maxyval = -1e20;
              int ndrawn = 0;
!             for (xsum = basex + xloc, i = 0; i < nelem; i++) {
                  float yval;
                  int ixpix, inextx;
                  if (xonset >= 0) {
!                     usexloc = basex + xloc + *(float *)((elem + elemsize*i) + xonset);
                      ixpix  = canvas_xtopixels(canvas, slot_cvttocoord(xslot, usexloc));
                      inextx = ixpix + 2;
                  } else {
!                     usexloc = xsum;
                      xsum += xinc;
                      ixpix  = canvas_xtopixels(canvas, slot_cvttocoord(xslot, usexloc));
--- 4524,4537 ----
              float minyval = 1e20, maxyval = -1e20;
              int ndrawn = 0;
! 	    xsum = basex + xloc;
!             for (int i=0; i<nelem; i++) {
                  float yval;
                  int ixpix, inextx;
                  if (xonset >= 0) {
!                     float usexloc = basex + xloc + *(float *)((elem + elemsize*i) + xonset);
                      ixpix  = canvas_xtopixels(canvas, slot_cvttocoord(xslot, usexloc));
                      inextx = ixpix + 2;
                  } else {
!                     float usexloc = xsum;
                      xsum += xinc;
                      ixpix  = canvas_xtopixels(canvas, slot_cvttocoord(xslot, usexloc));
***************
*** 4583,4587 ****
              char outline[20];
              int lastpixel = -1, ndrawn = 0;
!             float yval = 0, wval = 0, xpix;
              int ixpix = 0;
  	    /* draw the trace */
--- 4556,4560 ----
              char outline[20];
              int lastpixel = -1, ndrawn = 0;
!             float yval = 0, wval = 0;
              int ixpix = 0;
  	    /* draw the trace */
***************
*** 4590,4599 ****
  	        /* found "w" field which controls linewidth.  The trace is a filled polygon with 2n points. */
                  //sys_vgui(".x%lx.c create polygon \\\n", (long)canvas_getcanvas(canvas));
!                 for (i = 0, xsum = xloc; i < nelem; i++) {
!                     if (xonset >= 0) usexloc = xloc + *(float *)(elem+elemsize*i+xonset);
! 		    else usexloc = xsum, xsum += xinc;
!                     yval = yonset>=0 ? *(float *)(elem+elemsize*i+yonset) : 0;
                      wval = *(float *)(elem+elemsize*i+wonset);
!                     xpix = canvas_xtopixels(canvas, basex + slot_cvttocoord(xslot, usexloc));
                      ixpix = (int)roundf(xpix);
                      if (xonset >= 0 || ixpix != lastpixel) {
--- 4563,4572 ----
  	        /* found "w" field which controls linewidth.  The trace is a filled polygon with 2n points. */
                  //sys_vgui(".x%lx.c create polygon \\\n", (long)canvas_getcanvas(canvas));
! 		xsum = xloc;
!                 for (int i=0; i<nelem; i++) {
!                     float usexloc = xonset>=0 ? xloc+*(float *)(elem+elemsize*i+xonset) : (xsum+=xinc);
!                     float    yval = yonset>=0 ?      *(float *)(elem+elemsize*i+yonset) : 0;
                      wval = *(float *)(elem+elemsize*i+wonset);
!                     float xpix = canvas_xtopixels(canvas, basex + slot_cvttocoord(xslot, usexloc));
                      ixpix = (int)roundf(xpix);
                      if (xonset >= 0 || ixpix != lastpixel) {
***************
*** 4608,4617 ****
                  lastpixel = -1;
                  for (int i=nelem-1; i>=0; i--) {
!                     float usexloc;
!                     if (xonset >= 0) usexloc = xloc + *(float *)(elem+elemsize*i+xonset);
! 		    else xsum -= xinc, usexloc = xsum;
!                     if (yonset >= 0) yval = *(float *)(elem+elemsize*i+yonset); else yval = 0;
                      wval = *(float *)((elem + elemsize*i) + wonset);
!                     xpix = canvas_xtopixels(canvas, basex + slot_cvttocoord(xslot, usexloc));
                      ixpix = (int)roundf(xpix);
                      if (xonset >= 0 || ixpix != lastpixel) {
--- 4581,4588 ----
                  lastpixel = -1;
                  for (int i=nelem-1; i>=0; i--) {
!                     float usexloc = xonset>=0 ? xloc+*(float *)(elem+elemsize*i+xonset) : (xsum-=xinc);
!                     float    yval = yonset>=0 ?      *(float *)(elem+elemsize*i+yonset) : 0;
                      wval = *(float *)((elem + elemsize*i) + wonset);
!                     float xpix = canvas_xtopixels(canvas, basex + slot_cvttocoord(xslot, usexloc));
                      ixpix = (int)roundf(xpix);
                      if (xonset >= 0 || ixpix != lastpixel) {
***************
*** 4623,4633 ****
                      if (ndrawn >= 1000) goto ouch;
                  }
!                 /* TK will complain if there aren't at least 3 points.
!                    There should be at least two already. */
                  if (ndrawn < 4) {
! 		    int y = (int)slot_cvttocoord(yslot, yval);
! 		    int w = (int)slot_cvttocoord(wslot, wval);
!                     sys_vgui("%d %f \\\n", ixpix + 10, canvas_ytopixels(canvas, basey + yloc + y + w));
!                     sys_vgui("%d %f \\\n", ixpix + 10, canvas_ytopixels(canvas, basey + yloc + y - w));
                  }
              ouch:
--- 4594,4604 ----
                      if (ndrawn >= 1000) goto ouch;
                  }
!                 /* TK will complain if there aren't at least 3 points. There should be at least two already. */
                  if (ndrawn < 4) {
! 		    int y = int(slot_cvttocoord(yslot, yval));
! 		    int w = int(slot_cvttocoord(wslot, wval));
!                     sys_vgui("%d %f %d %f\\\n",
! 			ixpix + 10, canvas_ytopixels(canvas, basey + yloc + y + w),
!                         ixpix + 10, canvas_ytopixels(canvas, basey + yloc + y - w));
                  }
              ouch:
***************
*** 4639,4651 ****
  		   requested width; otherwise don't draw the trace at all. */
                  sys_vgui(".x%lx.c create line \\\n", (long)canvas_getcanvas(canvas));
!                 for (xsum = xloc, i = 0; i < nelem; i++) {
!                     float usexloc;
!                     if (xonset >= 0) usexloc = xloc + *(float *)(elem+elemsize*i+xonset); else {usexloc=xsum; xsum+=(int)xinc;}
!                     if (yonset >= 0) yval = *(float *)(elem+elemsize*i+yonset); else yval = 0;
!                     xpix = canvas_xtopixels(canvas, basex + slot_cvttocoord(xslot, usexloc));
                      ixpix = (int)roundf(xpix);
                      if (xonset >= 0 || ixpix != lastpixel) {
!                         sys_vgui("%d %f \\\n", ixpix,
! 				canvas_ytopixels(canvas, basey + yloc + slot_cvttocoord(yslot, yval)));
                          ndrawn++;
                      }
--- 4610,4621 ----
  		   requested width; otherwise don't draw the trace at all. */
                  sys_vgui(".x%lx.c create line \\\n", (long)canvas_getcanvas(canvas));
! 		xsum = xloc;
!                 for (int i=0; i<nelem; i++) {
!                     float usexloc = xonset>=0 ? xloc+*(float *)(elem+elemsize*i+xonset) : xsum; if (xonset>=0) xsum+=(int)xinc;
!                     float    yval = yonset>=0 ?      *(float *)(elem+elemsize*i+yonset) : 0;
!                     float xpix = canvas_xtopixels(canvas, basex + slot_cvttocoord(xslot, usexloc));
                      ixpix = (int)roundf(xpix);
                      if (xonset >= 0 || ixpix != lastpixel) {
!                         sys_vgui("%d %f \\\n", ixpix, canvas_ytopixels(canvas, basey + yloc + slot_cvttocoord(yslot, yval)));
                          ndrawn++;
                      }
***************
*** 4657,4664 ****
                  else if (ndrawn == 1) sys_vgui("%d %f \\\n", ixpix + 10,
                      canvas_ytopixels(canvas, basey + yloc + slot_cvttocoord(yslot, yval)));
!                 sys_vgui("-width %f\\\n", linewidth);
!                 sys_vgui("-fill %s\\\n", outline);
!                 if (style == PLOTSTYLE_BEZ) sys_vgui("-smooth 1\\\n");
!                 sys_vgui("-tags plot%lx\n", (long)data);
              }
          }
--- 4627,4631 ----
                  else if (ndrawn == 1) sys_vgui("%d %f \\\n", ixpix + 10,
                      canvas_ytopixels(canvas, basey + yloc + slot_cvttocoord(yslot, yval)));
!                 sys_vgui("-width %f -fill %s -smooth %d -tags plot%lx",linewidth,outline,style==PLOTSTYLE_BEZ,(long)data);
              }
          }
***************
*** 4668,4676 ****
  	    int xsum = (int)xloc;
              for (int i=0; i<nelem; i++) {
!                 float usexloc, useyloc;
!                 if (xonset >= 0)
!                     usexloc = basex + xloc + *(float *)(elem+elemsize*i+xonset); else {usexloc=basex+xsum; xsum+=(int)xinc;}
                  yval = yonset>=0 ? *(float *)(elem+elemsize*i+yonset) : 0;
!                 useyloc = basey + yloc + slot_cvttocoord(yslot, yval);
                  /*canvas_each(y,elemtemplatecanvas) pd_getparentwidget(y)->w_parentvisfn(y, canvas,
  			(t_word *)(elem+elemsize*i), elemtemplate, usexloc, useyloc, tovis);*/
--- 4635,4642 ----
  	    int xsum = (int)xloc;
              for (int i=0; i<nelem; i++) {
!                 //float usexloc = xonset>=0 ? basex + xloc + *(float *)(elem+elemsize*i+xonset) : basex+xsum;
! 		if (xonset>=0) xsum+=int(xinc);
                  yval = yonset>=0 ? *(float *)(elem+elemsize*i+yonset) : 0;
!                 //float useyloc = basey + yloc + slot_cvttocoord(yslot, yval);
                  /*canvas_each(y,elemtemplatecanvas) pd_getparentwidget(y)->w_parentvisfn(y, canvas,
  			(t_word *)(elem+elemsize*i), elemtemplate, usexloc, useyloc, tovis);*/
***************
*** 4679,4684 ****
      } else {
  	/* un-draw the individual points */
! 	/*
!         if (scalarvis != 0)
              for (int i=0; i<nelem; i++)
                  canvas_each(y,elemtemplatecanvas)
--- 4645,4649 ----
      } else {
  	/* un-draw the individual points */
! 	/* if (scalarvis != 0)
              for (int i=0; i<nelem; i++)
                  canvas_each(y,elemtemplatecanvas)





More information about the Pd-cvs mailing list