aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-02-20 08:28:27 +1100
committerNeil <nyamatongwe@gmail.com>2025-02-20 08:28:27 +1100
commitc095018183f100e044ee749aa5b99ac913b7637b (patch)
tree6b85ee27526e59ad8ba467c354cbd5d2884ffa8f
parent444aa02e383a80ddcaa5611a7bf0a4e55ac454d6 (diff)
downloadscintilla-mirror-c095018183f100e044ee749aa5b99ac913b7637b.tar.gz
Move SizeOfRect to header to allow use in ScintillaWin.cxx where it simplifies
and avoids type warnings.
-rw-r--r--win32/PlatWin.cxx4
-rw-r--r--win32/PlatWin.h4
-rw-r--r--win32/ScintillaWin.cxx7
3 files changed, 7 insertions, 8 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 1007e22de..a4fd552b2 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -1056,10 +1056,6 @@ ColourRGBA GradientValue(const std::vector<ColourStop> &stops, XYPOSITION propor
return ColourRGBA();
}
-constexpr SIZE SizeOfRect(RECT rc) noexcept {
- return { rc.right - rc.left, rc.bottom - rc.top };
-}
-
constexpr BLENDFUNCTION mergeAlpha = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
}
diff --git a/win32/PlatWin.h b/win32/PlatWin.h
index 192bdf6a7..86022a0cd 100644
--- a/win32/PlatWin.h
+++ b/win32/PlatWin.h
@@ -32,6 +32,10 @@ constexpr Point PointFromPOINT(POINT pt) noexcept {
return Point::FromInts(pt.x, pt.y);
}
+constexpr SIZE SizeOfRect(RECT rc) noexcept {
+ return { rc.right - rc.left, rc.bottom - rc.top };
+}
+
constexpr HWND HwndFromWindowID(WindowID wid) noexcept {
return static_cast<HWND>(wid);
}
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 52ccf8709..ad3691859 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -357,10 +357,9 @@ RECT GetClientRect(HWND hwnd) noexcept {
#if defined(USE_D2D)
D2D1_SIZE_U GetSizeUFromRect(const RECT &rc, const int scaleFactor) noexcept {
- const long width = rc.right - rc.left;
- const long height = rc.bottom - rc.top;
- const UINT32 scaledWidth = width * scaleFactor;
- const UINT32 scaledHeight = height * scaleFactor;
+ const SIZE size = SizeOfRect(rc);
+ const UINT32 scaledWidth = size.cx * scaleFactor;
+ const UINT32 scaledHeight = size.cy * scaleFactor;
return D2D1::SizeU(scaledWidth, scaledHeight);
}