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



commit 6e73a6278f306c976f068dfd18db9092819aa90d
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

 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 7af34c6..f57923c 100644
--- a/plug-ins/file-bmp/bmp-read.c
+++ b/plug-ins/file-bmp/bmp-read.c
@@ -725,11 +725,11 @@ ReadImage (FILE                  *fd,
             for (xpos= 0; xpos < width; ++xpos)
               {
                 px32 = ToL(&row_buf[xpos*4]);
-                *(temp++) = (px32 & masks[0].mask) >> masks[0].shiftin;
-                *(temp++) = (px32 & masks[1].mask) >> masks[1].shiftin;
-                *(temp++) = (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++)= (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]