Hi all,

I'm submitting a patch that changes the color format for Evas GL.

When I first wrote Evas_GL, I just had EVAS_GL_RGB_8 and EVAS_GL_RGBA_8 and etc
but it was misleading for some people.  It was more of a filler since
I couldn't decide on
a name.  I'm finally changing it to make it more clear.

typedef enum _Evas_GL_Color_Format
{
    EVAS_GL_RGB_888     = 0,      // 8 bits per channel
    EVAS_GL_RGBA_8888 = 1
} Evas_GL_Color_Format;

typedef enum _Evas_GL_Depth_Bits
{
    EVAS_GL_DEPTH_NONE   = 0,
    EVAS_GL_DEPTH_BIT_8  = 1,
    EVAS_GL_DEPTH_BIT_16 = 2,
    EVAS_GL_DEPTH_BIT_24 = 3,
    EVAS_GL_DEPTH_BIT_32 = 4,
} Evas_GL_Depth_Bits;

typedef enum _Evas_GL_Stencil_Bits
{
    EVAS_GL_STENCIL_NONE   = 0,
    EVAS_GL_STENCIL_BIT_1  = 1,
    EVAS_GL_STENCIL_BIT_2  = 2,
    EVAS_GL_STENCIL_BIT_4  = 3,
    EVAS_GL_STENCIL_BIT_8  = 4,
    EVAS_GL_STENCIL_BIT_16 = 5,
} Evas_GL_Stencil_Bits;

This will deal with backward compatibility issues as long as we keep the
ordering and the number same.

I'm also including an Elmentary patch for elm_glview.c that changes the format
accordingly.

Two patches:
   evas_gl_format_change.path                    // For Evas
   elmglview_evas_gl_format_change.patch   // For Elementary


Thanks a bunch.

cheers,
Sung
Index: src/lib/Evas_GL.h
===================================================================
--- src/lib/Evas_GL.h	(revision 64471)
+++ src/lib/Evas_GL.h	(working copy)
@@ -18,29 +18,27 @@
 
 typedef enum _Evas_GL_Color_Format
 {
-    EVAS_GL_RGB_8,      // 8 bits per channel
-    EVAS_GL_RGBA_8,
-    EVAS_GL_RGB_32,     // 32-bits per channel
-    EVAS_GL_RGBA_32,
+    EVAS_GL_RGB_888   = 0,
+    EVAS_GL_RGBA_8888 = 1
 } Evas_GL_Color_Format;
 
 typedef enum _Evas_GL_Depth_Bits
 {
-    EVAS_GL_DEPTH_BIT_8,
-    EVAS_GL_DEPTH_BIT_16,
-    EVAS_GL_DEPTH_BIT_24,
-    EVAS_GL_DEPTH_BIT_32,
-    EVAS_GL_DEPTH_NONE
+    EVAS_GL_DEPTH_NONE   = 0,
+    EVAS_GL_DEPTH_BIT_8  = 1,
+    EVAS_GL_DEPTH_BIT_16 = 2,
+    EVAS_GL_DEPTH_BIT_24 = 3,
+    EVAS_GL_DEPTH_BIT_32 = 4,
 } Evas_GL_Depth_Bits;
 
 typedef enum _Evas_GL_Stencil_Bits
 {
-    EVAS_GL_STENCIL_BIT_1,
-    EVAS_GL_STENCIL_BIT_2,
-    EVAS_GL_STENCIL_BIT_4,
-    EVAS_GL_STENCIL_BIT_8,
-    EVAS_GL_STENCIL_BIT_16,
-    EVAS_GL_STENCIL_NONE
+    EVAS_GL_STENCIL_NONE   = 0,
+    EVAS_GL_STENCIL_BIT_1  = 1,
+    EVAS_GL_STENCIL_BIT_2  = 2,
+    EVAS_GL_STENCIL_BIT_4  = 3,
+    EVAS_GL_STENCIL_BIT_8  = 4,
+    EVAS_GL_STENCIL_BIT_16 = 5,
 } Evas_GL_Stencil_Bits;
 
 struct _Evas_GL_Config
@@ -98,7 +96,7 @@
    // config for the surface for evas_gl
    Evas_GL_Config config =
      {
-        EVAS_GL_RGBA_8,
+        EVAS_GL_RGBA_8888,
         EVAS_GL_DEPTH_NONE,
         EVAS_GL_STENCIL_NONE
      };
Index: src/modules/engines/gl_x11/evas_engine.c
===================================================================
--- src/modules/engines/gl_x11/evas_engine.c	(revision 64471)
+++ src/modules/engines/gl_x11/evas_engine.c	(working copy)
@@ -2778,20 +2778,14 @@
    // Also initialize pixel format here as well...
    switch(cfg->color_format)
      {
-      case EVAS_GL_RGB_8:
+      case EVAS_GL_RGB_888:
          sfc->rt_fmt          = GL_RGB;
          sfc->rt_internal_fmt = GL_RGB;
          break;
-      case EVAS_GL_RGBA_8:
+      case EVAS_GL_RGBA_8888:
          sfc->rt_fmt          = GL_RGBA;
          sfc->rt_internal_fmt = GL_RGBA;
          break;
-      case EVAS_GL_RGB_32:
-         // Only supported on some hw
-         // Fill it in later...
-      case EVAS_GL_RGBA_32:
-         // Only supported on some hw
-         // Fill it in later...
       default:
          ERR("Invalid Color Format!");
          return 0;
Index: src/lib/elm_glview.c
===================================================================
--- src/lib/elm_glview.c	(revision 64471)
+++ src/lib/elm_glview.c	(working copy)
@@ -219,7 +219,7 @@
    Evas_Object *obj;
    Evas *e;
    Widget_Data *wd;
-   Evas_GL_Config cfg = { EVAS_GL_RGB_8,
+   Evas_GL_Config cfg = { EVAS_GL_RGB_888,
                           EVAS_GL_DEPTH_NONE,
                           EVAS_GL_STENCIL_NONE };
 
@@ -295,14 +295,14 @@
 {
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
    Widget_Data *wd = elm_widget_data_get(obj);
-   Evas_GL_Config cfg = { EVAS_GL_RGBA_8,
+   Evas_GL_Config cfg = { EVAS_GL_RGBA_8888,
                           EVAS_GL_DEPTH_NONE,
                           EVAS_GL_STENCIL_NONE };
    if (!wd) return EINA_FALSE;
 
    // Set the configs
    if (mode & ELM_GLVIEW_ALPHA)
-     cfg.color_format = EVAS_GL_RGBA_8;
+     cfg.color_format = EVAS_GL_RGBA_8888;
 
    if (mode & ELM_GLVIEW_DEPTH)
      cfg.depth_bits = EVAS_GL_DEPTH_BIT_24;
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to