[gimp/gimp-2-8] file-bmp: Use masks when BI_BITFIELDS method is found



commit c7c4475eaf578557e6413713ea911012900905d5
Author: Philippe Teuwen <phil teuwen org>
Date:   Thu Aug 28 19:27:51 2014 +0530

    file-bmp: Use masks when BI_BITFIELDS method is found
    
    (cherry picked from commit 6e73a6278f306c976f068dfd18db9092819aa90d)
    
    Conflicts:
        plug-ins/file-bmp/bmp-read.c

 plug-ins/file-bmp/bmp-read.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/file-bmp/bmp-read.c b/plug-ins/file-bmp/bmp-read.c
index 11d7414..b3f610b 100644
--- a/plug-ins/file-bmp/bmp-read.c
+++ b/plug-ins/file-bmp/bmp-read.c
@@ -727,11 +727,11 @@ ReadImage (FILE                  *fd,
             for (xpos= 0; xpos < width; ++xpos)
               {
                 px32 = ToL(&buffer[xpos*4]);
-                *(temp++)= (guchar)((px32 & masks[0].mask) >> masks[0].shiftin);
-                *(temp++)= (guchar)((px32 & masks[1].mask) >> masks[1].shiftin);
-                *(temp++)= (guchar)((px32 & masks[2].mask) >> masks[2].shiftin);
+                *(temp++) = ((px32 & masks[0].mask) >> masks[0].shiftin) * 255.0 / masks[0].max_value + 0.5;
+                *(temp++) = ((px32 & masks[1].mask) >> masks[1].shiftin) * 255.0 / masks[1].max_value + 0.5;
+                *(temp++) = ((px32 & masks[2].mask) >> masks[2].shiftin) * 255.0 / masks[2].max_value + 0.5;
                 if (channels > 3)
-                  *(temp++)= (guchar)((px32 & masks[3].mask) >> masks[3].shiftin);
+                  *(temp++) = ((px32 & masks[3].mask) >> masks[3].shiftin) * 255.0 / masks[3].max_value + 
0.5;
               }
             if (ypos == 0)
               break;


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