https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d8108a64a4922f65020ed…
commit d8108a64a4922f65020ed0c83c259a517836513b
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri Dec 29 20:58:51 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Dec 29 20:58:51 2023 +0900
[COMDLG32] Color Picker: Fix black cross (#6242)
JIRA issue: CORE-19403, CORE-19405
- Fix HRGN handle leak.
- Fix black cross coordinates.
---
dll/win32/comdlg32/colordlg.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/dll/win32/comdlg32/colordlg.c b/dll/win32/comdlg32/colordlg.c
index 1acf3524666..299c740e752 100644
--- a/dll/win32/comdlg32/colordlg.c
+++ b/dll/win32/comdlg32/colordlg.c
@@ -523,10 +523,15 @@ static void CC_PaintCross(CCPRIV *infoPtr)
if (IsWindowVisible(hwnd)) /* if full size */
{
HDC hDC;
+#ifdef __REACTOS__
+ int w = 8, wc = 6;
+#else
int w = GetDialogBaseUnits() - 1;
int wc = GetDialogBaseUnits() * 3 / 4;
+#endif
RECT rect;
POINT point, p;
+ HRGN region;
HPEN hPen;
int x, y;
@@ -535,7 +540,9 @@ static void CC_PaintCross(CCPRIV *infoPtr)
GetClientRect(hwnd, &rect);
hDC = GetDC(hwnd);
- SelectClipRgn( hDC, CreateRectRgnIndirect(&rect));
+ region = CreateRectRgnIndirect(&rect);
+ SelectClipRgn(hDC, region);
+ DeleteObject(region);
point.x = ((long)rect.right * (long)x) / (long)MAXHORI;
point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT;
@@ -544,10 +551,17 @@ static void CC_PaintCross(CCPRIV *infoPtr)
infoPtr->oldcross.right - infoPtr->oldcross.left,
infoPtr->oldcross.bottom - infoPtr->oldcross.top,
infoPtr->hdcMem, infoPtr->oldcross.left, infoPtr->oldcross.top,
SRCCOPY);
+#ifdef __REACTOS__
+ infoPtr->oldcross.left = point.x - w - 3;
+ infoPtr->oldcross.right = point.x + w + 3;
+ infoPtr->oldcross.top = point.y - w - 3;
+ infoPtr->oldcross.bottom = point.y + w + 3;
+#else
infoPtr->oldcross.left = point.x - w - 1;
infoPtr->oldcross.right = point.x + w + 1;
infoPtr->oldcross.top = point.y - w - 1;
infoPtr->oldcross.bottom = point.y + w + 1;
+#endif
hPen = CreatePen(PS_SOLID, 3, RGB(0, 0, 0)); /* -black- color */
hPen = SelectObject(hDC, hPen);