aboutsummaryrefslogtreecommitdiff
path: root/spectrogram.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2013-06-28 11:41:56 +0000
committerDimitri Sokolyuk <demon@dim13.org>2013-06-28 11:41:56 +0000
commitd8fa24a33d78e3a2a7a5376bf0a0eb9694e83225 (patch)
tree8b5a69476701d0784e85c862fbf15d988f6e1749 /spectrogram.c
parent4d26d6650fbc6b5d8221c36d8d7eb41fde92a3aa (diff)
reduce
Diffstat (limited to 'spectrogram.c')
-rw-r--r--spectrogram.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/spectrogram.c b/spectrogram.c
index 6fbf286..97f93cc 100644
--- a/spectrogram.c
+++ b/spectrogram.c
@@ -47,25 +47,24 @@ struct pixmap {
};
struct panel {
- Window win;
- XRectangle p; /* panel */
+ Window win; /* container */
- Window wf;
- XRectangle w; /* waterfall */
+ Window wf; /* waterfall */
+ XRectangle w;
struct pixmap wfbuf;
- Window sp;
- XRectangle s; /* spectrogram */
+ Window sp; /* spectrogram */
+ XRectangle s;
struct pixmap spbuf;
struct pixmap spbg;
struct pixmap spmask;
struct pixmap shbg;
struct pixmap shmask;
- unsigned long *palette;
int mirror;
int maxval;
double *data;
+ unsigned long *palette;
};
unsigned long
@@ -164,10 +163,10 @@ draw_panel(Display *d, struct panel *p)
XFillRectangle(d, p->spmask.pix, p->spmask.gc,
0, 0, p->s.width, p->s.height);
- for (i = 0; i < p->p.width; i++) {
+ for (i = 0; i < p->s.width; i++) {
/* limit maxval */
v = p->data[i] >= p->maxval ? p->maxval - 1 : p->data[i];
- x = p->mirror ? p->p.width - i - 1 : i;
+ x = p->mirror ? p->s.width - i - 1 : i;
/* draw waterfall */
XSetForeground(d, p->wfbuf.gc, p->palette[v]);
@@ -233,11 +232,6 @@ init_panel(Display *d, Window win, int x, int y, int w, int h, int mirror)
errx(1, "malloc failed");
/* main panel window */
- p->p.x = x;
- p->p.y = y;
- p->p.width = w;
- p->p.height = h;
-
p->win = XCreateSimpleWindow(d, win, x, y, w, h, 0, white, gray);
/* sperctrogram window and its bitmasks */
@@ -283,7 +277,7 @@ init_panel(Display *d, Window win, int x, int y, int w, int h, int mirror)
/* clear waterfall */
XSetForeground(d, p->wfbuf.gc, p->palette[0]);
XFillRectangle(d, p->wfbuf.pix, p->wfbuf.gc,
- 0, 0, p->p.width, p->p.height);
+ 0, 0, p->w.width, p->w.height);
/* clear shadow mask */
XSetForeground(d, p->shmask.gc, 0);