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/PlatCocoa.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/PlatCocoa.mm')
-rw-r--r-- | cocoa/PlatCocoa.mm | 13 |
1 files changed, 7 insertions, 6 deletions
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; } |