Skip to content

Commit

Permalink
fix 123506: Scrambled scores in Start Center
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Sep 26, 2016
1 parent 0e3e753 commit 460e5e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion libmscore/accidental.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ AccidentalType Accidental::name2subtype(const QString& tag)
{
SymId symId = Sym::name2id(tag);
if (symId == SymId::noSym)
qDebug("no symbol found");
; // qDebug("no symbol found");
else {
int i = 0;
for (const Acc& acc : accList) {
Expand Down
15 changes: 12 additions & 3 deletions libmscore/scorefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,24 @@ QImage Score::createThumbnail()
int h = int(fr.height() * mag);

QImage pm(w, h, QImage::Format_ARGB32_Premultiplied);
pm.setDotsPerMeterX(lrint((mag * 1000) / INCH));
pm.setDotsPerMeterY(lrint((mag * 1000) / INCH));

int dpm = lrint(DPMM * 1000.0);
pm.setDotsPerMeterX(dpm);
pm.setDotsPerMeterY(dpm);
pm.fill(0xffffffff);

double pr = MScore::pixelRatio;
MScore::pixelRatio = 1.0;

QPainter p(&pm);
p.setRenderHint(QPainter::Antialiasing, true);
p.setRenderHint(QPainter::TextAntialiasing, true);
p.scale(mag, mag);
print(&p, 0);
p.end();

MScore::pixelRatio = pr;

if (layoutMode() != mode) {
setLayoutMode(mode);
doLayout();
Expand Down Expand Up @@ -931,7 +940,7 @@ void Score::print(QPainter* painter, int pageNo)

QList<Element*> ell = page->items(fr);
qStableSort(ell.begin(), ell.end(), elementLessThan);
foreach(const Element* e, ell) {
for (const Element* e : ell) {
if (!e->visible())
continue;
painter->save();
Expand Down
23 changes: 8 additions & 15 deletions mscore/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,8 +1511,7 @@ void MuseScore::printFile()
double mag = printerDev.logicalDpiX() / DPI;

double pr = MScore::pixelRatio;
MScore::pixelRatio = DPI / printerDev.logicalDpiX();

MScore::pixelRatio = 1.0 / mag;
p.scale(mag, mag);

int fromPage = printerDev.fromPage() - 1;
Expand Down Expand Up @@ -1913,9 +1912,6 @@ bool MuseScore::savePdf(Score* cs, const QString& saveName)
double pr = MScore::pixelRatio;
MScore::pixelRatio = DPI / printerDev.logicalDpiX();

// double mag = printerDev.logicalDpiX() / DPI;
// p.scale(mag, mag);

const QList<Page*> pl = cs->pages();
int pages = pl.size();
bool firstPage = true;
Expand Down Expand Up @@ -1968,9 +1964,6 @@ bool MuseScore::savePdf(QList<Score*> cs, const QString& saveName)
MScore::pixelRatio = DPI / printerDev.logicalDpiX();
MScore::pdfPrinting = true;

// double mag = printerDev.logicalDpiX() / DPI;
// p.scale(mag, mag);

bool firstPage = true;
for (Score* s : cs) {
LayoutMode layoutMode = s->layoutMode();
Expand Down Expand Up @@ -2378,11 +2371,11 @@ bool MuseScore::savePng(Score* score, const QString& name, bool screenshot, bool
printer.setDotsPerMeterX(lrint((convDpi * 1000) / INCH));
printer.setDotsPerMeterY(lrint((convDpi * 1000) / INCH));

MScore::pixelRatio = DPI / printer.logicalDpiX();

printer.fill(transparent ? 0 : 0xffffffff);

double mag = convDpi / DPI;
MScore::pixelRatio = 1.0 / mag;

QPainter p(&printer);
p.setRenderHint(QPainter::Antialiasing, true);
p.setRenderHint(QPainter::TextAntialiasing, true);
Expand Down Expand Up @@ -2554,8 +2547,8 @@ QString MuseScore::getWallpaper(const QString& caption)
// [of edit that must be coordinated with the MuseScore master code base.
//
bool MuseScore::saveSvg(Score* score, const QString& saveName)
{
SvgGenerator printer;
{
SvgGenerator printer;

QString title(score->title());
printer.setTitle(title);
Expand Down Expand Up @@ -2659,16 +2652,16 @@ bool MuseScore::saveSvg(Score* score, const QString& saveName)

// Paint it
paintElement(p, e);
}
}
p.translate(QPointF(pf->width() * DPI, 0.0));
}
}

// Clean up and return
score->setPrinting(false);
MScore::pdfPrinting = false;
p.end(); // Writes MuseScore SVG file to disk, finally
return true;
}
}

//---------------------------------------------------------
// createThumbnail
Expand Down

0 comments on commit 460e5e7

Please sign in to comment.