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

gEDA-cvs: pcb.git: branch: master updated (789c632f69c093da731c2194f74ae5aa701697c4)



The branch, master has been updated
       via  789c632f69c093da731c2194f74ae5aa701697c4 (commit)
       via  30aaf303f5435d1305abede1766f36ed8dca41d9 (commit)
      from  51beb7e187b8ee6be6377619f1ea8363c6e82d0c (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/gtk/gtkhid-gdk.c |   40 ++++++++++------------------------------
 src/hid/gtk/gtkhid-gl.c  |   37 ++++++++++++-------------------------
 2 files changed, 22 insertions(+), 55 deletions(-)


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

commit 789c632f69c093da731c2194f74ae5aa701697c4
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Simplify and correct ghid_show_crosshair() logic for the GL renderer
    
    Drop the always-true parameter we were passed, and combine the code from
    ghid_show_crosshair() and draw_crosshair() into one function.

:100644 100644 e559c4f... b9a569f... M	src/hid/gtk/gtkhid-gl.c

commit 30aaf303f5435d1305abede1766f36ed8dca41d9
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Remove always-true parameter from show_crosshair() in GDK renderer
    
    Pass the render_priv pointer instead - this is vaguely useful. Also
    tidy the function a little to make it clearer, rolling the code from
    show_crosshair() and draw_crosshair() together into a combined
    "draw_crosshair()" function.
    
    The function no longer rejects negative x drawing coordinates, but we
    aren't passed those anyway.

:100644 100644 2d2d4c7... 963b5d4... M	src/hid/gtk/gtkhid-gdk.c

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

commit 789c632f69c093da731c2194f74ae5aa701697c4
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Simplify and correct ghid_show_crosshair() logic for the GL renderer
    
    Drop the always-true parameter we were passed, and combine the code from
    ghid_show_crosshair() and draw_crosshair() into one function.

diff --git a/src/hid/gtk/gtkhid-gl.c b/src/hid/gtk/gtkhid-gl.c
index e559c4f..b9a569f 100644
--- a/src/hid/gtk/gtkhid-gl.c
+++ b/src/hid/gtk/gtkhid-gl.c
@@ -731,34 +731,19 @@ draw_dozen_cross (gint x, gint y, gint z)
 }
 
 static void
-draw_crosshair (gint x, gint y, gint z)
-{
-  static enum crosshair_shape prev = Basic_Crosshair_Shape;
-
-  draw_right_cross (x, y, z);
-  if (prev == Union_Jack_Crosshair_Shape)
-    draw_slanted_cross (x, y, z);
-  if (prev == Dozen_Crosshair_Shape)
-    draw_dozen_cross (x, y, z);
-  prev = Crosshair.shape;
-}
-
-void
-ghid_show_crosshair (gboolean paint_new_location)
+draw_crosshair (render_priv *priv)
 {
   gint x, y, z;
   static int done_once = 0;
   static GdkColor cross_color;
 
-  if (!paint_new_location)
-    return;
-
   if (!done_once)
     {
       done_once = 1;
       /* FIXME: when CrossColor changed from config */
       ghid_map_color_string (Settings.CrossColor, &cross_color);
     }
+
   x = gport->crosshair_x;
   y = gport->crosshair_y;
   z = 0;
@@ -770,12 +755,15 @@ ghid_show_crosshair (gboolean paint_new_location)
              cross_color.green / 65535.,
              cross_color.blue / 65535.);
 
-  if (x >= 0 && paint_new_location)
-    {
-      glBegin (GL_LINES);
-      draw_crosshair (x, y, z);
-      glEnd ();
-    }
+  glBegin (GL_LINES);
+
+  draw_right_cross (x, y, z);
+  if (Crosshair.shape == Union_Jack_Crosshair_Shape)
+    draw_slanted_cross (x, y, z);
+  if (Crosshair.shape == Dozen_Crosshair_Shape)
+    draw_dozen_cross (x, y, z);
+
+  glEnd ();
 
   glDisable (GL_COLOR_LOGIC_OP);
 }
