diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2015-08-03 11:39:36 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2015-11-03 17:16:41 +0000 |
commit | 2158196a497ddd850d865c99846b39996859bc70 (patch) | |
tree | d9afc40dab804fe86647aa12ebc368be59e7a258 | |
parent | 20a75810e19a466c6228db678abb5bb0d8a096bb (diff) |
Align winBltExposedRegionsShadowGDI() with winTopLevelWindowProc's WM_PAINT
Note that this is used 1) in windowed mode when the GDI engine is selected, and
2) in multiwindow mode when "Hide Root Window" is off.
-rw-r--r-- | hw/xwin/winshadgdi.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c index 22836c518..067dd6f8c 100644 --- a/hw/xwin/winshadgdi.c +++ b/hw/xwin/winshadgdi.c @@ -760,6 +760,12 @@ winBltExposedRegionsShadowGDI(ScreenPtr pScreen) /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint(pScreenPriv->hwndScreen, &ps); + /* Avoid the BitBlt if the PAINTSTRUCT region is bogus */ + if (ps.rcPaint.right == 0 && ps.rcPaint.bottom == 0 && + ps.rcPaint.left == 0 && ps.rcPaint.top == 0) { + EndPaint(pScreenPriv->hwndScreen, &ps); + return 0; + } /* Realize the palette, if we have one */ if (pScreenPriv->pcmapInstalled != NULL) { @@ -769,11 +775,30 @@ winBltExposedRegionsShadowGDI(ScreenPtr pScreen) RealizePalette(hdcUpdate); } - /* Our BitBlt will be clipped to the invalidated region */ - BitBlt(hdcUpdate, - 0, 0, - pScreenInfo->dwWidth, pScreenInfo->dwHeight, - pScreenPriv->hdcShadow, 0, 0, SRCCOPY); + /* Try to copy from the shadow buffer to the invalidated region */ + if (!BitBlt(hdcUpdate, + ps.rcPaint.left, ps.rcPaint.top, + ps.rcPaint.right - ps.rcPaint.left, + ps.rcPaint.bottom - ps.rcPaint.top, + pScreenPriv->hdcShadow, + ps.rcPaint.left, + ps.rcPaint.top, + SRCCOPY)) { + LPVOID lpMsgBuf; + + /* Display an error message */ + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, 0, NULL); + + ErrorF("winBltExposedRegionsShadowGDI - BitBlt failed: %s\n", + (LPSTR) lpMsgBuf); + LocalFree(lpMsgBuf); + } /* EndPaint frees the DC */ EndPaint(pScreenPriv->hwndScreen, &ps); |