summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-06-16 13:46:04 +0300
committerLiang Qi <liang.qi@qt.io>2016-06-16 20:20:26 +0000
commit0628c226814f1386690f33d625b103e6ea8ad298 (patch)
tree370553efac73c623405e8c7ca555aa1ac7c2841b
parent6274ff9580e757ee50b4bd7a628e202c01d7af9f (diff)
downloadqtwebkit-0628c226814f1386690f33d625b103e6ea8ad298.tar.gz
Restored compatibility with QSGRenderNode API from Qt < 5.8.
Change-Id: If41869580556fbe9b79fa9c3b162cefb23c74d25 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp38
1 files changed, 33 insertions, 5 deletions
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp
index d6a694ae6..9a7b34951 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp
@@ -24,11 +24,16 @@
#include <QtGui/QPolygonF>
#include <QtQuick/QQuickItem>
#include <QtQuick/QQuickWindow>
-#include <QtQuick/QSGRenderNode>
#include <QtQuick/QSGSimpleRectNode>
#include <WebCore/CoordinatedGraphicsScene.h>
#include <WebCore/TransformationMatrix.h>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
+#include <QtQuick/QSGRenderNode>
+#else
+#include <QtQuick/private/qsgrendernode_p.h>
+#endif
+
using namespace WebCore;
namespace WebKit {
@@ -41,12 +46,33 @@ public:
coordinatedGraphicsScene()->setActive(true);
}
- StateFlags changedStates() const Q_DECL_OVERRIDE
+#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
+
+ StateFlags changedStates() const override
+ {
+ return StateFlags(StencilState) | ColorState | BlendState;
+ }
+
+ void render(const RenderState* state) override
+ {
+ renderInternal(state->projectionMatrix());
+ }
+
+#else
+
+ StateFlags changedStates() Q_DECL_OVERRIDE
{
return StateFlags(StencilState) | ColorState | BlendState;
}
- void render(const RenderState *state) Q_DECL_OVERRIDE
+ void render(const RenderState& state) Q_DECL_OVERRIDE
+ {
+ renderInternal(state.projectionMatrix);
+ }
+
+#endif // QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
+
+ void renderInternal(const QMatrix4x4* projection)
{
TransformationMatrix renderMatrix;
if (pageNode()->devicePixelRatio() != 1.0) {
@@ -58,14 +84,16 @@ public:
// When rendering to an intermediate surface, Qt will
// mirror the projection matrix to fit on the destination coordinate system.
- const QMatrix4x4* projection = state->projectionMatrix();
bool mirrored = projection && (*projection)(0, 0) * (*projection)(1, 1) - (*projection)(0, 1) * (*projection)(1, 0) > 0;
// FIXME: Support non-rectangular clippings.
coordinatedGraphicsScene()->paintToCurrentGLContext(renderMatrix, inheritedOpacity(), clipRect(), mirrored ? TextureMapper::PaintingMirrored : 0);
}
- void releaseResources() Q_DECL_OVERRIDE
+ void releaseResources()
+#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
+ override
+#endif
{
coordinatedGraphicsScene()->purgeGLResources();
}