diff --git a/main-window.c b/main-window.c index b9e2ba8..564fa52 100644 --- a/main-window.c +++ b/main-window.c @@ -242,8 +242,6 @@ static void on_convert_clicked(gpointer button, gpointer user) goto ret_layer_destroy; } - - /* save file dialog */ dialog = gtk_file_chooser_dialog_new((sett.renderer == RENDERER_LATEX_TIKZ ? "Save LaTeX File" : "Save PDF"), diff --git a/trigonometric/bounding-box.c b/trigonometric/bounding-box.c index 3499ce4..648ac1b 100644 --- a/trigonometric/bounding-box.c +++ b/trigonometric/bounding-box.c @@ -135,12 +135,26 @@ static void calculate_path_miter_points(struct vector_2d *a, struct vector_2d *b void bounding_box_calculate_path_box(GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box) { - + printf("Error! Function bounding_box_calculate_path_box not yet implemented!\n"); } void bounding_box_update_point(union bounding_box *destination, conv_generic_to_vector_2d_t conv_func, void *pt) { + struct vector_2d point; + if (!destination || !pt) { + return; + } + + if (!conv_func) + conv_func(pt, &point); + else + (void)vector_2d_copy(&point, (struct vector_2d *)pt); + + destination->vectors.lower_left.x = MIN(destination->vectors.lower_left.x, point.x); + destination->vectors.lower_left.y = MIN(destination->vectors.lower_left.y, point.y); + destination->vectors.upper_right.x = MAX(destination->vectors.upper_right.x, point.x); + destination->vectors.upper_right.y = MAX(destination->vectors.upper_right.y, point.y); } /** @} */ diff --git a/trigonometric/vector-operations.c b/trigonometric/vector-operations.c index 4cdbca4..0666056 100644 --- a/trigonometric/vector-operations.c +++ b/trigonometric/vector-operations.c @@ -76,18 +76,17 @@ struct vector_2d *vector_2d_copy(struct vector_2d *opt_res, struct vector_2d *ve if (!vec) return NULL; - if (opt_res) { - opt_res->x = vec->x; - opt_res->y = vec->y; - return opt_res; - } else { + + if (opt_res) + res = opt_res; + else res = vector_2d_alloc(); - if (res) { - res->x = vec->x; - res->y = vec->y; - } - return res; + + if (res) { + res->x = vec->x; + res->y = vec->y; } + return res; } struct vector_2d *vector_2d_alloc(void)