[WK2] Create dummy pixmap surface instead of pbuffer surface for WebGL.
authorHeejin Chung <heejin.r.chung@samsung.com>
Thu, 30 Aug 2012 07:28:18 +0000 (16:28 +0900)
committerHeejin Chung <heejin.r.chung@samsung.com>
Thu, 30 Aug 2012 07:28:18 +0000 (16:28 +0900)
Change-Id: Ib3d3d2c7b9973ab0bd9358286b74cca23f74f33f

Source/WebCore/platform/graphics/efl/GraphicsContext3DOffscreen.cpp
Source/WebCore/platform/graphics/efl/GraphicsContext3DOffscreen.h

index 8dfa59a..9c20962 100755 (executable)
@@ -54,6 +54,8 @@
 #define GLchar char
 #endif
 
+static Display* g_nativeDisplay = 0;
+static int g_nativeWindow = 0;
 namespace WebCore {
 
 PassOwnPtr<GraphicsContext3DOffscreen> GraphicsContext3DOffscreen::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow)
@@ -81,6 +83,7 @@ GraphicsContext3DOffscreen::GraphicsContext3DOffscreen(GraphicsContext3D::Attrib
     , m_display(EGL_NO_DISPLAY)
     , m_context(EGL_NO_CONTEXT)
     , m_surface(EGL_NO_SURFACE)
+    , m_pixmapID(0)
 #endif
 {
 }
@@ -111,6 +114,10 @@ GraphicsContext3DOffscreen::~GraphicsContext3DOffscreen()
         eglDestroyContext(m_display, m_context);
         m_context = EGL_NO_CONTEXT;
     }
+    if (m_pixmapID) {
+        XFreePixmap(g_nativeDisplay, m_pixmapID);
+        m_pixmapID = 0;
+    }
     m_display = 0;
 #endif
 #if USE(ACCELERATED_COMPOSITING) && !USE(TIZEN_TEXTURE_MAPPER)
@@ -134,16 +141,16 @@ bool GraphicsContext3DOffscreen::initialize(HostWindow* hostWindow)
     if (!GraphicsContext3DInternal::initialize(hostWindow))
         return false;
 #if ENABLE(TIZEN_WEBKIT2)
-    Display* nativeDisplay = XOpenDisplay(0);
-    int nativeWindow = XCreateSimpleWindow(nativeDisplay, XDefaultRootWindow(nativeDisplay),
+    g_nativeDisplay = XOpenDisplay(0);
+    g_nativeWindow = XCreateSimpleWindow(g_nativeDisplay, XDefaultRootWindow(g_nativeDisplay),
                             0, 0, 1, 1, 0,
-                            BlackPixel(nativeDisplay, 0), WhitePixel(nativeDisplay, 0));
-    XFlush(nativeDisplay);
+                            BlackPixel(g_nativeDisplay, 0), WhitePixel(g_nativeDisplay, 0));
+    XFlush(g_nativeDisplay);
 
     EGLint major, minor;
     EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
 
-    m_display = eglGetDisplay(nativeDisplay);
+    m_display = eglGetDisplay(g_nativeDisplay);
     if (m_display == EGL_NO_DISPLAY)
         return false;
 
@@ -174,9 +181,8 @@ bool GraphicsContext3DOffscreen::initialize(HostWindow* hostWindow)
     m_context = eglCreateContext(m_display, surfaceConfig, EGL_NO_CONTEXT, contextAttribs);
     if( m_context == EGL_NO_CONTEXT)
         return false;
-
-    EGLint surfaceAttribs[] = { EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE };
-    m_surface = eglCreatePbufferSurface(m_display, surfaceConfig, surfaceAttribs);
+    m_pixmapID = XCreatePixmap(g_nativeDisplay, g_nativeWindow, 1, 1, 32);
+    m_surface = eglCreatePixmapSurface(m_display, surfaceConfig, m_pixmapID, NULL);
     if (m_surface == EGL_NO_SURFACE)
         return false;
     m_acceleratedCompositingEnabled = true;
index 8857e62..ef43bf5 100755 (executable)
@@ -121,6 +121,7 @@ private:
     EGLDisplay m_display;
     EGLContext m_context;
     EGLSurface m_surface;
+    int m_pixmapID;
 #endif
 
 //Angle intgration block