Title: [138390] trunk/Source/WebCore
Revision
138390
Author
[email protected]
Date
2012-12-21 11:13:01 -0800 (Fri, 21 Dec 2012)

Log Message

[WebGL][EFL][Qt] Transparent canvas composited non-transparent
https://bugs.webkit.org/show_bug.cgi?id=105325

Patch by Viatcheslav Ostapenko <[email protected]> on 2012-12-21
Reviewed by Kenneth Rohde Christiansen.

glXPixmap is always created without alpha channel because 1st GLXFBConfig
in a list doesn't support transparency.
Use the same code that is used to find GLXFBConfig with alpha for window
creation in GraphicsSurfacePrivate::createPixmap(). Code is moved to
findFBConfigWithAlpha() method.

Covered by fast/canvas/webgl/webgl-composite-modes-repaint.html

* platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp:
(WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
(WebCore::GraphicsSurfacePrivate::createPixmap):
(WebCore::GraphicsSurfacePrivate::findFBConfigWithAlpha):
(GraphicsSurfacePrivate):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138389 => 138390)


--- trunk/Source/WebCore/ChangeLog	2012-12-21 18:57:43 UTC (rev 138389)
+++ trunk/Source/WebCore/ChangeLog	2012-12-21 19:13:01 UTC (rev 138390)
@@ -1,3 +1,24 @@
+2012-12-21  Viatcheslav Ostapenko  <[email protected]>
+
+        [WebGL][EFL][Qt] Transparent canvas composited non-transparent
+        https://bugs.webkit.org/show_bug.cgi?id=105325
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        glXPixmap is always created without alpha channel because 1st GLXFBConfig 
+        in a list doesn't support transparency. 
+        Use the same code that is used to find GLXFBConfig with alpha for window 
+        creation in GraphicsSurfacePrivate::createPixmap(). Code is moved to 
+        findFBConfigWithAlpha() method.
+
+        Covered by fast/canvas/webgl/webgl-composite-modes-repaint.html
+
+        * platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp:
+        (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
+        (WebCore::GraphicsSurfacePrivate::createPixmap):
+        (WebCore::GraphicsSurfacePrivate::findFBConfigWithAlpha):
+        (GraphicsSurfacePrivate):
+
 2012-12-21  Dimitri Glazkov  <[email protected]>
 
         Unreviewed, rolling out r138376.

Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp (138389 => 138390)


--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp	2012-12-21 18:57:43 UTC (rev 138389)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp	2012-12-21 19:13:01 UTC (rev 138390)
@@ -168,18 +168,8 @@
         GLXFBConfig* fbConfigs = glXChooseFBConfig(m_display, DefaultScreen(m_display), attributes, &numReturned);
 
         // Make sure that we choose a configuration that supports an alpha mask.
-        for (int i = 0; i < numReturned; ++i) {
-            XVisualInfo* visualInfo = glXGetVisualFromFBConfig(m_display, fbConfigs[i]);
-            if (!visualInfo)
-                continue;
+        m_fbConfig = findFBConfigWithAlpha(fbConfigs, numReturned);
 
-            XRenderPictFormat* format = XRenderFindVisualFormat(m_display, visualInfo->visual);
-            if (format && format->direct.alphaMask > 0) {
-                m_fbConfig = fbConfigs[i];
-                break;
-            }
-        }
-
         XFree(fbConfigs);
 
         // Create a GLX context for OpenGL rendering
@@ -255,8 +245,11 @@
         int numberOfConfigs;
         GLXFBConfig* configs = glXChooseFBConfig(m_display, XDefaultScreen(m_display), glxSpec, &numberOfConfigs);
 
+        // If origin window has alpha then find config with alpha.
+        GLXFBConfig& config = m_hasAlpha ? findFBConfigWithAlpha(configs, numberOfConfigs) : configs[0];
+
         m_xPixmap = XCompositeNameWindowPixmap(m_display, winId);
-        m_glxPixmap = glXCreatePixmap(m_display, *configs, m_xPixmap, glxAttributes);
+        m_glxPixmap = glXCreatePixmap(m_display, config, m_xPixmap, glxAttributes);
 
         uint inverted = 0;
         glXQueryDrawable(m_display, m_glxPixmap, GLX_Y_INVERTED_EXT, &inverted);
@@ -356,6 +349,24 @@
 
     bool isReceiver() const { return m_isReceiver; }
 private:
+    GLXFBConfig& findFBConfigWithAlpha(GLXFBConfig* fbConfigs, int numberOfConfigs)
+    {
+        for (int i = 0; i < numberOfConfigs; ++i) {
+            XVisualInfo* visualInfo = glXGetVisualFromFBConfig(m_display, fbConfigs[i]);
+            if (!visualInfo)
+                continue;
+
+            XRenderPictFormat* format = XRenderFindVisualFormat(m_display, visualInfo->visual);
+            if (format && format->direct.alphaMask > 0) {
+                return fbConfigs[i];
+                break;
+            }
+        }
+
+        // Return 1st config as a fallback with no alpha support.
+        return fbConfigs[0];
+    }
+
     OffScreenRootWindow m_offScreenWindow;
     IntSize m_size;
     Display* m_display;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to