Exemple #1
0
int gt_layout_sketch(GtLayout *layout, GtCanvas *target_canvas, GtError *err)
{
  int had_err = 0;
  unsigned long i;
  GtRenderTraverseInfo rti;
  gt_assert(layout && target_canvas);

  had_err = layout_all_tracks(layout, err);
  if (!had_err) {
    rti.layout = layout;
    rti.canvas = target_canvas;
    had_err = gt_canvas_visit_layout_pre(target_canvas, layout, err);
    if (had_err) return had_err;

    if (layout->track_ordering_func == NULL) {
      had_err = gt_hashmap_foreach_in_key_order(layout->tracks, render_tracks,
                                                &rti, err);
    } else {
      had_err = gt_hashmap_foreach_ordered(layout->tracks, render_tracks,
                                           &rti, (GtCompare) track_cmp_wrapper,
                                           err);
    }
    if (had_err) return had_err;
    had_err = gt_canvas_visit_layout_post(target_canvas, layout, err);
    if (had_err) return had_err;
    for (i=0;i<gt_array_size(layout->custom_tracks);i++)
    {
      GtCustomTrack *ct = *(GtCustomTrack**) gt_array_get(layout->custom_tracks,
                                                          i);
      had_err = render_custom_tracks(NULL, ct, &rti, err);
    }
  }
  return had_err ? -1 : 0;
}
Exemple #2
0
int gt_layout_sketch(GtLayout *layout, GtCanvas *target_canvas, GtError *err)
{
  int had_err = 0;
  unsigned long i;
  GtRenderTraverseInfo rti;
  gt_assert(layout && target_canvas);
  rti.layout = layout;
  rti.canvas = target_canvas;
  had_err = gt_canvas_visit_layout_pre(target_canvas, layout, err);
  if (had_err) return had_err;
  had_err = gt_hashmap_foreach_in_key_order(layout->tracks, render_tracks,
                                            &rti, err);
  if (had_err) return had_err;
  had_err = gt_canvas_visit_layout_post(target_canvas, layout, err);
  if (had_err) return had_err;
  for (i=0;i<gt_array_size(layout->custom_tracks);i++)
  {
    GtCustomTrack *ct = *(GtCustomTrack**) gt_array_get(layout->custom_tracks,
                                                        i);
    had_err = render_custom_tracks(NULL, ct, &rti, err);
  }
  return had_err;
}