示例#1
0
文件: gtkhid-gdk.c 项目: thequux/pcb
static int
use_gc (hidGC gc)
{

    if (gc->me_pointer != &ghid_hid)
    {
        fprintf (stderr, "Fatal: GC from another HID passed to GTK HID\n");
        abort ();
    }

    if (!gport->pixmap)
        return 0;
    if (!gc->gc)
    {
        gc->gc = gdk_gc_new (gport->top_window->window);
        ghid_set_color (gc, gc->colorname);
        ghid_set_line_width (gc, gc->width);
        ghid_set_line_cap (gc, (EndCapStyle)gc->cap);
        ghid_set_draw_xor (gc, gc->xor_mask);
    }
    if (gc->mask_seq != mask_seq)
    {
        if (mask_seq)
            gdk_gc_set_clip_mask (gc->gc, gport->mask);
        else
            gdk_gc_set_clip_mask (gc->gc, NULL);
        gc->mask_seq = mask_seq;
    }
    gport->u_gc = WHICH_GC (gc);
    return 1;
}
示例#2
0
static int
use_gc (hidGC gc)
{
  render_priv *priv = gport->render_priv;
  GdkWindow *window = gtk_widget_get_window (gport->top_window);

  if (gc->me_pointer != &ghid_hid)
    {
      fprintf (stderr, "Fatal: GC from another HID passed to GTK HID\n");
      abort ();
    }

  if (!gport->pixmap)
    return 0;
  if (!gc->gc)
    {
      gc->gc = gdk_gc_new (window);
      ghid_set_color (gc, gc->colorname);
      ghid_set_line_width (gc, gc->width);
      ghid_set_line_cap (gc, (EndCapStyle)gc->cap);
      ghid_set_draw_xor (gc, gc->xor_mask);
      gdk_gc_set_clip_origin (gc->gc, 0, 0);
    }
  if (gc->mask_seq != mask_seq)
    {
      if (mask_seq)
	gdk_gc_set_clip_mask (gc->gc, gport->mask);
      else
	set_clip (priv, gc->gc);
      gc->mask_seq = mask_seq;
    }
  priv->u_gc = WHICH_GC (gc);
  return 1;
}