[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-98-ge375e0c)



The branch, master has been updated
       via  e375e0c2c655d2320962febfdfcbb29b9867f2d2 (commit)
      from  217d45c0cfb9e8a5a7ea074ae70369ea42932453 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/include/prototype.h |    1 +
 gschem/src/gschem_cairo.c  |   17 +++++++++++++++++
 gschem/src/o_arc.c         |   27 ++++-----------------------
 3 files changed, 22 insertions(+), 23 deletions(-)


=================
 Commit Messages
=================

commit e375e0c2c655d2320962febfdfcbb29b9867f2d2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Wed Dec 31 19:53:38 2008 +0000

    gschem: Add cairo helper function for drawing arcs with geda semantics
    
    The angle parameters to gschem_cairo_arc() match those of start_angle
    and end_angle in libgeda's internal data-structures.

:100644 100644 e961fbf... 126728c... M	gschem/include/prototype.h
:100644 100644 112e445... 756f971... M	gschem/src/gschem_cairo.c
:100644 100644 01b1c7a... 155718c... M	gschem/src/o_arc.c

=========
 Changes
=========

commit e375e0c2c655d2320962febfdfcbb29b9867f2d2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Wed Dec 31 19:53:38 2008 +0000

    gschem: Add cairo helper function for drawing arcs with geda semantics
    
    The angle parameters to gschem_cairo_arc() match those of start_angle
    and end_angle in libgeda's internal data-structures.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index e961fbf..126728c 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -284,6 +284,7 @@ int main(int argc, char *argv[]);
 /* gschem_cairo.c */
 void gschem_cairo_line(cairo_t *cr, int line_end, int width, int x1, int y1, int x2, int y2);
 void gschem_cairo_box(cairo_t *cr, int width, int x1, int y1, int x2, int y2);
+void gschem_cairo_arc(cairo_t *cr, int width, int x, int y, int radius, int start_angle, int end_angle);
 void gschem_cairo_stroke(cairo_t *cr, int line_type, int line_end, int width, int length, int space);
 void gschem_cairo_set_source_color(cairo_t *cr, COLOR *color);
 /* i_basic.c */
diff --git a/gschem/src/gschem_cairo.c b/gschem/src/gschem_cairo.c
index 112e445..756f971 100644
--- a/gschem/src/gschem_cairo.c
+++ b/gschem/src/gschem_cairo.c
@@ -22,6 +22,7 @@
 #include <config.h>
 
 #include <cairo.h>
+#include <math.h>
 
 #include "gschem.h"
 
@@ -88,6 +89,22 @@ void gschem_cairo_box (cairo_t *cr, int width,
 }
 
 
+void gschem_cairo_arc (cairo_t *cr, int width, int x, int y,
+                       int radius, int start_angle, int end_angle)
+{
+  cairo_new_sub_path (cr);
+  if (start_angle > start_angle + end_angle) {
+    cairo_arc (cr, x + 0.5, y + 0.5, radius,
+               -start_angle * (M_PI / 180.),
+               (-start_angle - end_angle) * (M_PI / 180.));
+  } else {
+    cairo_arc_negative (cr, x + 0.5, y + 0.5, radius,
+                        -start_angle * (M_PI / 180.),
+                        (-start_angle - end_angle) * (M_PI / 180.));
+  }
+}
+
+
 void gschem_cairo_stroke (cairo_t *cr, int line_type, int line_end,
                           int width, int length, int space)
 {
diff --git a/gschem/src/o_arc.c b/gschem/src/o_arc.c
index 01b1c7a..155718c 100644
--- a/gschem/src/o_arc.c
+++ b/gschem/src/o_arc.c
@@ -45,7 +45,7 @@ void o_arc_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
   int wleft, wright, wtop, wbottom;
-  int x, y, radius, start_angle, end_angle;
+  int x, y, radius;
   int line_width;
   COLOR *color;
   int length, space;
@@ -83,18 +83,6 @@ void o_arc_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
    */
   WORLDtoSCREEN( toplevel, o_current->arc->x, o_current->arc->y, &x, &y );
   radius = SCREENabs( toplevel, o_current->arc->width / 2 );
-  start_angle = o_current->arc->start_angle;
-  end_angle   = o_current->arc->end_angle;
-
-#if DEBUG 
-  printf("drawing arc x: %d y: %d sa: %d ea: %d width: %d height: %d\n",
-         x,
-         y, 
-         o_current->arc->start_angle, 
-         o_current->arc->end_angle,
-         radius, 
-         radius);
-#endif
 
   if (toplevel->override_color != -1 )
     color = x_color_lookup (toplevel->override_color);
@@ -109,17 +97,10 @@ void o_arc_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   length = SCREENabs( toplevel, o_current->line_length );
   space = SCREENabs( toplevel, o_current->line_space );
 
+  gschem_cairo_arc (w_current->cr, line_width, x, y, radius,
+                    o_current->arc->start_angle, o_current->arc->end_angle);
+
   gschem_cairo_set_source_color (w_current->cr, color);
-  cairo_new_sub_path (w_current->cr);
-  if (start_angle > start_angle + end_angle) {
-    cairo_arc (w_current->cr, x + 0.5, y + 0.5, radius,
-               -start_angle * (M_PI / 180.),
-               (-start_angle - end_angle) * (M_PI / 180.));
-  } else {
-    cairo_arc_negative (w_current->cr, x + 0.5, y + 0.5, radius,
-                        -start_angle * (M_PI / 180.),
-                        (-start_angle - end_angle) * (M_PI / 180.));
-  }
   gschem_cairo_stroke (w_current->cr, o_current->line_type,
                        o_current->line_end, line_width, length, space);
 




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs