Commit 065f7335 authored by Jon Turney's avatar Jon Turney

hw/xwin: Align winBltExposedRegionsShadowGDI with winTopLevelWindowProc's WM_PAINT

Make winBltExposedRegionsShadowGDI() do the same stuff that
winTopLevelWindowProc()'s WM_PAINT handler does.

Note that winBltExposedRegionsShadowGDI() is currently used 1) in
windowed mode when the GDI engine is selected, and 2) in multiwindow
mode when "Hide Root Window" is off.
parent f4cdbf64
......@@ -750,6 +750,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) {
......@@ -759,11 +765,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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment