Skip to content

Commit d76e51d

Browse files
committed
fix some scaling regressions
1 parent 23c2b54 commit d76e51d

File tree

6 files changed

+23
-52
lines changed

6 files changed

+23
-52
lines changed

mscore/continuouspanel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ void ContinuousPanel::paint(const QRect& /*r*/, QPainter& p)
112112
//
113113
// Check elements at current panel position
114114
//
115-
_offsetPanel = -(_sv->xoffset()) / _sv->pmag();
115+
_offsetPanel = -(_sv->xoffset()) / _sv->mag();
116116
_rect = QRect(_offsetPanel + _width, _y, 1, _height);
117-
//qDebug() << "width=" << _width << "_y="<< _y << "_offsetPanel=" << _offsetPanel << "_sv->xoffset()" << _sv->xoffset() << "_sv->pmag()" << _sv->pmag() <<"_spatium" << _spatium << "s->canvasPos().x()" << s->canvasPos().x() << "s->x()" << s->x();
117+
//qDebug() << "width=" << _width << "_y="<< _y << "_offsetPanel=" << _offsetPanel << "_sv->xoffset()" << _sv->xoffset() << "_sv->mag()" << _sv->mag() <<"_spatium" << _spatium << "s->canvasPos().x()" << s->canvasPos().x() << "s->x()" << s->x();
118118
Page* page = _score->pages().front();
119119
QList<Element*> elementsCurrent = page->items(_rect);
120120
if (elementsCurrent.empty()) {
@@ -155,11 +155,11 @@ void ContinuousPanel::paint(const QRect& /*r*/, QPainter& p)
155155
findElementWidths(elementsCurrent);
156156

157157
// Don't show panel if staff names are visible
158-
if (_sv->xoffset() / _sv->pmag() + _xPosMeasure > 0) {
158+
if (_sv->xoffset() / _sv->mag() + _xPosMeasure > 0) {
159159
_visible = false;
160160
return;
161161
}
162-
//qDebug() << "_sv->xoffset()=" <<_sv->xoffset() << " _sv->pmag()="<< _sv->pmag() <<" s->x=" << s->x() << " width=" << _width << " currentMeasue=" << _currentMeasure->x() << " _xPosMeasure=" << _xPosMeasure;
162+
//qDebug() << "_sv->xoffset()=" <<_sv->xoffset() << " _sv->mag()="<< _sv->mag() <<" s->x=" << s->x() << " width=" << _width << " currentMeasue=" << _currentMeasure->x() << " _xPosMeasure=" << _xPosMeasure;
163163

164164
draw(p, elementsCurrent);
165165
_visible = true;

mscore/magbox.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,19 @@ double MagBox::getMag(ScoreView* canvas)
105105
const PageFormat* pf = score->pageFormat();
106106
switch(MagIdx(currentIndex())) {
107107
case MagIdx::MAG_PAGE_WIDTH: // page width
108-
nmag *= cw / (pf->width() * DPI);
108+
nmag *= (cw / (pf->width() * DPI)) / (mscore->physicalDotsPerInch() / DPI);
109109
break;
110110
case MagIdx::MAG_PAGE: // page
111111
{
112-
double mag1 = cw / (pf->width() * DPI);
113-
double mag2 = ch / (pf->height() * DPI);
112+
double mag1 = (cw / (pf->width() * DPI) / (mscore->physicalDotsPerInch() / DPI));
113+
double mag2 = (ch / (pf->height() * DPI) / (mscore->physicalDotsPerInch() / DPI));
114114
nmag *= (mag1 > mag2) ? mag2 : mag1;
115115
}
116116
break;
117117
case MagIdx::MAG_DBL_PAGE: // double page
118118
{
119-
double mag1 = cw / (pf->width()*2*DPI+50.0);
120-
double mag2 = ch / (pf->height() * DPI);
119+
double mag1 = (cw / (pf->width()*2*DPI+50.0)) / (mscore->physicalDotsPerInch() / DPI);
120+
double mag2 = (ch / (pf->height() * DPI)) / (mscore->physicalDotsPerInch() / DPI);
121121
nmag *= (mag1 > mag2) ? mag2 : mag1;
122122
}
123123
break;

mscore/musescore.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ void MuseScore::setCurrentScoreView(ScoreView* view)
14091409
updateUndoRedo();
14101410

14111411
if (view->magIdx() == MagIdx::MAG_FREE)
1412-
mag->setMag(view->mag());
1412+
mag->setMag(view->lmag());
14131413
else
14141414
mag->setCurrentIndex(int(view->magIdx()));
14151415

@@ -3003,7 +3003,7 @@ void MuseScore::magTextChanged()
30033003
void MuseScore::incMag()
30043004
{
30053005
if (cv) {
3006-
qreal _mag = cv->mag() * 1.7;
3006+
qreal _mag = cv->lmag() * 1.7;
30073007
if (_mag > 16.0)
30083008
_mag = 16.0;
30093009
cv->setMag(MagIdx::MAG_FREE, _mag);
@@ -3018,7 +3018,7 @@ void MuseScore::incMag()
30183018
void MuseScore::decMag()
30193019
{
30203020
if (cv) {
3021-
qreal _mag = cv->mag() / 1.7;
3021+
qreal _mag = cv->lmag() / 1.7;
30223022
if (_mag < 0.05)
30233023
_mag = 0.05;
30243024
cv->setMag(MagIdx::MAG_FREE, _mag);
@@ -3230,7 +3230,7 @@ void MuseScore::writeSessionFile(bool cleanExit)
32303230
xml.tag("tab", tab); // 0 instead of "tab" does not work
32313231
xml.tag("idx", i);
32323232
if (v->magIdx() == MagIdx::MAG_FREE)
3233-
xml.tag("mag", v->mag());
3233+
xml.tag("mag", v->lmag());
32343234
else
32353235
xml.tag("magIdx", int(v->magIdx()));
32363236
xml.tag("x", v->xoffset() / DPMM);
@@ -3250,7 +3250,7 @@ void MuseScore::writeSessionFile(bool cleanExit)
32503250
xml.tag("tab", 1);
32513251
xml.tag("idx", i);
32523252
if (v->magIdx() == MagIdx::MAG_FREE)
3253-
xml.tag("mag", v->mag());
3253+
xml.tag("mag", v->lmag());
32543254
else
32553255
xml.tag("magIdx", int(v->magIdx()));
32563256
xml.tag("x", v->xoffset() / DPMM);

mscore/scoreview.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,7 @@ void ScoreView::zoom(qreal _mag, const QPointF& pos)
20702070
_mag = 0.05;
20712071

20722072
mscore->setMag(_mag);
2073-
setMag(_mag);
2073+
setMag(_mag * (mscore->physicalDotsPerInch() / DPI));
20742074
_magIdx = MagIdx::MAG_FREE;
20752075

20762076
QPointF p2 = imatrix.map(pos);
@@ -2354,13 +2354,13 @@ void ScoreView::drawElements(QPainter& painter, const QList<Element*>& el)
23542354

23552355
//---------------------------------------------------------
23562356
// setMag
2357+
// nmag - physical scale
23572358
//---------------------------------------------------------
23582359

23592360
void ScoreView::setMag(qreal nmag)
23602361
{
23612362
qreal m = _matrix.m11();
23622363

2363-
nmag *= mscore->physicalDotsPerInch() / DPI;
23642364
if (nmag == m)
23652365
return;
23662366
double deltamag = nmag / m;
@@ -2382,12 +2382,13 @@ void ScoreView::setMag(qreal nmag)
23822382

23832383
//---------------------------------------------------------
23842384
// setMagIdx
2385+
// mag - logical scale
23852386
//---------------------------------------------------------
23862387

23872388
void ScoreView::setMag(MagIdx idx, double mag)
23882389
{
23892390
_magIdx = idx;
2390-
setMag(mag);
2391+
setMag(mag * (mscore->physicalDotsPerInch() / DPI));
23912392
emit viewRectChanged();
23922393
update();
23932394
}
@@ -3727,19 +3728,19 @@ void ScoreView::editInputTransition(QInputMethodEvent* ie)
37273728
}
37283729

37293730
//---------------------------------------------------------
3730-
// mag
3731+
// lmag
37313732
//---------------------------------------------------------
37323733

3733-
qreal ScoreView::mag() const
3734+
qreal ScoreView::lmag() const
37343735
{
37353736
return _matrix.m11() / (mscore->physicalDotsPerInch() / DPI);
37363737
}
37373738

37383739
//---------------------------------------------------------
3739-
// pmag
3740+
// mag
37403741
//---------------------------------------------------------
37413742

3742-
qreal ScoreView::pmag() const
3743+
qreal ScoreView::mag() const
37433744
{
37443745
return _matrix.m11();
37453746
}

mscore/scoreview.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ class ScoreView : public QWidget, public MuseScoreView {
376376
void setDropAnchor(const QLineF&);
377377
const QTransform& matrix() const { return _matrix; }
378378
qreal mag() const;
379-
qreal pmag() const;
379+
qreal lmag() const;
380380
MagIdx magIdx() const { return _magIdx; }
381381
void setMag(MagIdx idx, double mag);
382382
qreal xoffset() const;

thirdparty/freetype/CMakeLists.txt

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,9 @@ endif ()
4444
# Add local cmake modules
4545
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/thirdparty/freetype/builds)
4646

47-
48-
set(VERSION_MAJOR "2")
49-
set(VERSION_MINOR "6")
50-
set(VERSION_PATCH "1")
51-
52-
set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
53-
set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
54-
55-
5647
# Compiler definitions for building the library
5748
add_definitions(-DFT2_BUILD_LIBRARY)
5849

59-
60-
# Find dependencies
61-
###find_package(ZLIB)
62-
###find_package(BZip2)
63-
###find_package(PNG)
64-
###find_package(HarfBuzz)
65-
66-
6750
message(STATUS
6851
"Creating directory ${PROJECT_BINARY_DIR}/include/freetype/config")
6952
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/include/freetype/config")
@@ -141,7 +124,6 @@ file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h"
141124
include_directories("${PROJECT_SOURCE_DIR}/thirdparty/freetype/include")
142125
include_directories(BEFORE "${PROJECT_BINARY_DIR}/thirdparty/freetype/include")
143126

144-
145127
file(GLOB PUBLIC_HEADERS "include/ft2build.h" "include/freetype/*.h")
146128
file(GLOB PUBLIC_CONFIG_HEADERS "include/freetype/config/*.h")
147129
file(GLOB PRIVATE_HEADERS "include/freetype/internal/*.h")
@@ -199,26 +181,14 @@ else ()
199181
set(BASE_SRCS ${BASE_SRCS} src/base/ftdebug.c)
200182
endif ()
201183

202-
203-
if (BUILD_FRAMEWORK)
204-
set(BASE_SRCS
205-
${BASE_SRCS}
206-
builds/mac/freetype-Info.plist
207-
)
208-
endif ()
209-
210-
211184
add_library(mscore_freetype
212185
${PUBLIC_HEADERS}
213186
${PUBLIC_CONFIG_HEADERS}
214187
${PRIVATE_HEADERS}
215188
${BASE_SRCS}
216189
)
217190

218-
219191
if (MSVC)
220192
set_target_properties(freetype PROPERTIES
221193
COMPILE_FLAGS /Fd"$(IntDir)$(TargetName).pdb")
222194
endif ()
223-
224-

0 commit comments

Comments
 (0)