aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cocoa/InfoBar.mm4
-rw-r--r--cocoa/PlatCocoa.mm13
-rw-r--r--cocoa/ScintillaCocoa.mm6
-rw-r--r--cocoa/ScintillaView.mm10
-rw-r--r--gtk/PlatGTK.cxx4
-rw-r--r--gtk/ScintillaGTK.cxx8
-rw-r--r--src/CallTip.cxx6
-rw-r--r--src/EditView.cxx18
-rw-r--r--src/Indicator.cxx10
-rw-r--r--src/PositionCache.cxx2
-rw-r--r--win32/PlatWin.cxx30
11 files changed, 59 insertions, 52 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.);
}
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index 1fbdf4835..bb53bd693 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -457,8 +457,8 @@ void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired
void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) {
PenColour(back);
if (context && (rc.left < maxCoordinate)) { // Protect against out of range
- rc.left = lround(rc.left);
- rc.right = lround(rc.right);
+ rc.left = std::round(rc.left);
+ rc.right = std::round(rc.right);
cairo_rectangle(context, rc.left, rc.top,
rc.right - rc.left, rc.bottom - rc.top);
cairo_fill(context);
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 2fbeae39c..29cf5d3ac 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -1681,8 +1681,8 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) {
evbtn = gdk_event_copy(reinterpret_cast<GdkEvent *>(event));
buttonMouse = event->button;
Point pt;
- pt.x = floor(event->x);
- pt.y = floor(event->y);
+ pt.x = std::floor(event->x);
+ pt.y = std::floor(event->y);
PRectangle rcClient = GetClientRectangle();
//Platform::DebugPrintf("Press %0d,%0d in %0d,%0d %0d,%0d\n",
// pt.x, pt.y, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
@@ -1811,12 +1811,12 @@ gint ScintillaGTK::ScrollEvent(GtkWidget *widget, GdkEventScroll *event) {
sciThis->smoothScrollY += event->delta_y * smoothScrollFactor;
sciThis->smoothScrollX += event->delta_x * smoothScrollFactor;;
if (ABS(sciThis->smoothScrollY) >= 1.0) {
- const int scrollLines = trunc(sciThis->smoothScrollY);
+ const int scrollLines = std::trunc(sciThis->smoothScrollY);
sciThis->ScrollTo(sciThis->topLine + scrollLines);
sciThis->smoothScrollY -= scrollLines;
}
if (ABS(sciThis->smoothScrollX) >= 1.0) {
- const int scrollPixels = trunc(sciThis->smoothScrollX);
+ const int scrollPixels = std::trunc(sciThis->smoothScrollX);
sciThis->HorizontalScrollTo(sciThis->xOffset + scrollPixels);
sciThis->smoothScrollX -= scrollPixels;
}
diff --git a/src/CallTip.cxx b/src/CallTip.cxx
index 12df236d7..0cc818d44 100644
--- a/src/CallTip.cxx
+++ b/src/CallTip.cxx
@@ -155,7 +155,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
xEnd = NextTabPos(x);
} else {
std::string_view segText(s + startSeg, endSeg - startSeg);
- xEnd = x + static_cast<int>(lround(surface->WidthText(font, segText)));
+ xEnd = x + static_cast<int>(std::lround(surface->WidthText(font, segText)));
if (draw) {
rcClient.left = static_cast<XYPOSITION>(x);
rcClient.right = static_cast<XYPOSITION>(xEnd);
@@ -176,7 +176,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>(lround(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font)));
+ const int ascent = static_cast<int>(std::round(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font)));
// For each line...
// Draw the definition in three parts: before highlight, highlighted, after highlight
@@ -280,7 +280,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>(std::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 a29df0f2f..fa433d3ef 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -700,7 +700,7 @@ Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, Sci::
SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid,
bool charPosition, bool virtualSpace, const ViewStyle &vs, const PRectangle rcClient) {
pt.x = pt.x - vs.textStart;
- Sci::Line visibleLine = static_cast<int>(floor(pt.y / vs.lineHeight));
+ Sci::Line visibleLine = static_cast<int>(std::floor(pt.y / vs.lineHeight));
if (!canReturnInvalid && (visibleLine < 0))
visibleLine = 0;
const Sci::Line lineDoc = model.pcs->DocFromDisplay(visibleLine);
@@ -878,7 +878,7 @@ static void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle r
surface->FillRectangle(rcSegment, textBack);
}
FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
- const int normalCharHeight = static_cast<int>(ceil(vsDraw.styles[STYLE_CONTROLCHAR].capitalHeight));
+ const int normalCharHeight = static_cast<int>(std::ceil(vsDraw.styles[STYLE_CONTROLCHAR].capitalHeight));
PRectangle rcCChar = rcSegment;
rcCChar.left = rcCChar.left + 1;
rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight;
@@ -1261,8 +1261,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 = std::round(rcSegment.left);
+ rcBox.right = std::round(rcSegment.right);
const IntegerRectangle ircBox(rcBox);
surface->MoveTo(ircBox.left, ircBox.top);
surface->LineTo(ircBox.left, ircBox.bottom);
@@ -1479,7 +1479,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 = std::round(xposCaret - caretWidthOffset);
rcCaret.right = rcCaret.left + vsDraw.caretWidth;
} else if ((caretShape == ViewStyle::CaretShape::bar) && drawOverstrikeCaret) {
/* Overstrike (insert mode), use a modified bar caret */
@@ -1497,7 +1497,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt
}
} else {
/* Line caret */
- rcCaret.left = round(xposCaret - caretWidthOffset);
+ rcCaret.left = std::round(xposCaret - caretWidthOffset);
rcCaret.right = rcCaret.left + vsDraw.caretWidth;
}
const ColourDesired caretColour = mainCaret ? vsDraw.caretcolour : vsDraw.additionalCaretColour;
@@ -1841,7 +1841,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
indentCount <= (ll->positions[i + 1] - epsilon) / indentWidth;
indentCount++) {
if (indentCount > 0) {
- const XYPOSITION xIndent = floor(indentCount * indentWidth);
+ const XYPOSITION xIndent = std::floor(indentCount * indentWidth);
DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment,
(ll->xHighlightGuide == xIndent));
}
@@ -1920,7 +1920,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
indentCount <= (ll->positions[cpos + ts.start + 1] - epsilon) / indentWidth;
indentCount++) {
if (indentCount > 0) {
- const XYPOSITION xIndent = floor(indentCount * indentWidth);
+ const XYPOSITION xIndent = std::floor(indentCount * indentWidth);
DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment,
(ll->xHighlightGuide == xIndent));
}
@@ -1997,7 +1997,7 @@ void EditView::DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &mode
}
for (int indentPos = model.pdoc->IndentSize(); indentPos < indentSpace; indentPos += model.pdoc->IndentSize()) {
- const XYPOSITION xIndent = floor(indentPos * vsDraw.spaceWidth);
+ const XYPOSITION xIndent = std::floor(indentPos * vsDraw.spaceWidth);
if (xIndent < xStartText) {
DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcLine,
(ll->xHighlightGuide == xIndent));
diff --git a/src/Indicator.cxx b/src/Indicator.cxx
index 5ab0a7813..8db760f2b 100644
--- a/src/Indicator.cxx
+++ b/src/Indicator.cxx
@@ -25,8 +25,8 @@ using namespace Scintilla;
static PRectangle PixelGridAlign(const PRectangle &rc) {
// Move left and right side to nearest pixel to avoid blurry visuals
- return PRectangle(round(rc.left), floor(rc.top),
- round(rc.right), floor(rc.bottom));
+ return PRectangle(std::round(rc.left), std::floor(rc.top),
+ std::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 {
@@ -201,10 +201,10 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
surface->FillRectangle(rcComposition, sacDraw.fore);
} else if (sacDraw.style == INDIC_POINT || sacDraw.style == INDIC_POINTCHARACTER) {
if (rcCharacter.Width() >= 0.1) {
- const XYPOSITION pixelHeight = floor(rc.Height() - 1.0f); // 1 pixel onto next line if multiphase
+ 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 iy = floor(rc.top + 1.0f);
+ const XYPOSITION ix = std::round(x);
+ const XYPOSITION iy = std::floor(rc.top + 1.0f);
Point pts[] = {
Point(ix - pixelHeight, iy + pixelHeight), // Left
Point(ix + pixelHeight, iy + pixelHeight), // Right
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index aeb8d8bcf..65c90dd1d 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -348,7 +348,7 @@ XYPOSITION ScreenLine::RepresentationWidth(size_t position) const {
}
XYPOSITION ScreenLine::TabPositionAfter(XYPOSITION xPosition) const {
- return (floor((xPosition + TabWidthMinimumPixels()) / TabWidth()) + 1) * TabWidth();
+ return (std::floor((xPosition + TabWidthMinimumPixels()) / TabWidth()) + 1) * TabWidth();
}
LineLayoutCache::LineLayoutCache() :
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 766c91ef9..229b4d2e6 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -278,7 +278,7 @@ constexpr D2D1_TEXT_ANTIALIAS_MODE DWriteMapFontQuality(int extraFontFlag) noexc
void SetLogFont(LOGFONTW &lf, const char *faceName, int characterSet, float size, int weight, bool italic, int extraFontFlag) {
lf = LOGFONTW();
// The negative is to allow for leading
- lf.lfHeight = -(abs(lround(size)));
+ lf.lfHeight = -(abs(std::lround(size)));
lf.lfWeight = weight;
lf.lfItalic = italic ? 1 : 0;
lf.lfCharSet = static_cast<BYTE>(characterSet);
@@ -749,10 +749,10 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig
if (rc.Width() > 0) {
HDC hMemDC = ::CreateCompatibleDC(hdc);
if (rc.Width() > width)
- rc.left += floor((rc.Width() - width) / 2);
+ rc.left += std::floor((rc.Width() - width) / 2);
rc.right = rc.left + width;
if (rc.Height() > height)
- rc.top += floor((rc.Height() - height) / 2);
+ rc.top += std::floor((rc.Height() - height) / 2);
rc.bottom = rc.top + height;
const BITMAPINFO bpih = {{sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0},
@@ -1282,7 +1282,7 @@ void SurfaceD2D::Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesi
void SurfaceD2D::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) {
if (pRenderTarget) {
- const D2D1_RECT_F rectangle1 = D2D1::RectF(round(rc.left) + 0.5f, rc.top+0.5f, round(rc.right) - 0.5f, rc.bottom-0.5f);
+ const D2D1_RECT_F rectangle1 = D2D1::RectF(std::round(rc.left) + 0.5f, rc.top+0.5f, std::round(rc.right) - 0.5f, rc.bottom-0.5f);
D2DPenColour(back);
pRenderTarget->FillRectangle(&rectangle1, pBrush);
D2DPenColour(fore);
@@ -1293,7 +1293,7 @@ void SurfaceD2D::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired
void SurfaceD2D::FillRectangle(PRectangle rc, ColourDesired back) {
if (pRenderTarget) {
D2DPenColour(back);
- const D2D1_RECT_F rectangle1 = D2D1::RectF(round(rc.left), rc.top, round(rc.right), rc.bottom);
+ const D2D1_RECT_F rectangle1 = D2D1::RectF(std::round(rc.left), rc.top, std::round(rc.right), rc.bottom);
pRenderTarget->FillRectangle(&rectangle1, pBrush);
}
}
@@ -1343,23 +1343,23 @@ void SurfaceD2D::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil
if (pRenderTarget) {
if (cornerSize == 0) {
// When corner size is zero, draw square rectangle to prevent blurry pixels at corners
- const D2D1_RECT_F rectFill = D2D1::RectF(round(rc.left) + 1.0f, rc.top + 1.0f, round(rc.right) - 1.0f, rc.bottom - 1.0f);
+ const D2D1_RECT_F rectFill = D2D1::RectF(std::round(rc.left) + 1.0f, rc.top + 1.0f, std::round(rc.right) - 1.0f, rc.bottom - 1.0f);
D2DPenColour(fill, alphaFill);
pRenderTarget->FillRectangle(rectFill, pBrush);
- const D2D1_RECT_F rectOutline = D2D1::RectF(round(rc.left) + 0.5f, rc.top + 0.5f, round(rc.right) - 0.5f, rc.bottom - 0.5f);
+ const D2D1_RECT_F rectOutline = D2D1::RectF(std::round(rc.left) + 0.5f, rc.top + 0.5f, std::round(rc.right) - 0.5f, rc.bottom - 0.5f);
D2DPenColour(outline, alphaOutline);
pRenderTarget->DrawRectangle(rectOutline, pBrush);
} else {
const float cornerSizeF = static_cast<float>(cornerSize);
D2D1_ROUNDED_RECT roundedRectFill = {
- D2D1::RectF(round(rc.left) + 1.0f, rc.top + 1.0f, round(rc.right) - 1.0f, rc.bottom - 1.0f),
+ D2D1::RectF(std::round(rc.left) + 1.0f, rc.top + 1.0f, std::round(rc.right) - 1.0f, rc.bottom - 1.0f),
cornerSizeF, cornerSizeF};
D2DPenColour(fill, alphaFill);
pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush);
D2D1_ROUNDED_RECT roundedRect = {
- D2D1::RectF(round(rc.left) + 0.5f, rc.top + 0.5f, round(rc.right) - 0.5f, rc.bottom - 0.5f),
+ D2D1::RectF(std::round(rc.left) + 0.5f, rc.top + 0.5f, std::round(rc.right) - 0.5f, rc.bottom - 0.5f),
cornerSizeF, cornerSizeF};
D2DPenColour(outline, alphaOutline);
pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush);
@@ -1408,7 +1408,7 @@ void SurfaceD2D::GradientRectangle(PRectangle rc, const std::vector<ColourStop>
hr = pRenderTarget->CreateLinearGradientBrush(
lgbp, pGradientStops, &pBrushLinear);
if (SUCCEEDED(hr)) {
- const D2D1_RECT_F rectangle = D2D1::RectF(round(rc.left), rc.top, round(rc.right), rc.bottom);
+ const D2D1_RECT_F rectangle = D2D1::RectF(std::round(rc.left), rc.top, std::round(rc.right), rc.bottom);
pRenderTarget->FillRectangle(&rectangle, pBrushLinear);
pBrushLinear->Release();
}
@@ -1419,10 +1419,10 @@ void SurfaceD2D::GradientRectangle(PRectangle rc, const std::vector<ColourStop>
void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) {
if (pRenderTarget) {
if (rc.Width() > width)
- rc.left += floor((rc.Width() - width) / 2);
+ rc.left += std::floor((rc.Width() - width) / 2);
rc.right = rc.left + width;
if (rc.Height() > height)
- rc.top += floor((rc.Height() - height) / 2);
+ rc.top += std::floor((rc.Height() - height) / 2);
rc.bottom = rc.top + height;
std::vector<unsigned char> image(height * width * 4);
@@ -2037,17 +2037,17 @@ void SurfaceD2D::MeasureWidths(Font &font_, std::string_view text, XYPOSITION *p
XYPOSITION SurfaceD2D::Ascent(Font &font_) {
SetFont(font_);
- return ceil(yAscent);
+ return std::ceil(yAscent);
}
XYPOSITION SurfaceD2D::Descent(Font &font_) {
SetFont(font_);
- return ceil(yDescent);
+ return std::ceil(yDescent);
}
XYPOSITION SurfaceD2D::InternalLeading(Font &font_) {
SetFont(font_);
- return floor(yInternalLeading);
+ return std::floor(yInternalLeading);
}
XYPOSITION SurfaceD2D::Height(Font &font_) {