diff options
Diffstat (limited to 'cocoa')
-rw-r--r-- | cocoa/InfoBar.mm | 4 | ||||
-rw-r--r-- | cocoa/PlatCocoa.mm | 13 | ||||
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 6 | ||||
-rw-r--r-- | cocoa/ScintillaView.mm | 10 |
4 files changed, 20 insertions, 13 deletions
diff --git a/cocoa/InfoBar.mm b/cocoa/InfoBar.mm index 9fa1a19aa..5dd74f46f 100644 --- a/cocoa/InfoBar.mm +++ b/cocoa/InfoBar.mm @@ -10,6 +10,8 @@ * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). */ +#include <cmath> + #import "InfoBar.h" //-------------------------------------------------------------------------------------------------- @@ -33,7 +35,7 @@ CGFloat heightDelta = newRect.size.height - textSize.height; if (heightDelta > 0) { newRect.size.height -= heightDelta; - newRect.origin.y += ceil(heightDelta / 2); + newRect.origin.y += std::ceil(heightDelta / 2); } } diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index a74c805a4..08b3facfd 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -17,6 +17,7 @@ #include <cassert> #include <cstring> #include <cstdio> +#include <cmath> #include <stdexcept> #include <string_view> @@ -628,8 +629,8 @@ void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) { if (gc) { FillColour(back); // Snap rectangle boundaries to nearest int - rc.left = lround(rc.left); - rc.right = lround(rc.right); + rc.left = std::round(rc.left); + rc.right = std::round(rc.right); CGRect rect = PRectangleToCGRect(rc); CGContextFillRect(gc, rect); } @@ -805,8 +806,8 @@ void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, Colou ColourDesired outline, int alphaOutline, int /*flags*/) { if (gc) { // Snap rectangle boundaries to nearest int - rc.left = lround(rc.left); - rc.right = lround(rc.right); + rc.left = std::round(rc.left); + rc.right = std::round(rc.right); // Set the Fill color to match CGContextSetRGBFillColor(gc, fill.GetRed() / 255.0, fill.GetGreen() / 255.0, fill.GetBlue() / 255.0, alphaFill / 255.0); CGContextSetRGBStrokeColor(gc, outline.GetRed() / 255.0, outline.GetGreen() / 255.0, outline.GetBlue() / 255.0, alphaOutline / 255.0); @@ -1232,7 +1233,7 @@ XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) { XYPOSITION width = WidthText(font_, sizeString); - return round(width / strlen(sizeString)); + return std::round(width / strlen(sizeString)); } void SurfaceImpl::SetClip(PRectangle rc) { @@ -1750,7 +1751,7 @@ void ListBoxImpl::SetFont(Font &font_) { font.SetID(new QuartzTextStyle(*style)); NSFont *pfont = (__bridge NSFont *)style->getFontRef(); [colText.dataCell setFont: pfont]; - CGFloat itemHeight = ceil(pfont.boundingRectForFont.size.height); + CGFloat itemHeight = std::ceil(pfont.boundingRectForFont.size.height); table.rowHeight = itemHeight; } diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index b7b595b62..ffb365d13 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -14,6 +14,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> @@ -818,7 +820,7 @@ namespace { */ bool SupportAnimatedFind() { - return floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_12; + return std::floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_12; } } @@ -2486,7 +2488,7 @@ void ScintillaCocoa::ShowFindIndicatorForRange(NSRange charRange, BOOL retaining layerFindIndicator = [[FindHighlightLayer alloc] init]; [content setWantsLayer: YES]; layerFindIndicator.geometryFlipped = content.layer.geometryFlipped; - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_8) { + if (std::floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_8) { // Content layer is unflipped on 10.9, but the indicator shows wrong unless flipped layerFindIndicator.geometryFlipped = YES; } 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.); } |