Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor bugs/CC #10

Open
Philosoph228 opened this issue Nov 18, 2023 · 1 comment
Open

Fix minor bugs/CC #10

Philosoph228 opened this issue Nov 18, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Philosoph228
Copy link
Contributor

Philosoph228 commented Nov 18, 2023

inline static void ContractRect(LPRECT lprc, int i)

In WinAPI, there is already a function called InflateRect for resizing a RECT.

panitent/src/new.c

Lines 308 to 309 in a252d4f

SendDlgItemMessage(hwndDlg, IDC_DOCUMENTBKGND, CB_SETCURSEL,
(LPARAM)3, (LPARAM)0);

Incorrect type cast in the 4th argument. Expected WPARAM.

@Philosoph228
Copy link
Contributor Author

panitent/src/new.c

Lines 496 to 508 in a252d4f

HBRUSH hbrColor = CreateSolidBrush(color & 0x00FFFFFF);
if (color >> 24 != 0x00)
{
if (color >> 24 != 0xFF)
{
HDC hdcFill = CreateCompatibleDC(lpdis->hDC);
HBITMAP hbmFill = CreateCompatibleBitmap(lpdis->hDC, swatchWidth,
swatchHeight);
HGDIOBJ hOldObj = SelectObject(hdcFill, hbmFill);
RECT fillRc = { 0, 0, swatchWidth, swatchHeight };
FillRect(hdcFill, &fillRc, hbrColor);

Creating a solid brush here is redundant. The second parameter of FillRect accepts either an HBRUSH or a color value.

@Philosoph228 Philosoph228 self-assigned this Nov 21, 2023
@Philosoph228 Philosoph228 added the bug Something isn't working label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant