From 1cf755b51cc643240f60131a8fac5e990cfa5e9f Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 25 Mar 2019 11:00:39 +1100 Subject: Use generic versions of ceil, floor, round, lround, trunc from . --- src/EditView.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/EditView.cxx') diff --git a/src/EditView.cxx b/src/EditView.cxx index a29df0f2f..fa433d3ef 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -700,7 +700,7 @@ Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, Sci:: SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid, bool charPosition, bool virtualSpace, const ViewStyle &vs, const PRectangle rcClient) { pt.x = pt.x - vs.textStart; - Sci::Line visibleLine = static_cast(floor(pt.y / vs.lineHeight)); + Sci::Line visibleLine = static_cast(std::floor(pt.y / vs.lineHeight)); if (!canReturnInvalid && (visibleLine < 0)) visibleLine = 0; const Sci::Line lineDoc = model.pcs->DocFromDisplay(visibleLine); @@ -878,7 +878,7 @@ static void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle r surface->FillRectangle(rcSegment, textBack); } FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; - const int normalCharHeight = static_cast(ceil(vsDraw.styles[STYLE_CONTROLCHAR].capitalHeight)); + const int normalCharHeight = static_cast(std::ceil(vsDraw.styles[STYLE_CONTROLCHAR].capitalHeight)); PRectangle rcCChar = rcSegment; rcCChar.left = rcCChar.left + 1; rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; @@ -1261,8 +1261,8 @@ void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, con if (model.foldDisplayTextStyle == SC_FOLDDISPLAYTEXT_BOXED) { surface->PenColour(textFore); PRectangle rcBox = rcSegment; - rcBox.left = round(rcSegment.left); - rcBox.right = round(rcSegment.right); + rcBox.left = std::round(rcSegment.left); + rcBox.right = std::round(rcSegment.right); const IntegerRectangle ircBox(rcBox); surface->MoveTo(ircBox.left, ircBox.top); surface->LineTo(ircBox.left, ircBox.bottom); @@ -1479,7 +1479,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt const ViewStyle::CaretShape caretShape = drawDrag ? ViewStyle::CaretShape::line : vsDraw.CaretShapeForMode(model.inOverstrike); if (drawDrag) { /* Dragging text, use a line caret */ - rcCaret.left = round(xposCaret - caretWidthOffset); + rcCaret.left = std::round(xposCaret - caretWidthOffset); rcCaret.right = rcCaret.left + vsDraw.caretWidth; } else if ((caretShape == ViewStyle::CaretShape::bar) && drawOverstrikeCaret) { /* Overstrike (insert mode), use a modified bar caret */ @@ -1497,7 +1497,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt } } else { /* Line caret */ - rcCaret.left = round(xposCaret - caretWidthOffset); + rcCaret.left = std::round(xposCaret - caretWidthOffset); rcCaret.right = rcCaret.left + vsDraw.caretWidth; } const ColourDesired caretColour = mainCaret ? vsDraw.caretcolour : vsDraw.additionalCaretColour; @@ -1841,7 +1841,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi indentCount <= (ll->positions[i + 1] - epsilon) / indentWidth; indentCount++) { if (indentCount > 0) { - const XYPOSITION xIndent = floor(indentCount * indentWidth); + const XYPOSITION xIndent = std::floor(indentCount * indentWidth); DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, (ll->xHighlightGuide == xIndent)); } @@ -1920,7 +1920,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi indentCount <= (ll->positions[cpos + ts.start + 1] - epsilon) / indentWidth; indentCount++) { if (indentCount > 0) { - const XYPOSITION xIndent = floor(indentCount * indentWidth); + const XYPOSITION xIndent = std::floor(indentCount * indentWidth); DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, (ll->xHighlightGuide == xIndent)); } @@ -1997,7 +1997,7 @@ void EditView::DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &mode } for (int indentPos = model.pdoc->IndentSize(); indentPos < indentSpace; indentPos += model.pdoc->IndentSize()) { - const XYPOSITION xIndent = floor(indentPos * vsDraw.spaceWidth); + const XYPOSITION xIndent = std::floor(indentPos * vsDraw.spaceWidth); if (xIndent < xStartText) { DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcLine, (ll->xHighlightGuide == xIndent)); -- cgit v1.2.3