That bitmap caching never worked...

This commit is contained in:
Quantum 2014-04-14 20:21:32 -04:00
parent 7af966e0f3
commit 2ca1d5a9d3

View file

@ -471,12 +471,12 @@ void PianoControl::OnPaint()
if (!hMemDC) if (!hMemDC)
hMemDC = CreateCompatibleDC(hdc); hMemDC = CreateCompatibleDC(hdc);
if (!hMemBitmap) if (!hMemBitmap || cx > bmx || cy > bmy) {
hMemBitmap = CreateCompatibleBitmap(hdc, cx + 50, cy + 50);
if (cx > bmx || cy > bmy) {
if (hMemBitmap) if (hMemBitmap)
DeleteObject(hMemBitmap); DeleteObject(hMemBitmap);
hMemBitmap = CreateCompatibleBitmap(hdc, cx + 50, cy + 50); bmx = cx + 50;
bmy = cy + 50;
hMemBitmap = CreateCompatibleBitmap(hdc, bmx, bmy);
} }
if (hMemDC && hMemBitmap) { if (hMemDC && hMemBitmap) {
ps.hdc = hMemDC; ps.hdc = hMemDC;
@ -510,8 +510,6 @@ LRESULT PianoControl::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
InvalidateRect(m_hwnd, NULL, TRUE); InvalidateRect(m_hwnd, NULL, TRUE);
return 0; return 0;
case WM_LBUTTONDOWN: { case WM_LBUTTONDOWN: {
/*if (mouseDown)
return 0;*/
bool black; bool black;
int internal = hitTest(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), black); int internal = hitTest(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), black);
int key = internalToKeyID(internal, black); int key = internalToKeyID(internal, black);
@ -521,6 +519,7 @@ LRESULT PianoControl::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
lastNote = external; lastNote = external;
lastKey = key; lastKey = key;
mouseDown = true; mouseDown = true;
SetFocus(m_hwnd);
return 0; return 0;
} }
case WM_LBUTTONUP: { case WM_LBUTTONUP: {