diff options
| author | mitchell <unknown> | 2020-01-05 22:01:07 -0500 |
|---|---|---|
| committer | mitchell <unknown> | 2020-01-05 22:01:07 -0500 |
| commit | a7b57f9b5bb481c9b5b98dda13c0e9c44d26a237 (patch) | |
| tree | 2cdcc4c9d826c3a42c47746eab16b6079e35dfbd /src | |
| parent | c7e5af4bc7c06eaa6bb000b3f0a4569e31c9f9a9 (diff) | |
| download | scintilla-mirror-a7b57f9b5bb481c9b5b98dda13c0e9c44d26a237.tar.gz | |
Added Sci::round() and Sci::lround() for better compatibility with the default branch.
Some olders MacOSX SDKs do not have std::round() or std::lround().
Diffstat (limited to 'src')
| -rw-r--r-- | src/CallTip.cxx | 6 | ||||
| -rw-r--r-- | src/EditView.cxx | 10 | ||||
| -rw-r--r-- | src/Indicator.cxx | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src/CallTip.cxx b/src/CallTip.cxx index db66878ce..a78f8cab0 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -153,7 +153,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s, } else if (IsTabCharacter(s[startSeg])) { xEnd = NextTabPos(x); } else { - xEnd = x + static_cast<int>(lround(surface->WidthText(font, s + startSeg, endSeg - startSeg))); + xEnd = x + static_cast<int>(Sci::lround(surface->WidthText(font, s + startSeg, endSeg - startSeg))); if (draw) { rcClient.left = static_cast<XYPOSITION>(x); rcClient.right = static_cast<XYPOSITION>(xEnd); @@ -175,7 +175,7 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) { PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1); // To make a nice small call tip window, it is only sized to fit most normal characters without accents - const int ascent = static_cast<int>(round(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font))); + const int ascent = static_cast<int>(Sci::round(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font))); // For each line... // Draw the definition in three parts: before highlight, highlighted, after highlight @@ -279,7 +279,7 @@ PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, co rectDown = PRectangle(0,0,0,0); offsetMain = insetX; // changed to right edge of any arrows const int width = PaintContents(surfaceMeasure.get(), false) + insetX; - lineHeight = static_cast<int>(lround(surfaceMeasure->Height(font))); + lineHeight = static_cast<int>(Sci::lround(surfaceMeasure->Height(font))); // The returned // rectangle is aligned to the right edge of the last arrow encountered in diff --git a/src/EditView.cxx b/src/EditView.cxx index 3ae7a5d67..9418cf597 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -1173,8 +1173,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 = Sci::round(rcSegment.left); + rcBox.right = Sci::round(rcSegment.right); const IntegerRectangle ircBox(rcBox); surface->MoveTo(ircBox.left, ircBox.top); surface->LineTo(ircBox.left, ircBox.bottom); @@ -1333,7 +1333,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt for (size_t r = 0; (r<model.sel.Count()) || drawDrag; r++) { const bool mainCaret = r == model.sel.Main(); SelectionPosition posCaret = (drawDrag ? model.posDrag : model.sel.Range(r).caret); - if ((vsDraw.DrawCaretInsideSelection(model.inOverstrike, imeCaretBlockOverride)) && + if ((vsDraw.DrawCaretInsideSelection(model.inOverstrike, imeCaretBlockOverride)) && !drawDrag && posCaret > model.sel.Range(r).anchor) { if (posCaret.VirtualSpace() > 0) @@ -1381,7 +1381,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 = Sci::round(xposCaret - caretWidthOffset); rcCaret.right = rcCaret.left + vsDraw.caretWidth; } else if ((caretShape == ViewStyle::CaretShape::bar) && drawOverstrikeCaret) { /* Overstrike (insert mode), use a modified bar caret */ @@ -1399,7 +1399,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt } } else { /* Line caret */ - rcCaret.left = round(xposCaret - caretWidthOffset); + rcCaret.left = Sci::round(xposCaret - caretWidthOffset); rcCaret.right = rcCaret.left + vsDraw.caretWidth; } const ColourDesired caretColour = mainCaret ? vsDraw.caretcolour : vsDraw.additionalCaretColour; diff --git a/src/Indicator.cxx b/src/Indicator.cxx index 1d594d214..742e59b75 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -24,8 +24,8 @@ using namespace Scintilla; static PRectangle PixelGridAlign(const PRectangle &rc) noexcept { // Move left and right side to nearest pixel to avoid blurry visuals - return PRectangle(round(rc.left), std::floor(rc.top), - round(rc.right), std::floor(rc.bottom)); + return PRectangle(Sci::round(rc.left), std::floor(rc.top), + Sci::round(rc.right), std::floor(rc.bottom)); } void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const { @@ -202,7 +202,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r if (rcCharacter.Width() >= 0.1) { const XYPOSITION pixelHeight = std::floor(rc.Height() - 1.0f); // 1 pixel onto next line if multiphase const XYPOSITION x = (sacDraw.style == INDIC_POINT) ? (rcCharacter.left) : ((rcCharacter.right + rcCharacter.left) / 2); - const XYPOSITION ix = round(x); + const XYPOSITION ix = Sci::round(x); const XYPOSITION iy = std::floor(rc.top + 1.0f); Point pts[] = { Point(ix - pixelHeight, iy + pixelHeight), // Left |
