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 1bd9920c07f892aa2e368ce071fb15b43342a513
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Thu Sep 21 07:14:34 2023 +0200

    x11_grab: Use correct depth when grabbing
    
    Use queried drawable depth, not the context one.
    
    Fixes grabbing of bitmaps (now using intended colormap) in the
    usual 24 bit depth case.
    May fix other issues as well(?).
    
    Broken by 3ab94987772460112f7f66992c43d38a0bc6ebbe (in v1.11.0).
---
 src/lib/api_x11.c  | 3 ++-
 src/lib/x11_grab.c | 7 +++----
 src/lib/x11_grab.h | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/lib/api_x11.c b/src/lib/api_x11.c
index 2a9b76b..21e5e3c 100644
--- a/src/lib/api_x11.c
+++ b/src/lib/api_x11.c
@@ -329,7 +329,8 @@ imlib_create_image_from_ximage(XImage * image, XImage * mask, int x, int y,
    if (!im)
       return NULL;
 
-   __imlib_GrabXImageToRGBA(&ctx->x11, im->data, 0, 0, width, height,
+   __imlib_GrabXImageToRGBA(&ctx->x11, image->depth, im->data,
+                            0, 0, width, height,
                             image, mask, x, y, width, height, need_to_grab_x);
    return im;
 }
diff --git a/src/lib/x11_grab.c b/src/lib/x11_grab.c
index 43ff825..fae577d 100644
--- a/src/lib/x11_grab.c
+++ b/src/lib/x11_grab.c
@@ -24,13 +24,13 @@ Tmp_HandleXError(Display * d, XErrorEvent * ev)
 #define PTR(T, im_, y_) (T*)(void*)(im_->data + (im_->bytes_per_line * y_))
 
 void
-__imlib_GrabXImageToRGBA(const ImlibContextX11 * x11, uint32_t * data,
+__imlib_GrabXImageToRGBA(const ImlibContextX11 * x11, int depth,
+                         uint32_t * data,
                          int x_dst, int y_dst, int w_dst, int h_dst,
                          XImage * xim, XImage * mxim,
                          int x_src, int y_src, int w_src, int h_src, int grab)
 {
    int                 x, y, inx, iny;
-   int                 depth;
    const uint32_t     *src;
    const uint16_t     *s16;
    uint32_t           *ptr;
@@ -58,7 +58,6 @@ __imlib_GrabXImageToRGBA(const ImlibContextX11 * x11, uint32_t * data,
 
    /* go thru the XImage and convert */
 
-   depth = x11->depth;
    if ((depth == 24) && (xim->bits_per_pixel == 32))
       depth = 25;               /* fake depth meaning 24 bit in 32 bpp ximage */
 
@@ -814,7 +813,7 @@ __imlib_GrabDrawableToRGBA(const ImlibContextX11 * x11, uint32_t * data,
         CLEAR(x_dst + w_src, w_dst, y_dst, y_dst + h_src);
      }
 
-   __imlib_GrabXImageToRGBA(x11, data, x_dst, y_dst, w_dst, h_dst,
+   __imlib_GrabXImageToRGBA(x11, xatt.depth, data, x_dst, y_dst, w_dst, h_dst,
                             xim, mxim, x_src, y_src, w_src, h_src, 0);
 
    /* destroy the Ximage */
diff --git a/src/lib/x11_grab.h b/src/lib/x11_grab.h
index d09ca36..de9ba56 100644
--- a/src/lib/x11_grab.h
+++ b/src/lib/x11_grab.h
@@ -26,7 +26,7 @@ int                 __imlib_GrabDrawableScaledToRGBA(const ImlibContextX11 *
                                                      bool clear);
 
 void                __imlib_GrabXImageToRGBA(const ImlibContextX11 * x11,
-                                             uint32_t * data,
+                                             int depth, uint32_t * data,
                                              int x_dst, int y_dst,
                                              int w_dst, int h_dst,
                                              XImage * xim, XImage * mxim,

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

Reply via email to