]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/x11/x11_graphics.cpp
Win32 skins: reorder includes to fix warnings
[vlc] / modules / gui / skins2 / x11 / x11_graphics.cpp
index e1b59cf793e885a541246243d2c58107f205fff9..ac51f53c4fbad5a9264e02a0f5edcec57d7efeef 100644 (file)
@@ -73,11 +73,27 @@ X11Graphics::~X11Graphics()
 }
 
 
-void X11Graphics::clear()
+void X11Graphics::clear( int xDest, int yDest, int width, int height )
 {
-    // Clear the transparency mask
-    XDestroyRegion( m_mask );
-    m_mask = XCreateRegion();
+    if( width <= 0 || height <= 0 )
+    {
+        // Clear the transparency mask completely
+        XDestroyRegion( m_mask );
+        m_mask = XCreateRegion();
+    }
+    else
+    {
+        // remove this area from the mask
+        XRectangle rect;
+        rect.x = xDest;
+        rect.y = yDest;
+        rect.width = width;
+        rect.height = height;
+        Region regMask = XCreateRegion();
+        XUnionRectWithRegion( &rect, regMask, regMask );
+        XSubtractRegion( m_mask, regMask, m_mask );
+        XDestroyRegion( regMask );
+    }
 }
 
 
@@ -172,6 +188,10 @@ void X11Graphics::drawBitmap( const GenericBitmap &rBitmap, int xSrc,
         return;
     }
 
+    // Force pending XCopyArea to be sent to the X Server
+    // before issuing an XGetImage.
+    XSync( XDISPLAY, False );
+
     // Get the image from the pixmap
     XImage *pImage = XGetImage( XDISPLAY, m_pixmap, xDest, yDest, width,
                                 height, AllPlanes, ZPixmap );