Title: [153443] trunk/Source/WebCore
Revision
153443
Author
achristen...@apple.com
Date
2013-07-29 15:40:12 -0700 (Mon, 29 Jul 2013)

Log Message

Moved GLTransportSurface.h and .cpp out of efl-specific directory.
https://bugs.webkit.org/show_bug.cgi?id=119163

Reviewed by Alexis Menard.

* PlatformEfl.cmake: Changed directory of GLTransportSurface.cpp.
* platform/graphics/surfaces/GLTransportSurface.cpp: Copied from WebCore/platform/graphics/surfaces/efl/GLTransportSurface.cpp.
* platform/graphics/surfaces/GLTransportSurface.h: Copied from WebCore/platform/graphics/surfaces/efl/GLTransportSurface.h.
* platform/graphics/surfaces/efl/GLTransportSurface.cpp: Removed.
* platform/graphics/surfaces/efl/GLTransportSurface.h: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (153442 => 153443)


--- trunk/Source/WebCore/ChangeLog	2013-07-29 21:55:52 UTC (rev 153442)
+++ trunk/Source/WebCore/ChangeLog	2013-07-29 22:40:12 UTC (rev 153443)
@@ -1,5 +1,18 @@
 2013-07-29  Alex Christensen  <achristen...@apple.com>
 
+        Moved GLTransportSurface.h and .cpp out of efl-specific directory.
+        https://bugs.webkit.org/show_bug.cgi?id=119163
+
+        Reviewed by Alexis Menard.
+
+        * PlatformEfl.cmake: Changed directory of GLTransportSurface.cpp.
+        * platform/graphics/surfaces/GLTransportSurface.cpp: Copied from WebCore/platform/graphics/surfaces/efl/GLTransportSurface.cpp.
+        * platform/graphics/surfaces/GLTransportSurface.h: Copied from WebCore/platform/graphics/surfaces/efl/GLTransportSurface.h.
+        * platform/graphics/surfaces/efl/GLTransportSurface.cpp: Removed.
+        * platform/graphics/surfaces/efl/GLTransportSurface.h: Removed.
+
+2013-07-29  Alex Christensen  <achristen...@apple.com>
+
         Speculative implementation of missing GraphicsContext3D methods on Windows.
         https://bugs.webkit.org/show_bug.cgi?id=119167
 

Modified: trunk/Source/WebCore/PlatformEfl.cmake (153442 => 153443)


--- trunk/Source/WebCore/PlatformEfl.cmake	2013-07-29 21:55:52 UTC (rev 153442)
+++ trunk/Source/WebCore/PlatformEfl.cmake	2013-07-29 22:40:12 UTC (rev 153443)
@@ -299,7 +299,7 @@
         platform/graphics/opengl/GLPlatformSurface.cpp
         platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
         platform/graphics/surfaces/GraphicsSurface.cpp
-        platform/graphics/surfaces/efl/GLTransportSurface.cpp
+        platform/graphics/surfaces/GLTransportSurface.cpp
         platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp
         platform/graphics/surfaces/glx/X11Helper.cpp
         platform/graphics/texmap/TextureMapperGL.cpp

Copied: trunk/Source/WebCore/platform/graphics/surfaces/GLTransportSurface.cpp (from rev 153441, trunk/Source/WebCore/platform/graphics/surfaces/efl/GLTransportSurface.cpp) (0 => 153443)


