Skip to content

Commit 893ebbd

Browse files
committed
Performance improvement
1 parent 20fd5c1 commit 893ebbd

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/engraving/libmscore/beam.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,9 +2513,6 @@ Shape Beam::shape() const
25132513
// BEAM SEGMENT CLASS
25142514
//-------------------------------------------------------
25152515

2516-
BeamSegment::BeamSegment(Beam* b)
2517-
: EngravingItem(ElementType::BEAM_SEGMENT, b), beam(b) {}
2518-
25192516
Shape BeamSegment::shape() const
25202517
{
25212518
Shape shape;
@@ -2531,7 +2528,7 @@ Shape BeamSegment::shape() const
25312528
if (RealIsEqual(startPoint.y(), endPoint.y())) {
25322529
RectF rect(startPoint.x(), startPoint.y(), beamHorizontalLength, _beamWidth / 2);
25332530
rect.adjust(0.0, -_beamWidth / 2, 0.0, 0.0);
2534-
shape.add(rect, this);
2531+
shape.add(rect, beam);
25352532
return shape;
25362533
}
25372534
// If not, break the beam shape into multiple rectangles
@@ -2548,7 +2545,7 @@ Shape BeamSegment::shape() const
25482545
for (PointF point : pointsOnBeamLine) {
25492546
RectF rect(point.x(), point.y(), horizontalStep, _beamWidth / 2);
25502547
rect.adjust(0.0, -_beamWidth / 2, 0.0, 0.0);
2551-
shape.add(rect, this);
2548+
shape.add(rect, beam);
25522549
}
25532550
return shape;
25542551
}

src/engraving/libmscore/beam.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ enum class SpannerSegmentType;
3939

4040
struct BeamFragment;
4141

42-
class BeamSegment : public EngravingItem
42+
class BeamSegment
4343
{
44+
OBJECT_ALLOCATOR(engraving, BeamSegment)
4445
public:
4546
mu::LineF line;
4647
int level;
@@ -50,11 +51,11 @@ class BeamSegment : public EngravingItem
5051
bool isBeamlet = false;
5152
bool isBefore = false;
5253

53-
Shape shape() const override;
54+
Shape shape() const;
5455
Beam* beam;
5556

56-
BeamSegment(Beam* b);
57-
BeamSegment* clone() const override { return new BeamSegment(*this); }
57+
BeamSegment(Beam* b)
58+
: beam(b) {}
5859
};
5960

6061
//---------------------------------------------------------

src/engraving/libmscore/score.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5919,7 +5919,7 @@ void Score::createPaddingTable()
59195919
}
59205920

59215921
// This is needed for beamlets, not beams themselves
5922-
_paddingTable[ElementType::BEAM_SEGMENT][ElementType::BEAM_SEGMENT] = 0.4 * spatium();
5922+
_paddingTable[ElementType::BEAM][ElementType::BEAM] = 0.4 * spatium();
59235923
}
59245924

59255925
//--------------------------------------------------------

0 commit comments

Comments
 (0)