<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/104935/">http://git.reviewboard.kde.org/r/104935/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Amarok, Leo Franchi and Rick W. Chen.</div>
<div>By Alexander Potashev.</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The former scrolling algorithm was to scroll text continuously
while playing a song. In this case the first lines of lyrics hide
very quickly - often before they are sung.
Again, with the old algorithm the scrollbar position is 0 at the
beginning of the song (0:00), and it reaches the maximum possible
position exactly when the song ends.
The new algorithm tries to keep the currently "played" line
at center of the Lyrics applet window. To achieve this, we
target scrollbar position to be (-pageStep/2) at the beginning
of the song (0:00), and to reach position (maximum + pageStep/2)
exactly when the song ends.
`pageStep` is the height of Lyrics applet window expressed in the
units used by the scrollbar. Therefore `pageStep/2` is an offset
that can be added/substracted to move down/up by half a page in
the Lyrics applet.
Here is a formula to transform a scrollbar position used in the old
algorithm to the scrollbar position when the new algorithm is used:
new_pos = pos / maximum * (maximum + pageStep) - pageStep / 2
We make the following changes to the algorithm:
1. Multiply by (maximum + pageStep) instead of `maximum` to fulfill
the multiplication factor from the above formula.
2. Additionally, substract `pageStep/2`, as defined by the above
formula.
3. Avoid using floating point math (the "double" data type) to improve
performance.
4. Re-read the current position of the scrollbar when saving
`oldSliderPosition`, because scrollbar positions calculated using
the above formula may be out of the allowed range of the scrollbar
and "truncated", i.e. adjusted to fit the scrollbar range.
When truncated, `vbar->value()` differs from `newSliderPosition`.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Works as expected.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>src/context/applets/lyrics/LyricsApplet.cpp <span style="color: grey">(9720db0)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/104935/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>