From c4aa7826f3d2178e39e5bff2f6886d7d3d3f46d7 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 14 May 2018 14:13:13 +1000 Subject: Modernize Platform.h (3) - update Surface to delete WidthChar, use size_t for Polygon and delete the standard copy and assignment methods. --- src/CallTip.cxx | 4 ++-- src/Indicator.cxx | 2 +- src/LineMarker.cxx | 13 ++++++------- src/ViewStyle.cxx | 5 +++-- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/CallTip.cxx b/src/CallTip.cxx index 1b40c185d..2eab1146f 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -135,14 +135,14 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s, Point::FromInts(centreX + halfWidth, centreY + quarterWidth), Point::FromInts(centreX, centreY - halfWidth + quarterWidth), }; - surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG); + surface->Polygon(pts, std::size(pts), colourBG, colourBG); } else { // Down arrow Point pts[] = { Point::FromInts(centreX - halfWidth, centreY - quarterWidth), Point::FromInts(centreX + halfWidth, centreY - quarterWidth), Point::FromInts(centreX, centreY + halfWidth - quarterWidth), }; - surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG); + surface->Polygon(pts, std::size(pts), colourBG, colourBG); } } offsetMain = xEnd; diff --git a/src/Indicator.cxx b/src/Indicator.cxx index 0df7d7776..91f98ac58 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -190,7 +190,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r Point(ix + pixelHeight, iy + pixelHeight), // Right Point(ix, iy) // Top }; - surface->Polygon(pts, 3, sacDraw.fore, sacDraw.fore); + surface->Polygon(pts, std::size(pts), sacDraw.fore, sacDraw.fore); } } else { // Either INDIC_PLAIN or unknown surface->MoveTo(irc.left, ymid); diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index 6f1e4b01a..a2f7e299e 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -19,7 +19,6 @@ #include "Scintilla.h" -#include "StringCopy.h" #include "IntegerRectangle.h" #include "XPM.h" #include "LineMarker.h" @@ -186,7 +185,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point::FromInts(centreX - dimOn4, centreY + dimOn2), Point::FromInts(centreX + dimOn2 - dimOn4, centreY), }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); + surface->Polygon(pts, std::size(pts), fore, back); } else if (markType == SC_MARK_ARROWDOWN) { Point pts[] = { @@ -194,7 +193,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point::FromInts(centreX + dimOn2, centreY - dimOn4), Point::FromInts(centreX, centreY + dimOn2 - dimOn4), }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); + surface->Polygon(pts, std::size(pts), fore, back); } else if (markType == SC_MARK_PLUS) { Point pts[] = { @@ -211,7 +210,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point::FromInts(centreX - 1, centreY + 1), Point::FromInts(centreX - armSize, centreY + 1), }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); + surface->Polygon(pts, std::size(pts), fore, back); } else if (markType == SC_MARK_MINUS) { Point pts[] = { @@ -220,7 +219,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point::FromInts(centreX + armSize, centreY +1), Point::FromInts(centreX - armSize, centreY + 1), }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); + surface->Polygon(pts, std::size(pts), fore, back); } else if (markType == SC_MARK_SMALLRECT) { PRectangle rcSmall; @@ -416,7 +415,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point::FromInts(centreX, centreY + dimOn4), Point::FromInts(centreX, centreY + dimOn2), }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); + surface->Polygon(pts, std::size(pts), fore, back); } else if (markType == SC_MARK_LEFTRECT) { PRectangle rcLeft = rcWhole; rcLeft.right = rcLeft.left + 4; @@ -430,7 +429,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point::FromInts(ircWhole.right - 3, centreY + halfHeight), Point::FromInts(ircWhole.left, centreY + halfHeight), }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); + surface->Polygon(pts, std::size(pts), fore, back); } else { // SC_MARK_FULLRECT surface->FillRectangle(rcWhole, back); } diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 8a27f8bf2..1a95450ce 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -80,7 +80,7 @@ void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, cons descent = static_cast(surface.Descent(font)); capitalHeight = surface.Ascent(font) - surface.InternalLeading(font); aveCharWidth = surface.AverageCharWidth(font); - spaceWidth = surface.WidthChar(font, ' '); + spaceWidth = surface.WidthText(font, " ", 1); } ViewStyle::ViewStyle() : markers(MARKER_MAX + 1), indicators(INDIC_MAX + 1) { @@ -366,7 +366,8 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) { controlCharWidth = 0.0; if (controlCharSymbol >= 32) { - controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, static_cast(controlCharSymbol)); + const char cc[2] = { static_cast(controlCharSymbol), '\0' }; + controlCharWidth = surface.WidthText(styles[STYLE_CONTROLCHAR].font, cc, 1); } CalculateMarginWidthAndMask(); -- cgit v1.2.3