Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/engraving/rw/compat/compatutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "dom/dynamic.h"
#include "dom/expression.h"
#include "dom/harmony.h"
#include "dom/image.h"
#include "dom/laissezvib.h"
#include "dom/masterscore.h"
#include "dom/note.h"
Expand Down Expand Up @@ -1041,9 +1042,18 @@ void mu::engraving::compat::CompatUtils::doMigrateNoteParens(EngravingItem* item
EditChord::addChordParentheses(chord, { note });
}

static constexpr double PRE_470_DPI = 360;

Spatium mu::engraving::compat::CompatUtils::convertPre470FrameRadius(double frameRadius)
{
// The frame radius used to be expressed in raster units and divided by 2 at drawing. Since 4.7 it is expressed in spatium.
static constexpr int OLD_DPI = 360;
return Spatium(frameRadius * (DPI / OLD_DPI) / DefaultStyle::baseStyle().value(Sid::spatium).toDouble()) / 2;
return Spatium(frameRadius * (DPI / PRE_470_DPI) / DefaultStyle::baseStyle().value(Sid::spatium).toDouble()) / 2;
}

void CompatUtils::convertPre470ImageSize(Image* image)
{
if (image->size().isNull() && image->score()->mscVersion() < 470) {
image->init();
image->setSize(image->size() * (DPI / PRE_470_DPI));
}
}
1 change: 1 addition & 0 deletions src/engraving/rw/compat/compatutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class CompatUtils
static void setTextLineTextPositionFromAlign(TextLineBase* tl);
static void setMusicSymbolSize470(MStyle& style);
static Spatium convertPre470FrameRadius(double frameRadius);
static void convertPre470ImageSize(Image* image);
static void doMigrateNoteParens(EngravingItem* item);

private:
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/rw/read400/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,8 @@ void TRead::read(Image* img, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}

compat::CompatUtils::convertPre470ImageSize(img);
}

void TRead::read(Tuplet* t, XmlReader& e, ReadContext& ctx)
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/rw/read410/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,8 @@ void TRead::read(Image* img, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}

compat::CompatUtils::convertPre470ImageSize(img);
}

void TRead::read(Tuplet* t, XmlReader& e, ReadContext& ctx)
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/rw/read460/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,8 @@ void TRead::read(Image* img, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}

compat::CompatUtils::convertPre470ImageSize(img);
}

void TRead::read(Tuplet* t, XmlReader& e, ReadContext& ctx)
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/tests/parts_data/part-image-parts-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<eid>M_M</eid>
<z>9399</z>
<path>71b2e9f575296b78c22ba721cd71f6e5.png</path>
<size w="32.12" h="32.16"/>
</Image>
<eid>N_N</eid>
<path>71b2e9f575296b78c22ba721cd71f6e5.png</path>
Expand Down Expand Up @@ -926,6 +927,7 @@
<eid>FC_FC</eid>
<z>9399</z>
<path>71b2e9f575296b78c22ba721cd71f6e5.png</path>
<size w="32.12" h="32.16"/>
</Image>
<eid>GC_GC</eid>
<linkedTo>N_N</linkedTo>
Expand Down
1 change: 1 addition & 0 deletions src/engraving/tests/parts_data/part-image-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<eid>M_M</eid>
<z>9399</z>
<path>71b2e9f575296b78c22ba721cd71f6e5.png</path>
<size w="32.12" h="32.16"/>
</Image>
<eid>N_N</eid>
<path>71b2e9f575296b78c22ba721cd71f6e5.png</path>
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/tests/parts_data/part-image-udel.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<eid>M_M</eid>
<z>9399</z>
<path>71b2e9f575296b78c22ba721cd71f6e5.png</path>
<size w="32.12" h="32.16"/>
</Image>
<eid>N_N</eid>
<path>71b2e9f575296b78c22ba721cd71f6e5.png</path>
Expand Down Expand Up @@ -928,6 +929,7 @@
<eid>FC_FC</eid>
<z>9399</z>
<path>71b2e9f575296b78c22ba721cd71f6e5.png</path>
<size w="32.3749" h="32.4152"/>
</Image>
<eid>GC_GC</eid>
<linkedTo>N_N</linkedTo>
Expand Down
Loading