Enlightenment CVS committal

Author  : mej
Project : eterm
Module  : Eterm

Dir     : eterm/Eterm/src


Modified Files:
        pixmap.c 


Log Message:
Tue Apr 26 13:40:54 2005                        Michael Jennings (mej)

Patch from Tres Melton <[EMAIL PROTECTED]> to optimize 24-bit and
32-bit non-MMX shading routines.
----------------------------------------------------------------------

===================================================================
RCS file: /cvsroot/enlightenment/eterm/Eterm/src/pixmap.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -3 -r1.107 -r1.108
--- pixmap.c    26 Apr 2005 16:14:25 -0000      1.107
+++ pixmap.c    26 Apr 2005 17:43:21 -0000      1.108
@@ -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.107 2005/04/26 16:14:25 mej 
Exp $";
+static const char cvs_ident[] = "$Id: pixmap.c,v 1.108 2005/04/26 17:43:21 mej 
Exp $";
 
 #include "config.h"
 #include "feature.h"
@@ -1651,22 +1651,14 @@
         /* No saturation */
         for (y = h; --y >= 0;) {
             for (x = -(w * 4); x < 0; x += 4) {
-                int r, g, b;
-
 # if WORDS_BIGENDIAN
-                r = (ptr[x + 1] * rm) >> 8;
-                g = (ptr[x + 2] * gm) >> 8;
-                b = (ptr[x + 3] * bm) >> 8;
-                ptr[x + 1] = r;
-                ptr[x + 2] = g;
-                ptr[x + 3] = b;
+                ptr[x + 1] = (unsigned char) ((ptr[x + 1] * rm) >> 8);
+                ptr[x + 2] = (unsigned char) ((ptr[x + 2] * gm) >> 8);
+                ptr[x + 3] = (unsigned char) ((ptr[x + 3] * bm) >> 8);
 # else
-                r = (ptr[x + 2] * rm) >> 8;
-                g = (ptr[x + 1] * gm) >> 8;
-                b = (ptr[x + 0] * bm) >> 8;
-                ptr[x + 2] = r;
-                ptr[x + 1] = g;
-                ptr[x + 0] = b;
+                ptr[x + 2] = (unsigned char) ((ptr[x + 2] * rm) >> 8);
+                ptr[x + 1] = (unsigned char) ((ptr[x + 1] * gm) >> 8);
+                ptr[x + 0] = (unsigned char) ((ptr[x + 0] * bm) >> 8);
 # endif
             }
             ptr += bpl;
@@ -1675,27 +1667,20 @@
         for (y = h; --y >= 0;) {
             for (x = -(w * 4); x < 0; x += 4) {
                 int r, g, b;
-
 # if WORDS_BIGENDIAN
                 r = (ptr[x + 1] * rm) >> 8;
+                ptr[x + 1] = r|(!(r >> 8) - 1);
                 g = (ptr[x + 2] * gm) >> 8;
+                ptr[x + 2] = g|(!(g >> 8) - 1);
                 b = (ptr[x + 3] * bm) >> 8;
+                ptr[x + 3] = b|(!(b >> 8) - 1);
 # else
                 r = (ptr[x + 2] * rm) >> 8;
+                ptr[x + 2] = r|(!(r >> 8) - 1);
                 g = (ptr[x + 1] * gm) >> 8;
+                ptr[x + 1] = g|(!(g >> 8) - 1);
                 b = (ptr[x + 0] * bm) >> 8;
-# endif
-                r |= (!(r >> 8) - 1);
-                g |= (!(g >> 8) - 1);
-                b |= (!(b >> 8) - 1);
-# if WORDS_BIGENDIAN
-                ptr[x + 1] = r;
-                ptr[x + 2] = g;
-                ptr[x + 3] = b;
-# else
-                ptr[x + 2] = r;
-                ptr[x + 1] = g;
-                ptr[x + 0] = b;
+                ptr[x + 0] = b|(!(b >> 8) - 1);
 # endif
             }
             ptr += bpl;
@@ -1719,19 +1704,13 @@
                 int r, g, b;
 
 # if WORDS_BIGENDIAN
-                r = (ptr[x + 0] * rm) >> 8;
-                g = (ptr[x + 1] * gm) >> 8;
-                b = (ptr[x + 2] * bm) >> 8;
-                ptr[x + 0] = r;
-                ptr[x + 1] = g;
-                ptr[x + 2] = b;
+                ptr[x + 0] = (ptr[x + 0] * rm) >> 8;
+                ptr[x + 1] = (ptr[x + 1] * gm) >> 8;
+                ptr[x + 2] = (ptr[x + 2] * bm) >> 8;
 # else
-                r = (ptr[x + 2] * rm) >> 8;
-                g = (ptr[x + 1] * gm) >> 8;
-                b = (ptr[x + 0] * bm) >> 8;
-                ptr[x + 2] = r;
-                ptr[x + 1] = g;
-                ptr[x + 0] = b;
+                ptr[x + 2] = (ptr[x + 2] * rm) >> 8;
+                ptr[x + 1] = (ptr[x + 1] * gm) >> 8;
+                ptr[x + 0] = (ptr[x + 0] * bm) >> 8;
 # endif
             }
             ptr += bpl;
@@ -1740,27 +1719,20 @@
         for (y = h; --y >= 0;) {
             for (x = -(w * 3); x < 0; x += 3) {
                 int r, g, b;
-
 # if WORDS_BIGENDIAN
                 r = (ptr[x + 0] * rm) >> 8;
+                ptr[x + 0] = r|(!(r >> 8) - 1);
                 g = (ptr[x + 1] * gm) >> 8;
+                ptr[x + 1] = g|(!(g >> 8) - 1);
                 b = (ptr[x + 2] * bm) >> 8;
+                ptr[x + 2] = b|(!(b >> 8) - 1);
 # else
                 r = (ptr[x + 2] * rm) >> 8;
+                ptr[x + 2] = r|(!(r >> 8) - 1);
                 g = (ptr[x + 1] * gm) >> 8;
+                ptr[x + 1] = g|(!(g >> 8) - 1);
                 b = (ptr[x + 0] * bm) >> 8;
-# endif
-                r |= (!(r >> 8) - 1);
-                g |= (!(g >> 8) - 1);
-                b |= (!(b >> 8) - 1);
-# if WORDS_BIGENDIAN
-                ptr[x + 0] = r;
-                ptr[x + 1] = g;
-                ptr[x + 2] = b;
-# else
-                ptr[x + 2] = r;
-                ptr[x + 1] = g;
-                ptr[x + 0] = b;
+                ptr[x + 0] = b|(!(b >> 8) - 1);
 # endif
             }
             ptr += bpl;




-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to