summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2015-08-03 11:39:36 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2016-11-17 13:15:44 +0000
commit6076710db4f4ac4b5a75b08a408306706f64e7e0 (patch)
treef24bd58cf34597b1474720f50d1de9620df2fc59
parenta8dc58771476f8b59647b3ba220bebf8aeb330d3 (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.c35
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);