diff options
author | Neil <nyamatongwe@gmail.com> | 2025-03-12 09:30:49 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2025-03-12 09:30:49 +1100 |
commit | f73a19c810ff40d004f4c0e154de98bf4a52c010 (patch) | |
tree | 0b8bbd783db3aaaee1a29bc68bdbf9e5d74e2cad | |
parent | fba60a84ae848ce661fefa7e7bb31754fe889b7b (diff) | |
download | scintilla-mirror-f73a19c810ff40d004f4c0e154de98bf4a52c010.tar.gz |
Hoist RECT to PRectangle conversions into a function.
-rw-r--r-- | win32/PlatWin.cxx | 6 | ||||
-rw-r--r-- | win32/PlatWin.h | 4 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 7598f9447..930c0fa8b 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -2765,7 +2765,7 @@ void Window::Destroy() noexcept { PRectangle Window::GetPosition() const { RECT rc; ::GetWindowRect(HwndFromWindowID(wid), &rc); - return PRectangle::FromInts(rc.left, rc.top, rc.right, rc.bottom); + return PRectangleFromRECT(rc); } void Window::SetPosition(PRectangle rc) { @@ -2829,7 +2829,7 @@ PRectangle Window::GetClientPosition() const { RECT rc={0,0,0,0}; if (wid) ::GetClientRect(HwndFromWindowID(wid), &rc); - return PRectangle::FromInts(rc.left, rc.top, rc.right, rc.bottom); + return PRectangleFromRECT(rc); } void Window::Show(bool show) { @@ -3637,7 +3637,7 @@ void ListBoxX::AdjustWindowRect(PRectangle *rc, UINT dpiAdjust) const noexcept { } else { ::AdjustWindowRectEx(&rcw, frameStyle, false, WS_EX_WINDOWEDGE); } - *rc = PRectangle::FromInts(rcw.left, rcw.top, rcw.right, rcw.bottom); + *rc = PRectangleFromRECT(rcw); } int ListBoxX::ItemHeight() const noexcept { diff --git a/win32/PlatWin.h b/win32/PlatWin.h index 86022a0cd..6c51ec8ad 100644 --- a/win32/PlatWin.h +++ b/win32/PlatWin.h @@ -24,6 +24,10 @@ constexpr RECT RectFromPRectangle(PRectangle prc) noexcept { return rc; } +constexpr PRectangle PRectangleFromRECT(RECT rc) noexcept { + return PRectangle::FromInts(rc.left, rc.top, rc.right, rc.bottom); +} + constexpr POINT POINTFromPoint(Point pt) noexcept { return POINT{ static_cast<LONG>(pt.x), static_cast<LONG>(pt.y) }; } diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index af20467ad..4ce8aad0c 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -1278,7 +1278,7 @@ sptr_t ScintillaWin::WndPaint() { hRgnUpdate = ::CreateRectRgn(0, 0, 0, 0); ::GetUpdateRgn(MainHWND(), hRgnUpdate, FALSE); ::BeginPaint(MainHWND(), &ps); - rcPaint = PRectangle::FromInts(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); + rcPaint = PRectangleFromRECT(ps.rcPaint); const PRectangle rcClient = GetClientRectangle(); paintingAllText = BoundsContains(rcPaint, hRgnUpdate, rcClient); if (!PaintDC(ps.hdc)) { |