[COMDLG32] Color Picker: Fix black cross (#6242)

JIRA issue: CORE-19403, CORE-19405
- Fix HRGN handle leak.
- Fix black cross coordinates.
This commit is contained in:
Katayama Hirofumi MZ 2023-12-29 20:58:51 +09:00 committed by GitHub
parent 8e01ab830b
commit d8108a64a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -523,10 +523,15 @@ static void CC_PaintCross(CCPRIV *infoPtr)
if (IsWindowVisible(hwnd)) /* if full size */ if (IsWindowVisible(hwnd)) /* if full size */
{ {
HDC hDC; HDC hDC;
#ifdef __REACTOS__
int w = 8, wc = 6;
#else
int w = GetDialogBaseUnits() - 1; int w = GetDialogBaseUnits() - 1;
int wc = GetDialogBaseUnits() * 3 / 4; int wc = GetDialogBaseUnits() * 3 / 4;
#endif
RECT rect; RECT rect;
POINT point, p; POINT point, p;
HRGN region;
HPEN hPen; HPEN hPen;
int x, y; int x, y;
@ -535,7 +540,9 @@ static void CC_PaintCross(CCPRIV *infoPtr)
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
hDC = GetDC(hwnd); 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.x = ((long)rect.right * (long)x) / (long)MAXHORI;
point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT; 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.right - infoPtr->oldcross.left,
infoPtr->oldcross.bottom - infoPtr->oldcross.top, infoPtr->oldcross.bottom - infoPtr->oldcross.top,
infoPtr->hdcMem, infoPtr->oldcross.left, infoPtr->oldcross.top, SRCCOPY); 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.left = point.x - w - 1;
infoPtr->oldcross.right = point.x + w + 1; infoPtr->oldcross.right = point.x + w + 1;
infoPtr->oldcross.top = point.y - w - 1; infoPtr->oldcross.top = point.y - w - 1;
infoPtr->oldcross.bottom = point.y + w + 1; infoPtr->oldcross.bottom = point.y + w + 1;
#endif
hPen = CreatePen(PS_SOLID, 3, RGB(0, 0, 0)); /* -black- color */ hPen = CreatePen(PS_SOLID, 3, RGB(0, 0, 0)); /* -black- color */
hPen = SelectObject(hDC, hPen); hPen = SelectObject(hDC, hPen);