diff src/video/x11/SDL_x11render.c @ 4608:ff7b00d4b0d3

Fix X11_DisplayModeChanged.
author Sunny Sachanandani <sunnysachanandani@gmail.com>
date Wed, 21 Jul 2010 18:33:13 +0530
parents 9e9ec5e3be95
children 630002c8be85
line wrap: on
line diff
--- a/src/video/x11/SDL_x11render.c	Wed Jul 21 17:54:31 2010 +0530
+++ b/src/video/x11/SDL_x11render.c	Wed Jul 21 18:33:13 2010 +0530
@@ -554,11 +554,42 @@
 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
     if (data->use_xrender) {
         XRenderFreePicture(data->display, data->xwindow_pict);
+        
         data->xwindow_pict_fmt =
             XRenderFindVisualFormat(data->display, data->visual);
         data->xwindow_pict =
             XRenderCreatePicture(data->display, data->xwindow,
                                  data->xwindow_pict_fmt, 0, NULL);
+        
+        XRenderComposite(data->display,
+                         PictOpClear,
+                         data->xwindow_pict,
+                         None,
+                         data->xwindow_pict,
+                         0, 0,
+                         0, 0,
+                         0, 0,
+                         window->w, window->h);
+        
+        XFreePixmap(data->display, data->stencil);
+        /* Create a clip mask that is used for rendering primitives. */
+        data->stencil = XCreatePixmap(data->display, data->xwindow,
+                                   window->w, window->h, 32);
+        
+        XRenderFreePicture(data->display, data->stencil_pict);
+        data->stencil_pict =
+            XRenderCreatePicture(data->display, data->stencil,
+                                 XRenderFindStandardFormat(data->display,
+                                                           PictStandardARGB32),
+                                 0, NULL);
+#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
+        XDamageDestroy(data->display, data->stencil_damage);
+        if (data->use_xdamage) {
+            data->stencil_damage =
+                XDamageCreate(data->display, data->stencil, XDamageReportNonEmpty);
+            XDamageSubtract(data->display, data->stencil_damage, None, data->stencil_parts);
+        }
+#endif
     }
 #endif
     if (renderer->info.flags & SDL_RENDERER_SINGLEBUFFER) {