[MSPAINT] Add get/putSubImage in dib.cpp and use them

CORE-19094
This commit is contained in:
Katayama Hirofumi MZ 2023-11-18 14:25:19 +09:00
parent a65ebc8a71
commit 764e5505a7
5 changed files with 49 additions and 29 deletions

View file

@ -157,14 +157,10 @@ HBITMAP SelectionModel::GetSelectionContents()
if (m_hbmColor)
return CopyDIBImage(m_hbmColor, m_rc.Width(), m_rc.Height());
HDC hMemDC = ::CreateCompatibleDC(NULL);
HBITMAP hBitmap = CreateColorDIB(m_rc.Width(), m_rc.Height(), RGB(255, 255, 255));
HGDIOBJ hbmOld = ::SelectObject(hMemDC, hBitmap);
::BitBlt(hMemDC, 0, 0, m_rc.Width(), m_rc.Height(), imageModel.GetDC(), m_rc.left, m_rc.top, SRCCOPY);
::SelectObject(hMemDC, hbmOld);
::DeleteDC(hMemDC);
return hBitmap;
HBITMAP hbmWhole = imageModel.LockBitmap();
HBITMAP hbmPart = getSubImage(hbmWhole, m_rc);
imageModel.UnlockBitmap(hbmWhole);
return hbmPart;
}
BOOL SelectionModel::IsLanded() const