1717#include < cassert>
1818#include < cstring>
1919#include < cstdio>
20+ #include < cmath>
2021
2122#include < stdexcept>
2223#include < string_view>
@@ -251,7 +252,7 @@ void AddToIntervalVector(std::vector<Interval> &vi, XYPOSITION left, XYPOSITION
251252 vi.push_back (interval);
252253 } else {
253254 Interval &last = vi.back ();
254- if (fabs (last.right -interval.left ) < 0.01 ) {
255+ if (std::abs (last.right -interval.left ) < 0.01 ) {
255256 // If new left is very close to previous right then extend last item
256257 last.right = interval.right ;
257258 } else {
@@ -482,8 +483,8 @@ void GetPositions(CTLineRef line, std::vector<CGFloat> &positions) {
482483
483484// --------------------------------------------------------------------------------------------------
484485
485- CGImageRef SurfaceImpl::GetImage () {
486- // For now, assume that GetImage can only be called on PixMap surfaces.
486+ CGImageRef SurfaceImpl::CreateImage () {
487+ // For now, assume that CreateImage can only be called on PixMap surfaces.
487488 if (!bitmapData)
488489 return NULL ;
489490
@@ -628,8 +629,8 @@ void GetPositions(CTLineRef line, std::vector<CGFloat> &positions) {
628629 if (gc) {
629630 FillColour (back);
630631 // Snap rectangle boundaries to nearest int
631- rc.left = lround (rc.left );
632- rc.right = lround (rc.right );
632+ rc.left = std::round (rc.left );
633+ rc.right = std::round (rc.right );
633634 CGRect rect = PRectangleToCGRect (rc);
634635 CGContextFillRect (gc, rect);
635636 }
@@ -654,7 +655,7 @@ static void releaseImageRefCallback(void *info) {
654655 SurfaceImpl &patternSurface = static_cast <SurfaceImpl &>(surfacePattern);
655656
656657 // For now, assume that copy can only be called on PixMap surfaces. Shows up black.
657- CGImageRef image = patternSurface.GetImage ();
658+ CGImageRef image = patternSurface.CreateImage ();
658659 if (image == NULL ) {
659660 FillRectangle (rc, ColourDesired (0 ));
660661 return ;
@@ -805,8 +806,8 @@ static void DrawChamferedRectangle(CGContextRef gc, PRectangle rc, int cornerSiz
805806 ColourDesired outline, int alphaOutline, int /* flags*/ ) {
806807 if (gc) {
807808 // Snap rectangle boundaries to nearest int
808- rc.left = lround (rc.left );
809- rc.right = lround (rc.right );
809+ rc.left = std::round (rc.left );
810+ rc.right = std::round (rc.right );
810811 // Set the Fill color to match
811812 CGContextSetRGBFillColor (gc, fill.GetRed () / 255.0 , fill.GetGreen () / 255.0 , fill.GetBlue () / 255.0 , alphaFill / 255.0 );
812813 CGContextSetRGBStrokeColor (gc, outline.GetRed () / 255.0 , outline.GetGreen () / 255.0 , outline.GetBlue () / 255.0 , alphaOutline / 255.0 );
@@ -969,7 +970,7 @@ static CGImageRef ImageCreateFromRGBA(int width, int height, const unsigned char
969970
970971void SurfaceImpl::CopyImageRectangle (Surface &surfaceSource, PRectangle srcRect, PRectangle dstRect) {
971972 SurfaceImpl &source = static_cast <SurfaceImpl &>(surfaceSource);
972- CGImageRef image = source.GetImage ();
973+ CGImageRef image = source.CreateImage ();
973974
974975 CGRect src = PRectangleToCGRect (srcRect);
975976 CGRect dst = PRectangleToCGRect (dstRect);
@@ -1001,7 +1002,7 @@ static CGImageRef ImageCreateFromRGBA(int width, int height, const unsigned char
10011002 SurfaceImpl &source = static_cast <SurfaceImpl &>(surfaceSource);
10021003
10031004 // Get the CGImageRef
1004- CGImageRef image = source.GetImage ();
1005+ CGImageRef image = source.CreateImage ();
10051006 // If we could not get an image reference, fill the rectangle black
10061007 if (image == NULL ) {
10071008 FillRectangle (rc, ColourDesired (0 ));
@@ -1115,7 +1116,7 @@ CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet) {
11151116 CGColorRef color = CGColorCreateGenericRGB (colour.GetRed ()/255.0 , colour.GetGreen ()/255.0 , colour.GetBlue ()/255.0 , 1.0 );
11161117
11171118 QuartzTextStyle *style = TextStyleFromFont (font_);
1118- style->setCTStyleColor (color);
1119+ style->setCTStyleColour (color);
11191120
11201121 CGColorRelease (color);
11211122
@@ -1232,7 +1233,7 @@ CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet) {
12321233
12331234 XYPOSITION width = WidthText (font_, sizeString);
12341235
1235- return round (width / strlen (sizeString));
1236+ return std:: round (width / strlen (sizeString));
12361237}
12371238
12381239void SurfaceImpl::SetClip (PRectangle rc) {
@@ -1470,7 +1471,7 @@ PRectangle rcMonitor(rcWork.left - rcPosition.left,
14701471 SurfaceImpl *surfaceIXPM = static_cast <SurfaceImpl *>(surfaceXPM.get ());
14711472 CGContextClearRect (surfaceIXPM->GetContext (), CGRectMake (0 , 0 , width, height));
14721473 pxpm->Draw (surfaceXPM.get (), rcxpm);
1473- CGImageRef imageRef = surfaceIXPM->GetImage ();
1474+ CGImageRef imageRef = surfaceIXPM->CreateImage ();
14741475 img = [[NSImage alloc ] initWithCGImage: imageRef size: NSZeroSize ];
14751476 CGImageRelease (imageRef);
14761477 }
@@ -1750,7 +1751,7 @@ void SetDelegate(IListBoxDelegate *lbDelegate) override {
17501751 font.SetID (new QuartzTextStyle (*style));
17511752 NSFont *pfont = (__bridge NSFont *)style->getFontRef ();
17521753 [colText.dataCell setFont: pfont];
1753- CGFloat itemHeight = ceil (pfont.boundingRectForFont .size .height );
1754+ CGFloat itemHeight = std:: ceil (pfont.boundingRectForFont .size .height );
17541755 table.rowHeight = itemHeight;
17551756}
17561757
0 commit comments