summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbintegration.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-11-18 10:24:32 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-20 14:17:41 +0100
commitc274ea7cf5e11ade0a5812e3080baa671d012524 (patch)
tree86ebcf918989dc674b0e82700cf0c123ba44e49e /src/plugins/platforms/xcb/qxcbintegration.cpp
parent47d5d349d8f5bc590ca7cdf30bf13b69bddf3225 (diff)
Introducing QPlatformSharedGraphicsCache
Interface to provide cross-process caching mechanisms in a platform plugin. Can be used for shared glyph caches and icon caches etc. Change-Id: If0d89a0a50bbd6eee05daf908448262ff270fc5b Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbintegration.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 418915bd15..0bed8c6fbb 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -47,6 +47,7 @@
#include "qxcbnativeinterface.h"
#include "qxcbclipboard.h"
#include "qxcbdrag.h"
+#include "qxcbsharedgraphicscache.h"
#include <xcb/xcb.h>
@@ -107,6 +108,10 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters)
m_fontDatabase.reset(new QGenericUnixFontDatabase());
m_inputContext.reset(QPlatformInputContextFactory::create());
m_accessibility.reset(new QPlatformAccessibility());
+
+#if defined(QT_USE_XCB_SHARED_GRAPHICS_CACHE)
+ m_sharedGraphicsCache.reset(new QXcbSharedGraphicsCache);
+#endif
}
QXcbIntegration::~QXcbIntegration()
@@ -186,6 +191,10 @@ QPlatformBackingStore *QXcbIntegration::createPlatformBackingStore(QWindow *wind
bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
switch (cap) {
+#if defined(QT_USE_XCB_SHARED_GRAPHICS_CACHE)
+ case SharedGraphicsCache: return true;
+#endif
+
case ThreadedPixmaps: return true;
case OpenGL: return true;
case ThreadedOpenGL:
@@ -239,4 +248,24 @@ QPlatformAccessibility *QXcbIntegration::accessibility() const
return m_accessibility.data();
}
+#if defined(QT_USE_XCB_SHARED_GRAPHICS_CACHE)
+static bool sharedGraphicsCacheDisabled()
+{
+ static const char *environmentVariable = "QT_DISABLE_SHARED_CACHE";
+ static bool cacheDisabled = !qgetenv(environmentVariable).isEmpty()
+ && qgetenv(environmentVariable).toInt() != 0;
+ return cacheDisabled;
+}
+
+QPlatformSharedGraphicsCache *QXcbIntegration::createPlatformSharedGraphicsCache(const char *cacheId) const
+{
+ Q_UNUSED(cacheId);
+
+ if (sharedGraphicsCacheDisabled())
+ return 0;
+
+ return m_sharedGraphicsCache.data();
+}
+#endif
+
QT_END_NAMESPACE