ADG

Sign in or create your account | Project List | Help

ADG Commit Details

Date:2010-07-02 22:35:39 (2 months 5 days ago)
Author:Nicola Fontana
Commit:a09920ae91aff0fcd43217b82ea87cab8c31693f
Message:[AdgRDim] Avoid the rendering of incomplete entities


Checking the availability of all the needed data to define the entity
and avoid the arrange() and render() phases on condition not fulfilled.
Files: src/adg/adg-rdim.c (6 diffs)

Change Details

src/adg/adg-rdim.c
6767static void _adg_render (AdgEntity *entity,
6868                                                 cairo_t *cr);
6969static gchar * _adg_default_value (AdgDim *dim);
70static void _adg_update_geometry (AdgRDim *rdim);
70static gboolean _adg_update_geometry (AdgRDim *rdim);
7171static void _adg_update_entities (AdgRDim *rdim);
7272static void _adg_clear_trail (AdgRDim *rdim);
7373static void _adg_dispose_marker (AdgRDim *rdim);
...... 
343343    data = rdim->data;
344344    quote = adg_dim_get_quote(dim);
345345
346    _adg_update_geometry(rdim);
346    if (!_adg_update_geometry(rdim))
347        return;
348
347349    _adg_update_entities(rdim);
348350
349351    if (data->cpml.path.status == CAIRO_STATUS_SUCCESS) {
...... 
419421    const cairo_path_t *cairo_path;
420422
421423    rdim = (AdgRDim *) entity;
422    dim = (AdgDim *) entity;
423424    data = rdim->data;
425
426    if (!data->geometry_arranged) {
427        /* Entity not arranged, probably due to undefined pair found */
428        return;
429    }
430
431    dim = (AdgDim *) entity;
424432    dim_style = _ADG_GET_DIM_STYLE(dim);
425433
426434    adg_style_apply((AdgStyle *) dim_style, entity, cr);
...... 
451459    dim_style = _ADG_GET_DIM_STYLE(dim);
452460    format = adg_dim_style_get_number_format(dim_style);
453461
454    _adg_update_geometry(rdim);
462    if (!_adg_update_geometry(rdim))
463        return g_strdup("undef");
455464
456465    return g_strdup_printf(format, data->radius);
457466}
458467
459static void
468static gboolean
460469_adg_update_geometry(AdgRDim *rdim)
461470{
462471    AdgRDimPrivate *data;
...... 
470479    data = rdim->data;
471480
472481    if (data->geometry_arranged)
473        return;
482        return TRUE;
474483
475484    dim = (AdgDim *) rdim;
476    dim_style = _ADG_GET_DIM_STYLE(rdim);
477485    ref1 = adg_point_get_pair(adg_dim_get_ref1(dim));
478486    ref2 = adg_point_get_pair(adg_dim_get_ref2(dim));
479487    pos = adg_point_get_pair(adg_dim_get_pos(dim));
488
489    if (ref1 == NULL || ref2 == NULL || pos == NULL)
490        return FALSE;
491
492    dim_style = _ADG_GET_DIM_STYLE(rdim);
480493    spacing = adg_dim_style_get_baseline_spacing(dim_style);
481494    level = adg_dim_get_level(dim);
482495    pos_distance = cpml_pair_distance(pos, ref1);
483496    vector.x = ref2->x - ref1->x;
484497    vector.y = ref2->y - ref1->y;
498
485499    if (cpml_pair_squared_distance(pos, ref1) <
486500        cpml_pair_squared_distance(pos, ref2)) {
487501        vector.x = -vector.x;
...... 
505519    cpml_vector_set_length(&data->shift.base, spacing * level);
506520
507521    data->geometry_arranged = TRUE;
522
523    return TRUE;
508524}
509525
510526static void
511527

Archive Download the corresponding diff file