Title: [139724] trunk/Source/WebCore
Revision
139724
Author
[email protected]
Date
2013-01-15 00:54:59 -0800 (Tue, 15 Jan 2013)

Log Message

[EFL] [WebGL] Minor cleanup in PlatformContext.
https://bugs.webkit.org/show_bug.cgi?id=106758

Patch by Kondapally Kalyan <[email protected]> on 2013-01-15
Reviewed by Kenneth Rohde Christiansen.

We currently have different implementations of CurrentContextWrapper for EGL and GLX.
This patch cleans up the code to use same implementation for both the backends.

* platform/graphics/opengl/GLPlatformContext.cpp:
(GLCurrentContextWrapper):
(WebCore::GLCurrentContextWrapper::GLCurrentContextWrapper):
(WebCore::GLCurrentContextWrapper::~GLCurrentContextWrapper):

Common implementation for both EGL and GLX.
(WebCore::createOffScreenContext):
(WebCore::GLPlatformContext::createContext):
* platform/graphics/surfaces/egl/EGLContext.cpp:
* platform/graphics/surfaces/egl/EGLContext.h:
* platform/graphics/surfaces/glx/GLXContext.h:

Removed code related to CurrentContextWrapper.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (139723 => 139724)


--- trunk/Source/WebCore/ChangeLog	2013-01-15 08:30:34 UTC (rev 139723)
+++ trunk/Source/WebCore/ChangeLog	2013-01-15 08:54:59 UTC (rev 139724)
@@ -1,3 +1,27 @@
+2013-01-15  Kondapally Kalyan  <[email protected]>
+
+        [EFL] [WebGL] Minor cleanup in PlatformContext.
+        https://bugs.webkit.org/show_bug.cgi?id=106758
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        We currently have different implementations of CurrentContextWrapper for EGL and GLX.
+        This patch cleans up the code to use same implementation for both the backends.
+
+        * platform/graphics/opengl/GLPlatformContext.cpp:
+        (GLCurrentContextWrapper):
+        (WebCore::GLCurrentContextWrapper::GLCurrentContextWrapper):
+        (WebCore::GLCurrentContextWrapper::~GLCurrentContextWrapper):
+
+        Common implementation for both EGL and GLX.
+        (WebCore::createOffScreenContext):
+        (WebCore::GLPlatformContext::createContext):
+        * platform/graphics/surfaces/egl/EGLContext.cpp:
+        * platform/graphics/surfaces/egl/EGLContext.h:
+        * platform/graphics/surfaces/glx/GLXContext.h:
+
+        Removed code related to CurrentContextWrapper.
+
 2013-01-14  Ryosuke Niwa  <[email protected]>
 
         platform/mac/accessibility/progressbar.html fails on Mac WK1 and WK2

Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp (139723 => 139724)


--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp	2013-01-15 08:30:34 UTC (rev 139723)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp	2013-01-15 08:54:59 UTC (rev 139724)
@@ -36,6 +36,10 @@
 
 #include "NotImplemented.h"
 
+#if HAVE(GLX)
+#include <GL/glx.h>
+#endif
+
 namespace WebCore {
 
 #if USE(OPENGL_ES_2)
@@ -45,23 +49,31 @@
 #endif
 static GLPlatformContext* m_currentContext = 0;
 
-static PassOwnPtr<GLPlatformContext> createOffScreenContext()
-{
-#if USE(GLX)
-    return adoptPtr(new GLXOffScreenContext());
+class GLCurrentContextWrapper : public GLPlatformContext {
+
+public:
+    GLCurrentContextWrapper()
+        : GLPlatformContext()
+    {
+        // FIXME:: This is a workaround until support to build evas with EGL has been added.
+#if USE(GLX) || PLATFORM(EFL)
+        m_contextHandle = glXGetCurrentContext();
 #elif USE(EGL)
-    return adoptPtr(new EGLOffScreenContext());
+        m_contextHandle = eglGetCurrentContext();
 #endif
+        if (m_contextHandle)
+            m_currentContext = this;
+    }
 
-    return nullptr;
-}
+    virtual ~GLCurrentContextWrapper() { }
+};
 
-static PassOwnPtr<GLPlatformContext> createCurrentContextWrapper()
+static PassOwnPtr<GLPlatformContext> createOffScreenContext()
 {
 #if USE(GLX)
-    return adoptPtr(new GLXCurrentContextWrapper());
+    return adoptPtr(new GLXOffScreenContext());
 #elif USE(EGL)
-    return adoptPtr(new EGLCurrentContextWrapper());
+    return adoptPtr(new EGLOffScreenContext());
 #endif
 
     return nullptr;
@@ -104,12 +116,12 @@
 
     switch (renderStyle) {
     case GraphicsContext3D::RenderOffscreen:
-        if (OwnPtr<GLPlatformContext> glxContext = createOffScreenContext())
-            return glxContext.release();
+        if (OwnPtr<GLPlatformContext> context = createOffScreenContext())
+            return context.release();
         break;
     case GraphicsContext3D::RenderToCurrentGLContext:
-        if (OwnPtr<GLPlatformContext> glxContext = createCurrentContextWrapper())
-            return glxContext.release();
+        if (OwnPtr<GLPlatformContext> context = adoptPtr(new GLCurrentContextWrapper()))
+            return context.release();
         break;
     case GraphicsContext3D::RenderDirectlyToHostWindow:
         ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp (139723 => 139724)


--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp	2013-01-15 08:30:34 UTC (rev 139723)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp	2013-01-15 08:54:59 UTC (rev 139724)
@@ -30,10 +30,6 @@
 
 #include <wtf/text/WTFString.h>
 
-#if HAVE(GLX)
-#include <GL/glx.h>
-#endif
-
 namespace WebCore {
 
 static const EGLint contextAttributes[] = {
@@ -65,17 +61,6 @@
     return isRobustnessExtensionSupported;
 }
 
-EGLCurrentContextWrapper::EGLCurrentContextWrapper()
-    : GLPlatformContext()
-{
-}
-
-// FIXME: This is a temporary workaround until we are able to build evas with EGL support.
-PlatformContext EGLCurrentContextWrapper::handle() const
-{
-    return glXGetCurrentContext();
-}
-
 EGLOffScreenContext::EGLOffScreenContext()
     : GLPlatformContext()
     , m_display(0)

Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLContext.h (139723 => 139724)


--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLContext.h	2013-01-15 08:30:34 UTC (rev 139723)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLContext.h	2013-01-15 08:54:59 UTC (rev 139724)
@@ -32,14 +32,6 @@
 
 namespace WebCore {
 
-class EGLCurrentContextWrapper : public GLPlatformContext {
-
-public:
-    EGLCurrentContextWrapper();
-    virtual PlatformContext handle() const OVERRIDE;
-    virtual ~EGLCurrentContextWrapper() { }
-};
-
 class EGLOffScreenContext : public GLPlatformContext {
 
 public:

Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.h (139723 => 139724)


--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.h	2013-01-15 08:30:34 UTC (rev 139723)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.h	2013-01-15 08:54:59 UTC (rev 139724)
@@ -32,18 +32,6 @@
 
 namespace WebCore {
 
-class GLXCurrentContextWrapper : public GLPlatformContext {
-
-public:
-    GLXCurrentContextWrapper()
-        : GLPlatformContext()
-    {
-        m_contextHandle = glXGetCurrentContext();
-    }
-
-    virtual ~GLXCurrentContextWrapper() { }
-};
-
 class GLXOffScreenContext : public GLPlatformContext {
 
 public:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to