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

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-146-gd615982)



The branch, master has been updated
       via  d615982103652c0143eca430570bbfcfa0d206fe (commit)
      from  1626b1a02a6e55327ac7f2d00dd976aba57855d7 (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/src/gschem_cairo.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)


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

commit d615982103652c0143eca430570bbfcfa0d206fe
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Jan 5 05:01:13 2009 +0000

    gschem: Clamp minimum size to draw stoke dots using cairo, apply hinting (Rest!)
    
    Activate the code partially committed in the last commit, and add the
    remaining code to hint the position of dots in a stroke.
    
    Since cairo uses antialiased drawings, a dot of diameter 1px will actually
    render ligher than it would have with GDK. Once the line width reaches 1px
    switch back to drawing dots as squares.
    
    Also add hinting to the position of the drawn dots drawn along the stroke
    to ensure they land centered on pixels.

:100644 100644 5ea3298... 9f5255a... M	gschem/src/gschem_cairo.c

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

commit d615982103652c0143eca430570bbfcfa0d206fe
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Jan 5 05:01:13 2009 +0000

    gschem: Clamp minimum size to draw stoke dots using cairo, apply hinting (Rest!)
    
    Activate the code partially committed in the last commit, and add the
    remaining code to hint the position of dots in a stroke.
    
    Since cairo uses antialiased drawings, a dot of diameter 1px will actually
    render ligher than it would have with GDK. Once the line width reaches 1px
    switch back to drawing dots as squares.
    
    Also add hinting to the position of the drawn dots drawn along the stroke
    to ensure they land centered on pixels.

diff --git a/gschem/src/gschem_cairo.c b/gschem/src/gschem_cairo.c
index 5ea3298..9f5255a 100644
--- a/gschem/src/gschem_cairo.c
+++ b/gschem/src/gschem_cairo.c
@@ -255,6 +255,7 @@ void gschem_cairo_center_arc (GSCHEM_TOPLEVEL *w_current,
 void gschem_cairo_stroke (GSCHEM_TOPLEVEL *w_current, int line_type, int line_end,
                           int wwidth, int wlength, int wspace)
 {
+  double offset;
   double dashes[4];
   cairo_line_cap_t cap;
   cairo_line_cap_t round_cap_if_legible;
@@ -264,11 +265,12 @@ void gschem_cairo_stroke (GSCHEM_TOPLEVEL *w_current, int line_type, int line_en
   width  = screen_width (w_current, wwidth);
   length = SCREENabs (w_current, wlength);
   space  = SCREENabs (w_current, wspace);
+  offset = ((width % 2) == 0) ? 0 : 0.5;
 
   cairo_set_line_width (w_current->cr, width);
   cairo_set_line_join (w_current->cr, CAIRO_LINE_JOIN_MITER);
 
-  round_cap_if_legible = (width <= 0) ? CAIRO_LINE_CAP_SQUARE :
+  round_cap_if_legible = (width <= 1) ? CAIRO_LINE_CAP_SQUARE :
                                         CAIRO_LINE_CAP_ROUND;
 
   switch (line_end) {
@@ -300,7 +302,7 @@ void gschem_cairo_stroke (GSCHEM_TOPLEVEL *w_current, int line_type, int line_en
       dashes[1] = space;
       num_dashes = 2;
 
-      cairo_set_dash (w_current->cr, dashes, num_dashes, 0.);
+      cairo_set_dash (w_current->cr, dashes, num_dashes, offset);
       cairo_set_line_cap (w_current->cr, round_cap_if_legible);
       cairo_stroke (w_current->cr);
       break;
@@ -328,7 +330,7 @@ void gschem_cairo_stroke (GSCHEM_TOPLEVEL *w_current, int line_type, int line_en
       dashes[1] = 2 * space + length;
       num_dashes = 2;
 
-      cairo_set_dash (w_current->cr, dashes, num_dashes, -length - space);
+      cairo_set_dash (w_current->cr, dashes, num_dashes, -length - space + offset);
       cairo_set_line_cap (w_current->cr, round_cap_if_legible);
       cairo_stroke (w_current->cr);
       break;
@@ -348,7 +350,7 @@ void gschem_cairo_stroke (GSCHEM_TOPLEVEL *w_current, int line_type, int line_en
       dashes[3] = 2 * space + length;
       num_dashes = 4;
 
-      cairo_set_dash (w_current->cr, dashes, num_dashes, -length - space);
+      cairo_set_dash (w_current->cr, dashes, num_dashes, -length - space + offset);
       cairo_set_line_cap (w_current->cr, round_cap_if_legible);
       cairo_stroke (w_current->cr);
       break;




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