Mercurial > hg > svgui
comparison layer/PianoScale.cpp @ 946:36cddc3de023 alignment_view
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:19:52 +0100 |
parents | b66fb15de477 |
children | 4fe7a09be0fe |
comparison
equal
deleted
inserted
replaced
897:499b637f2a26 | 946:36cddc3de023 |
---|---|
25 | 25 |
26 void | 26 void |
27 PianoScale::paintPianoVertical(View *v, | 27 PianoScale::paintPianoVertical(View *v, |
28 QPainter &paint, | 28 QPainter &paint, |
29 QRect r, | 29 QRect r, |
30 float minf, | 30 double minf, |
31 float maxf) | 31 double maxf) |
32 { | 32 { |
33 int x0 = r.x(), y0 = r.y(), x1 = r.x() + r.width(), y1 = r.y() + r.height(); | 33 int x0 = r.x(), y0 = r.y(), x1 = r.x() + r.width(), y1 = r.y() + r.height(); |
34 | 34 |
35 paint.drawLine(x0, y0, x0, y1); | 35 paint.drawLine(x0, y0, x0, y1); |
36 | 36 |
37 int py = y1, ppy = y1; | 37 int py = y1, ppy = y1; |
38 paint.setBrush(paint.pen().color()); | 38 paint.setBrush(paint.pen().color()); |
39 | 39 |
40 for (int i = 0; i < 128; ++i) { | 40 for (int i = 0; i < 128; ++i) { |
41 | 41 |
42 float f = Pitch::getFrequencyForPitch(i); | 42 double f = Pitch::getFrequencyForPitch(i); |
43 int y = lrintf(v->getYForFrequency(f, minf, maxf, true)); | 43 int y = int(lrint(v->getYForFrequency(f, minf, maxf, true))); |
44 | 44 |
45 if (y < y0 - 2) break; | 45 if (y < y0 - 2) break; |
46 if (y > y1 + 2) { | 46 if (y > y1 + 2) { |
47 continue; | 47 continue; |
48 } | 48 } |