Diff
Modified: trunk/Source/WebCore/ChangeLog (107814 => 107815)
--- trunk/Source/WebCore/ChangeLog 2012-02-15 15:29:40 UTC (rev 107814)
+++ trunk/Source/WebCore/ChangeLog 2012-02-15 15:33:07 UTC (rev 107815)
@@ -1,3 +1,26 @@
+2012-02-15 Simon Hausmann <[email protected]>
+
+ [Qt] Move Qt platform specific GL Context/Surface creation out of WebCore into WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=78692
+
+ Reviewed by Noam Rosenthal.
+
+ Replace the "glWidget" term in the GraphicsContext with "surface" and delegate
+ the context and surface creation to the page client.
+
+ * platform/graphics/GraphicsContext3D.h:
+ * platform/graphics/qt/GraphicsContext3DQt.cpp:
+ (GraphicsContext3DPrivate):
+ (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
+ (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
+ (WebCore::GraphicsContext3DPrivate::blitMultisampleFramebufferAndRestoreContext):
+ (WebCore::GraphicsContext3DPrivate::makeCurrentIfNeeded):
+ (WebCore::GraphicsContext3D::GraphicsContext3D):
+ (WebCore::GraphicsContext3D::~GraphicsContext3D):
+ (WebCore::GraphicsContext3D::platformGraphicsContext3D):
+ * platform/qt/QWebPageClient.h:
+ (QWebPageClient):
+
2012-02-15 No'am Rosenthal <[email protected]>
[Texmap] Support filters in TextureMapperImageBuffer
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (107814 => 107815)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2012-02-15 15:29:40 UTC (rev 107814)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2012-02-15 15:33:07 UTC (rev 107815)
@@ -55,6 +55,8 @@
QT_BEGIN_NAMESPACE
class QPainter;
class QRect;
+class QGLWidget;
+class QGLContext;
QT_END_NAMESPACE
#elif PLATFORM(GTK) || PLATFORM(EFL)
typedef unsigned int GLuint;
@@ -62,6 +64,9 @@
#if PLATFORM(MAC)
typedef CGLContextObj PlatformGraphicsContext3D;
+#elif PLATFORM(QT)
+typedef QGLContext* PlatformGraphicsContext3D;
+typedef QGLWidget* PlatformGraphicsSurface3D;
#else
typedef void* PlatformGraphicsContext3D;
#endif
Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp (107814 => 107815)
--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp 2012-02-15 15:29:40 UTC (rev 107814)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp 2012-02-15 15:33:07 UTC (rev 107815)
@@ -71,7 +71,6 @@
GraphicsContext3DPrivate(GraphicsContext3D*, HostWindow*);
~GraphicsContext3DPrivate();
- QGLWidget* getViewportGLWidget();
#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
virtual void paintToTextureMapper(TextureMapper*, const FloatRect& target, const TransformationMatrix&, float opacity, BitmapTexture* mask);
#endif
@@ -83,8 +82,8 @@
GraphicsContext3D* m_context;
HostWindow* m_hostWindow;
- QGLWidget* m_glWidget;
- QGLWidget* m_viewportGLWidget;
+ PlatformGraphicsSurface3D m_surface;
+ PlatformGraphicsContext3D m_platformContext;
};
bool GraphicsContext3D::isGLES2Compliant() const
@@ -99,41 +98,26 @@
GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, HostWindow* hostWindow)
: m_context(context)
, m_hostWindow(hostWindow)
- , m_glWidget(0)
- , m_viewportGLWidget(0)
+ , m_surface(0)
+ , m_platformContext(0)
{
- m_viewportGLWidget = getViewportGLWidget();
-
- if (m_viewportGLWidget)
- m_glWidget = new QGLWidget(0, m_viewportGLWidget);
- else
- m_glWidget = new QGLWidget();
-
- // Geometry can be set to zero because m_glWidget is used only for its QGLContext.
- m_glWidget->setGeometry(0, 0, 0, 0);
-
+ QWebPageClient* webPageClient = m_hostWindow->platformPageClient();
+ if (!webPageClient)
+ return;
+ webPageClient->createPlatformGraphicsContext3D(&m_platformContext, &m_surface);
+ if (!m_surface)
+ return;
makeCurrentIfNeeded();
}
GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
{
- delete m_glWidget;
- m_glWidget = 0;
+ delete m_surface;
+ m_surface = 0;
+ // ### Delete context?
+ m_platformContext = 0;
}
-QGLWidget* GraphicsContext3DPrivate::getViewportGLWidget()
-{
- QWebPageClient* webPageClient = m_hostWindow->platformPageClient();
- if (!webPageClient)
- return 0;
-
- QAbstractScrollArea* scrollArea = qobject_cast<QAbstractScrollArea*>(webPageClient->ownerWidget());
- if (scrollArea)
- return qobject_cast<QGLWidget*>(scrollArea->viewport());
-
- return 0;
-}
-
static inline quint32 swapBgrToRgb(quint32 pixel)
{
return ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff) | (pixel & 0xff00ff00);
@@ -216,23 +200,23 @@
return;
const QGLContext* currentContext = QGLContext::currentContext();
- const QGLContext* widgetContext = m_glWidget->context();
+ const QGLContext* widgetContext = m_surface->context();
if (currentContext != widgetContext)
- m_glWidget->makeCurrent();
+ m_surface->makeCurrent();
blitMultisampleFramebuffer();
if (currentContext) {
if (currentContext != widgetContext)
const_cast<QGLContext*>(currentContext)->makeCurrent();
} else
- m_glWidget->doneCurrent();
+ m_surface->doneCurrent();
}
bool GraphicsContext3DPrivate::makeCurrentIfNeeded() const
{
const QGLContext* currentContext = QGLContext::currentContext();
- const QGLContext* widgetContext = m_glWidget->context();
+ const QGLContext* widgetContext = m_surface->context();
if (currentContext != widgetContext)
- m_glWidget->makeCurrent();
+ m_surface->makeCurrent();
return QGLContext::currentContext() == widgetContext;
}
@@ -273,7 +257,7 @@
validateAttributes();
#endif
- if (!m_private->m_glWidget->isValid()) {
+ if (!m_private->m_surface) {
LOG_ERROR("GraphicsContext3D: QGLWidget initialization failed.");
m_private = nullptr;
return;
@@ -351,7 +335,7 @@
GraphicsContext3D::~GraphicsContext3D()
{
makeContextCurrent();
- if (!m_private->m_glWidget->isValid())
+ if (!m_private->m_surface->isValid())
return;
glDeleteTextures(1, &m_texture);
glDeleteFramebuffers(1, &m_fbo);
@@ -374,7 +358,7 @@
PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D()
{
- return m_private->m_glWidget;
+ return m_private->m_platformContext;
}
Platform3DObject GraphicsContext3D::platformTexture() const
Modified: trunk/Source/WebCore/platform/qt/QWebPageClient.h (107814 => 107815)
--- trunk/Source/WebCore/platform/qt/QWebPageClient.h 2012-02-15 15:29:40 UTC (rev 107814)
+++ trunk/Source/WebCore/platform/qt/QWebPageClient.h 2012-02-15 15:33:07 UTC (rev 107815)
@@ -34,6 +34,10 @@
#include <GraphicsLayer.h>
#endif
+#if ENABLE(WEBGL)
+#include <GraphicsContext3D.h>
+#endif
+
#include <QPalette>
#include <QRect>
@@ -101,6 +105,11 @@
virtual void setWidgetVisible(WebCore::Widget*, bool visible) = 0;
+#if ENABLE(WEBGL)
+ virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*,
+ PlatformGraphicsSurface3D*) = 0;
+#endif
+
protected:
#ifndef QT_NO_CURSOR
virtual QCursor cursor() const = 0;
Modified: trunk/Source/WebKit/qt/ChangeLog (107814 => 107815)
--- trunk/Source/WebKit/qt/ChangeLog 2012-02-15 15:29:40 UTC (rev 107814)
+++ trunk/Source/WebKit/qt/ChangeLog 2012-02-15 15:33:07 UTC (rev 107815)
@@ -1,3 +1,21 @@
+2012-02-15 Simon Hausmann <[email protected]>
+
+ [Qt] Move Qt platform specific GL Context/Surface creation out of WebCore into WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=78692
+
+ Reviewed by Noam Rosenthal.
+
+ Implement GLWidget and GLContext creation from the page client interface.
+
+ * WebCoreSupport/PageClientQt.cpp:
+ (createPlatformGraphicsContext3DFromWidget):
+ (WebCore):
+ (WebCore::PageClientQWidget::createPlatformGraphicsContext3D):
+ (WebCore::PageClientQGraphicsWidget::createPlatformGraphicsContext3D):
+ * WebCoreSupport/PageClientQt.h:
+ (PageClientQWidget):
+ (PageClientQGraphicsWidget):
+
2012-02-14 Simon Hausmann <[email protected]>
[Qt] Eliminate first set of QtWidgets dependencies from WebCore
Modified: trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp (107814 => 107815)
--- trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp 2012-02-15 15:29:40 UTC (rev 107814)
+++ trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp 2012-02-15 15:33:07 UTC (rev 107815)
@@ -27,6 +27,34 @@
#include <QX11Info>
#endif
+#if ENABLE(WEBGL)
+#include <QGLWidget>
+
+static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformGraphicsContext3D* context,
+ PlatformGraphicsSurface3D* surface)
+{
+ *context = 0;
+ *surface = 0;
+ QAbstractScrollArea* scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
+ if (!scrollArea)
+ return;
+
+ QGLWidget* glViewport = qobject_cast<QGLWidget*>(scrollArea->viewport());
+ if (!glViewport)
+ return;
+ QGLWidget* glWidget = new QGLWidget(0, glViewport);
+ if (glWidget->isValid()) {
+ // Geometry can be set to zero because m_glWidget is used only for its QGLContext.
+ glWidget->setGeometry(0, 0, 0, 0);
+ *surface = glWidget;
+ *context = const_cast<QGLContext*>(glWidget->context());
+ } else {
+ delete glWidget;
+ glWidget = 0;
+ }
+}
+#endif
+
#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
#include "TextureMapper.h"
#include "texmap/TextureMapperLayer.h"
@@ -186,6 +214,14 @@
qtWidget->setVisible(visible);
}
+#if ENABLE(WEBGL)
+void PageClientQWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context,
+ PlatformGraphicsSurface3D* surface)
+{
+ createPlatformGraphicsContext3DFromWidget(view, context, surface);
+}
+#endif
+
#if !defined(QT_NO_GRAPHICSVIEW)
PageClientQGraphicsWidget::~PageClientQGraphicsWidget()
{
@@ -428,4 +464,12 @@
}
#endif // QT_NO_GRAPHICSVIEW
+#if ENABLE(WEBGL)
+void PageClientQGraphicsWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context,
+ PlatformGraphicsSurface3D* surface)
+{
+ createPlatformGraphicsContext3DFromWidget(ownerWidget(), context, surface);
+}
+#endif
+
} // namespace WebCore
Modified: trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.h (107814 => 107815)
--- trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.h 2012-02-15 15:29:40 UTC (rev 107814)
+++ trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.h 2012-02-15 15:33:07 UTC (rev 107815)
@@ -99,6 +99,11 @@
virtual void setWidgetVisible(Widget*, bool visible);
+#if ENABLE(WEBGL)
+ virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*,
+ PlatformGraphicsSurface3D*);
+#endif
+
QWidget* view;
QWebPage* page;
@@ -202,6 +207,11 @@
virtual void setWidgetVisible(Widget*, bool);
+#if ENABLE(WEBGL)
+ virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*,
+ PlatformGraphicsSurface3D*);
+#endif
+
void createOrDeleteOverlay();
#if USE(TILED_BACKING_STORE)