Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-spa committed May 22, 2024
1 parent b5412b6 commit 6e0f341
Show file tree
Hide file tree
Showing 6 changed files with 387 additions and 351 deletions.
3 changes: 2 additions & 1 deletion src/engraving/dom/accidental.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ double Accidental::subtype2centOffset(AccidentalType st)

int Accidental::line() const
{
return note()->line();
Note* n = note();
return n ? n->line() : 0;
}

//---------------------------------------------------------
Expand Down
8 changes: 5 additions & 3 deletions src/engraving/dom/accidental.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ class Accidental final : public EngravingItem
OBJECT_ALLOCATOR(engraving, Accidental)
DECLARE_CLASSOF(ElementType::ACCIDENTAL)

M_PROPERTY2(int, stackingOrderOffset, setStackingOrderOffset, 0)

public:

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

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

int line() const;

Expand Down Expand Up @@ -140,6 +138,9 @@ class Accidental final : public EngravingItem
};
DECLARE_LAYOUTDATA_METHODS(Accidental)

int stackingOrderOffset() const { return m_stackingOrderOffset; }
void setStackingOrderOffset(int v) { m_stackingOrderOffset = v; }

private:

friend class Factory;
Expand All @@ -150,6 +151,7 @@ class Accidental final : public EngravingItem
AccidentalBracket m_bracket = AccidentalBracket::NONE;
AccidentalRole m_role = AccidentalRole::AUTO;
bool m_isSmall = false;
int m_stackingOrderOffset = 0;
};

extern AccidentalVal sym2accidentalVal(SymId id);
Expand Down
20 changes: 6 additions & 14 deletions src/engraving/infrastructure/shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,19 +513,11 @@ bool Shape::contains(const PointF& p) const
// intersects
//---------------------------------------------------------

bool Shape::intersects(const RectF& rr, double horClearance, double vertClearance) const
bool Shape::intersects(const RectF& rr) const
{
if (RealIsNull(horClearance) && RealIsNull(vertClearance)) {
for (const RectF& r : m_elements) {
if (r.intersects(rr)) {
return true;
}
}
} else {
for (const RectF& r : m_elements) {
if (r.intersects(rr.adjusted(-horClearance, -vertClearance, horClearance, vertClearance))) {
return true;
}
for (const RectF& r : m_elements) {
if (r.intersects(rr)) {
return true;
}
}
return false;
Expand All @@ -535,10 +527,10 @@ bool Shape::intersects(const RectF& rr, double horClearance, double vertClearanc
// intersects
//---------------------------------------------------------

bool Shape::intersects(const Shape& other, double horClearance, double vertClearance) const
bool Shape::intersects(const Shape& other) const
{
for (const RectF& r : other.m_elements) {
if (intersects(r, horClearance, vertClearance)) {
if (intersects(r)) {
return true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/infrastructure/shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ class Shape
double leftMostEdgeAtHeight(double yAbove, double yBelow) const;

bool contains(const PointF&) const;
bool intersects(const RectF& rr, double horClearance = 0.0, double vertClearance = 0.0) const;
bool intersects(const Shape& other, double horClearance = 0.0, double vertClearance = 0.0) const;
bool intersects(const RectF& rr) const;
bool intersects(const Shape& other) const;
bool clearsVertically(const Shape& a) const;

void paint(muse::draw::Painter& painter) const;
Expand Down
Loading

0 comments on commit 6e0f341

Please sign in to comment.