123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- #include "sys-defines.h"
- #include "extern.h"
- #define NUM_KEPT_COLORS 256
- #define NUM_KEPT_FRAMES 16
- bool
- _pl_x_erase_page (S___(Plotter *_plotter))
- {
- bool head_found;
- int window_width, window_height;
- int i, current_frame_number, current_page_number;
- plColorRecord *cptr, **link = NULL;
- plDrawState *stateptr;
-
- _pl_x_set_bg_color (S___(_plotter));
-
- window_width = (_plotter->data->imax - _plotter->data->imin) + 1;
- window_height = (_plotter->data->jmin - _plotter->data->jmax) + 1;
- if (_plotter->x_double_buffering != X_DBL_BUF_NONE)
- {
-
- #if 0
- #ifdef HAVE_X11_EXTENSIONS_XDBE_H
- #ifdef HAVE_DBE_SUPPORT
- if (_plotter->x_double_buffering == X_DBL_BUF_DBE)
-
- {
- XdbeSwapInfo info;
-
-
- info.swap_window = _plotter->x_drawable2;
- info.swap_action = XdbeUndefined;
- XdbeSwapBuffers (_plotter->x_dpy, &info, 1);
- }
- else
- #endif
- #endif
- #ifdef HAVE_X11_EXTENSIONS_MULTIBUF_H
- #ifdef HAVE_MBX_SUPPORT
- if (_plotter->x_double_buffering == X_DBL_BUF_MBX)
-
- {
- Multibuffer multibuf;
-
- XmbufDisplayBuffers (_plotter->x_dpy, 1, &(_plotter->x_drawable3), 0, 0);
-
- multibuf = _plotter->x_drawable3;
- _plotter->x_drawable3 = _plotter->y_drawable4;
- _plotter->y_drawable4 = multibuf;
- }
- else
- #endif
- #endif
- #endif
-
- if (_plotter->x_double_buffering == X_DBL_BUF_BY_HAND)
- {
-
- if (_plotter->x_drawable1)
- XCopyArea (_plotter->x_dpy,
- _plotter->x_drawable3, _plotter->x_drawable1,
- _plotter->drawstate->x_gc_bg,
- 0, 0,
- (unsigned int)window_width,
- (unsigned int)window_height,
- 0, 0);
- if (_plotter->x_drawable2)
- XCopyArea (_plotter->x_dpy,
- _plotter->x_drawable3, _plotter->x_drawable2,
- _plotter->drawstate->x_gc_bg,
- 0, 0,
- (unsigned int)window_width,
- (unsigned int)window_height,
- 0, 0);
- }
-
- XFillRectangle (_plotter->x_dpy, _plotter->x_drawable3,
- _plotter->drawstate->x_gc_bg,
-
- 0, 0,
- (unsigned int)window_width,
- (unsigned int)window_height);
- }
- else
-
- {
-
- if (_plotter->x_drawable1)
- XFillRectangle (_plotter->x_dpy, _plotter->x_drawable1,
- _plotter->drawstate->x_gc_bg,
-
- 0, 0,
- (unsigned int)window_width, (unsigned int)window_height);
- if (_plotter->x_drawable2)
- XFillRectangle (_plotter->x_dpy, _plotter->x_drawable2,
- _plotter->drawstate->x_gc_bg,
-
- 0, 0,
- (unsigned int)window_width, (unsigned int)window_height);
- }
- #if 0
-
- {
- Arg wargs[1];
- #ifdef USE_MOTIF
- XtSetArg (wargs[0], XmNbackground, _plotter->drawstate->x_gc_bgcolor);
- #else
- XtSetArg (wargs[0], XtNbackground, _plotter->drawstate->x_gc_bgcolor);
- #endif
- XtSetValues (_plotter->y_toplevel, wargs, (Cardinal)1);
- XtSetValues (_plotter->y_canvas, wargs, (Cardinal)1);
- }
- #endif
-
- cptr = _plotter->x_colorlist;
- _plotter->x_colorlist = NULL;
- i = 0;
- head_found = false;
- current_frame_number = _plotter->data->frame_number;
- current_page_number = _plotter->data->page_number;
- while (cptr)
- {
- plColorRecord *cptrnext;
- cptrnext = cptr->next;
- if (cptr->allocated)
- {
- if ((_plotter->x_double_buffering == X_DBL_BUF_NONE
- && cptr->page_number == current_page_number
- && i < NUM_KEPT_COLORS)
- ||
- (_plotter->x_double_buffering != X_DBL_BUF_NONE
- && cptr->page_number == current_page_number
- && cptr->frame_number >= current_frame_number - NUM_KEPT_FRAMES))
-
- {
- if (head_found)
- *link = cptr;
- else
- {
- _plotter->x_colorlist = cptr;
- head_found = true;
- }
- cptr->next = NULL;
- link = &(cptr->next);
- i++;
- }
- else
-
- {
- XFreeColors (_plotter->x_dpy, _plotter->x_cmap,
- &(cptr->rgb.pixel), 1, (unsigned long)0);
- free (cptr);
- }
- }
- else
-
- free (cptr);
- cptr = cptrnext;
- }
-
- for (stateptr = _plotter->drawstate; stateptr; stateptr = stateptr->previous)
- {
- stateptr->x_gc_fgcolor_status = false;
- stateptr->x_gc_fillcolor_status = false;
- stateptr->x_gc_bgcolor_status = false;
- }
-
- _maybe_handle_x_events (S___(_plotter));
- return true;
- }
|