Enlightenment CVS committal

Author  : mej
Project : eterm
Module  : Eterm

Dir     : eterm/Eterm/src


Modified Files:
        pixmap.c 


Log Message:
Sat May  7 02:30:53 2005                        Michael Jennings (mej)

Patch from Tres Melton <[EMAIL PROTECTED]> to correct overflow in
non-MMX 16bpp shading code.
----------------------------------------------------------------------

===================================================================
RCS file: /cvsroot/enlightenment/eterm/Eterm/src/pixmap.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -3 -r1.109 -r1.110
--- pixmap.c    27 Apr 2005 18:48:32 -0000      1.109
+++ pixmap.c    7 May 2005 06:33:36 -0000       1.110
@@ -21,7 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-static const char cvs_ident[] = "$Id: pixmap.c,v 1.109 2005/04/27 18:48:32 mej 
Exp $";
+static const char cvs_ident[] = "$Id: pixmap.c,v 1.110 2005/05/07 06:33:36 mej 
Exp $";
 
 #include "config.h"
 #include "feature.h"
@@ -1620,19 +1620,16 @@
         }
     } else {
         for (y = h; --y >= 0;) {
+            int r, g, b;
             for (x = -w; x < 0; x++) {
-                int r, g, b;
-
                 b = ((DATA16 *) ptr)[x];
-                r = (b & 0xf800) * rm;
-                g = (b & 0x7e0) * gm;
-                b = (b & 0x1f) * bm;
-                r |= (!(r >> 16) - 1);
-                g |= (!(g >> 11) - 1);
-                b |= (!(b >> 5) - 1);
-                ((DATA16 *) ptr)[x] = ((r >> 8) & 0xf800)
-                    | ((g >> 8) & 0x7e0)
-                    | ((b >> 8) & 0x1f);
+                r = ( (b >> 11 )            * rm ) >> 8;
+               r = ( r > 0x001f ) ? 0xf800 : ( r << 11 );
+                g = (((b >>  5 ) & 0x003f ) * gm ) >> 8;
+               g = ( g > 0x003f ) ? 0x07e0 : ( g << 5 );
+                b = (( b         & 0x001f ) * bm ) >> 8;
+               b = ( b > 0x001f ) ? 0x001f : b;
+                ((DATA16 *) ptr)[x] = (r|g|b);
             }
             ptr += bpl;
         }




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to