Skip to content

Commit 6e0f341

Browse files
committed
Code review
1 parent b5412b6 commit 6e0f341

File tree

6 files changed

+387
-351
lines changed

6 files changed

+387
-351
lines changed

src/engraving/dom/accidental.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ double Accidental::subtype2centOffset(AccidentalType st)
308308

309309
int Accidental::line() const
310310
{
311-
return note()->line();
311+
Note* n = note();
312+
return n ? n->line() : 0;
312313
}
313314

314315
//---------------------------------------------------------

src/engraving/dom/accidental.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ class Accidental final : public EngravingItem
6161
OBJECT_ALLOCATOR(engraving, Accidental)
6262
DECLARE_CLASSOF(ElementType::ACCIDENTAL)
6363

64-
M_PROPERTY2(int, stackingOrderOffset, setStackingOrderOffset, 0)
65-
6664
public:
6765

6866
Accidental* clone() const override { return new Accidental(*this); }
@@ -111,7 +109,7 @@ class Accidental final : public EngravingItem
111109
static bool isMicrotonal(AccidentalType t) { return t > AccidentalType::FLAT3; }
112110
static double subtype2centOffset(AccidentalType);
113111

114-
int stackingOrder() const { return ldata()->stackingNumber + _stackingOrderOffset; }
112+
int stackingOrder() const { return ldata()->stackingNumber + m_stackingOrderOffset; }
115113

116114
int line() const;
117115

@@ -140,6 +138,9 @@ class Accidental final : public EngravingItem
140138
};
141139
DECLARE_LAYOUTDATA_METHODS(Accidental)
142140

141+
int stackingOrderOffset() const { return m_stackingOrderOffset; }
142+
void setStackingOrderOffset(int v) { m_stackingOrderOffset = v; }
143+
143144
private:
144145

145146
friend class Factory;
@@ -150,6 +151,7 @@ class Accidental final : public EngravingItem
150151
AccidentalBracket m_bracket = AccidentalBracket::NONE;
151152
AccidentalRole m_role = AccidentalRole::AUTO;
152153
bool m_isSmall = false;
154+
int m_stackingOrderOffset = 0;
153155
};
154156

155157
extern AccidentalVal sym2accidentalVal(SymId id);

src/engraving/infrastructure/shape.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -513,19 +513,11 @@ bool Shape::contains(const PointF& p) const
513513
// intersects
514514
//---------------------------------------------------------
515515

516-
bool Shape::intersects(const RectF& rr, double horClearance, double vertClearance) const
516+
bool Shape::intersects(const RectF& rr) const
517517
{
518-
if (RealIsNull(horClearance) && RealIsNull(vertClearance)) {
519-
for (const RectF& r : m_elements) {
520-
if (r.intersects(rr)) {
521-
return true;
522-
}
523-
}
524-
} else {
525-
for (const RectF& r : m_elements) {
526-
if (r.intersects(rr.adjusted(-horClearance, -vertClearance, horClearance, vertClearance))) {
527-
return true;
528-
}
518+
for (const RectF& r : m_elements) {
519+
if (r.intersects(rr)) {
520+
return true;
529521
}
530522
}
531523
return false;
@@ -535,10 +527,10 @@ bool Shape::intersects(const RectF& rr, double horClearance, double vertClearanc
535527
// intersects
536528
//---------------------------------------------------------
537529

538-
bool Shape::intersects(const Shape& other, double horClearance, double vertClearance) const
530+
bool Shape::intersects(const Shape& other) const
539531
{
540532
for (const RectF& r : other.m_elements) {
541-
if (intersects(r, horClearance, vertClearance)) {
533+
if (intersects(r)) {
542534
return true;
543535
}
544536
}

src/engraving/infrastructure/shape.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ class Shape
160160
double leftMostEdgeAtHeight(double yAbove, double yBelow) const;
161161

162162
bool contains(const PointF&) const;
163-
bool intersects(const RectF& rr, double horClearance = 0.0, double vertClearance = 0.0) const;
164-
bool intersects(const Shape& other, double horClearance = 0.0, double vertClearance = 0.0) const;
163+
bool intersects(const RectF& rr) const;
164+
bool intersects(const Shape& other) const;
165165
bool clearsVertically(const Shape& a) const;
166166

167167
void paint(muse::draw::Painter& painter) const;

0 commit comments

Comments
 (0)