Skip to content

Commit

Permalink
added stride functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
pchilds committed Sep 15, 2012
1 parent 74655fc commit c7d069d
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 40 deletions.
6 changes: 3 additions & 3 deletions gtk2plot/gtkplotlinear.c
Expand Up @@ -165,7 +165,7 @@ static void draw(GtkWidget *widget, cairo_t *cr)
GtkPlot *plt;
GtkAllocation alloc;
gint dtt, ft, hg, j, k, lt, st, tf, to, tn, tnn, tx, tz, wd, xa, xl, xr, xr2, xt, xu, xv, xvn, xw, ya, yl, yr, yr2, yu, yv, yvn, yw;
gdouble av, delx, dely, dt, lr, lr2, vv, wv, zv;
gdouble av, delx, dely, dt, lr1, lr2, vv, wv, zv;
guint lr3;
gchar *str1=NULL;
gchar lbl[BFL];
Expand Down Expand Up @@ -4183,12 +4183,12 @@ void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl)
{(plot->xlab)=g_strdup(xl); (plot->ylab)=g_strdup(yl);}
}

void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz)
void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st)
{
if (plot->xdata) g_array_free((plot->xdata), FALSE);
if (plot->ydata) g_array_free((plot->ydata), FALSE);
{(plot->xdata)=g_array_ref(xd); (plot->ydata)=g_array_ref(yd);}
gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
}

static void gtk_plot_linear_finalise(GtkPlotLinear *plot)
Expand Down
2 changes: 1 addition & 1 deletion gtk2plot/gtkplotlinear.h
Expand Up @@ -71,7 +71,7 @@
gboolean gtk_plot_linear_print_png(GtkWidget *widget, gchar *fout);
gboolean gtk_plot_linear_print_svg(GtkWidget *widget, gchar *fout);
void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl);
void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz);
void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st);
GtkWidget *gtk_plot_linear_new(void);
G_END_DECLS
#endif
24 changes: 12 additions & 12 deletions gtk2plot/gtkplotpolar.c
Expand Up @@ -1758,10 +1758,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{vv=g_array_index((plt->rd), gdouble, ft); wv=g_array_index((plt->gr), gdouble, ft); xv=g_array_index((plt->bl), gdouble, ft); yv=g_array_index((plt->al), gdouble, ft);}
cairo_set_source_rgba(cr, vv, wv, xv, yv);
ft=g_array_index((plt->ind), gint, k);
if (ft>=(plot->ydata->len)) break;
if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
Expand Down Expand Up @@ -2481,10 +2481,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{vv=g_array_index((plt->rd), gdouble, ft); wv=g_array_index((plt->gr), gdouble, ft); xv=g_array_index((plt->bl), gdouble, ft); yv=g_array_index((plt->al), gdouble, ft);}
cairo_set_source_rgba(cr, vv, wv, xv, yv);
ft=g_array_index((plt->ind), gint, k);
if (ft>=(plot->ydata->len)) break;
if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
Expand Down Expand Up @@ -3290,10 +3290,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{vv=g_array_index((plt->rd), gdouble, ft); wv=g_array_index((plt->gr), gdouble, ft); xv=g_array_index((plt->bl), gdouble, ft); yv=g_array_index((plt->al), gdouble, ft);}
cairo_set_source_rgba(cr, vv, wv, xv, yv);
ft=g_array_index((plt->ind), gint, k);
if (ft>=(plot->ydata->len)) break;
if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
Expand Down Expand Up @@ -4093,10 +4093,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{vv=g_array_index((plt->rd), gdouble, ft); wv=g_array_index((plt->gr), gdouble, ft); xv=g_array_index((plt->bl), gdouble, ft); yv=g_array_index((plt->al), gdouble, ft);}
cairo_set_source_rgba(cr, vv, wv, xv, yv);
ft=g_array_index((plt->ind), gint, k);
if (ft>=(plot->ydata->len)) break;
if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
Expand Down Expand Up @@ -4897,10 +4897,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{vv=g_array_index((plt->rd), gdouble, ft); wv=g_array_index((plt->gr), gdouble, ft); xv=g_array_index((plt->bl), gdouble, ft); yv=g_array_index((plt->al), gdouble, ft);}
cairo_set_source_rgba(cr, vv, wv, xv, yv);
ft=g_array_index((plt->ind), gint, k);
if (ft>=(plot->ydata->len)) break;
if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (j=ft+st; j<lt; j+=st)
{
r=g_array_index((plot->rdata), gdouble, j);
Expand Down Expand Up @@ -5546,12 +5546,12 @@ void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl)
{(plot->rlab)=g_strdup(rl); (plot->thlab)=g_strdup(tl);}
}

