diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-01-25 14:43:07 +1000 |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2012-01-25 14:43:07 +1000 |
commit | c3601a8db91bc777ea859d6a796dfab6a218675e (patch) | |
tree | d2a4f6c83bec3cddcce020966cccac72be3aa04a /src/quick/scenegraph/qsgcontext.cpp | |
parent | 35794301d188b731a7b596d92fc632fff58586c0 (diff) | |
parent | 149f6afe321ce59aebe4ce2f9dddd1881d0ac22b (diff) | |
download | qtdeclarative-wip/animation-refactor.tar.gz |
Merge branch 'master' into animation-refactorwip/animation-refactoranimation-refactor
Conflicts:
tests/auto/declarative/declarative.pro
Change-Id: Ie339be2989fac553d351f3077869f1847367b504
Diffstat (limited to 'src/quick/scenegraph/qsgcontext.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
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); } |