--- trunk/Source/WebCore/platform/graphics/surfaces/GLTransportSurface.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/surfaces/GLTransportSurface.cpp	2013-07-29 22:40:12 UTC (rev 153443)
@@ -0,0 +1,263 @@
+/*
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GLTransportSurface.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "FloatRect.h"
+
+#if USE(GLX)
+#include "GLXSurface.h"
+#endif
+
+#if USE(EGL)
+#include "EGLSurface.h"
+#endif
+
+#include <texmap/TextureMapperShaderProgram.h>
+
+namespace WebCore {
+
+static const GLfloat vertices[] = { 0, 0, 1, 0, 1, 1, 0, 1 };
+static bool vertexArrayObjectSupported = false;
+
+PassOwnPtr<GLTransportSurface> GLTransportSurface::createTransportSurface(const IntSize& size, SurfaceAttributes attributes)
+{
+    OwnPtr<GLTransportSurface> surface;
+#if USE(GLX)
+    surface = adoptPtr(new GLXTransportSurface(size, attributes));
+#elif USE(EGL)
+    surface = EGLTransportSurface::createTransportSurface(size, attributes);
+#endif
+
+    if (surface && surface->handle() && surface->drawable())
+        return surface.release();
+
+    return nullptr;
+}
+
+GLTransportSurface::GLTransportSurface(const IntSize& size, SurfaceAttributes attributes)
+    : GLPlatformSurface(attributes)
+    , m_vbo(0)
+    , m_vertexHandle(0)
+    , m_boundTexture(0)
+{
+    m_rect = IntRect(IntPoint(), size);
+}
+
+GLTransportSurface::~GLTransportSurface()
+{
+}
+
+void GLTransportSurface::updateContents(const uint32_t texture)
+{
+    if (!m_shaderProgram)
+        initializeShaderProgram();
+
+    draw(texture);
+    swapBuffers();
+}
+
+void GLTransportSurface::setGeometry(const IntRect& newRect)
+{
+    m_rect = newRect;
+
+    if (!m_shaderProgram)
+        return;
+
+    updateTransformationMatrix();
+}
+
+void GLTransportSurface::destroy()
+{
+    m_rect = IntRect();
+
+    if (!m_shaderProgram || !m_context3D)
+        return;
+
+    ::glBindFramebuffer(GL_FRAMEBUFFER, 0);
+    ::glBindTexture(GL_TEXTURE_2D, 0);
+    ::glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+    if (m_vbo)
+        ::glDeleteBuffers(1, &m_vbo);
+
+    if (m_vertexHandle) {
+        m_context3D->getExtensions()->bindVertexArrayOES(0);
+        m_context3D->getExtensions()->deleteVertexArrayOES(m_vertexHandle);
+    } else if (m_shaderProgram)
+        ::glDisableVertexAttribArray(m_shaderProgram->vertexLocation());
+
+    ::glUseProgram(0);
+
+    m_shaderProgram = nullptr;
+    m_context3D = nullptr;
+    m_boundTexture = 0;
+}
+
+void GLTransportSurface::draw(const uint32_t texture)
+{
+    if (!m_vertexHandle)
+        bindArrayBuffer();
+
+    if (m_boundTexture != texture) {
+        ::glBindTexture(GL_TEXTURE_2D, texture);
+        m_boundTexture = texture;
+    }
+
+    ::glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+}
+
+void GLTransportSurface::bindArrayBuffer() const
+{
+    ::glEnableVertexAttribArray(m_shaderProgram->vertexLocation());
+    ::glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
+    ::glVertexAttribPointer(m_shaderProgram->vertexLocation(), 2, GraphicsContext3D::FLOAT, false, 0, 0);
+}
+
+void GLTransportSurface::updateTransformationMatrix()
+{
+    if (!m_shaderProgram)
+        return;
+
+    ::glViewport(m_rect.x(), m_rect.y(), m_rect.width(), m_rect.height());
+    m_boundTexture = 0;
+
+    FloatRect targetRect = FloatRect(m_rect);
+    TransformationMatrix identityMatrix;
+    TransformationMatrix matrix = TransformationMatrix(identityMatrix).multiply(TransformationMatrix::rectToRect(FloatRect(0, 0, 1, 1), targetRect));
+    m_shaderProgram->setMatrix(m_shaderProgram->modelViewMatrixLocation(), matrix);
+
+    // Taken from TextureMapperGL.
+    const float nearValue = 9999999;
+    const float farValue = -99999;
+
+    TransformationMatrix projectionMatrix = TransformationMatrix(2.0 / float(m_rect.width()), 0, 0, 0,
+        0, (-2.0) / float(m_rect.height()), 0, 0,
+        0, 0, -2.f / (farValue - nearValue), 0,
+        -1, 1, -(farValue + nearValue) / (farValue - nearValue), 1);
+
+    m_shaderProgram->setMatrix(m_shaderProgram->projectionMatrixLocation(), projectionMatrix);
+}
+
+void GLTransportSurface::initializeShaderProgram()
+{
+    if (!m_context3D)
+        m_context3D = GraphicsContext3D::createForCurrentGLContext();
+
+    vertexArrayObjectSupported = m_context3D->getExtensions()->supports("GL_OES_vertex_array_object");
+
+    TextureMapperShaderProgram::Options options = TextureMapperShaderProgram::Texture;
+    m_shaderProgram = TextureMapperShaderProgram::create(m_context3D, options);
+
+    ::glUseProgram(m_shaderProgram->programID());
+    ::glUniform1i(m_shaderProgram->samplerLocation(), 0);
+    ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+    ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+    TransformationMatrix flipTransform;
+    flipTransform.flipY();
+    flipTransform.translate(0, -1);
+    m_shaderProgram->setMatrix(m_shaderProgram->textureSpaceMatrixLocation(), flipTransform);
+
+    ::glUniform1f(m_shaderProgram->opacityLocation(), 1.0);
+
+    if (!m_vbo) {
+        ::glGenBuffers(1, &m_vbo);
+        ::glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
+        ::glBufferData(GL_ARRAY_BUFFER, sizeof(GC3Dfloat) * 8, vertices, GL_STATIC_DRAW);
+    }
+
+    // Create and set-up vertex array object.
+    if (vertexArrayObjectSupported) {
+        m_vertexHandle = m_context3D->getExtensions()->createVertexArrayOES();
+
+        if (m_vertexHandle) {
+            m_context3D->getExtensions()->bindVertexArrayOES(m_vertexHandle);
+            bindArrayBuffer();
+        }
+    }
+
+    updateTransformationMatrix();
+}
+
+PassOwnPtr<GLTransportSurfaceClient> GLTransportSurfaceClient::createTransportSurfaceClient(const PlatformBufferHandle handle, const IntSize& size, bool hasAlpha)
+{
+    OwnPtr<GLTransportSurfaceClient> client;
+#if USE(GLX)
+    client = adoptPtr(new GLXTransportSurfaceClient(handle, hasAlpha));
+    UNUSED_PARAM(size);
+#else
+    client = EGLTransportSurface::createTransportSurfaceClient(handle, size, hasAlpha);
+#endif
+
+    if (!client || !client->texture()) {
+        LOG_ERROR("Failed to Create Transport Surface client.");
+        return nullptr;
+    }
+
+    return client.release();
+}
+
+
+GLTransportSurfaceClient::GLTransportSurfaceClient()
+    : m_texture(0)
+{
+}
+
+GLTransportSurfaceClient::~GLTransportSurfaceClient()
+{
+}
+
+void GLTransportSurfaceClient::destroy()
+{
+    if (m_texture) {
+        glBindTexture(GL_TEXTURE_2D, 0);
+        glDeleteTextures(1, &m_texture);
+        m_texture = 0;
+    }
+}
+
+void GLTransportSurfaceClient::prepareTexture()
+{
+}
+
+void GLTransportSurfaceClient::createTexture()
+{
+    ::glGenTextures(1, &m_texture);
+    ::glBindTexture(GL_TEXTURE_2D, m_texture);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+}
+
+}
+
+#endif

Copied: trunk/Source/WebCore/platform/graphics/surfaces/GLTransportSurface.h (from rev 153441, trunk/Source/WebCore/platform/graphics/surfaces/efl/GLTransportSurface.h) (0 => 153443)


--- trunk/Source/WebCore/platform/graphics/surfaces/GLTransportSurface.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/surfaces/GLTransportSurface.h	2013-07-29 22:40:12 UTC (rev 153443)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GLTransportSurface_h
+#define GLTransportSurface_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "GLPlatformSurface.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class TextureMapperShaderProgram;
+
+class GLTransportSurface : public GLPlatformSurface {
+
+public:
+    // Creates a GL surface whose results can be transported to the UI process for display.
+    static PassOwnPtr<GLTransportSurface> createTransportSurface(const IntSize&, SurfaceAttributes = GLPlatformSurface::Default);
+    virtual ~GLTransportSurface();
+    virtual void updateContents(const uint32_t) OVERRIDE;
+    virtual void setGeometry(const IntRect&) OVERRIDE;
+    virtual void destroy() OVERRIDE;
+
+protected:
+    GLTransportSurface(const IntSize&, SurfaceAttributes);
+    void updateTransformationMatrix();
+    void bindArrayBuffer() const;
+    void initializeShaderProgram();
+    void draw(const uint32_t);
+
+    RefPtr<GraphicsContext3D> m_context3D;
+    RefPtr<TextureMapperShaderProgram> m_shaderProgram;
+    Platform3DObject m_vbo;
+    Platform3DObject m_vertexHandle;
+    GLuint m_boundTexture;
+};
+
+class GLTransportSurfaceClient {
+
+public:
+    static PassOwnPtr<GLTransportSurfaceClient> createTransportSurfaceClient(const PlatformBufferHandle, const IntSize&, bool);
+    virtual ~GLTransportSurfaceClient();
+    virtual void prepareTexture();
+    virtual void destroy();
+    GLuint texture() const { return m_texture; }
+
+protected:
+    GLTransportSurfaceClient();
+    void createTexture();
+    GLuint m_texture;
+};
+
+}
+
+#endif
+
+#endif

Deleted: trunk/Source/WebCore/platform/graphics/surfaces/efl/GLTransportSurface.cpp (153442 => 153443)


--- trunk/Source/WebCore/platform/graphics/surfaces/efl/GLTransportSurface.cpp	2013-07-29 21:55:52 UTC (rev 153442)
+++ trunk/Source/WebCore/platform/graphics/surfaces/efl/GLTransportSurface.cpp	2013-07-29 22:40:12 UTC (rev 153443)
@@ -1,263 +0,0 @@
-/*
- * Copyright (C) 2013 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GLTransportSurface.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "FloatRect.h"
-
-#if USE(GLX)
-#include "GLXSurface.h"
-#endif
-
-#if USE(EGL)
-#include "EGLSurface.h"
-#endif
-
-#include <texmap/TextureMapperShaderProgram.h>
-
-namespace WebCore {
-
-static const GLfloat vertices[] = { 0, 0, 1, 0, 1, 1, 0, 1 };
-static bool vertexArrayObjectSupported = false;
-
-PassOwnPtr<GLTransportSurface> GLTransportSurface::createTransportSurface(const IntSize& size, SurfaceAttributes attributes)
-{
-    OwnPtr<GLTransportSurface> surface;
-#if USE(GLX)
-    surface = adoptPtr(new GLXTransportSurface(size, attributes));
-#elif USE(EGL)
-    surface = EGLTransportSurface::createTransportSurface(size, attributes);
-#endif
-
-    if (surface && surface->handle() && surface->drawable())
-        return surface.release();
-
-    return nullptr;
-}
-
-GLTransportSurface::GLTransportSurface(const IntSize& size, SurfaceAttributes attributes)
-    : GLPlatformSurface(attributes)
-    , m_vbo(0)
-    , m_vertexHandle(0)
-    , m_boundTexture(0)
-{
-    m_rect = IntRect(IntPoint(), size);
-}
-
-GLTransportSurface::~GLTransportSurface()
-{
-}
-
-void GLTransportSurface::updateContents(const uint32_t texture)
-{
-    if (!m_shaderProgram)
-        initializeShaderProgram();
-
-    draw(texture);
-    swapBuffers();
-}
-
-void GLTransportSurface::setGeometry(const IntRect& newRect)
-{
-    m_rect = newRect;
-
-    if (!m_shaderProgram)
-        return;
-
-    updateTransformationMatrix();
-}
-
-void GLTransportSurface::destroy()
-{
-    m_rect = IntRect();
-
-    if (!m_shaderProgram || !m_context3D)
-        return;
-
-    ::glBindFramebuffer(GL_FRAMEBUFFER, 0);
-    ::glBindTexture(GL_TEXTURE_2D, 0);
-    ::glBindBuffer(GL_ARRAY_BUFFER, 0);
-
-    if (m_vbo)
-        ::glDeleteBuffers(1, &m_vbo);
-
-    if (m_vertexHandle) {
-        m_context3D->getExtensions()->bindVertexArrayOES(0);
-        m_context3D->getExtensions()->deleteVertexArrayOES(m_vertexHandle);
-    } else if (m_shaderProgram)
-        ::glDisableVertexAttribArray(m_shaderProgram->vertexLocation());
-
-    ::glUseProgram(0);
-
-    m_shaderProgram = nullptr;
-    m_context3D = nullptr;
-    m_boundTexture = 0;
-}
-
-void GLTransportSurface::draw(const uint32_t texture)
-{
-    if (!m_vertexHandle)
-        bindArrayBuffer();
-
-    if (m_boundTexture != texture) {
-        ::glBindTexture(GL_TEXTURE_2D, texture);
-        m_boundTexture = texture;
-    }
-
-    ::glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-}
-
-void GLTransportSurface::bindArrayBuffer() const
-{
-    ::glEnableVertexAttribArray(m_shaderProgram->vertexLocation());
-    ::glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
-    ::glVertexAttribPointer(m_shaderProgram->vertexLocation(), 2, GraphicsContext3D::FLOAT, false, 0, 0);
-}
-
-void GLTransportSurface::updateTransformationMatrix()
-{
-    if (!m_shaderProgram)
-        return;
-
-    ::glViewport(m_rect.x(), m_rect.y(), m_rect.width(), m_rect.height());
-    m_boundTexture = 0;
-
-    FloatRect targetRect = FloatRect(m_rect);
-    TransformationMatrix identityMatrix;
-    TransformationMatrix matrix = TransformationMatrix(identityMatrix).multiply(TransformationMatrix::rectToRect(FloatRect(0, 0, 1, 1), targetRect));
-    m_shaderProgram->setMatrix(m_shaderProgram->modelViewMatrixLocation(), matrix);
-
-    // Taken from TextureMapperGL.
-    const float nearValue = 9999999;
-    const float farValue = -99999;
-
-    TransformationMatrix projectionMatrix = TransformationMatrix(2.0 / float(m_rect.width()), 0, 0, 0,
-        0, (-2.0) / float(m_rect.height()), 0, 0,
-        0, 0, -2.f / (farValue - nearValue), 0,
-        -1, 1, -(farValue + nearValue) / (farValue - nearValue), 1);
-
-    m_shaderProgram->setMatrix(m_shaderProgram->projectionMatrixLocation(), projectionMatrix);
-}
-
-void GLTransportSurface::initializeShaderProgram()
-{
-    if (!m_context3D)
-        m_context3D = GraphicsContext3D::createForCurrentGLContext();
-
-    vertexArrayObjectSupported = m_context3D->getExtensions()->supports("GL_OES_vertex_array_object");
-
-    TextureMapperShaderProgram::Options options = TextureMapperShaderProgram::Texture;
-    m_shaderProgram = TextureMapperShaderProgram::create(m_context3D, options);
-
-    ::glUseProgram(m_shaderProgram->programID());
-    ::glUniform1i(m_shaderProgram->samplerLocation(), 0);
-    ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-    ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-    ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-    ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
-    TransformationMatrix flipTransform;
-    flipTransform.flipY();
-    flipTransform.translate(0, -1);
-    m_shaderProgram->setMatrix(m_shaderProgram->textureSpaceMatrixLocation(), flipTransform);
-
-    ::glUniform1f(m_shaderProgram->opacityLocation(), 1.0);
-
-    if (!m_vbo) {
-        ::glGenBuffers(1, &m_vbo);
-        ::glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
-        ::glBufferData(GL_ARRAY_BUFFER, sizeof(GC3Dfloat) * 8, vertices, GL_STATIC_DRAW);
-    }
-
-    // Create and set-up vertex array object.
-    if (vertexArrayObjectSupported) {
-        m_vertexHandle = m_context3D->getExtensions()->createVertexArrayOES();
-
-        if (m_vertexHandle) {
-            m_context3D->getExtensions()->bindVertexArrayOES(m_vertexHandle);
-            bindArrayBuffer();
-        }
-    }
-
-    updateTransformationMatrix();
-}
-
-PassOwnPtr<GLTransportSurfaceClient> GLTransportSurfaceClient::createTransportSurfaceClient(const PlatformBufferHandle handle, const IntSize& size, bool hasAlpha)
-{
-    OwnPtr<GLTransportSurfaceClient> client;
-#if USE(GLX)
-    client = adoptPtr(new GLXTransportSurfaceClient(handle, hasAlpha));
-    UNUSED_PARAM(size);
-#else
-    client = EGLTransportSurface::createTransportSurfaceClient(handle, size, hasAlpha);
-#endif
-
-    if (!client || !client->texture()) {
-        LOG_ERROR("Failed to Create Transport Surface client.");
-        return nullptr;
-    }
-
-    return client.release();
-}
-
-
-GLTransportSurfaceClient::GLTransportSurfaceClient()
-    : m_texture(0)
-{
-}
-
-GLTransportSurfaceClient::~GLTransportSurfaceClient()
-{
-}
-
-void GLTransportSurfaceClient::destroy()
-{
-    if (m_texture) {
-        glBindTexture(GL_TEXTURE_2D, 0);
-        glDeleteTextures(1, &m_texture);
-        m_texture = 0;
-    }
-}
-
-void GLTransportSurfaceClient::prepareTexture()
-{
-}
-
-void GLTransportSurfaceClient::createTexture()
-{
-    ::glGenTextures(1, &m_texture);
-    ::glBindTexture(GL_TEXTURE_2D, m_texture);
-    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-}
-
-}
-
-#endif

Deleted: trunk/Source/WebCore/platform/graphics/surfaces/efl/GLTransportSurface.h (153442 => 153443)


--- trunk/Source/WebCore/platform/graphics/surfaces/efl/GLTransportSurface.h	2013-07-29 21:55:52 UTC (rev 153442)
+++ trunk/Source/WebCore/platform/graphics/surfaces/efl/GLTransportSurface.h	2013-07-29 22:40:12 UTC (rev 153443)
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2013 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GLTransportSurface_h
-#define GLTransportSurface_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "GLPlatformSurface.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace WebCore {
-
-class TextureMapperShaderProgram;
-
-class GLTransportSurface : public GLPlatformSurface {
-
-public:
-    // Creates a GL surface whose results can be transported to the UI process for display.
-    static PassOwnPtr<GLTransportSurface> createTransportSurface(const IntSize&, SurfaceAttributes = GLPlatformSurface::Default);
-    virtual ~GLTransportSurface();
-    virtual void updateContents(const uint32_t) OVERRIDE;
-    virtual void setGeometry(const IntRect&) OVERRIDE;
-    virtual void destroy() OVERRIDE;
-
-protected:
-    GLTransportSurface(const IntSize&, SurfaceAttributes);
-    void updateTransformationMatrix();
-    void bindArrayBuffer() const;
-    void initializeShaderProgram();
-    void draw(const uint32_t);
-
-    RefPtr<GraphicsContext3D> m_context3D;
-    RefPtr<TextureMapperShaderProgram> m_shaderProgram;
-    Platform3DObject m_vbo;
-    Platform3DObject m_vertexHandle;
-    GLuint m_boundTexture;
-};
-
-class GLTransportSurfaceClient {
-
-public:
-    static PassOwnPtr<GLTransportSurfaceClient> createTransportSurfaceClient(const PlatformBufferHandle, const IntSize&, bool);
-    virtual ~GLTransportSurfaceClient();
-    virtual void prepareTexture();
-    virtual void destroy();
-    GLuint texture() const { return m_texture; }
-
-protected:
-    GLTransportSurfaceClient();
-    void createTexture();
-    GLuint m_texture;
-};
-
-}
-
-#endif
-
-#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to