void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz)
void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, GArray *st)
{
if (plot->rdata) g_array_free((plot->rdata), FALSE);
if (plot->thdata) g_array_free((plot->thdata), FALSE);
{(plot->rdata)=g_array_ref(rd); (plot->thdata)=g_array_ref(td);}
gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
}

static void gtk_plot_polar_finalise(GtkPlotPolar *plot)
Expand Down
2 changes: 1 addition & 1 deletion gtk2plot/gtkplotpolar.h
Expand Up @@ -74,7 +74,7 @@
gboolean gtk_plot_polar_print_png(GtkWidget *widget, gchar *fout);
gboolean gtk_plot_polar_print_svg(GtkWidget *widget, gchar *fout);
void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl);
void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz);
void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, GArray *st);
GtkWidget *gtk_plot_polar_new(void);
G_END_DECLS
#endif
4 changes: 2 additions & 2 deletions gtk2plot/testplotlinear.c
Expand Up @@ -512,8 +512,8 @@ void upg(GtkWidget *widget, gpointer data)

int main(int argc, char *argv[])
{
AtkObject *atk_widget, *atk_label;
GArray *caa, *cab, *cag, *car, *nx, *sz, *x, *y;
AtkObject *atk_label, *atk_widget;
GArray *caa, *cab, *cag, *car, *nx, *st, *sz, *x, *y;
gdouble fll, val;
GtkAccelGroup *accel_group=NULL;
GtkAdjustment *adj;
Expand Down
4 changes: 2 additions & 2 deletions gtk2plot/testplotpolar.c
Expand Up @@ -510,8 +510,8 @@ void upg(GtkWidget *widget, gpointer data)

int main(int argc, char *argv[])
{
AtkObject *atk_widget, *atk_label;
GArray *caa, *cab, *cag, *car, *nx, *st, *sz, *x, *y;
AtkObject *atk_label, *atk_widget;
GArray *x, *y, *st, *sz, *nx, *car, *cab, *cag, *caa;
gdouble fll, valx, valy;
GtkAccelGroup *accel_group=NULL;
GtkAdjustment *adj;
Expand Down
4 changes: 2 additions & 2 deletions gtk3plot/gtkplot.h
Expand Up @@ -49,8 +49,8 @@
};
void gtk_plot_set_font(GtkPlot *plot, PangoFontDescription *lf, PangoFontDescription *af);
void gtk_plot_set_colour(GtkPlot *plot, GArray *cl);
void gtk_plot_polar_set_indices(GtkPlot *plot, GArray *nd, GArray *sz, GArray *st);
void gtk_plot_polar_set_index(GtkPlot *plot, GArray *nd);
void gtk_plot_set_indices(GtkPlot *plot, GArray *nd, GArray *sz, GArray *st);
void gtk_plot_set_index(GtkPlot *plot, GArray *nd);
GtkWidget *gtk_plot_new(void);
G_END_DECLS
#endif
4 changes: 2 additions & 2 deletions gtk3plot/gtkplotlinear.c
Expand Up @@ -4172,12 +4172,12 @@ void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl)
{(plot->xlab)=g_strdup(xl); (plot->ylab)=g_strdup(yl);}
}

