diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-03-31 17:01:20 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-03-31 17:01:48 +0200 |
commit | e5b17da8674447acaf0c30cd003fed18875d379e (patch) | |
tree | 9e2c3b6de99d1701c6c32a5647abaa8e7768917c /examples/qml-compositor/main.cpp | |
parent | 2a8e51f7d4e1c24b0cf0b86ff225546b068d166f (diff) |
Update compositor to reflect latest changes in qtquick2.
Diffstat (limited to 'examples/qml-compositor/main.cpp')
-rw-r--r-- | examples/qml-compositor/main.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/examples/qml-compositor/main.cpp b/examples/qml-compositor/main.cpp index 79823bc58..7746be2a5 100644 --- a/examples/qml-compositor/main.cpp +++ b/examples/qml-compositor/main.cpp @@ -54,15 +54,15 @@ #include <QGLWidget> #endif -#include <QtDeclarative/adaptationlayer.h> -#include <QSGContext> #include <QSGItem> -#include <QSGTextureManager> -#include <QSGTextureProvider> #include <QSGView> +#include <private/qsgadaptationlayer_p.h> +#include <private/qsgcontext_p.h> #include <private/qsgitem_p.h> +#include <private/qsgtexture_p.h> #include <private/qsgrectangle_p.h> +#include <private/qsgtextureprovider_p.h> class WaylandSurfaceTextureProvider : public QSGTextureProvider { @@ -81,13 +81,13 @@ private slots: private: WaylandSurface *m_surface; - QSGTexture *m_texture; + QSGPlainTexture *m_texture; QSGTextureRef m_textureRef; }; WaylandSurfaceTextureProvider::WaylandSurfaceTextureProvider(WaylandSurface *surface) : m_surface(surface) - , m_texture(new QSGTexture) + , m_texture(new QSGPlainTexture) , m_textureRef(m_texture) { connect(surface, SIGNAL(damaged(const QRect &)), this, SLOT(surfaceDamaged(const QRect &))); @@ -101,9 +101,9 @@ void WaylandSurfaceTextureProvider::surfaceDamaged(const QRect &) { if (m_surface->type() == WaylandSurface::Texture) { m_texture->setTextureId(m_surface->texture()); - m_texture->setAlphaChannel(false); + m_texture->setHasAlphaChannel(false); } else { - if (m_texture->status() == QSGTexture::Null) { + if (!m_texture->textureId()) { GLuint textureId; glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); @@ -119,13 +119,12 @@ void WaylandSurfaceTextureProvider::surfaceDamaged(const QRect &) glBindTexture(GL_TEXTURE_2D, m_texture->textureId()); glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, image.width(), image.height(), 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, image.bits()); - m_texture->setAlphaChannel(image.hasAlphaChannel()); + m_texture->setHasAlphaChannel(image.hasAlphaChannel()); } m_texture->setTextureSize(m_surface->geometry().size()); m_texture->setOwnsTexture(true); m_texture->setHasMipmaps(false); - m_texture->setStatus(QSGTexture::Ready); emit textureChanged(); } @@ -157,7 +156,7 @@ private slots: void surfaceMapped(const QRect &rect); protected: - Node *updatePaintNode(Node *oldNode, UpdatePaintNodeData *); + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *); private: QPoint toSurface(const QPointF &pos) const; @@ -235,12 +234,12 @@ void WindowItem::surfaceMapped(const QRect &rect) update(); } -Node *WindowItem::updatePaintNode(Node *oldNode, UpdatePaintNodeData *) +QSGNode *WindowItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { - TextureNodeInterface *node = static_cast<TextureNodeInterface *>(oldNode); + QSGImageNode *node = static_cast<QSGImageNode *>(oldNode); if (!node) { - node = QSGContext::current->createTextureNode(); - node->setFlag(Node::UsePreprocess, false); + node = QSGContext::current->createImageNode(); + node->setFlag(QSGNode::UsePreprocess, false); node->setTexture(m_textureProvider); } |