[metacity/wip/test-3-20: 8/10] compositor: use window mask



commit 284150eb1912290a6d19715bd438ded9876e6ffb
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Apr 14 20:18:16 2016 +0300

    compositor: use window mask

 src/compositor/compositor-xrender.c |   56 +++++++++++++++++++++++++---------
 src/ui/frames.c                     |    2 +-
 2 files changed, 42 insertions(+), 16 deletions(-)
---
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index 3be9a34..e913c93 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -1535,17 +1535,24 @@ paint_windows (MetaScreen   *screen,
       if (cw->mode == WINDOW_SOLID)
         {
           int x, y, wid, hei;
+          MetaFrame *frame;
+          MetaFrameBorders borders;
 
           x = cw->attrs.x;
           y = cw->attrs.y;
           wid = cw->attrs.width + cw->attrs.border_width * 2;
           hei = cw->attrs.height + cw->attrs.border_width * 2;
 
+          frame = cw->window ? meta_window_get_frame (cw->window) : NULL;
+          meta_frame_calc_borders (frame, &borders);
+
           XFixesSetPictureClipRegion (xdisplay, root_buffer,
                                       0, 0, paint_region);
-          XRenderComposite (xdisplay, PictOpSrc, cw->picture,
-                            None, root_buffer, 0, 0, 0, 0,
-                            x, y, wid, hei);
+          XRenderComposite (xdisplay, PictOpSrc, cw->picture, None, root_buffer,
+                            borders.total.left, borders.total.top, 0, 0,
+                            x + borders.total.left, y + borders.total.top,
+                            wid - borders.total.left - borders.total.right,
+                            hei - borders.total.top - borders.total.bottom);
 
           if (cw->type == META_COMP_WINDOW_DESKTOP)
             {
@@ -1553,8 +1560,16 @@ paint_windows (MetaScreen   *screen,
               XFixesCopyRegion (xdisplay, desktop_region, paint_region);
             }
 
-          XFixesSubtractRegion (xdisplay, paint_region,
-                                paint_region, cw->frame_region);
+          if (frame == NULL)
+            {
+              XFixesSubtractRegion (xdisplay, paint_region,
+                                    paint_region, cw->frame_region);
+            }
+          else
+            {
+              XFixesSubtractRegion (xdisplay, paint_region,
+                                    paint_region, cw->client_region);
+            }
         }
 
       if (!cw->border_clip)
@@ -1581,6 +1596,13 @@ paint_windows (MetaScreen   *screen,
 
       if (cw->picture)
         {
+          int x, y, wid, hei;
+
+          x = cw->attrs.x;
+          y = cw->attrs.y;
+          wid = cw->attrs.width + cw->attrs.border_width * 2;
+          hei = cw->attrs.height + cw->attrs.border_width * 2;
+
           if (cw->shadow && cw->type != META_COMP_WINDOW_DOCK)
             {
               XserverRegion shadow_clip;
@@ -1592,11 +1614,10 @@ paint_windows (MetaScreen   *screen,
                                           shadow_clip);
 
               XRenderComposite (xdisplay, PictOpOver, info->black_picture,
-                                cw->shadow, root_buffer,
-                                0, 0, 0, 0,
-                                cw->attrs.x + cw->shadow_dx,
-                                cw->attrs.y + cw->shadow_dy,
+                                cw->shadow, root_buffer, 0, 0, 0, 0,
+                                x + cw->shadow_dx, y + cw->shadow_dy,
                                 cw->shadow_width, cw->shadow_height);
+
               if (shadow_clip)
                 XFixesDestroyRegion (xdisplay, shadow_clip);
             }
@@ -1612,15 +1633,20 @@ paint_windows (MetaScreen   *screen,
                                  cw->frame_region);
           XFixesSetPictureClipRegion (xdisplay, root_buffer, 0, 0,
                                       cw->border_clip);
-          if (cw->mode == WINDOW_ARGB)
+
+          if (cw->mask != None)
             {
-              int x, y, wid, hei;
+              XRenderComposite (xdisplay, PictOpOver, cw->mask,
+                                cw->alpha_pict, root_buffer, 0, 0, 0, 0,
+                                x, y, wid, hei);
 
-              x = cw->attrs.x;
-              y = cw->attrs.y;
-              wid = cw->attrs.width + cw->attrs.border_width * 2;
-              hei = cw->attrs.height + cw->attrs.border_width * 2;
+              XRenderComposite (xdisplay, PictOpAdd, cw->picture,
+                                None, root_buffer, 0, 0, 0, 0,
+                                x, y, wid, hei);
+            }
 
+          if (cw->mode == WINDOW_ARGB)
+            {
               XRenderComposite (xdisplay, PictOpOver, cw->picture,
                                 cw->alpha_pict, root_buffer, 0, 0, 0, 0,
                                 x, y, wid, hei);
diff --git a/src/ui/frames.c b/src/ui/frames.c
index ad6a8e7..be51bf5 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -2184,7 +2184,7 @@ generate_pixmap (MetaFrames            *frames,
     return NULL;
 
   result = gdk_window_create_similar_surface (frame->window,
-                                              CAIRO_CONTENT_COLOR_ALPHA,
+                                              CAIRO_CONTENT_COLOR,
                                               rect->width, rect->height);
 
   cr = cairo_create (result);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]