aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-05-14 14:13:13 +1000
committerNeil <nyamatongwe@gmail.com>2018-05-14 14:13:13 +1000
commitc4aa7826f3d2178e39e5bff2f6886d7d3d3f46d7 (patch)
treee5f93f314c700da99e6c54f590d034645c73a111 /cocoa
parent3fc8c97d80a6797e60e6b203c9b4aa9d553df8a7 (diff)
downloadscintilla-mirror-c4aa7826f3d2178e39e5bff2f6886d7d3d3f46d7.tar.gz
Modernize Platform.h (3) - update Surface to delete WidthChar, use size_t for
Polygon and delete the standard copy and assignment methods.
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/PlatCocoa.h3
-rw-r--r--cocoa/PlatCocoa.mm15
2 files changed, 3 insertions, 15 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h
index d6f2bf449..aafcf67bb 100644
--- a/cocoa/PlatCocoa.h
+++ b/cocoa/PlatCocoa.h
@@ -87,7 +87,7 @@ public:
int DeviceHeightFont(int points) override;
void MoveTo(int x_, int y_) override;
void LineTo(int x_, int y_) override;
- void Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, ColourDesired back) override;
+ void Polygon(Scintilla::Point *pts, size_t npts, ColourDesired fore, ColourDesired back) override;
void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) override;
void FillRectangle(PRectangle rc, ColourDesired back) override;
void FillRectangle(PRectangle rc, Surface &surfacePattern) override;
@@ -104,7 +104,6 @@ public:
void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) override;
void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) override;
XYPOSITION WidthText(Font &font_, const char *s, int len) override;
- XYPOSITION WidthChar(Font &font_, char ch) override;
XYPOSITION Ascent(Font &font_) override;
XYPOSITION Descent(Font &font_) override;
XYPOSITION InternalLeading(Font &font_) override;
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 704645cb6..9f04870c2 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -376,12 +376,12 @@ void SurfaceImpl::LineTo(int x_, int y_) {
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourDesired fore,
+void SurfaceImpl::Polygon(Scintilla::Point *pts, size_t npts, ColourDesired fore,
ColourDesired back) {
// Allocate memory for the array of points.
std::vector<CGPoint> points(npts);
- for (int i = 0; i < npts; i++) {
+ for (size_t i = 0; i < npts; i++) {
// Quartz floating point issues: plot the MIDDLE of the pixels
points[i].x = pts[i].x + 0.5;
points[i].y = pts[i].y + 0.5;
@@ -925,17 +925,6 @@ XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
return 1;
}
-XYPOSITION SurfaceImpl::WidthChar(Font &font_, char ch) {
- char str[2] = { ch, '\0' };
- if (font_.GetID()) {
- CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_));
- textLayout->setText(str, 1, encoding, *TextStyleFromFont(font_));
-
- return textLayout->MeasureStringWidth();
- } else
- return 1;
-}
-
// This string contains a good range of characters to test for size.
const char sizeString[] = "`~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890"
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";