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

gEDA-cvs: pcb.git: branch: master updated (8ce572e8c1cfded6459e43d61c776df859e11f55)



The branch, master has been updated
       via  8ce572e8c1cfded6459e43d61c776df859e11f55 (commit)
      from  8478d4d8e661801d31cbc0c9bef1c13aab2403c6 (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
=========

 src/hid/common/hidgl.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)


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

commit 8ce572e8c1cfded6459e43d61c776df859e11f55
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/common/hidgl.c: Use tags on circular contours to render them faster
    
    This lets us avoid the polygon tesselator for circular contours, and lets
    us render a different number of vertices in our appoximation depending
    upon zoom level.

:100644 100644 00efdce... bbba217... M	src/hid/common/hidgl.c

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

commit 8ce572e8c1cfded6459e43d61c776df859e11f55
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/common/hidgl.c: Use tags on circular contours to render them faster
    
    This lets us avoid the polygon tesselator for circular contours, and lets
    us render a different number of vertices in our appoximation depending
    upon zoom level.

diff --git a/src/hid/common/hidgl.c b/src/hid/common/hidgl.c
index 00efdce..bbba217 100644
--- a/src/hid/common/hidgl.c
+++ b/src/hid/common/hidgl.c
@@ -554,11 +554,24 @@ hidgl_fill_polygon (int n_coords, int *x, int *y)
 }
 
 void
-tesselate_contour (GLUtesselator *tobj, PLINE *contour, GLdouble *vertices)
+tesselate_contour (GLUtesselator *tobj, PLINE *contour, GLdouble *vertices,
+                   double scale)
 {
   VNODE *vn = &contour->head;
   int offset = 0;
 
+  /* If the contour is round, and hidgl_fill_circle would use
+   * less slices than we have vertices to draw it, then call
+   * hidgl_fill_circle to draw this contour.
+   */
+  if (contour->is_round) {
+    double slices = calc_slices (contour->radius / scale, 2 * M_PI);
+    if (slices < contour->Count) {
+      hidgl_fill_circle (contour->cx, contour->cy, contour->radius, scale);
+      return;
+    }
+  }
+
   gluTessBeginPolygon (tobj, NULL);
   gluTessBeginContour (tobj);
   do {
@@ -575,6 +588,7 @@ tesselate_contour (GLUtesselator *tobj, PLINE *contour, GLdouble *vertices)
 struct do_hole_info {
   GLUtesselator *tobj;
   GLdouble *vertices;
+  double scale;
 };
 
 static int
@@ -588,7 +602,7 @@ do_hole (const BoxType *b, void *cl)
     return 0;
   }
 
-  tesselate_contour (info->tobj, curc, info->vertices);
+  tesselate_contour (info->tobj, curc, info->vertices, info->scale);
   return 1;
 }
 
@@ -605,6 +619,7 @@ hidgl_fill_pcb_polygon (PolygonType *poly, const BoxType *clip_box, double scale
   struct do_hole_info info;
   int stencil_bit;
 
+  info.scale = scale;
   global_scale = scale;
 
   if (poly->Clipped == NULL)
@@ -664,7 +679,7 @@ hidgl_fill_pcb_polygon (PolygonType *poly, const BoxType *clip_box, double scale
   /* Drawing operations as masked to areas where the stencil buffer is '0' */
 
   /* Draw the polygon outer */
-  tesselate_contour (info.tobj, poly->Clipped->contours, info.vertices);
+  tesselate_contour (info.tobj, poly->Clipped->contours, info.vertices, scale);
   hidgl_flush_triangles (&buffer);
 
   /* Unassign our stencil buffer bit */




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