Skip to content

Commit

Permalink
fix #65331 Bad screen scaling if staff scaled to 50% and zoom set to …
Browse files Browse the repository at this point in the history
…200%
  • Loading branch information
wschweer authored and lasconic committed Jun 17, 2015
1 parent 6d09138 commit 345e6ff
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libmscore/clef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void Clef::draw(QPainter* painter) const
return;
QColor color(curColor());
foreach(Element* e, elements) {
e->setColor(color);
e->setColor(color); //??
QPointF pt(e->pos());
painter->translate(pt);
e->draw(painter);
Expand Down
10 changes: 7 additions & 3 deletions libmscore/sym.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5290,9 +5290,14 @@ SymId Sym::userName2id(const QString& s)
return (val == -1) ? SymId::noSym : (SymId)(val);
}

//---------------------------------------------------------
// GlyphKey operator==
//---------------------------------------------------------

bool GlyphKey::operator==(const GlyphKey& k) const
{
return id == k.id && mag == k.mag && color == k.color;
return (face == k.face) && (id == k.id)
&& (mag == k.mag) && (worldScale == k.worldScale) && (color == k.color);
}

//---------------------------------------------------------
Expand Down Expand Up @@ -5328,7 +5333,6 @@ void ScoreFont::draw(SymId id, QPainter* painter, qreal mag, const QPointF& pos,
qDebug("Mscore: fatal error: cannot load internal font <%s>", qPrintable(s));
return;
}
printf("load <%s> <%s>\n", qPrintable(s), qPrintable(_family));
font = new QFont;
font->setWeight(QFont::Normal);
font->setItalic(false);
Expand All @@ -5355,7 +5359,7 @@ void ScoreFont::draw(SymId id, QPainter* painter, qreal mag, const QPointF& pos,
worldScale = 1.0;
int scale16 = lrint(worldScale * 6553.6 * mag);

GlyphKey gk(id, scale16, color);
GlyphKey gk(face, id, mag, worldScale, color);
GlyphPixmap* pm = cache->object(gk);
if (!pm) {
FT_Matrix matrix {
Expand Down
7 changes: 5 additions & 2 deletions libmscore/sym.h
Original file line number Diff line number Diff line change
Expand Up @@ -2592,12 +2592,15 @@ class Sym {
//---------------------------------------------------------

struct GlyphKey {
FT_Face face;
SymId id;
int mag;
qreal mag;
qreal worldScale;
QColor color;

public:
GlyphKey(SymId _id, int m, QColor c) : id(_id), mag(m), color(c) {}
GlyphKey(FT_Face _f, SymId _id, float m, float s, QColor c)
: face(_f), id(_id), mag(m), worldScale(s), color(c) {}
bool operator==(const GlyphKey&) const;
};

Expand Down
2 changes: 1 addition & 1 deletion mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2316,7 +2316,7 @@ void ScoreView::drawElements(QPainter& painter, const QList<Element*>& el)

void ScoreView::setMag(qreal nmag)
{
qreal m = mag();
qreal m = _matrix.m11();

if (nmag == m)
return;
Expand Down

0 comments on commit 345e6ff

Please sign in to comment.