diff options
author | Neil <nyamatongwe@gmail.com> | 2019-03-25 11:00:39 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2019-03-25 11:00:39 +1100 |
commit | 1cf755b51cc643240f60131a8fac5e990cfa5e9f (patch) | |
tree | 1a1a8d12e390942dc456b6df0d64d51701c1b9af /cocoa/ScintillaView.mm | |
parent | 5344ef2aee7eaca738b0bddab8d9025bf49f1137 (diff) | |
download | scintilla-mirror-1cf755b51cc643240f60131a8fac5e990cfa5e9f.tar.gz |
Use generic versions of ceil, floor, round, lround, trunc from <cmath>.
Diffstat (limited to 'cocoa/ScintillaView.mm')
-rw-r--r-- | cocoa/ScintillaView.mm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index b32c549b1..116ea36e9 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -9,6 +9,8 @@ * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). */ +#include <cmath> + #include <string_view> #include <vector> @@ -58,7 +60,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) { [super tile]; #if defined(MAC_OS_X_VERSION_10_14) - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_13) { + if (std::floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_13) { NSRect frame = self.contentView.frame; frame.origin.x = self.verticalRulerView.requiredThickness; frame.size.width -= frame.origin.x; @@ -744,14 +746,14 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) { // Only snap for positions inside the document - allow outside // for overshoot. long lineHeight = mOwner.backend->WndProc(SCI_TEXTHEIGHT, 0, 0); - rc.origin.y = roundf(static_cast<XYPOSITION>(rc.origin.y) / lineHeight) * lineHeight; + rc.origin.y = std::round(static_cast<XYPOSITION>(rc.origin.y) / lineHeight) * lineHeight; } // Snap to whole points - on retina displays this avoids visual debris // when scrolling horizontally. if ((rc.origin.x > 0) && (NSMaxX(rc) < contentRect.size.width)) { // Only snap for positions inside the document - allow outside // for overshoot. - rc.origin.x = roundf(static_cast<XYPOSITION>(rc.origin.x)); + rc.origin.x = std::round(static_cast<XYPOSITION>(rc.origin.x)); } return rc; } @@ -1398,7 +1400,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) { #if defined(MAC_OS_X_VERSION_10_14) // Let SCIScrollView account for other subviews such as vertical ruler by turning off // automaticallyAdjustsContentInsets. - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_13) { + if (std::floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_13) { scrollView.contentView.automaticallyAdjustsContentInsets = NO; scrollView.contentView.contentInsets = NSEdgeInsetsMake(0., 0., 0., 0.); } |