Esempio n. 1
0
void GdDetach(Drauing *drawing, Engine *engine)
{
  Engine *eng;
  for (eng=GpNextEngine(0) ; eng ; eng=GpNextEngine(eng)) {
    if (!drawing || eng->drawing==drawing) {
      eng->drawing= 0;
      eng->inhibit= eng->damaged= 0;
      eng->lastDrawn= -1;
    }
  }
}
Esempio n. 2
0
int GdBeginDr(Drauing *drawing, GpBox *damage, int landscape)
{
  int needToRedraw= 0;
  Engine *eng;

  if (damage) {
    /* If drawing has incurred damage, report damage to ALL engines
       interested in the drawing (not just active engines).  */
    for (eng=GpNextEngine(0) ; eng ; eng=GpNextEngine(eng))
      if (eng->drawing==drawing) GpDamage(eng, drawing, damage);
  }

  /* Loop on active engines to alert them that drawing is coming.  */
  for (eng=GpNextActive(0) ; eng ; eng=GpNextActive(eng)) {
    if (eng->drawing!=drawing) {
      /* This engine is not marked as interested in this drawing.
         Mark it, and reset damaged and lastDrawn flags so that no
         elements will be inhibited.  */
      eng->drawing= drawing;
      eng->lastDrawn= -1;
      eng->damaged= 0;
      if (landscape != eng->landscape) {
        eng->landscape= landscape;
        /* This change will be detected and acted upon by the first call
           to the ChangeMap method (GpSetTrans).  */
      }
      /* The semantics here are subtle --
         After a ClearDrawing, GdDetach zeroes eng->drawing in order to
         communicate that the drawing has been cleared.  Thus, the code
         gets here on a GdDraw after the drawing has been cleared, so
         the time has come to carry out the deferred clearing of this
         engine's plotting surface.  */
      GpClear(eng, CONDITIONALLY);
      needToRedraw= 1;

    } else if (eng->damaged) {
      /* This engine was interested in the drawing, which has been
         damaged.  Clear damaged area in preparation for repair work.
         (This is redundant if the damage was due to an X windows
          expose event, but the resulting inefficiency is very small.)  */
      eng->ClearArea(eng, &eng->damage);
      needToRedraw= 1;

    } else if (eng->lastDrawn<drawing->nElements-1) {
      needToRedraw= 1;
    }
  }

  gdNowRendering= gdMaxRendered= -1;
  return needToRedraw;
}
Esempio n. 3
0
static void
g_on_panic(p_scr *screen)
{
  Engine *eng = 0;
  XEngine *xeng = 0;
  do {
    for (eng=GpNextEngine(eng) ; eng ; eng=GpNextEngine(eng)) {
      xeng= GisXEngine(eng);
      if (xeng && xeng->s==screen) break;
    }
    if (eng) {
      xeng->s = 0;  /* be sure not to call p_disconnect */
      Kill(eng);
    }
  } while (eng);
  XErrHandler("play on_panic called (screen graphics engines killed)");
}
Esempio n. 4
0
static void
ShutDown(XEngine *xeng)
{
  p_scr *s = xeng->s;
  p_win *w = xeng->w;
  p_win *win = xeng->win;
  xeng->mapped= 0;
  /* destroy any hlevel references without further ado */
  if (HLevelHook) HLevelHook((Engine *)xeng);
  xeng->w = xeng->win = 0;
  xeng->s = 0;
  if (w && w!=win) p_destroy(w);
  GpDelEngine(&xeng->e);
  if (s) {
    Engine *eng;
    XEngine *xe2;
    for (eng=GpNextEngine(0) ; eng ; eng=GpNextEngine(eng)) {
      xe2 = GisXEngine(eng);
      if (xe2 && xe2->s==s) break;
    }
    if (!eng) {
      int i;
      if (g_pending_task == g_do_disconnect) {
        for (i=0 ; i<=G_N_PENDING ; i++)
          if (g_pending_scr[i] == s) break;
        if (i >= G_N_PENDING) {
          for (i=0 ; i<=G_N_PENDING ; i++)
            if (!g_pending_scr[i]) break;
          if (i < G_N_PENDING) g_pending_scr[i] = s;
        }
      } else {
        g_pending_scr[0] = s;
        for (i=1 ; i<=G_N_PENDING ; i++) g_pending_scr[i] = 0;
        g_pending_task = g_do_disconnect;
      }
    }
  }
}