Beispiel #1
0
static void
ChangeMap(Engine *engine)
{
  XEngine *xeng = (XEngine *)engine;
  p_win *w = xeng->w;
  int landscape = xeng->width > xeng->height;
  int x0, y0, x1, y1;
  GpBox *clipport;
  if (!w) return;

  /* check to be sure that landscape/portrait mode hasn't changed */
  if (landscape!=xeng->e.landscape) {
    /* this is probably insane if in animation mode... */
    SetXTransform(&xeng->e.transform, xeng->e.landscape, xeng->dpi);
    xeng->width = (int)xeng->e.transform.window.xmax;
    xeng->height = (int)xeng->e.transform.window.ymin;
    xeng->swapped = xeng->e.transform;
    /* make adjustments to allow for SetXTransform, then recenter */
    if (xeng->w != xeng->win) {
      xeng->a_x += xeng->x+1;
      xeng->a_y += xeng->y+1;
    }
    xeng->x = xeng->y = -1;
    GxRecenter(xeng, xeng->wtop+xeng->leftMargin, xeng->htop+xeng->topMargin);
  }

  /* do generic change map */
  GpComposeMap(engine);

  /* get current clip window */
  if (xeng->e.damaged) clipport = DamageClip(&xeng->e.damage);
  else clipport = &gistT.viewport;
  if (clipport) {
    /* set clipping rectangle for this XEngine */
    GetXRectangle(&engine->devMap, clipport, &x0, &y0, &x1, &y1);
    if (xeng->w == xeng->win) {
      /* additional restriction for vignetting by window borders */
      int lm = xeng->leftMargin;
      int tm = xeng->topMargin;
      if (x0 < lm) x0 = lm;
      if (x1 > lm+xeng->wtop) x1 = lm+xeng->wtop;
      if (y0 < tm) y0 = tm;
      if (y1 > tm+xeng->htop) y1 = tm+xeng->htop;
      xeng->clipping = 1;
    } else {
      if (x0 < 0) x0 = 0;
      if (x1 > xeng->a_width) x1 = xeng->a_width;
      if (y0 < 0) y0 = 0;
      if (y1 > xeng->a_height) y1 = xeng->a_height;
      if (x0==0 && x1==xeng->a_width && y0==0 && y1==xeng->a_height)
        x0 = x1 = y0 = y1 = 0;
    }
    if (x0 || x1 || y0 || y1) {
      if (x1<=x0) x1 = x0+1;
      if (y1<=y0) y1 = y0+1;
    }
    p_clip(xeng->w, x0, y0, x1, y1);
  }
}
Beispiel #2
0
static void
g_on_resize(void *c,int w,int h)
{
  if (!gg_on_resize || gg_on_resize(c,w,h)) {
    XEngine *xeng = c;
    if (xeng->w) GxRecenter(xeng, w, h);
  }
}
Beispiel #3
0
static void
g_on_resize(void *c,int w,int h)
{
  XEngine *xeng = c;
  if (xeng->e.on==&g_x_on) {
    if (xeng->w) GxRecenter(xeng, w, h);
  } else if (xeng->e.on && xeng->e.on->resize) {
    xeng->e.on->resize(c, w, h);
  }
}