64,666
社区成员
发帖
与我相关
我的任务
分享
_VOID Canvas_Flip(_HANDLE hCanvas, _INT nX, _INT nY, _INT nWidth, _INT nHeight)
{
HDC hDC = (HDC)::SendMessage(SimulatorData.m_hMainFrame, UM_GetDrawDevices, NULL, NULL);
_CANVASOBJECT* pCanvas = (_CANVASOBJECT*)hCanvas;
if (hDC && pCanvas)
{
_RECT rect;
GetScreenRect(&rect);
if ((MediaPlayerRect.nWidth <= 0) || (MediaPlayerRect.nHeight <= 0))
BitBlt(hDC, rect.nLeft + nX, rect.nTop + nY, nWidth, nHeight, pCanvas->hMemDC, nX, nY, SRCCOPY);
else
{
_INT x1 = nX, x2 = MediaPlayerRect.nLeft, x3 = MediaPlayerRect.nLeft + MediaPlayerRect.nWidth, x4 = nX + nWidth;
_INT y1 = nY, y2 = MediaPlayerRect.nTop, y3 = MediaPlayerRect.nTop + MediaPlayerRect.nHeight, y4 = nY + nHeight;
if (x4 > x1 > 0 && y2 > y1)
BitBlt(hDC, rect.nLeft + x1, rect.nTop + y1, x4 - x1, y2 - y1, pCanvas->hMemDC, x1, y1, SRCCOPY);
if (x2 > x1 > 0 && y3 > y2)
BitBlt(hDC, rect.nLeft + x1, rect.nTop + y2, x2 - x1, y3 - y2, pCanvas->hMemDC, x1, y2, SRCCOPY);
if (x4 > x3 > 0 && y3 > y2)
BitBlt(hDC, rect.nLeft + x3, rect.nTop + y2, x4 - x3, y3 - y2, pCanvas->hMemDC, x3, y2, SRCCOPY);
if (x4 > x1 > 0 && y4 > y3)
BitBlt(hDC, rect.nLeft + x1, rect.nTop + y3, x4 - x1, y4 - y3, pCanvas->hMemDC, x1, y3, SRCCOPY);
}
}
::SendMessage(SimulatorData.m_hMainFrame, UM_ReleaseDrawDevices, (WPARAM)hDC, NULL);
}