Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        iclass.c 


Log Message:
Avoid shape processing for images with alpha set but no shape set.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iclass.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -3 -r1.78 -r1.79
--- iclass.c    16 Oct 2005 16:27:48 -0000      1.78
+++ iclass.c    16 Oct 2005 21:39:14 -0000      1.79
@@ -256,6 +256,25 @@
    EAllocColor(&is->lolo);
 }
 
+static int
+e16_image_check_has_alpha(void)
+{
+   static const short  oink = 3;       /* For endianness checking */
+   unsigned char      *pb, *pe;
+
+   if (!imlib_image_has_alpha())
+      return 0;
+
+   pb = (unsigned char *)imlib_image_get_data_for_reading_only();
+   pe = pb + 4 * imlib_image_get_width() * imlib_image_get_height();
+   pb += *((char *)(&oink));
+   for (; pb < pe; pb += 4)
+      if (*pb != 0xff)
+        return 1;
+
+   return 0;
+}
+
 static void
 ImagestateRealize(ImageState * is)
 {
@@ -281,6 +300,14 @@
 
    imlib_context_set_image(is->im);
 
+   if (imlib_image_has_alpha() && !e16_image_check_has_alpha())
+     {
+#if 0
+       Eprintf("Alpha set but no shape %s\n", is->real_file);
+#endif
+       imlib_image_set_has_alpha(0);
+     }
+
    if (is->border)
       imlib_image_set_border(is->border);
 




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to