kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2.git/commit/?id=e3be3eb0fc11d7ddf6af2ab9aa8c457f6f1f4def

commit e3be3eb0fc11d7ddf6af2ab9aa8c457f6f1f4def
Author: Kim Woelders <k...@woelders.dk>
Date:   Sun Dec 6 13:53:58 2020 +0100

    grab.c: Support 30bpp display in __imlib_GrabXImageToRGBA()
    
    Patch by the_third.
    
    https://phab.enlightenment.org/T8808
---
 src/lib/grab.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/src/lib/grab.c b/src/lib/grab.c
index 6c935b8..3e41351 100644
--- a/src/lib/grab.c
+++ b/src/lib/grab.c
@@ -91,6 +91,7 @@ __imlib_GrabXImageToRGBA(DATA32 * data, int ox, int oy, int 
ow, int oh,
              break;
           case 24:
           case 25:
+          case 30:
           case 32:
              for (y = 0; y < h; y++)
                {
@@ -439,6 +440,82 @@ __imlib_GrabXImageToRGBA(DATA32 * data, int ox, int oy, 
int ow, int oh,
                }
           }
         break;
+     case 30:
+        if (bgr)
+          {
+             if (mxim)
+               {
+                  for (y = 0; y < h; y++)
+                    {
+                       src = (DATA32 *) (xim->data + (xim->bytes_per_line * 
y));
+                       ptr = data + ((y + iny) * ow) + inx;
+                       for (x = 0; x < w; x++)
+                         {
+                            pixel = (((*src) & 0x000003ff) << 14 & 0x00ff0000) 
|
+                               (((*src) & 0x000ffc00) >> 4 & 0x0000ff00) |
+                               (((*src) & 0x3ff00000) >> 22 & 0x000000ff);
+                            if (XGetPixel(mxim, x, y))
+                               pixel |= 0xff000000;
+                            *ptr++ = pixel;
+                            src++;
+                         }
+                    }
+               }
+             else
+               {
+                  for (y = 0; y < h; y++)
+                    {
+                       src = (DATA32 *) (xim->data + (xim->bytes_per_line * 
y));
+                       ptr = data + ((y + iny) * ow) + inx;
+                       for (x = 0; x < w; x++)
+                         {
+                            *ptr++ = 0xff000000 |
+                               (((*src) & 0x000003ff) << 14 & 0x00ff0000) |
+                               (((*src) & 0x000ffc00) >> 4 & 0x0000ff00) |
+                               (((*src) & 0x3ff00000) >> 22 & 0x000000ff);
+                            src++;
+                         }
+                    }
+               }
+          }
+        else
+          {
+             if (mxim)
+               {
+                  for (y = 0; y < h; y++)
+                    {
+                       src = (DATA32 *) (xim->data + (xim->bytes_per_line * 
y));
+                       ptr = data + ((y + iny) * ow) + inx;
+                       for (x = 0; x < w; x++)
+                         {
+                            pixel = (((*src) & 0x3ff00000) >> 6 & 0x00ff0000) |
+                               (((*src) & 0x000ffc00) >> 4 & 0x0000ff00) |
+                               (((*src) & 0x000003ff) >> 2 & 0x000000ff);
+                            if (XGetPixel(mxim, x, y))
+                               pixel |= 0xff000000;
+                            *ptr++ = pixel;
+                            src++;
+                         }
+                    }
+               }
+             else
+               {
+                  for (y = 0; y < h; y++)
+                    {
+                       src = (DATA32 *) (xim->data + (xim->bytes_per_line * 
y));
+                       ptr = data + ((y + iny) * ow) + inx;
+                       for (x = 0; x < w; x++)
+                         {
+                            *ptr++ = 0xff000000 |
+                               (((*src) & 0x3ff00000) >> 6 & 0x00ff0000) |
+                               (((*src) & 0x000ffc00) >> 4 & 0x0000ff00) |
+                               (((*src) & 0x000003ff) >> 2 & 0x000000ff);
+                            src++;
+                         }
+                    }
+               }
+          }
+        break;
      case 32:
         if (bgr)
           {

-- 


Reply via email to