diff options
Diffstat (limited to 'src/quick/scenegraph')
65 files changed, 959 insertions, 152 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp b/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp index 0bed1b8683..a7faf653fd 100644 --- a/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/coreapi/qsgdefaultrenderer_p.h b/src/quick/scenegraph/coreapi/qsgdefaultrenderer_p.h index 7bbac40f84..df7ae8ea36 100644 --- a/src/quick/scenegraph/coreapi/qsgdefaultrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgdefaultrenderer_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index 311ee9b3fe..3de69ae2b8 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the Qt scene graph research project. ** diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h index 85f48814ed..3420b83e7d 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.h +++ b/src/quick/scenegraph/coreapi/qsggeometry.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the Qt scene graph research project. ** diff --git a/src/quick/scenegraph/coreapi/qsggeometry_p.h b/src/quick/scenegraph/coreapi/qsggeometry_p.h index a7a1330d47..47cc0930d5 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry_p.h +++ b/src/quick/scenegraph/coreapi/qsggeometry_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp index 36b50e89b6..cabe425525 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -471,6 +471,12 @@ QSGMaterial::~QSGMaterial() \value Blending Set this flag to true if the material requires GL_BLEND to be enabled during rendering. + + \value RequiresDeterminant Set this flag to true if the material relies on + the determinant of the matrix of the geometry nodes for rendering. + + \value RequiresFullMatrix Set this flag to true if the material relies on + the full matrix of the geometry nodes for rendering. */ diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.h b/src/quick/scenegraph/coreapi/qsgmaterial.h index d8411b4d88..6c4108c19e 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.h +++ b/src/quick/scenegraph/coreapi/qsgmaterial.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -113,7 +113,9 @@ class Q_QUICK_EXPORT QSGMaterial { public: enum Flag { - Blending = 0x0001 + Blending = 0x0001, + RequiresDeterminant = 0x0002, + RequiresFullMatrix = 0x0004 | RequiresDeterminant }; Q_DECLARE_FLAGS(Flags, Flag) diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index bc83a81b48..fe0e637e1a 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h index 54e50e48be..d8dc87112b 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.h +++ b/src/quick/scenegraph/coreapi/qsgnode.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp b/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp index c5fa656c71..1c50a4aa30 100644 --- a/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp +++ b/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -97,15 +97,13 @@ void QSGNodeUpdater::updateStates(QSGNode *n) bool QSGNodeUpdater::isNodeBlocked(QSGNode *node, QSGNode *root) const { qreal opacity = 1; - while (node != root) { + while (node != root && node != 0) { if (node->type() == QSGNode::OpacityNodeType) { opacity *= static_cast<QSGOpacityNode *>(node)->opacity(); if (opacity < 0.001) return true; } node = node->parent(); - - Q_ASSERT_X(node, "QSGNodeUpdater::isNodeBlocked", "node is not in the subtree of root"); } return false; diff --git a/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h b/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h index 446bdefdc5..ad0da66420 100644 --- a/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h +++ b/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp index a7aac5f42c..317deee0c5 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h index 5217bee205..4fde0e26c8 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp index 73ac81fd5b..574c1218bb 100644 --- a/src/quick/scenegraph/qsgadaptationlayer.cpp +++ b/src/quick/scenegraph/qsgadaptationlayer.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -267,6 +267,21 @@ void QSGDistanceFieldGlyphCache::setGlyphsPosition(const QList<GlyphPosition> &g } } +void QSGDistanceFieldGlyphCache::registerOwnerElement(QQuickItem *ownerElement) +{ + Q_UNUSED(ownerElement); +} + +void QSGDistanceFieldGlyphCache::unregisterOwnerElement(QQuickItem *ownerElement) +{ + Q_UNUSED(ownerElement); +} + +void QSGDistanceFieldGlyphCache::processPendingGlyphs() +{ + /* Intentionally empty */ +} + void QSGDistanceFieldGlyphCache::setGlyphsTexture(const QVector<glyph_t> &glyphs, const Texture &tex) { int i = m_cacheData->textures.indexOf(tex); diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h index c4851c326b..2d82ca30ba 100644 --- a/src/quick/scenegraph/qsgadaptationlayer_p.h +++ b/src/quick/scenegraph/qsgadaptationlayer_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -110,6 +110,8 @@ public: HighQualitySubPixelAntialiasing }; + QSGGlyphNode() : m_ownerElement(0) {} + virtual void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) = 0; virtual void setColor(const QColor &color) = 0; virtual void setStyle(QQuickText::TextStyle style) = 0; @@ -123,8 +125,12 @@ public: virtual void update() = 0; + void setOwnerElement(QQuickItem *ownerElement) { m_ownerElement = ownerElement; } + QQuickItem *ownerElement() const { return m_ownerElement; } + protected: QRectF m_bounding_rect; + QQuickItem *m_ownerElement; }; class Q_QUICK_EXPORT QSGDistanceFieldGlyphCache @@ -185,6 +191,10 @@ public: void registerGlyphNode(QSGDistanceFieldGlyphNode *node); void unregisterGlyphNode(QSGDistanceFieldGlyphNode *node); + virtual void registerOwnerElement(QQuickItem *ownerElement); + virtual void unregisterOwnerElement(QQuickItem *ownerElement); + virtual void processPendingGlyphs(); + protected: struct GlyphPosition { glyph_t glyph; @@ -204,6 +214,7 @@ protected: void updateTexture(GLuint oldTex, GLuint newTex, const QSize &newTexSize); bool containsGlyph(glyph_t glyph) const; + GLuint textureIdForGlyph(glyph_t glyph) const; QOpenGLContext *ctx; diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index cad2cb09c8..834f336394 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -47,6 +47,8 @@ #include <QtQuick/private/qsgdefaultimagenode_p.h> #include <QtQuick/private/qsgdefaultglyphnode_p.h> #include <QtQuick/private/qsgdistancefieldglyphnode_p.h> +#include <QtQuick/private/qsgshareddistancefieldglyphcache_p.h> + #include <QtQuick/private/qsgtexture_p.h> #include <QtQuick/private/qdeclarativepixmapcache_p.h> @@ -56,6 +58,11 @@ #include <QDeclarativeImageProvider> #include <private/qdeclarativeglobal_p.h> +#include <QtQuick/private/qsgtexture_p.h> +#include <QtGui/private/qguiapplication_p.h> + +#include <QtGui/qplatformsharedgraphicscache_qpa.h> + #include <private/qobject_p.h> #include <qmutex.h> @@ -247,6 +254,35 @@ QSGImageNode *QSGContext::createImageNode() QSGDistanceFieldGlyphCache *QSGContext::createDistanceFieldGlyphCache(const QRawFont &font) { Q_D(QSGContext); + + QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration(); + if (platformIntegration != 0 + && platformIntegration->hasCapability(QPlatformIntegration::SharedGraphicsCache)) { + QFontEngine *fe = QRawFontPrivate::get(font)->fontEngine; + if (!fe->faceId().filename.isEmpty()) { + QByteArray keyName = fe->faceId().filename; + if (font.style() != QFont::StyleNormal) + keyName += QByteArray(" I"); + if (font.weight() != QFont::Normal) + keyName += " " + QByteArray::number(font.weight()); + keyName += QByteArray(" DF"); + QPlatformSharedGraphicsCache *sharedGraphicsCache = + platformIntegration->createPlatformSharedGraphicsCache(keyName); + + if (sharedGraphicsCache != 0) { + sharedGraphicsCache->ensureCacheInitialized(keyName, + QPlatformSharedGraphicsCache::OpenGLTexture, + QPlatformSharedGraphicsCache::Alpha8); + + return new QSGSharedDistanceFieldGlyphCache(keyName, + sharedGraphicsCache, + d->distanceFieldCacheManager, + glContext(), + font); + } + } + } + return new QSGDefaultDistanceFieldGlyphCache(d->distanceFieldCacheManager, glContext(), font); } diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index ea1db19e29..cc7060f553 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -56,7 +56,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QSGContextPrivate; class QSGRectangleNode; diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index 6bf6ac90e7..7467448dbd 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgcontextplugin_p.h b/src/quick/scenegraph/qsgcontextplugin_p.h index 21924c90ac..6cd689e1bd 100644 --- a/src/quick/scenegraph/qsgcontextplugin_p.h +++ b/src/quick/scenegraph/qsgcontextplugin_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp index 57a9a8741c..0227791d72 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h index 06f9283bcc..b701f2ef3d 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgdefaultglyphnode.cpp b/src/quick/scenegraph/qsgdefaultglyphnode.cpp index f41fbe486a..7ad8b0590c 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index 36efe9b570..d99ea2bfba 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -195,7 +195,7 @@ void QSGTextMaskMaterial::populate(const QPointF &p, fixedPointPositions.data()); cache->fillInPendingGlyphs(); - int margin = cache->glyphMargin(); + int margin = fontD->fontEngine->glyphMargin(cache->cacheType()); Q_ASSERT(geometry->indexType() == GL_UNSIGNED_SHORT); geometry->allocate(glyphIndexes.size() * 4, glyphIndexes.size() * 6); diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.h b/src/quick/scenegraph/qsgdefaultglyphnode_p.h index cc14d33a30..307deaaa15 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.h +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h index 2378178a1b..2da3434a44 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp index 072a309206..e7c8502302 100644 --- a/src/quick/scenegraph/qsgdefaultimagenode.cpp +++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgdefaultimagenode_p.h b/src/quick/scenegraph/qsgdefaultimagenode_p.h index f1b416d69c..6bc102bae9 100644 --- a/src/quick/scenegraph/qsgdefaultimagenode_p.h +++ b/src/quick/scenegraph/qsgdefaultimagenode_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp index bb89b4a9f8..d633ad7652 100644 --- a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp +++ b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h index b491913428..a6d787c840 100644 --- a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h +++ b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp index f192573624..eb1c1eb22d 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -57,10 +57,10 @@ QSGDistanceFieldGlyphNode::QSGDistanceFieldGlyphNode(QSGDistanceFieldGlyphCacheM , m_dirtyGeometry(false) , m_dirtyMaterial(false) { - setFlag(UsePreprocess); m_geometry.setDrawingMode(GL_TRIANGLES); setGeometry(&m_geometry); setPreferredAntialiasingMode(cacheManager->defaultAntialiasingMode()); + setFlag(UsePreprocess); #ifdef QML_RUNTIME_TESTING description = QLatin1String("glyphs"); #endif @@ -112,9 +112,13 @@ void QSGDistanceFieldGlyphNode::setGlyphs(const QPointF &position, const QGlyphR QSGDistanceFieldGlyphCache *oldCache = m_glyph_cache; m_glyph_cache = m_glyph_cacheManager->cache(m_glyphs.rawFont()); if (m_glyph_cache != oldCache) { - if (oldCache) + Q_ASSERT(ownerElement() != 0); + if (oldCache) { oldCache->unregisterGlyphNode(this); + oldCache->unregisterOwnerElement(ownerElement()); + } m_glyph_cache->registerGlyphNode(this); + m_glyph_cache->registerOwnerElement(ownerElement()); } m_glyph_cache->populate(glyphs.glyphIndexes()); @@ -158,12 +162,13 @@ void QSGDistanceFieldGlyphNode::preprocess() { Q_ASSERT(m_glyph_cache); - m_glyph_cache->update(); - for (int i = 0; i < m_nodesToDelete.count(); ++i) delete m_nodesToDelete.at(i); m_nodesToDelete.clear(); + m_glyph_cache->processPendingGlyphs(); + m_glyph_cache->update(); + if (m_dirtyGeometry) updateGeometry(); } @@ -285,6 +290,7 @@ void QSGDistanceFieldGlyphNode::updateGeometry() QHash<const QSGDistanceFieldGlyphCache::Texture *, QSGDistanceFieldGlyphNode *>::iterator subIt = m_subNodes.find(ite.key()); if (subIt == m_subNodes.end()) { QSGDistanceFieldGlyphNode *subNode = new QSGDistanceFieldGlyphNode(m_glyph_cacheManager); + subNode->setOwnerElement(m_ownerElement); subNode->setColor(m_color); subNode->setStyle(m_style); subNode->setStyleColor(m_styleColor); diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp index 938fe9b42d..6a220c9fe5 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -90,8 +90,8 @@ const char *QSGDistanceFieldTextMaterialShader::fragmentShader() const { "varying highp vec2 sampleCoord; \n" "uniform sampler2D texture; \n" "uniform lowp vec4 color; \n" - "uniform lowp float alphaMin; \n" - "uniform lowp float alphaMax; \n" + "uniform mediump float alphaMin; \n" + "uniform mediump float alphaMax; \n" "void main() { \n" " gl_FragColor = color * smoothstep(alphaMin, \n" " alphaMax, \n" @@ -189,7 +189,7 @@ QSGDistanceFieldTextMaterial::QSGDistanceFieldTextMaterial() : m_glyph_cache(0) , m_texture(0) { - setFlag(Blending, true); + setFlag(Blending | RequiresDeterminant, true); } QSGDistanceFieldTextMaterial::~QSGDistanceFieldTextMaterial() @@ -324,10 +324,10 @@ const char *DistanceFieldOutlineTextMaterialShader::fragmentShader() const { "uniform sampler2D texture; \n" "uniform lowp vec4 color; \n" "uniform lowp vec4 styleColor; \n" - "uniform lowp float alphaMin; \n" - "uniform lowp float alphaMax; \n" - "uniform lowp float outlineAlphaMax0; \n" - "uniform lowp float outlineAlphaMax1; \n" + "uniform mediump float alphaMin; \n" + "uniform mediump float alphaMax; \n" + "uniform mediump float outlineAlphaMax0; \n" + "uniform mediump float outlineAlphaMax1; \n" "void main() { \n" " mediump float d = texture2D(texture, sampleCoord).a; \n" " gl_FragColor = mix(styleColor, color, smoothstep(alphaMin, alphaMax, d)) \n" @@ -468,8 +468,8 @@ const char *DistanceFieldShiftedStyleTextMaterialShader::fragmentShader() const "uniform sampler2D texture; \n" "uniform lowp vec4 color; \n" "uniform lowp vec4 styleColor; \n" - "uniform lowp float alphaMin; \n" - "uniform lowp float alphaMax; \n" + "uniform mediump float alphaMin; \n" + "uniform mediump float alphaMax; \n" "void main() { \n" " highp float a = smoothstep(alphaMin, alphaMax, texture2D(texture, sampleCoord).a);\n" " highp vec4 shifted = styleColor * smoothstep(alphaMin, \n" @@ -558,8 +558,8 @@ const char *QSGHiQSubPixelDistanceFieldTextMaterialShader::fragmentShader() cons "varying highp vec3 sampleFarRight; \n" "uniform sampler2D texture; \n" "uniform lowp vec4 color; \n" - "uniform lowp float alphaMin; \n" - "uniform lowp float alphaMax; \n" + "uniform mediump float alphaMin; \n" + "uniform mediump float alphaMax; \n" "void main() { \n" " highp vec4 n; \n" " n.x = texture2DProj(texture, sampleFarLeft).a; \n" @@ -697,8 +697,8 @@ const char *QSGLoQSubPixelDistanceFieldTextMaterialShader::fragmentShader() cons "varying highp vec3 sampleNearRight; \n" "uniform sampler2D texture; \n" "uniform lowp vec4 color; \n" - "uniform lowp float alphaMin; \n" - "uniform lowp float alphaMax; \n" + "uniform mediump float alphaMin; \n" + "uniform mediump float alphaMax; \n" "void main() { \n" " highp vec2 n; \n" " n.x = texture2DProj(texture, sampleNearLeft).a; \n" diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h index 79b40ddf3e..a58e0b1eb4 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -69,7 +69,6 @@ public: virtual void setStyleColor(const QColor &color); virtual void update(); - void preprocess(); void invalidateGlyphs(const QVector<quint32> &glyphs); diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h index d71cc48196..2bffb1ecb6 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgflashnode.cpp b/src/quick/scenegraph/qsgflashnode.cpp index 9546e91ee1..92c705cb28 100644 --- a/src/quick/scenegraph/qsgflashnode.cpp +++ b/src/quick/scenegraph/qsgflashnode.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgflashnode_p.h b/src/quick/scenegraph/qsgflashnode_p.h index 71ac22d648..0029146503 100644 --- a/src/quick/scenegraph/qsgflashnode_p.h +++ b/src/quick/scenegraph/qsgflashnode_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgpathsimplifier.cpp b/src/quick/scenegraph/qsgpathsimplifier.cpp index 4b9f401786..79cd7a290b 100644 --- a/src/quick/scenegraph/qsgpathsimplifier.cpp +++ b/src/quick/scenegraph/qsgpathsimplifier.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgpathsimplifier_p.h b/src/quick/scenegraph/qsgpathsimplifier_p.h index 0639c4f622..e3d2e769eb 100644 --- a/src/quick/scenegraph/qsgpathsimplifier_p.h +++ b/src/quick/scenegraph/qsgpathsimplifier_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp new file mode 100644 index 0000000000..841322e58b --- /dev/null +++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp @@ -0,0 +1,621 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#define EGL_EGLEXT_PROTOTYPES +#define GL_GLEXT_PROTOTYPES +#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG) +#include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> +#endif + +#include "qsgshareddistancefieldglyphcache_p.h" + +#include <QtCore/qhash.h> +#include <QtCore/qthread.h> +#include <QtGui/qplatformsharedgraphicscache_qpa.h> + +#include <QtQuick/qquickcanvas.h> + +#include <QtOpenGL/qglframebufferobject.h> + +// #define QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG + +Q_DECLARE_METATYPE(QVector<quint32>) +Q_DECLARE_METATYPE(QVector<QImage>) + +QT_BEGIN_NAMESPACE + +QSGSharedDistanceFieldGlyphCache::QSGSharedDistanceFieldGlyphCache(const QByteArray &cacheId, + QPlatformSharedGraphicsCache *sharedGraphicsCache, + QSGDistanceFieldGlyphCacheManager *man, + QOpenGLContext *c, + const QRawFont &font) + : QSGDistanceFieldGlyphCache(man, c, font) + , m_cacheId(cacheId) + , m_sharedGraphicsCache(sharedGraphicsCache) +{ +#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG) + qDebug("QSGSharedDistanceFieldGlyphCache with id %s created in thread %p", + cacheId.constData(), QThread::currentThreadId()); +#endif + + Q_ASSERT(sizeof(glyph_t) == sizeof(quint32)); + Q_ASSERT(sharedGraphicsCache != 0); + + qRegisterMetaType<QVector<quint32> >(); + qRegisterMetaType<QVector<QImage> >(); + + connect(sharedGraphicsCache, SIGNAL(itemsMissing(QByteArray,QVector<quint32>)), + this, SLOT(reportItemsMissing(QByteArray,QVector<quint32>)), + Qt::DirectConnection); + connect(sharedGraphicsCache, SIGNAL(itemsAvailable(QByteArray,void*,QSize,QVector<quint32>,QVector<QPoint>)), + this, SLOT(reportItemsAvailable(QByteArray,void*,QSize,QVector<quint32>,QVector<QPoint>)), + Qt::DirectConnection); + connect(sharedGraphicsCache, SIGNAL(itemsUpdated(QByteArray,void*,QSize,QVector<quint32>,QVector<QPoint>)), + this, SLOT(reportItemsAvailable(QByteArray,void*,QSize,QVector<quint32>,QVector<QPoint>)), + Qt::DirectConnection); + connect(sharedGraphicsCache, SIGNAL(itemsInvalidated(QByteArray,QVector<quint32>)), + this, SLOT(reportItemsInvalidated(QByteArray,QVector<quint32>)), + Qt::DirectConnection); +} + +QSGSharedDistanceFieldGlyphCache::~QSGSharedDistanceFieldGlyphCache() +{ + { + QHash<glyph_t, void *>::const_iterator it = m_bufferForGlyph.constBegin(); + while (it != m_bufferForGlyph.constEnd()) { + m_sharedGraphicsCache->dereferenceBuffer(it.value()); + ++it; + } + } + + { + QHash<quint32, PendingGlyph>::const_iterator it = m_pendingReadyGlyphs.constBegin(); + while (it != m_pendingReadyGlyphs.constEnd()) { + m_sharedGraphicsCache->dereferenceBuffer(it.value().buffer); + ++it; + } + } +} + +void QSGSharedDistanceFieldGlyphCache::requestGlyphs(const QSet<glyph_t> &glyphs) +{ + QMutexLocker locker(&m_pendingGlyphsMutex); + +#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG) + qDebug("QSGSharedDistanceFieldGlyphCache::requestGlyphs() called for %s (%d glyphs)", + m_cacheId.constData(), glyphs.size()); +#endif + + m_requestedGlyphsThatHaveNotBeenReturned.unite(glyphs); + + QVector<quint32> glyphsVector; + glyphsVector.reserve(glyphs.size()); + + QSet<glyph_t>::const_iterator it; + for (it = glyphs.constBegin(); it != glyphs.constEnd(); ++it) { + Q_ASSERT(!m_bufferForGlyph.contains(*it)); + glyphsVector.append(*it); + } + + // Invoke method on queued connection to make sure it's called asynchronously on the + // correct thread (requestGlyphs() is called from the rendering thread.) + QMetaObject::invokeMethod(m_sharedGraphicsCache, "requestItems", Qt::QueuedConnection, + Q_ARG(QByteArray, m_cacheId), + Q_ARG(QVector<quint32>, glyphsVector)); +} + +void QSGSharedDistanceFieldGlyphCache::waitForGlyphs() +{ + { + QMutexLocker locker(&m_pendingGlyphsMutex); + while (!m_requestedGlyphsThatHaveNotBeenReturned.isEmpty()) + m_pendingGlyphsCondition.wait(&m_pendingGlyphsMutex); + } +} + +void QSGSharedDistanceFieldGlyphCache::storeGlyphs(const QHash<glyph_t, QImage> &glyphs) +{ + { + QMutexLocker locker(&m_pendingGlyphsMutex); +#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG) + qDebug("QSGSharedDistanceFieldGlyphCache::storeGlyphs() called for %s (%d glyphs)", + m_cacheId.constData(), glyphs.size()); +#endif + + int glyphCount = glyphs.size(); + QVector<quint32> glyphIds(glyphCount); + QVector<QImage> images(glyphCount); + QHash<glyph_t, QImage>::const_iterator it = glyphs.constBegin(); + int i=0; + while (it != glyphs.constEnd()) { + m_requestedGlyphsThatHaveNotBeenReturned.insert(it.key()); + glyphIds[i] = it.key(); + images[i] = it.value(); + + ++it; ++i; + } + + QMetaObject::invokeMethod(m_sharedGraphicsCache, "insertItems", Qt::QueuedConnection, + Q_ARG(QByteArray, m_cacheId), + Q_ARG(QVector<quint32>, glyphIds), + Q_ARG(QVector<QImage>, images)); + } + + processPendingGlyphs(); +} + +void QSGSharedDistanceFieldGlyphCache::referenceGlyphs(const QSet<glyph_t> &glyphs) +{ + Q_UNUSED(glyphs); + + // Intentionally empty. Not required in this implementation, since the glyphs are reference + // counted outside and releaseGlyphs() will only be called when there are no more references. +} + +void QSGSharedDistanceFieldGlyphCache::releaseGlyphs(const QSet<glyph_t> &glyphs) +{ +#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG) + qDebug("QSGSharedDistanceFieldGlyphCache::releaseGlyphs() called for %s (%d glyphs)", + m_cacheId.constData(), glyphs.size()); +#endif + + QVector<quint32> glyphsVector; + glyphsVector.reserve(glyphs.size()); + + QSet<glyph_t>::const_iterator glyphsIt; + for (glyphsIt = glyphs.constBegin(); glyphsIt != glyphs.constEnd(); ++glyphsIt) { + QHash<glyph_t, void *>::iterator bufferIt = m_bufferForGlyph.find(*glyphsIt); + if (bufferIt != m_bufferForGlyph.end()) { + void *buffer = bufferIt.value(); + removeGlyph(*glyphsIt); + m_bufferForGlyph.erase(bufferIt); + Q_ASSERT(!m_bufferForGlyph.contains(*glyphsIt)); + + if (!m_sharedGraphicsCache->dereferenceBuffer(buffer)) { +#if !defined(QT_NO_DEBUG) + bufferIt = m_bufferForGlyph.begin(); + while (bufferIt != m_bufferForGlyph.end()) { + Q_ASSERT(bufferIt.value() != buffer); + ++bufferIt; + } +#endif + } + } + + glyphsVector.append(*glyphsIt); + } + + QMetaObject::invokeMethod(m_sharedGraphicsCache, "releaseItems", Qt::QueuedConnection, + Q_ARG(QByteArray, m_cacheId), + Q_ARG(QVector<quint32>, glyphsVector)); +} + +void QSGSharedDistanceFieldGlyphCache::registerOwnerElement(QQuickItem *ownerElement) +{ + bool ok = connect(this, SIGNAL(glyphsPending()), ownerElement, SLOT(triggerPreprocess())); + Q_ASSERT_X(ok, Q_FUNC_INFO, "QML element that owns a glyph node must have triggerPreprocess() slot"); + Q_UNUSED(ok); +} + +void QSGSharedDistanceFieldGlyphCache::unregisterOwnerElement(QQuickItem *ownerElement) +{ + disconnect(this, SIGNAL(glyphsPending()), ownerElement, SLOT(triggerPreprocess())); +} + +#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG_) +# include <QtOpenGL/private/qglextensions_p.h> + +void QSGSharedDistanceFieldGlyphCache::saveTexture(GLuint textureId, int width, int height) +{ + GLuint fboId; + glGenFramebuffers(1, &fboId); + + GLuint tmpTexture = 0; + glGenTextures(1, &tmpTexture); + glBindTexture(GL_TEXTURE_2D, tmpTexture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + 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); + glBindTexture(GL_TEXTURE_2D, 0); + + glBindFramebuffer(GL_FRAMEBUFFER_EXT, fboId); + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, + tmpTexture, 0); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, textureId); + + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_BLEND); + + GLfloat textureCoordinateArray[8]; + textureCoordinateArray[0] = 0.0f; + textureCoordinateArray[1] = 0.0f; + textureCoordinateArray[2] = 1.0f; + textureCoordinateArray[3] = 0.0f; + textureCoordinateArray[4] = 1.0f; + textureCoordinateArray[5] = 1.0f; + textureCoordinateArray[6] = 0.0f; + textureCoordinateArray[7] = 1.0f; + + GLfloat vertexCoordinateArray[8]; + vertexCoordinateArray[0] = -1.0f; + vertexCoordinateArray[1] = -1.0f; + vertexCoordinateArray[2] = 1.0f; + vertexCoordinateArray[3] = -1.0f; + vertexCoordinateArray[4] = 1.0f; + vertexCoordinateArray[5] = 1.0f; + vertexCoordinateArray[6] = -1.0f; + vertexCoordinateArray[7] = 1.0f; + + glViewport(0, 0, width, height); + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray); + + { + static const char *vertexShaderSource = + "attribute highp vec4 vertexCoordsArray; \n" + "attribute highp vec2 textureCoordArray; \n" + "varying highp vec2 textureCoords; \n" + "void main(void) \n" + "{ \n" + " gl_Position = vertexCoordsArray; \n" + " textureCoords = textureCoordArray; \n" + "} \n"; + + static const char *fragmentShaderSource = + "varying highp vec2 textureCoords; \n" + "uniform sampler2D texture; \n" + "void main() \n" + "{ \n" + " gl_FragColor = texture2D(texture, textureCoords); \n" + "} \n"; + + GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER); + GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); + + if (vertexShader == 0 || fragmentShader == 0) { + GLenum error = glGetError(); + qWarning("SharedGraphicsCacheServer::setupShaderPrograms: Failed to create shaders. (GL error: %x)", + error); + return; + } + + glShaderSource(vertexShader, 1, &vertexShaderSource, NULL); + glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL); + glCompileShader(vertexShader); + + GLint len = 1; + glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &len); + + char infoLog[2048]; + glGetShaderInfoLog(vertexShader, 2048, NULL, infoLog); + if (qstrlen(infoLog) > 0) { + qWarning("SharedGraphicsCacheServer::setupShaderPrograms, problems compiling vertex shader:\n %s", + infoLog); + //return; + } + + glCompileShader(fragmentShader); + glGetShaderInfoLog(fragmentShader, 2048, NULL, infoLog); + if (qstrlen(infoLog) > 0) { + qWarning("SharedGraphicsCacheServer::setupShaderPrograms, problems compiling fragent shader:\n %s", + infoLog); + //return; + } + + GLuint shaderProgram = glCreateProgram(); + glAttachShader(shaderProgram, vertexShader); + glAttachShader(shaderProgram, fragmentShader); + + glBindAttribLocation(shaderProgram, 0, "vertexCoordsArray"); + glBindAttribLocation(shaderProgram, 1, "textureCoordArray"); + + glLinkProgram(shaderProgram); + glGetProgramInfoLog(shaderProgram, 2048, NULL, infoLog); + if (qstrlen(infoLog) > 0) { + qWarning("SharedGraphicsCacheServer::setupShaderPrograms, problems linking shaders:\n %s", + infoLog); + //return; + } + + glUseProgram(shaderProgram); + glEnableVertexAttribArray(0); + glEnableVertexAttribArray(1); + + int textureUniformLocation = glGetUniformLocation(shaderProgram, "texture"); + glUniform1i(textureUniformLocation, 0); + } + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + { + GLenum error = glGetError(); + if (error != GL_NO_ERROR) { + qWarning("SharedGraphicsCacheServer::readBackBuffer: glDrawArrays reported error 0x%x", + error); + } + } + + uchar *data = new uchar[width * height * 4]; + + glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); + + QImage image(width, height, QImage::Format_ARGB32); + quint32 *dest = reinterpret_cast<quint32 *>(image.bits()); + for (int i=0; i<width*height; ++i) + dest[i] = qRgba(0xff, 0xff, 0xff, data[i]); + + QByteArray fileName = m_cacheId + " " + QByteArray::number(textureId); + fileName = fileName.replace('/', '_').replace(' ', '_') + ".png"; + image.save(QString::fromLocal8Bit(fileName)); + + { + GLenum error = glGetError(); + if (error != GL_NO_ERROR) { + qWarning("SharedGraphicsCacheServer::readBackBuffer: glReadPixels reported error 0x%x", + error); + } + } + + glDisableVertexAttribArray(0); + glDisableVertexAttribArray(1); + + glDeleteFramebuffers(1, &fboId); + glDeleteTextures(1, &tmpTexture); + + delete[] data; +} +#endif + +namespace { + struct TextureContent { + QSize size; + QVector<glyph_t> glyphs; + }; +} + +void QSGSharedDistanceFieldGlyphCache::processPendingGlyphs() +{ + Q_ASSERT(QThread::currentThread() == thread()); + + waitForGlyphs(); + + { + QMutexLocker locker(&m_pendingGlyphsMutex); + if (m_pendingMissingGlyphs.isEmpty() + && m_pendingReadyGlyphs.isEmpty() + && m_pendingInvalidatedGlyphs.isEmpty()) { + return; + } + + { + QVector<glyph_t> pendingMissingGlyphs; + pendingMissingGlyphs.reserve(m_pendingMissingGlyphs.size()); + + QSet<glyph_t>::const_iterator it = m_pendingMissingGlyphs.constBegin(); + while (it != m_pendingMissingGlyphs.constEnd()) { + pendingMissingGlyphs.append(*it); + ++it; + } + + markGlyphsToRender(pendingMissingGlyphs); + } + + { + QVector<glyph_t> filteredPendingInvalidatedGlyphs; + filteredPendingInvalidatedGlyphs.reserve(m_pendingInvalidatedGlyphs.size()); + + QSet<glyph_t>::const_iterator it = m_pendingInvalidatedGlyphs.constBegin(); + while (it != m_pendingInvalidatedGlyphs.constEnd()) { + bool rerequestGlyph = false; + + // The glyph was invalidated right after being posted as ready, we throw away + // the ready glyph and rerequest it to be certain + QHash<quint32, PendingGlyph>::iterator pendingGlyphIt = m_pendingReadyGlyphs.find(*it); + if (pendingGlyphIt != m_pendingReadyGlyphs.end()) { + m_sharedGraphicsCache->dereferenceBuffer(pendingGlyphIt.value().buffer); + pendingGlyphIt = m_pendingReadyGlyphs.erase(pendingGlyphIt); + rerequestGlyph = true; + } + + void *bufferId = m_bufferForGlyph.value(*it, 0); + if (bufferId != 0) { + m_sharedGraphicsCache->dereferenceBuffer(bufferId); + m_bufferForGlyph.remove(*it); + rerequestGlyph = true; + } + + if (rerequestGlyph) + filteredPendingInvalidatedGlyphs.append(*it); + + ++it; + } + + // If this cache is still using the glyphs, reset the texture held by them, and mark them + // to be rendered again since they are still needed. + if (!filteredPendingInvalidatedGlyphs.isEmpty()) { + setGlyphsTexture(filteredPendingInvalidatedGlyphs, Texture()); + markGlyphsToRender(filteredPendingInvalidatedGlyphs); + } + } + + { + QList<GlyphPosition> glyphPositions; + + QHash<void *, TextureContent> textureContentForBuffer; + { + QHash<quint32, PendingGlyph>::iterator it = m_pendingReadyGlyphs.begin(); + while (it != m_pendingReadyGlyphs.end()) { + void *currentGlyphBuffer = m_bufferForGlyph.value(it.key(), 0); + if (currentGlyphBuffer != 0) { + if (!m_sharedGraphicsCache->dereferenceBuffer(currentGlyphBuffer)) { + Q_ASSERT(!textureContentForBuffer.contains(currentGlyphBuffer)); + } + } + + PendingGlyph &pendingGlyph = it.value(); + + // We don't ref or deref the buffer here, since it was already referenced when + // added to the pending ready glyphs + m_bufferForGlyph[it.key()] = pendingGlyph.buffer; + + textureContentForBuffer[pendingGlyph.buffer].size = pendingGlyph.bufferSize; + textureContentForBuffer[pendingGlyph.buffer].glyphs.append(it.key()); + + GlyphPosition glyphPosition; + glyphPosition.glyph = it.key(); + glyphPosition.position = pendingGlyph.position; + + glyphPositions.append(glyphPosition); + + ++it; + } + } + + setGlyphsPosition(glyphPositions); + + { + QHash<void *, TextureContent>::const_iterator it = textureContentForBuffer.constBegin(); + while (it != textureContentForBuffer.constEnd()) { + Texture texture; + texture.textureId = m_sharedGraphicsCache->textureIdForBuffer(it.key()); + texture.size = it.value().size; + +#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG_) + saveTexture(texture.textureId, texture.size.width(), texture.size.height()); +#endif + setGlyphsTexture(it.value().glyphs, texture); + + ++it; + } + } + } + + m_pendingMissingGlyphs.clear(); + m_pendingInvalidatedGlyphs.clear(); + m_pendingReadyGlyphs.clear(); + } +} + +void QSGSharedDistanceFieldGlyphCache::reportItemsAvailable(const QByteArray &cacheId, + void *bufferId, const QSize &bufferSize, + const QVector<quint32> &itemIds, + const QVector<QPoint> &positions) +{ + { + QMutexLocker locker(&m_pendingGlyphsMutex); + if (m_cacheId != cacheId) + return; + + Q_ASSERT(itemIds.size() == positions.size()); + +#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG) + qDebug("QSGSharedDistanceFieldGlyphCache::reportItemsAvailable() called for %s (%d glyphs, bufferSize: %dx%d)", + cacheId.constData(), itemIds.size(), bufferSize.width(), bufferSize.height()); +#endif + + for (int i=0; i<itemIds.size(); ++i) { + PendingGlyph &pendingGlyph = m_pendingReadyGlyphs[itemIds.at(i)]; + void *oldBuffer = pendingGlyph.buffer; + Q_ASSERT(bufferSize.height() >= pendingGlyph.bufferSize.height()); + + pendingGlyph.buffer = bufferId; + pendingGlyph.position = positions.at(i); + pendingGlyph.bufferSize = bufferSize; + + m_sharedGraphicsCache->referenceBuffer(bufferId); + if (oldBuffer != 0) + m_sharedGraphicsCache->dereferenceBuffer(oldBuffer); + + m_requestedGlyphsThatHaveNotBeenReturned.remove(itemIds.at(i)); + } + } + + m_pendingGlyphsCondition.wakeAll(); + emit glyphsPending(); +} + +void QSGSharedDistanceFieldGlyphCache::reportItemsInvalidated(const QByteArray &cacheId, + const QVector<quint32> &itemIds) +{ + { + QMutexLocker locker(&m_pendingGlyphsMutex); + if (m_cacheId != cacheId) + return; + + for (int i=0; i<itemIds.size(); ++i) + m_pendingInvalidatedGlyphs.insert(itemIds.at(i)); + } + + emit glyphsPending(); +} + + +void QSGSharedDistanceFieldGlyphCache::reportItemsMissing(const QByteArray &cacheId, + const QVector<quint32> &itemIds) +{ + { + QMutexLocker locker(&m_pendingGlyphsMutex); + if (m_cacheId != cacheId) + return; + +#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG) + qDebug("QSGSharedDistanceFieldGlyphCache::reportItemsMissing() called for %s (%d glyphs)", + cacheId.constData(), itemIds.size()); +#endif + + for (int i=0; i<itemIds.size(); ++i) { + m_pendingMissingGlyphs.insert(itemIds.at(i)); + m_requestedGlyphsThatHaveNotBeenReturned.remove(itemIds.at(i)); + } + } + + m_pendingGlyphsCondition.wakeAll(); + emit glyphsPending(); +} + +QT_END_NAMESPACE diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h new file mode 100644 index 0000000000..6f5696eabb --- /dev/null +++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSGSHAREDDISTANCEFIELDGLYPHCACHE_H +#define QSGSHAREDDISTANCEFIELDGLYPHCACHE_H + +#include <QtCore/qwaitcondition.h> +#include <private/qsgadaptationlayer_p.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QPlatformSharedGraphicsCache; +class QSGSharedDistanceFieldGlyphCache : public QObject, public QSGDistanceFieldGlyphCache +{ + Q_OBJECT +public: + explicit QSGSharedDistanceFieldGlyphCache(const QByteArray &cacheId, + QPlatformSharedGraphicsCache *sharedGraphicsCache, + QSGDistanceFieldGlyphCacheManager *man, + QOpenGLContext *c, + const QRawFont &font); + ~QSGSharedDistanceFieldGlyphCache(); + + void registerOwnerElement(QQuickItem *ownerElement); + void unregisterOwnerElement(QQuickItem *ownerElement); + void processPendingGlyphs(); + + void requestGlyphs(const QSet<glyph_t> &glyphs); + void referenceGlyphs(const QSet<glyph_t> &glyphs); + void storeGlyphs(const QHash<glyph_t, QImage> &glyphs); + void releaseGlyphs(const QSet<glyph_t> &glyphs); + +Q_SIGNALS: + void glyphsPending(); + +private Q_SLOTS: + void reportItemsMissing(const QByteArray &cacheId, const QVector<quint32> &itemIds); + void reportItemsAvailable(const QByteArray &cacheId, + void *bufferId, const QSize &bufferSize, + const QVector<quint32> &itemIds, const QVector<QPoint> &positions); + void reportItemsInvalidated(const QByteArray &cacheId, const QVector<quint32> &itemIds); + +private: + void waitForGlyphs(); + void saveTexture(GLuint textureId, int width, int height); + + QSet<quint32> m_requestedGlyphsThatHaveNotBeenReturned; + QWaitCondition m_pendingGlyphsCondition; + QByteArray m_cacheId; + QPlatformSharedGraphicsCache *m_sharedGraphicsCache; + QMutex m_pendingGlyphsMutex; + + QSet<glyph_t> m_pendingInvalidatedGlyphs; + QSet<glyph_t> m_pendingMissingGlyphs; + + struct PendingGlyph + { + PendingGlyph() : buffer(0) {} + + void *buffer; + QSize bufferSize; + QPoint position; + }; + + QHash<quint32, PendingGlyph> m_pendingReadyGlyphs; + QHash<glyph_t, void *> m_bufferForGlyph; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSGSHAREDDISTANCEFIELDGLYPHCACHE_H diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri index db57b1e52b..9fc92222ae 100644 --- a/src/quick/scenegraph/scenegraph.pri +++ b/src/quick/scenegraph/scenegraph.pri @@ -18,7 +18,6 @@ SOURCES += \ $$PWD/coreapi/qsgnodeupdater.cpp \ $$PWD/coreapi/qsgrenderer.cpp - # Util API HEADERS += \ $$PWD/util/qsgareaallocator_p.h \ @@ -63,7 +62,8 @@ HEADERS += \ $$PWD/qsgdefaultimagenode_p.h \ $$PWD/qsgdefaultrectanglenode_p.h \ $$PWD/qsgflashnode_p.h \ - $$PWD/qsgpathsimplifier_p.h + $$PWD/qsgpathsimplifier_p.h \ + $$PWD/qsgshareddistancefieldglyphcache_p.h SOURCES += \ $$PWD/qsgadaptationlayer.cpp \ @@ -77,7 +77,8 @@ SOURCES += \ $$PWD/qsgdefaultimagenode.cpp \ $$PWD/qsgdefaultrectanglenode.cpp \ $$PWD/qsgflashnode.cpp \ - $$PWD/qsgpathsimplifier.cpp + $$PWD/qsgpathsimplifier.cpp \ + $$PWD/qsgshareddistancefieldglyphcache.cpp diff --git a/src/quick/scenegraph/util/qsgareaallocator.cpp b/src/quick/scenegraph/util/qsgareaallocator.cpp index c5171f1c93..09593e0b44 100644 --- a/src/quick/scenegraph/util/qsgareaallocator.cpp +++ b/src/quick/scenegraph/util/qsgareaallocator.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgareaallocator_p.h b/src/quick/scenegraph/util/qsgareaallocator_p.h index be26046865..1f70143902 100644 --- a/src/quick/scenegraph/util/qsgareaallocator_p.h +++ b/src/quick/scenegraph/util/qsgareaallocator_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp index d1b0445ee0..843120ae96 100644 --- a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp +++ b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h index bc28a4d9e1..3e2ce5d47a 100644 --- a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h +++ b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgengine.cpp b/src/quick/scenegraph/util/qsgengine.cpp index b8c93bab8b..65780278c0 100644 --- a/src/quick/scenegraph/util/qsgengine.cpp +++ b/src/quick/scenegraph/util/qsgengine.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -78,8 +78,8 @@ QSGEngine::~QSGEngine() void QSGEngine::setCanvas(QQuickCanvas *canvas) { d_func()->canvas = canvas; - connect(canvas, SIGNAL(afterRendering()), this, SIGNAL(afterRendering())); - connect(canvas, SIGNAL(beforeRendering()), this, SIGNAL(beforeRendering())); + connect(canvas, SIGNAL(afterRendering()), this, SIGNAL(afterRendering()), Qt::DirectConnection); + connect(canvas, SIGNAL(beforeRendering()), this, SIGNAL(beforeRendering()), Qt::DirectConnection); } void QSGEngine::setClearBeforeRendering(bool enabled) diff --git a/src/quick/scenegraph/util/qsgengine.h b/src/quick/scenegraph/util/qsgengine.h index 6b7ceb939f..2457509e7f 100644 --- a/src/quick/scenegraph/util/qsgengine.h +++ b/src/quick/scenegraph/util/qsgengine.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp index cf5c7869ea..e14f4d9e7c 100644 --- a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp +++ b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.h b/src/quick/scenegraph/util/qsgflatcolormaterial.h index d788901b8a..13297eba5a 100644 --- a/src/quick/scenegraph/util/qsgflatcolormaterial.h +++ b/src/quick/scenegraph/util/qsgflatcolormaterial.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgpainternode.cpp b/src/quick/scenegraph/util/qsgpainternode.cpp index 2ce42fcc4d..876c27e97d 100644 --- a/src/quick/scenegraph/util/qsgpainternode.cpp +++ b/src/quick/scenegraph/util/qsgpainternode.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgpainternode_p.h b/src/quick/scenegraph/util/qsgpainternode_p.h index 85f26f6056..8fc757a713 100644 --- a/src/quick/scenegraph/util/qsgpainternode_p.h +++ b/src/quick/scenegraph/util/qsgpainternode_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgsimplematerial.h b/src/quick/scenegraph/util/qsgsimplematerial.h index 44beb135f7..2bca97cf17 100644 --- a/src/quick/scenegraph/util/qsgsimplematerial.h +++ b/src/quick/scenegraph/util/qsgsimplematerial.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgsimplerectnode.cpp b/src/quick/scenegraph/util/qsgsimplerectnode.cpp index c3dc5354ca..7e8a430592 100644 --- a/src/quick/scenegraph/util/qsgsimplerectnode.cpp +++ b/src/quick/scenegraph/util/qsgsimplerectnode.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgsimplerectnode.h b/src/quick/scenegraph/util/qsgsimplerectnode.h index 6519290cfe..0aed02ea6d 100644 --- a/src/quick/scenegraph/util/qsgsimplerectnode.h +++ b/src/quick/scenegraph/util/qsgsimplerectnode.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp index 00b240e435..0054f92c3d 100644 --- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp +++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.h b/src/quick/scenegraph/util/qsgsimpletexturenode.h index 605cae11e4..94f900f2eb 100644 --- a/src/quick/scenegraph/util/qsgsimpletexturenode.h +++ b/src/quick/scenegraph/util/qsgsimpletexturenode.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index a732c5ab06..32042b0a3d 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgtexture.h b/src/quick/scenegraph/util/qsgtexture.h index 6fdab9f401..df07382d10 100644 --- a/src/quick/scenegraph/util/qsgtexture.h +++ b/src/quick/scenegraph/util/qsgtexture.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgtexture_p.h b/src/quick/scenegraph/util/qsgtexture_p.h index e1d6dd0e32..4186995afd 100644 --- a/src/quick/scenegraph/util/qsgtexture_p.h +++ b/src/quick/scenegraph/util/qsgtexture_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp index 0bee81993c..893993db6c 100644 --- a/src/quick/scenegraph/util/qsgtexturematerial.cpp +++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgtexturematerial.h b/src/quick/scenegraph/util/qsgtexturematerial.h index b2b3ce6374..fa34e9f31e 100644 --- a/src/quick/scenegraph/util/qsgtexturematerial.h +++ b/src/quick/scenegraph/util/qsgtexturematerial.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgtexturematerial_p.h b/src/quick/scenegraph/util/qsgtexturematerial_p.h index 0ab552f4e9..7ffe15e85a 100644 --- a/src/quick/scenegraph/util/qsgtexturematerial_p.h +++ b/src/quick/scenegraph/util/qsgtexturematerial_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgtextureprovider.cpp b/src/quick/scenegraph/util/qsgtextureprovider.cpp index 62b2819dab..984733513a 100644 --- a/src/quick/scenegraph/util/qsgtextureprovider.cpp +++ b/src/quick/scenegraph/util/qsgtextureprovider.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgtextureprovider.h b/src/quick/scenegraph/util/qsgtextureprovider.h index bc4ffec03d..87755d852d 100644 --- a/src/quick/scenegraph/util/qsgtextureprovider.h +++ b/src/quick/scenegraph/util/qsgtextureprovider.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp index 8c6996642b..ef1fecae90 100644 --- a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp +++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.h b/src/quick/scenegraph/util/qsgvertexcolormaterial.h index 1d3b5a82e0..e6b075415d 100644 --- a/src/quick/scenegraph/util/qsgvertexcolormaterial.h +++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** |