Enlightenment CVS committal

Author  : turran
Project : e17
Module  : proto/enesim

Dir     : e17/proto/enesim/src/lib/raster/surface


Modified Files:
        surface.h surface.c 


Log Message:
- Initial stubs for convert functions
- Initial stubs for premul/unpremul functions

===================================================================
RCS file: /cvs/e/e17/proto/enesim/src/lib/raster/surface/surface.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- surface.h   12 Oct 2007 11:04:53 -0000      1.1
+++ surface.h   16 Oct 2007 22:09:50 -0000      1.2
@@ -42,6 +42,11 @@
        Enesim_Surface_Data             data;
 };
 
+typedef void (*Conv_Func) (Enesim_Surface_Data *sdata, Enesim_Surface_Data 
*ddata, int w, int h);
+extern Conv_Func rgb565_conv_funcs[ENESIM_SURFACE_FORMATS];
+extern Conv_Func argb8888_conv_funcs[ENESIM_SURFACE_FORMATS];
+
 Span_Color_Func enesim_surface_span_color_get(Enesim_Surface *s, int rop);
+void enesim_surface_premul(Enesim_Surface *s);
 
 #endif
===================================================================
RCS file: /cvs/e/e17/proto/enesim/src/lib/raster/surface/surface.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- surface.c   12 Oct 2007 11:04:53 -0000      1.1
+++ surface.c   16 Oct 2007 22:09:50 -0000      1.2
@@ -11,6 +11,12 @@
        argb8888_funcs,
        rgb565_funcs,
 };
+#if 0
+static Conv_Func *_conv_funcs[ENESIM_SURFACE_FORMATS] = {
+       argb8888_conv_funcs,
+       rgb565_conv_funcs,
+};
+#endif
 /*============================================================================*
  *                                 Global                                     
* 
  
*============================================================================*/
@@ -20,12 +26,21 @@
  */
 Span_Color_Func enesim_surface_span_color_get(Enesim_Surface *s, int rop)
 {
+#if 0
        if ((rop == ENESIM_RENDERER_BLEND) && (s->flags & ENESIM_SURFACE_DIRTY))
        {
 
        }
+#endif
        return _funcs[s->format][ENESIM_RENDERER_BLEND].sp_color;
 }
+/**
+ * To be documented
+ * FIXME: To be fixed
+ */
+void enesim_surface_premul(Enesim_Surface *s)
+{
+}
 /*============================================================================*
  *                                   API                                      
* 
  
*============================================================================*/
@@ -61,6 +76,8 @@
                break;
        }
        va_end(va);
+       if (!(s->flags & ENESIM_SURFACE_PREMUL))
+               enesim_surface_premul(s);
        return s;
 }
 /**
@@ -174,6 +191,8 @@
                break;
        }
        va_end(va);
+       if (!(s->flags & ENESIM_SURFACE_PREMUL))
+                       enesim_surface_premul(s);
 }
 /**
  * To be documented
@@ -183,4 +202,48 @@
 enesim_surface_resize(Enesim_Surface *s, Enesim_Rectangle *srect, 
Enesim_Surface *d, Enesim_Rectangle *drect, int mode)
 {
 
+}
+/**
+ * To be documented
+ * FIXME: To be fixed
+ */
+EAPI void 
+enesim_surface_unpremul(Enesim_Surface *s)
+{
+       DATA32 *d, *e;
+       int len;
+       
+       assert(s);
+       /* FIXME this is only for 32bpp */
+       len = s->w * s->h;
+#define ARGB_JOIN(a,r,g,b) (((a) << 24) + ((r) << 16) + ((g) << 8) + (b))
+#define A_VAL(p) ((DATA8 *)(p))[3]
+#define R_VAL(p) ((DATA8 *)(p))[2]
+#define G_VAL(p) ((DATA8 *)(p))[1]
+#define B_VAL(p) ((DATA8 *)(p))[0]
+       d = s->data.argb8888.data;
+       e = d + len;
+       while (d < e)
+       {
+               DATA32 a = (*d >> 24);
+
+               if ((a > 0) && (a < 255))
+                       *d = ARGB_JOIN(a, (R_VAL(d) * 255) / a, (G_VAL(d) * 255)
+                                       / a, (B_VAL(d) * 255) / a);
+               d++;
+       }
+}
+/**
+ * To be documented
+ * FIXME: To be fixed
+ */
+EAPI void 
+enesim_surface_convert(Enesim_Surface *s, Enesim_Surface *d)
+{
+       assert(s);
+       assert(d);
+       if (s->format == d->format) return;
+       /* TODO call the correct convert function based on the src
+        * and dst format, the src and dst flags, etc
+        */
 }



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to