This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit 51d74520fc6a06f137df35f16fc43a3692c15788
Author: Kim Woelders <[email protected]>
AuthorDate: Thu Feb 16 06:30:33 2023 +0100

    test_grab: Check get-mask-from-shape too
    
    Since only pixmap grabbing is tested for now, testing mask handling
    just checks that we don't do something silly (like getting shape from
    pixmap).
---
 test/test_grab.cpp | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/test/test_grab.cpp b/test/test_grab.cpp
index 74f2167..7ccc0f0 100644
--- a/test/test_grab.cpp
+++ b/test/test_grab.cpp
@@ -206,6 +206,7 @@ _test_grab_1(const int wsrc, const int hsrc, const int xsrc, const int ysrc,
    int                 x, y, err;
    int                 wimg, himg;
    int                 xi, yi, xo, yo, wo, ho, fac, bw;
+   int                 mask_from_shape;
    char                buf[128];
    Pixmap              mask;
 
@@ -228,6 +229,9 @@ _test_grab_1(const int wsrc, const int hsrc, const int xsrc, const int ysrc,
      case 1:                   // With mask
         mask = _pmap_mk_mask(wsrc, hsrc, 0, 0);
         break;
+     case 2:                   // Mask from shape
+        mask = 1;
+        break;
      }
 
    switch (xd.func)
@@ -264,9 +268,13 @@ _test_grab_1(const int wsrc, const int hsrc, const int xsrc, const int ysrc,
                 yi = (ysrc * himg - (hsrc - 1)) / hsrc;
              bw = (bw + fac - 1) / fac;
           }
+        mask_from_shape = mask == 1;
+        if (mask_from_shape)
+           mask = None;
         im = imlib_create_scaled_image_from_drawable(mask,
                                                      xsrc, ysrc, wsrc, hsrc,
-                                                     wimg, himg, 0, 0);
+                                                     wimg, himg, 0,
+                                                     mask_from_shape);
         xo = -xi;
         yo = -yi;
         wo = wimg;
@@ -287,7 +295,7 @@ _test_grab_1(const int wsrc, const int hsrc, const int xsrc, const int ysrc,
         break;
      }
 
-   if (mask != None)
+   if (mask != None && mask != 1)
       XFreePixmap(xd.dpy, mask);
 
    D("%s: %3dx%3d(%d,%d) -> %3dx%3d(%d,%d -> %d,%d)\n", __func__,
@@ -445,8 +453,14 @@ _test_grab(const char *test, int func, int opt)
    _test_grab_2(test, 24, func, opt, 0);
    _test_grab_2(test, 32, func, opt, 0);
 
-   _test_grab_2(test, 24, func, opt, 1);
-   _test_grab_2(test, 32, func, opt, 1);
+   if (opt == 0)
+     {
+        _test_grab_2(test, 24, func, opt, 1);
+        _test_grab_2(test, 32, func, opt, 1);
+
+        _test_grab_2(test, 24, func, opt, 2);
+        _test_grab_2(test, 32, func, opt, 2);
+     }
 }
 
 // No scaling - imlib_create_image_from_drawable

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to