Created
June 16, 2016 10:01
-
-
Save annulen/ac2b37cf0ee1e416e012b70c96889ea1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit eb3965c6d4ec916b897da4e4c5e6b80ba77bd5cf | |
Author: Konstantin Tokarev <annulen@yandex.ru> | |
Date: Thu Jun 16 12:58:34 2016 +0300 | |
Restored compatibility with QSGRenderNode API from Qt < 5.8. | |
Change-Id: If41869580556fbe9b79fa9c3b162cefb23c74d25 | |
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp | |
index d6a694a..fea2ad4 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); | |
} | |
+#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) | |
+ | |
StateFlags changedStates() const 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()); | |
+ } | |
+ | |
+#else | |
+ | |
+ StateFlags changedStates() Q_DECL_OVERRIDE | |
+ { | |
+ return StateFlags(StencilState) | ColorState | BlendState; | |
+ } | |
+ | |
+ 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) | |
+ Q_DECL_OVERRIDE | |
+#endif | |
{ | |
coordinatedGraphicsScene()->purgeGLResources(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment