[gimp] plug-ins: support loading more 16-bit, single channel DDS images



commit d914580336abd14d104021dc4ee0bed48ee52db8
Author: Jacob Boerema <jgboerema gmail com>
Date:   Mon May 2 14:49:42 2022 -0400

    plug-ins: support loading more 16-bit, single channel DDS images
    
    Single channel 16-bit DDS images can use other channels than red, so
    let's support all masks with a value of 0xffff.

 plug-ins/file-dds/ddsread.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/file-dds/ddsread.c b/plug-ins/file-dds/ddsread.c
index a7c7e0fabe..5f89923f57 100644
--- a/plug-ins/file-dds/ddsread.c
+++ b/plug-ins/file-dds/ddsread.c
@@ -287,7 +287,10 @@ read_dds (GFile          *file,
 
               type = GIMP_RGB;
             }
-          else if (hdr.pixelfmt.rmask == 0xffff) /* L16 */
+          else if (hdr.pixelfmt.rmask == 0xffff || /* L16 */
+                   hdr.pixelfmt.gmask == 0xffff ||
+                   hdr.pixelfmt.bmask == 0xffff ||
+                   hdr.pixelfmt.amask == 0xffff)
             {
               d.gimp_bpp = 2;
               d.gimp_bps = 2;
@@ -1045,7 +1048,10 @@ load_layer (FILE             *fp,
           type = (hdr->pixelfmt.amask == 0x8000) ? GIMP_RGBA_IMAGE : GIMP_RGB_IMAGE;
           bablfmt = (hdr->pixelfmt.amask == 0x8000) ? babl_format ("R'G'B'A u8") : babl_format ("R'G'B' u8");
         }
-      else if (hdr->pixelfmt.rmask == 0xffff) /* L16 */
+      else if (hdr->pixelfmt.rmask == 0xffff || /* L16 */
+               hdr->pixelfmt.gmask == 0xffff ||
+               hdr->pixelfmt.bmask == 0xffff ||
+               hdr->pixelfmt.amask == 0xffff)
         {
           type = GIMP_GRAY_IMAGE;
           bablfmt = babl_format ("Y' u16");
@@ -1218,7 +1224,10 @@ load_layer (FILE             *fp,
                             (pixel >> d->ashift << (8 - d->abits) & d->amask) * 255 / d->amask;
                         }
                     }
-                  else if (hdr->pixelfmt.rmask == 0xffff) /* L16 */
+                  else if (hdr->pixelfmt.rmask == 0xffff || /* L16 */
+                           hdr->pixelfmt.gmask == 0xffff ||
+                           hdr->pixelfmt.bmask == 0xffff ||
+                           hdr->pixelfmt.amask == 0xffff)
                     {
                       guint16 *pixels16 = (guint16 *) &pixels[pos];
 


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