fix direct egl img rgba ordering.
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 18 Aug 2010 09:53:14 +0000 (09:53 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 18 Aug 2010 09:53:14 +0000 (09:53 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@51273 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/gl_common/evas_gl_context.c
src/modules/engines/gl_common/evas_gl_image.c
src/modules/engines/gl_common/evas_gl_texture.c

index 4a33453..935aa8a 100644 (file)
@@ -1187,10 +1187,20 @@ evas_gl_common_context_image_push(Evas_GL_Context *gc,
    
    if (tex_only)
      {
-        if ((a == 255) && (r == 255) && (g == 255) && (b == 255))
-          prog = gc->shared->shader.tex_nomul.prog;
+        if (tex->pt->dyn.img)
+          {
+             if ((a == 255) && (r == 255) && (g == 255) && (b == 255))
+                prog = gc->shared->shader.img_nomul.prog;
+             else
+                prog = gc->shared->shader.img.prog;
+          }
         else
-          prog = gc->shared->shader.tex.prog;
+          {
+             if ((a == 255) && (r == 255) && (g == 255) && (b == 255))
+                prog = gc->shared->shader.tex_nomul.prog;
+             else
+                prog = gc->shared->shader.tex.prog;
+          }
      }
    else
      {
@@ -1769,16 +1779,32 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
    
    if (tex_only)
      {
-        if ((a == 255) && (r == 255) && (g == 255) && (b == 255))
+        if (tex->pt->dyn.img)
           {
-             if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) &&
-                 (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff))
-               prog = gc->shared->shader.tex_nomul.prog;
+             if ((a == 255) && (r == 255) && (g == 255) && (b == 255))
+               {
+                  if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) &&
+                      (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff))
+                     prog = gc->shared->shader.img_nomul.prog;
+                  else
+                     prog = gc->shared->shader.img.prog;
+               }
              else
-               prog = gc->shared->shader.tex.prog;
+                prog = gc->shared->shader.img.prog;
           }
         else
-          prog = gc->shared->shader.tex.prog;
+          {
+             if ((a == 255) && (r == 255) && (g == 255) && (b == 255))
+               {
+                  if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) &&
+                      (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff))
+                     prog = gc->shared->shader.tex_nomul.prog;
+                  else
+                     prog = gc->shared->shader.tex.prog;
+               }
+             else
+                prog = gc->shared->shader.tex.prog;
+          }
      }
    else
      {
index c06d170..83c9641 100644 (file)
@@ -280,6 +280,7 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint)
    im->content_hint = hint;
    if (!im->gc) return;
    if (!im->gc->shared->info.sec_image_map) return;
+   if (!im->gc->shared->info.bgra) return;
    // does not handle yuv yet.
    if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return;
    if (im->content_hint == EVAS_IMAGE_CONTENT_HINT_DYNAMIC)
index 6d2228a..385b23b 100644 (file)
@@ -442,12 +442,11 @@ _pool_tex_dynamic_new(Evas_GL_Context *gc, int w, int h, int intformat, int form
    attr[1] = pt->w;
    attr[3] = pt->h;
 
-   // FIXME: RGBA/ABGR is swapped.
-   // FIXME: seems a bit slower than i'd like - maybe too many flushes?
-   // FIXME: YCbCr no support as yet
    // FIXME: stride not fetched or used from engine api
    // FIXME: have to set dynamic AFTER setting alpha and size. shoudl allow
    //        any order
+   // FIXME: seems a bit slower than i'd like - maybe too many flushes?
+   // FIXME: YCbCr no support as yet
    pt->dyn.img = secsym_eglCreateImage(egldisplay,
                                        EGL_NO_CONTEXT, 
                                        EGL_MAP_GL_TEXTURE_2D_SEC,
@@ -671,16 +670,16 @@ evas_gl_common_texture_dynamic_new(Evas_GL_Context *gc, Evas_GL_Image *im)
    if (tex->alpha)
      {
         if (gc->shared->info.bgra)
-          tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, rgba_ifmt, rgba_fmt);
+          tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, bgra_ifmt, bgra_fmt);
         else
-          tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, rgba_ifmt, rgba_fmt);
+          tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, bgra_ifmt, bgra_fmt);
      }
    else
      {
         if (gc->shared->info.bgra)
-          tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, rgb_ifmt, rgb_fmt);
+          tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, bgra_ifmt, bgra_fmt);
         else
-          tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, rgb_ifmt, rgb_fmt);
+          tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, bgra_ifmt, bgra_fmt);
      }
    if (!tex->pt)
      {