aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-05-01 13:47:01 +1000
committerNeil <nyamatongwe@gmail.com>2018-05-01 13:47:01 +1000
commit6065b35281afe152b61d346850bbcdd8e26419ee (patch)
treeb38d6144827db68adbdc61ffee5c64a1caaa590a
parent305b903fe092c08d2873785d1e2638cbfbe831ab (diff)
downloadscintilla-mirror-6065b35281afe152b61d346850bbcdd8e26419ee.tar.gz
Use RectFromPRectangle to avoid casts.
-rw-r--r--win32/PlatWin.cxx4
-rw-r--r--win32/PlatWin.h2
-rw-r--r--win32/ScintillaWin.cxx4
3 files changed, 7 insertions, 3 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 4d31e5af5..71e31e59d 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -49,6 +49,8 @@
#include "DBCS.h"
#include "FontQuality.h"
+#include "PlatWin.h"
+
#ifndef SPI_GETFONTSMOOTHINGCONTRAST
#define SPI_GETFONTSMOOTHINGCONTRAST 0x200C
#endif
@@ -61,7 +63,7 @@ namespace Scintilla {
UINT CodePageFromCharSet(DWORD characterSet, UINT documentCodePage);
-static RECT RectFromPRectangle(PRectangle prc) {
+RECT RectFromPRectangle(PRectangle prc) {
RECT rc = {static_cast<LONG>(prc.left), static_cast<LONG>(prc.top),
static_cast<LONG>(prc.right), static_cast<LONG>(prc.bottom)};
return rc;
diff --git a/win32/PlatWin.h b/win32/PlatWin.h
index eff1fea01..bff73ae70 100644
--- a/win32/PlatWin.h
+++ b/win32/PlatWin.h
@@ -13,6 +13,8 @@ namespace Scintilla {
extern void Platform_Initialise(void *hInstance);
extern void Platform_Finalise(bool fromDllMain);
+RECT RectFromPRectangle(PRectangle prc);
+
#if defined(USE_D2D)
extern bool LoadD2D();
extern ID2D1Factory *pD2DFactory;
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 34302b3fc..4335c1164 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -702,8 +702,8 @@ bool BoundsContains(PRectangle rcBounds, HRGN hRgnBounds, PRectangle rcCheck) {
contains = false;
} else if (hRgnBounds) {
// In bounding rectangle so check more accurately using region
- HRGN hRgnCheck = ::CreateRectRgn(static_cast<int>(rcCheck.left), static_cast<int>(rcCheck.top),
- static_cast<int>(rcCheck.right), static_cast<int>(rcCheck.bottom));
+ const RECT rcw = RectFromPRectangle(rcCheck);
+ HRGN hRgnCheck = ::CreateRectRgnIndirect(&rcw);
if (hRgnCheck) {
HRGN hRgnDifference = ::CreateRectRgn(0, 0, 0, 0);
if (hRgnDifference) {