Skip to content

Commit ec4c4e6

Browse files
committed
Refactor DrawDivLine()
1 parent 961c1bb commit ec4c4e6

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

src/view_neume.cpp

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,6 @@ void View::DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, S
362362
DivLine *divLine = dynamic_cast<DivLine *>(element);
363363
assert(divLine);
364364

365-
// int x = divLine->GetDrawingX();
366-
// int y = divLine->GetDrawingY();
367-
368365
dc->StartGraphic(element, "", element->GetID());
369366

370367
int sym = 0;
@@ -380,29 +377,14 @@ void View::DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, S
380377
}
381378

382379
int x, y;
383-
if (m_doc->IsFacs() && (divLine->HasFacs())) {
384-
x = divLine->GetDrawingX();
385-
y = ToLogicalY(staff->GetDrawingY());
386-
}
387-
else {
388-
x = element->GetDrawingX();
389-
y = element->GetDrawingY();
390-
y -= m_doc->GetDrawingUnit(staff->m_drawingStaffSize);
391-
}
380+
x = element->GetDrawingX();
381+
y = element->GetDrawingY();
392382

393383
y -= (m_doc->GetDrawingUnit(staff->m_drawingStaffSize)) * 3;
394384

395-
int rotationOffset = 0;
396-
if (m_doc->IsFacs() && (staff->GetDrawingRotate() != 0)) {
397-
double deg = staff->GetDrawingRotate();
398-
int xDiff = x - staff->GetDrawingX();
399-
rotationOffset = int(xDiff * tan(deg * M_PI / 180.0));
385+
if (staff->HasDrawingRotation()) {
386+
y -= staff->GetDrawingRotationOffsetFor(x);
400387
}
401-
else if (staff->HasDrawingRotation()) {
402-
rotationOffset = staff->GetDrawingRotationOffsetFor(x);
403-
}
404-
405-
y -= rotationOffset;
406388

407389
DrawSmuflCode(dc, x, y, sym, staff->m_drawingStaffSize, false, true);
408390

0 commit comments

Comments
 (0)