Fixed DC eating

This commit is contained in:
Quantum 2014-04-14 20:51:57 -04:00
parent 2ca1d5a9d3
commit 019567b10d

View file

@ -473,7 +473,8 @@ void PianoControl::OnPaint()
hMemDC = CreateCompatibleDC(hdc); hMemDC = CreateCompatibleDC(hdc);
if (!hMemBitmap || cx > bmx || cy > bmy) { if (!hMemBitmap || cx > bmx || cy > bmy) {
if (hMemBitmap) if (hMemBitmap)
DeleteObject(hMemBitmap); if (!DeleteObject(hMemBitmap))
MessageBox(m_hwnd, L"FAILED TO DELETE BITMAP", NULL, 0);
bmx = cx + 50; bmx = cx + 50;
bmy = cy + 50; bmy = cy + 50;
hMemBitmap = CreateCompatibleBitmap(hdc, bmx, bmy); hMemBitmap = CreateCompatibleBitmap(hdc, bmx, bmy);
@ -488,6 +489,7 @@ void PianoControl::OnPaint()
BitBlt(hdc, x, y, cx, cy, hMemDC, x, y, SRCCOPY); BitBlt(hdc, x, y, cx, cy, hMemDC, x, y, SRCCOPY);
SelectObject(hMemDC, hbmPrev); SelectObject(hMemDC, hbmPrev);
ps.hdc = hdc;
} else } else
PaintContent(&ps); PaintContent(&ps);
EndPaint(m_hwnd, &ps); EndPaint(m_hwnd, &ps);