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

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


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

Modified Files:
	score-pane.lisp sdl.lisp 
Log Message:
more comments

Date: Tue Nov  8 04:15:03 2005
Author: rstrandh

Index: gsharp/score-pane.lisp
diff -u gsharp/score-pane.lisp:1.15 gsharp/score-pane.lisp:1.16
--- gsharp/score-pane.lisp:1.15	Mon Nov  7 19:51:41 2005
+++ gsharp/score-pane.lisp	Tue Nov  8 04:15:02 2005
@@ -149,6 +149,9 @@
 ;;; Given a staff-step value, determine the corresponding number of
 ;;; pixels in the current font.  The sign of the value returned is 
 ;;; the same as that of the argument.
+;;; But is that reasonable?  It seems more logical to have it return
+;;; the opposite sign, so that the result from staff-step is always
+;;; added to some y coordinate.
 (defun staff-step (n)
   (* n (/ (staff-line-distance *font*) 2)))
 
@@ -181,6 +184,8 @@
 ;;; finally the upper glyph.  
 ;;; It appears that this function increases the staff step in each iteration,
 ;;; which seems incomptible with the way draw-antialiased-glyph appears to work.
+;;; This function is currently used only by the three draw-xxx-stack functions,
+;;; which in turn are currently not used.
 (defun draw-stack (pane glyph-lower glyph-upper glyph-two x staff-step how-many)
   (draw-antialiased-glyph pane glyph-lower x staff-step)
   (loop for ss from staff-step by 2
@@ -299,8 +304,10 @@
 
 (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))
-	  (y2 (- (- (staff-step staff-step)) down)))
+	  (y2 (+ (- (staff-step staff-step)) down)))
       (draw-rectangle* pane x1 y1 x2 y2))))
 
 (defclass staff-output-record (output-record)


Index: gsharp/sdl.lisp
diff -u gsharp/sdl.lisp:1.5 gsharp/sdl.lisp:1.6
--- gsharp/sdl.lisp:1.5	Mon Aug  1 01:36:56 2005
+++ gsharp/sdl.lisp	Tue Nov  8 04:15:02 2005
@@ -130,6 +130,14 @@
   (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).
 (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