more small low level optimizations

This commit is contained in:
ws 2013-01-03 08:42:40 +01:00
parent 9fae9fbfea
commit 30a68e90bd
6 changed files with 14 additions and 25 deletions

View file

@ -1173,8 +1173,8 @@ static Bm beamMetric1(bool up, char l1, char l2)
static int adjust(qreal _spatium4, int slant, const QList<ChordRest*>& cl)
{
int n = cl.size();
const Chord* c1;
const Chord* c2;
const Chord* c1 = 0;
const Chord* c2 = 0;
int i1, i2;
for (i1 = 0; i1 < n; ++i1) {
if (cl[i1]->type() == Element::CHORD) {

View file

@ -1304,7 +1304,7 @@ void Chord::layout2()
Element* e = s->element(track);
if (!e || e->type() != CHORD)
continue;
QList<LedgerLine*>* lll = static_cast<Chord*>(e)->ledgerLines();
QVector<LedgerLine*>* lll = static_cast<Chord*>(e)->ledgerLines();
int nn = lll->size();
for (int ii = 0; ii < nn; ++ii) {
LedgerLine* ll = lll->at(ii);

View file

@ -96,7 +96,7 @@ class Chord : public ChordRest {
Q_PROPERTY(QDeclarativeListProperty<Lyrics> lyrics READ qmlLyrics);
QList<Note*> _notes; // sorted to increasing pitch
QList<LedgerLine*> _ledgerLines;
QVector<LedgerLine*> _ledgerLines;
Stem* _stem;
Hook* _hook;
@ -139,7 +139,7 @@ class Chord : public ChordRest {
void setStemDirection(MScore::Direction d) { _stemDirection = d; }
MScore::Direction stemDirection() const { return _stemDirection; }
QList<LedgerLine*>* ledgerLines() { return &_ledgerLines; }
QVector<LedgerLine*>* ledgerLines() { return &_ledgerLines; }
void layoutStem1();
void layoutStem();

View file

@ -274,18 +274,6 @@ Element::~Element()
delete _links;
}
}
if (score()) {
foreach(Element* e, score()->selection().elements()) {
if (e == this) {
// if (MScore::debugMode)
qDebug("======~Element: %p still in selection! generated %d\n",
this, generated());
// if (MScore::debugMode)
// abort();
score()->deselect(this);
}
}
}
}
//---------------------------------------------------------
@ -304,9 +292,6 @@ Element::Element(Score* s) :
_track(-1),
_color(MScore::defaultColor),
_mag(1.0),
// _pos(QPointF()),
// _userOff(QPointF()),
// _readPos(QPointF()),
_tag(1),
_score(s),
itemDiscovered(0)

View file

@ -1089,8 +1089,12 @@ void Slur::read(const QDomElement& de)
static bool chordsHaveTie(Chord* c1, Chord* c2)
{
foreach(Note* n1, c1->notes()) {
foreach(Note* n2, c2->notes()) {
int n1 = c1->notes().size();
for (int i1 = 0; i1 < n1; ++i1) {
Note* n1 = c1->notes().at(i1);
int n2 = c2->notes().size();
for (int i2 = 0; i2 < n2; ++i2) {
Note* n2 = c2->notes().at(i2);
if (n1->tieFor() && n1->tieFor() == n2->tieBack())
return true;
}

View file

@ -89,9 +89,9 @@ void updateNoteLines(Segment* segment, int track)
for (int t = track; t < track + VOICES; ++t) {
Chord* chord = static_cast<Chord*>(s->element(t));
if (chord && chord->type() == Element::CHORD) {
foreach(Note* note, chord->notes()) {
note->updateLine();
}
int n = chord->notes().size();
for (int i = 0; i < n; ++i)
chord->notes().at(i)->updateLine();
}
}
}