[gimp] fix the rgb565 mode of the raw plugin.



commit 2afc3419e5515bd19f699a154e6a6755d85c35b6
Author: Simon Budig <simon budig de>
Date:   Thu Dec 1 11:05:09 2011 +0100

    fix the rgb565 mode of the raw plugin.
    
    The rgb565 mode of the raw plugin was wrong. Some colors accidentially
    got bits from the adjacent colors. Fixed by properly masking the resp.
    bits and properly extending them to the 8 bit range.

 plug-ins/common/file-raw.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/common/file-raw.c b/plug-ins/common/file-raw.c
index edc1b05..aecb71e 100644
--- a/plug-ins/common/file-raw.c
+++ b/plug-ins/common/file-raw.c
@@ -435,9 +435,9 @@ rgb_565_to_888 (guint16 *in,
 
   for (i = 0, j = 0; i < num_pixels; i++)
     {
-      out[j++] = 0x00FF & ((in[i] >> 8) | ((in[i] >> 13) & 0x0007));
-      out[j++] = 0x00FF & ((in[i] >> 3) | ((in[i] >>  9) & 0x0003));
-      out[j++] = 0x00FF & ((in[i] << 3) | ((in[i] >>  2) & 0x0007));
+      out[j++] = ((((in[i] >> 11) & 0x1f) * 0x21) >> 2);
+      out[j++] = ((((in[i] >>  5) & 0x3f) * 0x41) >> 4);
+      out[j++] = ((((in[i] >>  0) & 0x1f) * 0x21) >> 2);
     }
 }
 



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