...
 
Commits (2)
......@@ -1877,43 +1877,41 @@ plot_and_check(plotter * pl, command * cmd, Display * dpy, Display * dpy2)
return TRUE;
}
/* Return true if we finished the list, false if we were interrupted */
/* Per-level decimation factor. Must be a power-of-two */
#define DECIMATE (1<<5)
/* Return true if we finished the list, false if we were interrupted.
Also, update the first/final mapped pointers for the given clist if requested.
*/
static bool
plot(plotter * pl, command * clist, command * stop,
Display * dpy, Display * dpy2)
plot_decimate(plotter * pl, command * clist, command * stop,
Display * dpy, Display * dpy2, bool update, unsigned decimate_level)
{
command * c;
unsigned decimator;
#define DECIMATE2 16
#define DECIMATE1 (DECIMATE2 * DECIMATE2)
command * c = clist, * final = NULL;
unsigned d_factor, decimator;
SAVx = -100000; SAVy = -100000; SAVc = SAVd = 0;
for (d_factor = 1; decimate_level; decimate_level--) d_factor *= DECIMATE;
/* plot a quick overview first then fill in later */
for (c = clist, decimator = 0;
c && c != stop;
c = c->next, decimator++, decimator &= ~DECIMATE1)
if (decimator == 0 && c->mapped && c->needs_redraw)
if (!plot_and_check(pl, c, dpy, dpy2)) return FALSE;
for (c = clist, decimator = 0;
c && c != stop;
c = c->next, decimator++, decimator &= ~DECIMATE1)
if ((decimator & (DECIMATE2-1)) == 0 && c->mapped && c->needs_redraw)
if (!plot_and_check(pl, c, dpy, dpy2)) return FALSE;
if (update) /* find/update the first-mapped point */
{
for (; c && c != stop; c = c->next) if (c->mapped) break;
pl->first_mapped_plain[pl->viewno] = c;
}
for (c = clist, decimator = 0;
for (decimator = 0;
c && c != stop;
c = c->next, decimator++, decimator &= ~DECIMATE2)
if (decimator != 0 && c->mapped && c->needs_redraw)
c = c->next, decimator++, decimator &= ~d_factor)
if (c->mapped)
{
if (decimator == 0 && c->needs_redraw)
if (!plot_and_check(pl, c, dpy, dpy2)) return FALSE;
final = c;
}
/* #define SAVE_PRINTOUTS */
#ifdef SAVE_PRINTOUTS
fprintf(stderr, "saved %d/%d %f%%\n",
SAVc, SAVc+SAVd, SAVc*100.0/(SAVc+SAVd) );
#endif
if (update)
pl->final_mapped_plain[pl->viewno] = final;
return TRUE;
}
......@@ -2259,12 +2257,13 @@ main(int argc, char *argv[])
do {
if (XPending(dpy) == 0
&& (dpy2 == 0 || XPending(dpy2) == 0)
) {
)
{
int visible_count = 0;
for (ALLPLOTTERS) {
/* if plotter is not yet displayed, do nothing */
if (pl->win == 0) continue;
/* if plotter is not yet displayed, do nothing */
for (ALLPLOTTERS) if (pl->win != 0)
{
visible_count++;
if (pl->size_changed) {
......@@ -2286,7 +2285,8 @@ main(int argc, char *argv[])
XSetClipRectangles(pl->dpy, pl->gcs[i], 0, 0, xr, 1, YXBanded);
}
if (pl->new_expose) {
if (pl->new_expose)
{
pl->clean = FALSE;
for (c = pl->decoration_cmds; c; c = c->next) if (c->mapped)
......@@ -2300,19 +2300,48 @@ main(int argc, char *argv[])
if (c->mapped) c->needs_redraw = TRUE;
pl->new_expose = FALSE;
}
}
if (pl->visibility != VisibilityFullyObscured && !pl->clean) {
if ( plot(pl, pl->decoration_cmds, NULL, dpy, dpy2)
&& plot(pl, pl->label_cmds, NULL, dpy, dpy2)
&& plot(pl, pl->first_mapped_plain[pl->viewno],
pl->final_mapped_plain[pl->viewno], dpy, dpy2)
)
pl->clean = TRUE;
}
}
if (visible_count > 0)
{
bool cont = TRUE;
for (ALLPLOTTERS) if (cont && pl->win != 0)
if (pl->visibility != VisibilityFullyObscured && !pl->clean)
if ( !plot_decimate(pl, pl->decoration_cmds, NULL, dpy, dpy2, FALSE, 0)
|| !plot_decimate(pl, pl->label_cmds, NULL, dpy, dpy2, FALSE, 0)
|| !plot_decimate(pl, pl->first_mapped_plain[pl->viewno],
pl->final_mapped_plain[pl->viewno], dpy, dpy2, TRUE, 2)
)
cont = FALSE;
for (ALLPLOTTERS) if (cont && pl->win != 0)
if (pl->visibility != VisibilityFullyObscured && !pl->clean)
if ( !plot_decimate(pl, pl->first_mapped_plain[pl->viewno],
pl->final_mapped_plain[pl->viewno], dpy, dpy2, FALSE, 1)
)
cont = FALSE;
for (ALLPLOTTERS) if (cont && pl->win != 0)
if (pl->visibility != VisibilityFullyObscured && !pl->clean)
if ( !plot_decimate(pl, pl->first_mapped_plain[pl->viewno],
pl->final_mapped_plain[pl->viewno], dpy, dpy2, FALSE, 0)
)
cont = FALSE;
else
{
pl->clean = TRUE;
/* #define SAVE_PRINTOUTS */
#ifdef SAVE_PRINTOUTS
fprintf(stderr, "saved %d/%d %f%%\n",
SAVc, SAVc+SAVd, SAVc*100.0/(SAVc+SAVd) );
#endif
}
}
if (visible_count == 0) break; /* will exit */
}
}
do {
if (XPending(dpy) != 0) {
......@@ -2781,8 +2810,10 @@ main(int argc, char *argv[])
pl->final_mapped_plain[newviewno] = pl->final_mapped_plain[pl->viewno];
pl->viewno = newviewno;
if (do_x && !y_synch) /*XXX why not duplicated for Y? */
if (do_x && !y_synch)
shrink_to_bbox(pl,0,1); /* reevaluate just the y-limits */
if (do_y && !x_synch)
shrink_to_bbox(pl,1,0); /* reevaluate just the x-limits */
}
pl->size_changed = TRUE;
}
......