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

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-102-gdba5ef6)



The branch, master has been updated
       via  dba5ef64f4425d61bf43eef5ae69d863b740edbf (commit)
      from  508ab0fd9a1e4317ee660bc9eba79fcb49329841 (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 |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)


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

commit dba5ef64f4425d61bf43eef5ae69d863b740edbf
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Jan 1 14:07:22 2009 +0000

    gschem: Adjust hinting of lines to include an extra overlapping pixel
    
    When drawing using GDK, a span of pixels being rendered in a line would
    light all pixels touched by the span.
    
    Since moving to cairo, our hinting code has rounded the line's end-points
    to land between pixels. (So cairo paints the whole pixel), however it
    means that there is one pixel less being painted (as both ends are
    adjusted in the same direction).
    
    Fix this with a manual addition of 1px as appropriate to the coordinates
    such that an extra pixel is hit for horizontal and vertical lines.
    
    This now means that a line drawn between two grid positions will acually
    be drawn on top of both of those grid lines, rather than being drawn on
    top of one, and just touching the other.
    
    Apply the offset factor (0 or 0.5px) to both X and Y coordinate pairs for
    non horizontal / vertical lines, since that gives better alignment with
    the grid.
    
    Apply the same hinting to round capped lines as to square capped.

:100644 100644 6c36ac9... c153fd7... M	gschem/src/gschem_cairo.c

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

commit dba5ef64f4425d61bf43eef5ae69d863b740edbf
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Jan 1 14:07:22 2009 +0000

    gschem: Adjust hinting of lines to include an extra overlapping pixel
    
    When drawing using GDK, a span of pixels being rendered in a line would
    light all pixels touched by the span.
    
    Since moving to cairo, our hinting code has rounded the line's end-points
    to land between pixels. (So cairo paints the whole pixel), however it
    means that there is one pixel less being painted (as both ends are
    adjusted in the same direction).
    
    Fix this with a manual addition of 1px as appropriate to the coordinates
    such that an extra pixel is hit for horizontal and vertical lines.
    
    This now means that a line drawn between two grid positions will acually
    be drawn on top of both of those grid lines, rather than being drawn on
    top of one, and just touching the other.
    
    Apply the offset factor (0 or 0.5px) to both X and Y coordinate pairs for
    non horizontal / vertical lines, since that gives better alignment with
    the grid.
    
    Apply the same hinting to round capped lines as to square capped.

diff --git a/gschem/src/gschem_cairo.c b/gschem/src/gschem_cairo.c
index 6c36ac9..c153fd7 100644
--- a/gschem/src/gschem_cairo.c
+++ b/gschem/src/gschem_cairo.c
@@ -52,6 +52,8 @@ void gschem_cairo_line (cairo_t *cr, int line_end, int width,
     yoffset = offset;
   else if (vertical)
     xoffset = offset;
+  else
+    xoffset = yoffset = offset;
 
   /* Now hint the ends of the lines */
 
@@ -60,18 +62,25 @@ void gschem_cairo_line (cairo_t *cr, int line_end, int width,
       /* Line terminates at the passed coordinate */
       /* Do nothing */
       break;
+
     case END_SQUARE:
+    case END_ROUND:
       /* Line terminates half a width away from the passed coordinate */
       if (horizontal) {
         xoffset = offset;
       } else if (vertical) {
         yoffset = offset;
       }
-    case END_ROUND:
-      /* Do nothing */
       break;
   }
 
+  /* Add an extra pixel to give an inclusive span */
+  if (horizontal) {
+    if (x1 > x2) x1 += 1; else x2 += 1;
+  } else if (vertical) {
+    if (y1 > y2) y1 += 1; else y2 += 1;
+  }
+
   cairo_move_to (cr, x1 + xoffset, y1 + yoffset);
   cairo_line_to (cr, x2 + xoffset, y2 + yoffset);
 }




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