[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: o_arc_basic.c
User: pcjc2
Date: 07/02/25 08:29:27
Modified: . Tag: noscreen o_arc_basic.c o_box_basic.c
o_bus_basic.c o_circle_basic.c o_line_basic.c
o_net_basic.c o_picture.c o_pin_basic.c
Log:
Tidied world_get_..._bounds() functions to use simple min(), max()
implementations where appropriate. Fixed world_get_arc_bounds() to have
the same semantics as the other functions, IE. top and bottom swapped to
give bottom > top numerically.
Revision Changes Path
No revision
No revision
1.31.2.7 +4 -4 eda/geda/gaf/libgeda/src/o_arc_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_arc_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_arc_basic.c,v
retrieving revision 1.31.2.6
retrieving revision 1.31.2.7
diff -u -b -r1.31.2.6 -r1.31.2.7
--- o_arc_basic.c 25 Feb 2007 13:21:12 -0000 1.31.2.6
+++ o_arc_basic.c 25 Feb 2007 13:29:27 -0000 1.31.2.7
@@ -672,8 +672,8 @@
*left = (x1 < x2) ? ((x1 < x3) ? x1 : x3) : ((x2 < x3) ? x2 : x3);
*right = (x1 > x2) ? ((x1 > x3) ? x1 : x3) : ((x2 > x3) ? x2 : x3);
- *bottom = (y1 < y2) ? ((y1 < y3) ? y1 : y3) : ((y2 < y3) ? y2 : y3);
- *top = (y1 > y2) ? ((y1 > y3) ? y1 : y3) : ((y2 > y3) ? y2 : y3);
+ *bottom = (y1 > y2) ? ((y1 > y3) ? y1 : y3) : ((y2 > y3) ? y2 : y3);
+ *top = (y1 < y2) ? ((y1 < y3) ? y1 : y3) : ((y2 < y3) ? y2 : y3);
/*! \note
* The previous rectangle is extended to the final one
@@ -685,9 +685,9 @@
angle = angle + 90;
if(angle < start_angle + end_angle) {
if(angle % 360 == 0) *right = x1 + radius;
- if(angle % 360 == 90) *top = y1 + radius;
+ if(angle % 360 == 90) *bottom = y1 + radius;
if(angle % 360 == 180) *left = x1 - radius;
- if(angle % 360 == 270) *bottom = y1 - radius;
+ if(angle % 360 == 270) *top = y1 - radius;
} else {
break;
}
1.26.2.6 +0 -3 eda/geda/gaf/libgeda/src/o_box_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_box_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_box_basic.c,v
retrieving revision 1.26.2.5
retrieving revision 1.26.2.6
diff -u -b -r1.26.2.5 -r1.26.2.6
--- o_box_basic.c 25 Feb 2007 13:21:14 -0000 1.26.2.5
+++ o_box_basic.c 25 Feb 2007 13:29:27 -0000 1.26.2.6
@@ -707,14 +707,11 @@
void world_get_box_bounds(TOPLEVEL *w_current, BOX *box,
int *left, int *top, int *right, int *bottom)
{
- /* pb20011002 - why using min and max here and not above ? */
*left = min(box->upper_x, box->lower_x);
*top = min(box->upper_y, box->lower_y);
*right = max(box->upper_x, box->lower_x);
*bottom = max(box->upper_y, box->lower_y);
- /* PB : same as above here for width of edges */
-
#if DEBUG
printf("box: %d %d %d %d\n", *left, *top, *right, *bottom);
#endif
1.17.2.5 +4 -15 eda/geda/gaf/libgeda/src/o_bus_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_bus_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_bus_basic.c,v
retrieving revision 1.17.2.4
retrieving revision 1.17.2.5
diff -u -b -r1.17.2.4 -r1.17.2.5
--- o_bus_basic.c 25 Feb 2007 13:21:16 -0000 1.17.2.4
+++ o_bus_basic.c 25 Feb 2007 13:29:27 -0000 1.17.2.5
@@ -79,21 +79,10 @@
void world_get_bus_bounds(TOPLEVEL *w_current, LINE *line, int *left, int *top,
int *right, int *bottom)
{
- *left = w_current->init_right;
- *top = w_current->init_bottom;
- *right = 0;
- *bottom = 0;
-
- if (line->x[0] < *left) *left = line->x[0];
- if (line->x[0] > *right) *right = line->x[0];
- if (line->y[0] < *top) *top = line->y[0];
- if (line->y[0] > *bottom) *bottom = line->y[0];
-
- if (line->x[1] < *left) *left = line->x[1];
- if (line->x[1] > *right) *right = line->x[1];
- if (line->y[1] < *top) *top = line->y[1];
- if (line->y[1] > *bottom) *bottom = line->y[1];
-
+ *left = min( line->x[0], line->x[1] );
+ *top = min( line->y[0], line->y[1] );
+ *right = max( line->x[0], line->x[1] );
+ *bottom = max( line->y[0], line->y[1] );
}
/* \brief
1.27.2.6 +0 -19 eda/geda/gaf/libgeda/src/o_circle_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_circle_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_circle_basic.c,v
retrieving revision 1.27.2.5
retrieving revision 1.27.2.6
diff -u -b -r1.27.2.5 -r1.27.2.6
--- o_circle_basic.c 25 Feb 2007 13:21:16 -0000 1.27.2.5
+++ o_circle_basic.c 25 Feb 2007 13:29:27 -0000 1.27.2.6
@@ -634,30 +634,11 @@
int *top, int *right, int *bottom)
{
- *left = w_current->init_right;
- *top = w_current->init_bottom;
- *right = 0;
- *bottom = 0;
-
-
*left = circle->center_x - circle->radius;
*top = circle->center_y - circle->radius;
*right = circle->center_x + circle->radius;
*bottom = circle->center_y + circle->radius;
- /*
- *left = points->x1;
- *top = points->y1;
- *right = points->x1+(temp);
- *bottom = points->y1-(temp);
- */
-
- /*
- *left = min(circle->x1, circle->x1+temp);
- *top = min(circle->y1, circle->y1-temp);
- *right = max(circle->x1, circle->x1+temp);
- *bottom = max(circle->y1, circle->y1-temp);*/
-
#if DEBUG
printf("circle: %d %d %d %d\n", *left, *top, *right, *bottom);
#endif
1.26.2.6 +4 -15 eda/geda/gaf/libgeda/src/o_line_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_line_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_line_basic.c,v
retrieving revision 1.26.2.5
retrieving revision 1.26.2.6
diff -u -b -r1.26.2.5 -r1.26.2.6
--- o_line_basic.c 25 Feb 2007 13:21:17 -0000 1.26.2.5
+++ o_line_basic.c 25 Feb 2007 13:29:27 -0000 1.26.2.6
@@ -625,21 +625,10 @@
void world_get_line_bounds(TOPLEVEL *w_current, LINE *line,
int *left, int *top, int *right, int *bottom)
{
- *left = w_current->init_right;
- *top = w_current->init_bottom;
- *right = 0;
- *bottom = 0;
-
- if (line->x[0] < *left) *left = line->x[0];
- if (line->x[0] > *right) *right = line->x[0];
- if (line->y[0] < *top) *top = line->y[0];
- if (line->y[0] > *bottom) *bottom = line->y[0];
-
- if (line->x[1] < *left) *left = line->x[1];
- if (line->x[1] > *right) *right = line->x[1];
- if (line->y[1] < *top) *top = line->y[1];
- if (line->y[1] > *bottom) *bottom = line->y[1];
-
+ *left = min( line->x[0], line->x[1] );
+ *top = min( line->y[0], line->y[1] );
+ *right = max( line->x[0], line->x[1] );
+ *bottom = max( line->y[0], line->y[1] );
}
/*! \brief Print line to Postscript document.
1.34.2.5 +4 -23 eda/geda/gaf/libgeda/src/o_net_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_net_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_net_basic.c,v
retrieving revision 1.34.2.4
retrieving revision 1.34.2.5
diff -u -b -r1.34.2.4 -r1.34.2.5
--- o_net_basic.c 25 Feb 2007 13:21:17 -0000 1.34.2.4
+++ o_net_basic.c 25 Feb 2007 13:29:27 -0000 1.34.2.5
@@ -100,29 +100,10 @@
void world_get_net_bounds(TOPLEVEL *w_current, LINE *line, int *left,
int *top, int *right, int *bottom)
{
- *left = w_current->init_right;
- *top = w_current->init_bottom;
- *right = 0;
- *bottom = 0;
-
- if (line->x[0] < *left)
- *left = line->x[0];
- if (line->x[0] > *right)
- *right = line->x[0];
- if (line->y[0] < *top)
- *top = line->y[0];
- if (line->y[0] > *bottom)
- *bottom = line->y[0];
-
- if (line->x[1] < *left)
- *left = line->x[1];
- if (line->x[1] > *right)
- *right = line->x[1];
- if (line->y[1] < *top)
- *top = line->y[1];
- if (line->y[1] > *bottom)
- *bottom = line->y[1];
-
+ *left = min( line->x[0], line->x[1] );
+ *top = min( line->y[0], line->y[1] );
+ *right = max( line->x[0], line->x[1] );
+ *bottom = max( line->y[0], line->y[1] );
}
/*! \todo Finish function documentation!!!
1.5.2.5 +0 -3 eda/geda/gaf/libgeda/src/o_picture.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_picture.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_picture.c,v
retrieving revision 1.5.2.4
retrieving revision 1.5.2.5
diff -u -b -r1.5.2.4 -r1.5.2.5
--- o_picture.c 12 Feb 2007 02:20:24 -0000 1.5.2.4
+++ o_picture.c 25 Feb 2007 13:29:27 -0000 1.5.2.5
@@ -537,14 +537,11 @@
void world_get_picture_bounds(TOPLEVEL *w_current, PICTURE *picture,
int *left, int *top, int *right, int *bottom)
{
- /* pb20011002 - why using min and max here and not above ? */
*left = min(picture->upper_x, picture->lower_x);
*top = min(picture->upper_y, picture->lower_y);
*right = max(picture->upper_x, picture->lower_x);
*bottom = max(picture->upper_y, picture->lower_y);
- /* PB : same as above here for width of edges */
-
#if DEBUG
printf("picture: %d %d %d %d\n", *left, *top, *right, *bottom);
#endif
1.24.2.5 +4 -14 eda/geda/gaf/libgeda/src/o_pin_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_pin_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_pin_basic.c,v
retrieving revision 1.24.2.4
retrieving revision 1.24.2.5
diff -u -b -r1.24.2.4 -r1.24.2.5
--- o_pin_basic.c 25 Feb 2007 13:21:18 -0000 1.24.2.4
+++ o_pin_basic.c 25 Feb 2007 13:29:27 -0000 1.24.2.5
@@ -79,20 +79,10 @@
void world_get_pin_bounds(TOPLEVEL *w_current, LINE *line, int *left, int *top,
int *right, int *bottom)
{
- *left = w_current->init_right;
- *top = w_current->init_bottom;
- *right = 0;
- *bottom = 0;
-
- if (line->x[0] < *left) *left = line->x[0];
- if (line->x[0] > *right) *right = line->x[0];
- if (line->y[0] < *top) *top = line->y[0];
- if (line->y[0] > *bottom) *bottom = line->y[0];
-
- if (line->x[1] < *left) *left = line->x[1];
- if (line->x[1] > *right) *right = line->x[1];
- if (line->y[1] < *top) *top = line->y[1];
- if (line->y[1] > *bottom) *bottom = line->y[1];
+ *left = min( line->x[0], line->x[1] );
+ *top = min( line->y[0], line->y[1] );
+ *right = max( line->x[0], line->x[1] );
+ *bottom = max( line->y[0], line->y[1] );
}
/*! \todo Finish function documentation!!!
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs