Compare commits

..

No commits in common. "74eb17b2dc97012743d24b265697d20732774511" and "0304c0d08b581c3f5653a24882dcda795bcbf2b4" have entirely different histories.

4 changed files with 14 additions and 17 deletions

View File

@ -1,4 +1,4 @@
# Maintainer: Mario Hüttel <mario (dot) huettel (!) gmx (dot) net> # Maintainer: Mario Hüttel <mario (dot) huettel (!) gmx (dot) net>
pkgname=gds-render pkgname=gds-render
pkgver=20180725.001 pkgver=20180725.001

View File

@ -90,8 +90,7 @@ int gds_tree_check_cell_references(struct gds_library *lib)
* @param cell Cell to check for * @param cell Cell to check for
* @return 0 if cell is not in list. 1 if cell is in list * @return 0 if cell is not in list. 1 if cell is in list
*/ */
static int gds_tree_check_list_contains_cell(GList *list, struct gds_cell *cell) static int gds_tree_check_list_contains_cell(GList *list, struct gds_cell *cell) {
{
GList *iter; GList *iter;
for (iter = list; iter != NULL; iter = g_list_next(iter)) { for (iter = list; iter != NULL; iter = g_list_next(iter)) {
@ -178,14 +177,12 @@ int gds_tree_check_reference_loops(struct gds_library *lib)
res = gds_tree_check_iterate_ref_and_check(cell_to_check, &visited_cells); res = gds_tree_check_iterate_ref_and_check(cell_to_check, &visited_cells);
if (visited_cells) { if (visited_cells) {
/* /* If cell contains no loop, print error when list not empty.
* If cell contains no loop, print error when list not empty.
* In case of a loop, it is completely normal that the list is not empty, * In case of a loop, it is completely normal that the list is not empty,
* due to the instant return from gds_tree_check_iterate_ref_and_check() * due to the instant return from gds_tree_check_iterate_ref_and_check()
*/ */
if (res == 0) if (res == 0)
fprintf(stderr, fprintf(stderr, "Visited cell list should be empty. This is a bug. Please report this.\n");
"Visited cell list should be empty. This is a bug. Please report this.\n");
g_list_free(visited_cells); g_list_free(visited_cells);
visited_cells = NULL; visited_cells = NULL;
} }

View File

@ -33,8 +33,8 @@
#include <gds-render/geometric/bounding-box.h> #include <gds-render/geometric/bounding-box.h>
#define MIN(a, b) (((a) < (b)) ? (a) : (b)) /**< @brief Return smaller number */ #define MIN(a,b) (((a) < (b)) ? (a) : (b)) /**< @brief Return smaller number */
#define MAX(a, b) (((a) > (b)) ? (a) : (b)) /**< @brief Return bigger number */ #define MAX(a,b) (((a) > (b)) ? (a) : (b)) /**< @brief Return bigger number */
#define ABS_DBL(a) ((a) < 0 ? -(a) : (a)) #define ABS_DBL(a) ((a) < 0 ? -(a) : (a))
void bounding_box_calculate_polygon(GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box) void bounding_box_calculate_polygon(GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box)
@ -151,7 +151,7 @@ void bounding_box_calculate_path_box(GList *vertices, double thickness,
GList *vertex_iterator; GList *vertex_iterator;
struct vector_2d pt; struct vector_2d pt;
/* printf("Warning! Function %s not yet implemented correctly!\n", __func__); */ //printf("Warning! Function bounding_box_calculate_path_box not yet implemented correctly!\n");
if (!vertices || !box) if (!vertices || !box)
return; return;

View File

@ -46,10 +46,9 @@ double vector_2d_scalar_multipy(struct vector_2d *a, struct vector_2d *b)
void vector_2d_normalize(struct vector_2d *vec) void vector_2d_normalize(struct vector_2d *vec)
{ {
double len; double len;
if (!vec) if (!vec)
return; return;
len = sqrt(pow(vec->x, 2) + pow(vec->y, 2)); len = sqrt(pow(vec->x,2)+pow(vec->y,2));
vec->x = vec->x/len; vec->x = vec->x/len;
vec->y = vec->y/len; vec->y = vec->y/len;
} }
@ -98,8 +97,9 @@ struct vector_2d *vector_2d_alloc(void)
void vector_2d_free(struct vector_2d *vec) void vector_2d_free(struct vector_2d *vec)
{ {
if (vec) if (vec) {
free(vec); free(vec);
}
} }
void vector_2d_scale(struct vector_2d *vec, double scale) void vector_2d_scale(struct vector_2d *vec, double scale)
@ -114,9 +114,9 @@ void vector_2d_scale(struct vector_2d *vec, double scale)
double vector_2d_abs(struct vector_2d *vec) double vector_2d_abs(struct vector_2d *vec)
{ {
double len = 0.0; double len = 0.0;
if (vec) {
if (vec) len = sqrt(pow(vec->x,2)+pow(vec->y,2));
len = sqrt(pow(vec->x, 2) + pow(vec->y, 2)); }
return len; return len;
} }
@ -142,7 +142,7 @@ void vector_2d_subtract(struct vector_2d *res, struct vector_2d *a, struct vecto
void vector_2d_add(struct vector_2d *res, struct vector_2d *a, struct vector_2d *b) void vector_2d_add(struct vector_2d *res, struct vector_2d *a, struct vector_2d *b)
{ {
if (res && a && b) { if (res && a && b) {
res->x = a->x + b->x; res->x = a->x +b->x;
res->y = a->y + b->y; res->y = a->y + b->y;
} }
} }