[gsharp-cvs] CVS update: gsharp/score-pane.lisp gsharp/sdl.lisp

Robert Strandh rstrandh at common-lisp.net
Tue Nov 8 05:16:16 UTC 2005


Update of /project/gsharp/cvsroot/gsharp
In directory common-lisp.net:/tmp/cvs-serv31471

Modified Files:
	score-pane.lisp sdl.lisp 
Log Message:
Change the convention for staff-line-offsets so that the one going
down is nonnegative and the one going up is negative.  This way, they
should both be added to the y-coordinate of the reference point
to obtain the lower and upper edge of the staff line respectively.  

Date: Tue Nov  8 06:16:15 2005
Author: rstrandh

Index: gsharp/score-pane.lisp
diff -u gsharp/score-pane.lisp:1.16 gsharp/score-pane.lisp:1.17
--- gsharp/score-pane.lisp:1.16	Tue Nov  8 04:15:02 2005
+++ gsharp/score-pane.lisp	Tue Nov  8 06:16:12 2005
@@ -304,9 +304,7 @@
 
 (defun draw-staff-line (pane x1 staff-step x2)
   (multiple-value-bind (down up) (staff-line-offsets *font*)
-    ;; the staff line offsets are both positive, so subract
-    ;; the UP value from y and add the DOWN value to y. 
-    (let ((y1 (- (- (staff-step staff-step)) up))
+    (let ((y1 (+ (- (staff-step staff-step)) up))
 	  (y2 (+ (- (staff-step staff-step)) down)))
       (draw-rectangle* pane x1 y1 x2 y2))))
 


Index: gsharp/sdl.lisp
diff -u gsharp/sdl.lisp:1.6 gsharp/sdl.lisp:1.7
--- gsharp/sdl.lisp:1.6	Tue Nov  8 04:15:02 2005
+++ gsharp/sdl.lisp	Tue Nov  8 06:16:14 2005
@@ -56,7 +56,7 @@
       (setf staff-line-offset-down
 	    (floor (/ staff-line-thickness 2))
 	    staff-line-offset-up
-	    (- staff-line-thickness staff-line-offset-down)))
+	    (- staff-line-offset-down staff-line-thickness)))
     (let ((stem-thickness (round (/ staff-line-distance 11.9))))
       (setf stem-offset-left
 	    (- (floor (/ stem-thickness 2)))
@@ -130,14 +130,17 @@
   (with-slots (x-offset y-offset) (aref (glyphs font) glyph-no)
     (values x-offset y-offset)))
 
-;;; the staff line offsets are both positive integers.
-;;; if the staff line has a thickness which is an even
-;;; number of pixels, then the two values returned are the
-;;; same.  Otherwise the first value (down) is 1 smaller
-;;; than the second value (up).  This implies that the
-;;; y-value of the reference point for a staff line is either
-;;; in the middle of the staff line (if the thickness is even)
-;;; or half a pixel BELOW the middle (if the thickness is odd).
+;;; the DOWN staff line offset is a nonnegative integer, and the UP
+;;; staff line offset is a negative integer.  This way, both of them
+;;; should be ADDED to a reference y value to obtain the lower and
+;;; upper y coordinates of the staff line.  If the staff line has a
+;;; thickness which is an even number of pixels, then the two values
+;;; returned have the same magnitude (but opposite signs).  Otherwise
+;;; the first value (DOWN) has a magnitude which is one smaller than
+;;; that of the second value (UP).  This implies that the y-value of the
+;;; reference point for a staff line is either in the middle of the
+;;; staff line (if the thickness is even) or half a pixel BELOW the
+;;; middle (if the thickness is odd).
 (defmethod staff-line-offsets ((font font))
   (with-slots (staff-line-offset-down staff-line-offset-up) font
     (values staff-line-offset-down staff-line-offset-up)))




More information about the Gsharp-cvs mailing list