| 728 | } |
| 729 | |
| 730 | void CColorCopDlg::OnPaint() { |
| 731 | if (IsIconic()) { |
| 732 | CPaintDC dc(this); |
| 733 | SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); |
| 734 | int cxIcon = GetSystemMetrics(SM_CXICON); |
| 735 | int cyIcon = GetSystemMetrics(SM_CYICON); |
| 736 | CRect rect; |
| 737 | GetClientRect(&rect); |
| 738 | int x = (rect.Width() - cxIcon + 1) / 2; |
| 739 | int y = (rect.Height() - cyIcon + 1) / 2; |
| 740 | dc.DrawIcon(x, y, m_hIcon); |
| 741 | } else { |
| 742 | CDialog::OnPaint(); |
| 743 | // Custom magnifier rendering and color preview drawing |
| 744 | HWND hWndMain = GetSafeHwnd(); |
| 745 | |
| 746 | WindowDC hdc(hWndMain); // RAII — auto‑releases |
| 747 | if (hBitmap) { |
| 748 | HDC hdcMem = ::CreateCompatibleDC(hdc); |
| 749 | |
| 750 | ::SelectObject(hdcMem, hBitmap); |
| 751 | |
| 752 | if (m_Appflags & ExpandedDialog) { |
| 753 | ::BitBlt(hdc, |
| 754 | magrect.TopLeft().x + 2, magrect.TopLeft().y + 2, |
| 755 | magrect.Width() - 4, magrect.Height() - 4, |
| 756 | hdcMem, |
| 757 | 0, 0, |
| 758 | SRCCOPY); |
| 759 | } |
| 760 | ::DeleteDC(hdcMem); |
| 761 | } |
| 762 | |
| 763 | if (m_Appflags & ExpandedDialog) { |
| 764 | ::DrawEdge(hdc, &magrect, EDGE_SUNKEN, BF_RECT); |
| 765 | } |
| 766 | |
| 767 | DisplayColor(); // keep the color window showing |
| 768 | } |
| 769 | } |
| 770 | |
| 771 | void CColorCopDlg::ComputeHSV(int red, int green, int blue, |
| 772 | double& outH, double& outS, double& outV) { |
nothing calls this directly
no outgoing calls
no test coverage detected