[maemo-commits] [maemo-commits] r17194 - in projects/haf/trunk/clutter: clutter/eglx debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Jan 15 13:37:00 EET 2009
Author: gw
Date: 2009-01-15 13:36:57 +0200 (Thu, 15 Jan 2009)
New Revision: 17194

Modified:
   projects/haf/trunk/clutter/clutter/eglx/clutter-eglx-texture-pixmap.c
   projects/haf/trunk/clutter/debian/changelog
Log:
Modified eglx_texture_pixmap to try creating a texture with alpha before
    it creates one without - this solves the transparent window issue on Rover


Modified: projects/haf/trunk/clutter/clutter/eglx/clutter-eglx-texture-pixmap.c
===================================================================
--- projects/haf/trunk/clutter/clutter/eglx/clutter-eglx-texture-pixmap.c	2009-01-15 11:10:16 UTC (rev 17193)
+++ projects/haf/trunk/clutter/clutter/eglx/clutter-eglx-texture-pixmap.c	2009-01-15 11:36:57 UTC (rev 17194)
@@ -49,6 +49,7 @@
 #endif
 
 #include <X11/extensions/Xcomposite.h>
+#include <string.h>
 
 #include "../x11/clutter-x11-texture-pixmap.h"
 #include "clutter-eglx-texture-pixmap.h"
@@ -452,6 +453,9 @@
                             EGLSurface *surface, EGLNativePixmapType p_or_w)
 {
    EGLConfig configs[20];
+   EGLint creation_config[
+                    MAX(sizeof(pixmap_creation_config),
+                        sizeof(window_creation_config))];
    int i, nconfigs = 0;
    EGLBoolean ret;
 
@@ -459,11 +463,13 @@
      {
        ret = eglChooseConfig (display, pixmap_config, configs,
 		              G_N_ELEMENTS (configs), &nconfigs);
+       memcpy(creation_config, pixmap_creation_config, sizeof(pixmap_creation_config));
      }
    else
      {
        ret = eglChooseConfig (display, window_config, configs,
 		              G_N_ELEMENTS (configs), &nconfigs);
+       memcpy(creation_config, window_creation_config, sizeof(window_creation_config));
      }
 
    if (ret != EGL_TRUE)
@@ -478,26 +484,35 @@
 
    for (i = 0; i < nconfigs; ++i)
     {
-      if (for_pixmap)
+      int j;
+      /* we don't seem to be able to find out if we have an alpha channel or
+       * not from the pixmap (depth may be 32, but no alpha) - so we'll
+       * just try once with alpha, and if it fails we try without */
+
+      /* set up texture for alpha and try to create a surface... */
+      for (j=0; creation_config[j]!=EGL_NONE; j+=2)
+        if (creation_config[j] == EGL_TEXTURE_FORMAT)
+          creation_config[j+1] = EGL_TEXTURE_RGBA;
+
+      *surface = eglCreatePixmapSurface (display, configs[i],
+                                         p_or_w, creation_config);
+
+      if (*surface == EGL_NO_SURFACE)
         {
+          /* set up texture for no alpha and try... */
+          for (j=0; creation_config[j]!=EGL_NONE; j+=2)
+            if (creation_config[j] == EGL_TEXTURE_FORMAT)
+              creation_config[j+1] = EGL_TEXTURE_RGB;
           *surface = eglCreatePixmapSurface (display, configs[i],
-		                             p_or_w, pixmap_creation_config);
+                                             p_or_w, creation_config);
         }
-      else
-        {
-          *surface = eglCreatePixmapSurface (display, configs[i],
-		                             p_or_w, window_creation_config);
-        }
 
-      if (*surface == EGL_NO_SURFACE)
-	{
-          g_debug ("%s: eglCreate(Pixmap|Window)Surface failed for config:",
-		   __FUNCTION__);
-	  print_config_info (configs[i]);
-          continue;
-	}
-      else
-	break;
+      if (*surface != EGL_NO_SURFACE)
+        break;
+
+      g_debug ("%s: eglCreate(Pixmap|Window)Surface failed for config:",
+               __FUNCTION__);
+      print_config_info (configs[i]);
    }
 
    return configs[i];

Modified: projects/haf/trunk/clutter/debian/changelog
===================================================================
--- projects/haf/trunk/clutter/debian/changelog	2009-01-15 11:10:16 UTC (rev 17193)
+++ projects/haf/trunk/clutter/debian/changelog	2009-01-15 11:36:57 UTC (rev 17194)
@@ -8,6 +8,8 @@
     set_from_rgb_data
   * Added clutter_x11_texture_pixmap_add_shape to deal with transparency in
     textures via XShapeGetRectangles    
+  * Modified eglx_texture_pixmap to try creating a texture with alpha before
+    it creates one without - this solves the transparent window issue on Rover
 
  -- Gordon Williams <gordon.williams at collabora.co.uk>  Mon, 14 Jan 2009 19:21:48 +0000
 


More information about the maemo-commits mailing list