void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz)
void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st)
{
if (plot->xdata) g_array_free((plot->xdata), FALSE);
if (plot->ydata) g_array_free((plot->ydata), FALSE);
{(plot->xdata)=g_array_ref(xd); (plot->ydata)=g_array_ref(yd);}
gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
}

static void gtk_plot_linear_finalise(GtkPlotLinear *plot)
Expand Down
2 changes: 1 addition & 1 deletion gtk3plot/gtkplotlinear.h
Expand Up @@ -71,7 +71,7 @@
gboolean gtk_plot_linear_print_png(GtkWidget *widget, gchar *fout);
gboolean gtk_plot_linear_print_svg(GtkWidget *widget, gchar *fout);
void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl);
void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz);
void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st);
GtkWidget *gtk_plot_linear_new(void);
G_END_DECLS
#endif
24 changes: 12 additions & 12 deletions gtk3plot/gtkplotpolar.c
Expand Up @@ -1755,10 +1755,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
vv=g_array_index((plt->cl), GdkRGBA, ft);
cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
ft=g_array_index((plt->ind), gint, k);
if (ft>=(plot->ydata->len)) break;
if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
Expand Down Expand Up @@ -2478,10 +2478,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
vv=g_array_index((plt->cl), GdkRGBA, ft);
cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
ft=g_array_index((plt->ind), gint, k);
if (ft>=(plot->ydata->len)) break;
if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
Expand Down Expand Up @@ -3287,10 +3287,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
vv=g_array_index((plt->cl), GdkRGBA, ft);
cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
ft=g_array_index((plt->ind), gint, k);
if (ft>=(plot->ydata->len)) break;
if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
Expand Down Expand Up @@ -4090,10 +4090,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
vv=g_array_index((plt->cl), GdkRGBA, ft);
cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
ft=g_array_index((plt->ind), gint, k);
if (ft>=(plot->ydata->len)) break;
if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
Expand Down Expand Up @@ -4894,10 +4894,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
vv=g_array_index((plt->cl), GdkRGBA, ft);
cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
ft=g_array_index((plt->ind), gint, k);
if (ft>=(plot->ydata->len)) break;
if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (j=ft; j<lt; j+=st)
{
r=g_array_index((plot->rdata), gdouble, j);
Expand Down Expand Up @@ -5533,12 +5533,12 @@ void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl)
{(plot->rlab)=g_strdup(rl); (plot->thlab)=g_strdup(tl);}
}

void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz)
void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, Garray *st)
{
if (plot->rdata) g_array_free((plot->rdata), FALSE);
if (plot->thdata) g_array_free((plot->thdata), FALSE);
{(plot->rdata)=g_array_ref(rd); (plot->thdata)=g_array_ref(td);}
gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
}

static void gtk_plot_polar_finalise(GtkPlotPolar *plot)
Expand Down
2 changes: 1 addition & 1 deletion gtk3plot/gtkplotpolar.h
Expand Up @@ -74,7 +74,7 @@
gboolean gtk_plot_polar_print_png(GtkWidget *widget, gchar *fout);
gboolean gtk_plot_polar_print_svg(GtkWidget *widget, gchar *fout);
void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl);
void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz);
void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, GArray *st);
GtkWidget *gtk_plot_polar_new(void);
G_END_DECLS
#endif
2 changes: 1 addition & 1 deletion gtk3plot/testplotpolar.c
Expand Up @@ -465,13 +465,13 @@ int main(int argc, char *argv[])
AtkObject *atk_label, *atk_widget;
GArray *cla, *nx, *st, *sz, *x, *y;
GdkRGBA cl;
guint j;
gdouble valx, valy;
GtkAccelGroup *accel_group=NULL;
GtkAdjustment *adj;
GtkPlot *pt;
GtkPlotPolar *plt;
GtkWidget *butt, *grid, *grid2, *label, *mnb, *mni, *mnu, *pane;
guint j;

gtk_init(&argc, &argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
Expand Down

0 comments on commit c7d069d

Please sign in to comment.