diff options
| author | Neil <nyamatongwe@gmail.com> | 2020-03-25 09:19:53 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2020-03-25 09:19:53 +1100 |
| commit | 878a934343d10fb3f5412c06522db2f46570c1bb (patch) | |
| tree | 76e57b102d318f095b78e15c7685e9ca6f787b4d | |
| parent | 31817524c949b176a9fc5ac34b7dfd9d824c00e8 (diff) | |
| download | scintilla-mirror-878a934343d10fb3f5412c06522db2f46570c1bb.tar.gz | |
Backport: Replace const with constexpr where possible.
Backport of changeset 8026:3d47c097aa3f.
| -rw-r--r-- | win32/PlatWin.cxx | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index bca0bd5f0..654e10fbd 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -336,7 +336,7 @@ FontID CreateFontFromParameters(const FontParameters &fp) { hr = pIDWriteFactory->CreateTextLayout(L"X", 1, pTextFormat, 100.0f, 100.0f, &pTextLayout); if (SUCCEEDED(hr)) { - const int maxLines = 2; + constexpr int maxLines = 2; DWRITE_LINE_METRICS lineMetrics[maxLines]{}; UINT32 lineCount = 0; hr = pTextLayout->GetLineMetrics(lineMetrics, maxLines, &lineCount); @@ -409,7 +409,7 @@ public: } }; -const int stackBufferLength = 1000; +constexpr int stackBufferLength = 1000; class TextWide : public VarBuffer<wchar_t, stackBufferLength> { public: int tlen; // Using int instead of size_t as most Win32 APIs take int. @@ -1574,7 +1574,7 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION * if (!SUCCEEDED(hrCreate)) { return; } - const int clusters = stackBufferLength; + constexpr int clusters = stackBufferLength; DWRITE_CLUSTER_METRICS clusterMetrics[clusters]; UINT32 count = 0; const HRESULT hrGetCluster = pTextLayout->GetClusterMetrics(clusterMetrics, clusters, &count); @@ -1983,9 +1983,9 @@ class ListBoxX : public ListBox { void Paint(HDC); static LRESULT PASCAL ControlWndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam); - static const Point ItemInset; // Padding around whole item - static const Point TextInset; // Padding around text - static const Point ImageInset; // Padding around image + static constexpr Point ItemInset {0, 0}; // Padding around whole item + static constexpr Point TextInset {2, 0}; // Padding around text + static constexpr Point ImageInset {1, 0}; // Padding around image public: ListBoxX() : lineHeight(10), fontCopy{}, technology(0), lb{}, unicodeMode(false), @@ -2024,10 +2024,6 @@ public: static LRESULT PASCAL StaticWndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam); }; -const Point ListBoxX::ItemInset(0, 0); -const Point ListBoxX::TextInset(2, 0); -const Point ListBoxX::ImageInset(1, 0); - ListBox *ListBox::Allocate() { ListBoxX *lb = new ListBoxX(); return lb; |
