- // Restore the area under the card
- dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
- &memoryDC, 0, 0, wxCOPY);
-
- // Copy the area under the card in the new position
- memoryDC.Blit(0, 0, CardWidth, CardHeight,
- &dc, m_xPos + dx, m_yPos + dy, wxCOPY);
- }
- else if (dx >= 0)
- {
- // dx >= 0
- dc.Blit(m_xPos, m_yPos, dx, CardHeight, &memoryDC, 0, 0, wxCOPY);
- if (dy >= 0)
- {
- // dy >= 0
- dc.Blit(m_xPos + dx, m_yPos, CardWidth - dx, dy, &memoryDC, dx, 0, wxCOPY);
- memoryDC.Blit(0, 0, CardWidth - dx, CardHeight - dy,
- &memoryDC, dx, dy, wxCOPY);
- memoryDC.Blit(0, CardHeight - dy, CardWidth - dx, dy,
- &dc, m_xPos + dx, m_yPos + CardHeight, wxCOPY);
- }
- else
- {
- // dy < 0
- dc.Blit(m_xPos + dx, m_yPos + dy + CardHeight, CardWidth - dx, -dy,
- &memoryDC, dx, CardHeight + dy, wxCOPY);
- memoryDC.Blit(0, -dy, CardWidth - dx, CardHeight + dy,
- &memoryDC, dx, 0, wxCOPY);
- memoryDC.Blit(0, 0, CardWidth - dx, -dy,
- &dc, m_xPos + dx, m_yPos + dy, wxCOPY);
- }
- memoryDC.Blit(CardWidth - dx, 0, dx, CardHeight,
- &dc, m_xPos + CardWidth, m_yPos + dy, wxCOPY);
- }
- else
- {
- // dx < 0
- dc.Blit(m_xPos + CardWidth + dx, m_yPos, -dx, CardHeight,
- &memoryDC, CardWidth + dx, 0, wxCOPY);
- if (dy >= 0)
- {
- dc.Blit(m_xPos, m_yPos, CardWidth + dx, dy, &memoryDC, 0, 0, wxCOPY);
- memoryDC.Blit(-dx, 0, CardWidth + dx, CardHeight - dy,
- &memoryDC, 0, dy, wxCOPY);
- memoryDC.Blit(-dx, CardHeight - dy, CardWidth + dx, dy,
- &dc, m_xPos, m_yPos + CardHeight, wxCOPY);
- }
- else
- {
- // dy < 0
- dc.Blit(m_xPos, m_yPos + CardHeight + dy, CardWidth + dx, -dy,
- &memoryDC, 0, CardHeight + dy, wxCOPY);
- memoryDC.Blit(-dx, -dy, CardWidth + dx, CardHeight + dy,
- &memoryDC, 0, 0, wxCOPY);
- memoryDC.Blit(-dx, 0, CardWidth + dx, -dy,
- &dc, m_xPos, m_yPos + dy, wxCOPY);
- }
- memoryDC.Blit(0, 0, -dx, CardHeight,
- &dc, m_xPos + dx, m_yPos + dy, wxCOPY);
- }
- m_xPos += dx;
- m_yPos += dy;
-
- // draw the card in its new position
- memoryDC.SelectObject(*m_bmapCard);
- dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
- &memoryDC, 0, 0, wxCOPY);
+ // dx < 0
+ dc.Blit(m_xPos + CardWidth + dx, m_yPos, -dx, CardHeight,
+ &memoryDC, CardWidth + dx, 0, wxCOPY);
+ if (dy >= 0)
+ {
+ dc.Blit(m_xPos, m_yPos, CardWidth + dx, dy, &memoryDC, 0, 0, wxCOPY);
+ memoryDC.Blit(-dx, 0, CardWidth + dx, CardHeight - dy,
+ &memoryDC, 0, dy, wxCOPY);
+ memoryDC.Blit(-dx, CardHeight - dy, CardWidth + dx, dy,
+ &dc, m_xPos, m_yPos + CardHeight, wxCOPY);
+ }
+ else
+ {
+ // dy < 0
+ dc.Blit(m_xPos, m_yPos + CardHeight + dy, CardWidth + dx, -dy,
+ &memoryDC, 0, CardHeight + dy, wxCOPY);
+ memoryDC.Blit(-dx, -dy, CardWidth + dx, CardHeight + dy,
+ &memoryDC, 0, 0, wxCOPY);
+ memoryDC.Blit(-dx, 0, CardWidth + dx, -dy,
+ &dc, m_xPos, m_yPos + dy, wxCOPY);
+ }
+ memoryDC.Blit(0, 0, -dx, CardHeight,
+ &dc, m_xPos + dx, m_yPos + dy, wxCOPY);
+ }
+ m_xPos += dx;
+ m_yPos += dy;
+
+ // draw the card in its new position
+ memoryDC.SelectObject(*m_bmapCard);
+ dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
+ &memoryDC, 0, 0, wxCOPY);