@@ -966,8 +954,7 @@ ghid_drawing_area_expose_cb (GtkWidget *widget,
   DrawMark ();
   hidgl_flush_triangles (&buffer);
 
-  ghid_show_crosshair (TRUE);
-
+  draw_crosshair (priv);
   hidgl_flush_triangles (&buffer);
 
   draw_lead_user (priv);

commit 30aaf303f5435d1305abede1766f36ed8dca41d9
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Remove always-true parameter from show_crosshair() in GDK renderer
    
    Pass the render_priv pointer instead - this is vaguely useful. Also
    tidy the function a little to make it clearer, rolling the code from
    show_crosshair() and draw_crosshair() together into a combined
    "draw_crosshair()" function.
    
    The function no longer rejects negative x drawing coordinates, but we
    aren't passed those anyway.

diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index 2d2d4c7..963b5d4 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -1005,26 +1005,11 @@ draw_dozen_cross (GdkGC *xor_gc, gint x, gint y)
 }
 
 static void
-draw_crosshair (GdkGC *xor_gc, gint x, gint y)
+draw_crosshair (render_priv *priv)
 {
-  static enum crosshair_shape prev = Basic_Crosshair_Shape;
-
-  draw_right_cross (xor_gc, x, y);
-  if (prev == Union_Jack_Crosshair_Shape)
-    draw_slanted_cross (xor_gc, x, y);
-  if (prev == Dozen_Crosshair_Shape)
-    draw_dozen_cross (xor_gc, x, y);
-  prev = Crosshair.shape;
-}
-
-static void
-show_crosshair (gboolean paint_new_location)
-{
-  render_priv *priv = gport->render_priv;
   GdkWindow *window = gtk_widget_get_window (gport->drawing_area);
   GtkStyle *style = gtk_widget_get_style (gport->drawing_area);
   gint x, y;
-  static gint x_prev = -1, y_prev = -1;
   static GdkGC *xor_gc;
   static GdkColor cross_color;
 
@@ -1041,22 +1026,17 @@ show_crosshair (gboolean paint_new_location)
       /* FIXME: when CrossColor changed from config */
       ghid_map_color_string (Settings.CrossColor, &cross_color);
     }
-  x = DRAW_X (gport->crosshair_x);
-  y = DRAW_Y (gport->crosshair_y);
 
   gdk_gc_set_foreground (xor_gc, &cross_color);
 
-  if (x_prev >= 0 && !paint_new_location)
-    draw_crosshair (xor_gc, x_prev, y_prev);
+  x = DRAW_X (gport->crosshair_x);
+  y = DRAW_Y (gport->crosshair_y);
 
-  if (x >= 0 && paint_new_location)
-    {
-      draw_crosshair (xor_gc, x, y);
-      x_prev = x;
-      y_prev = y;
-    }
-  else
-    x_prev = y_prev = -1;
+  draw_right_cross (xor_gc, x, y);
+  if (Crosshair.shape == Union_Jack_Crosshair_Shape)
+    draw_slanted_cross (xor_gc, x, y);
+  if (Crosshair.shape == Dozen_Crosshair_Shape)
+    draw_dozen_cross (xor_gc, x, y);
 }
 
 void
@@ -1115,7 +1095,7 @@ ghid_screen_update (void)
 
   gdk_draw_drawable (window, priv->bg_gc, gport->pixmap,
                      0, 0, 0, 0, gport->width, gport->height);
-  show_crosshair (TRUE);
+  draw_crosshair (priv);
 }
 
 gboolean
@@ -1129,7 +1109,7 @@ ghid_drawing_area_expose_cb (GtkWidget *widget,
   gdk_draw_drawable (window, priv->bg_gc, port->pixmap,
                      ev->area.x, ev->area.y, ev->area.x, ev->area.y,
                      ev->area.width, ev->area.height);
-  show_crosshair (TRUE);
+  draw_crosshair (priv);
   return FALSE;
 }
 




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