diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-12 12:46:23 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-12 12:46:23 (GMT) |
commit | f0915d4a19f30b3ec0e0ee1c538e11be6b43a7b3 (patch) | |
tree | 72a401f29b4b411fc072e2cbdc080cf2f66686aa | |
parent | fc3ef51ef7344e189699e62ec54f3ce469c553f9 (diff) | |
parent | 4f1b0d758e42872d2852e0eedd2417a858d603e2 (diff) | |
download | Qt-f0915d4a19f30b3ec0e0ee1c538e11be6b43a7b3.zip Qt-f0915d4a19f30b3ec0e0ee1c538e11be6b43a7b3.tar.gz Qt-f0915d4a19f30b3ec0e0ee1c538e11be6b43a7b3.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Removed a Valgrind warning.
Made QGLExtensions::glExtensions() thread-safe.
QTreeView: Optimise QTreeViewPrivate::viewIndex
Optimize QSortFilterProxyModel
QTreeView: speedup more QTreeViewPrivate::layout(-1)
Remove debug output from qt_eglproperties_set_glformat
Delete the QGLContext in ~QX11GLPixmapData
Made QGLTextureCache::instance() threadsafe.
Add support for QFont::NoAntialias on QWS
Fix 1-bit to 8-bit conversion for bitmap fonts on QWS
-rw-r--r-- | src/gui/egl/qegl.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qsortfilterproxymodel.cpp | 16 | ||||
-rw-r--r-- | src/gui/itemviews/qtreeview.cpp | 100 | ||||
-rw-r--r-- | src/gui/itemviews/qtreeview_p.h | 5 | ||||
-rw-r--r-- | src/gui/painting/qcups.cpp | 3 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_qws.cpp | 7 | ||||
-rw-r--r-- | src/gui/text/qfontengine_qpf.cpp | 14 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 65 | ||||
-rw-r--r-- | src/opengl/qgl_egl.cpp | 9 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 4 | ||||
-rw-r--r-- | src/opengl/qgl_qws.cpp | 1 | ||||
-rw-r--r-- | src/opengl/qgl_wince.cpp | 1 | ||||
-rw-r--r-- | src/opengl/qgl_x11egl.cpp | 1 | ||||
-rw-r--r-- | src/opengl/qpixmapdata_x11gl_egl.cpp | 3 |
14 files changed, 119 insertions, 112 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 6e0331f..b870523 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -60,7 +60,7 @@ static QEglContext * volatile currentVGContext = 0; QEglContext::QEglContext() : apiType(QEgl::OpenGL) , ctx(EGL_NO_CONTEXT) - , cfg(0) + , cfg(QEGL_NO_CONFIG) , currentSurface(EGL_NO_SURFACE) , current(false) , ownsContext(true) diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index c63a07b..5c7d24b7 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -122,10 +122,10 @@ public: QVector<int> proxy_rows; QVector<int> proxy_columns; QVector<QModelIndex> mapped_children; - QMap<QModelIndex, Mapping *>::const_iterator map_iter; + QHash<QModelIndex, Mapping *>::const_iterator map_iter; }; - mutable QMap<QModelIndex, Mapping*> source_index_mapping; + mutable QHash<QModelIndex, Mapping*> source_index_mapping; int source_sort_column; int proxy_sort_column; @@ -142,7 +142,7 @@ public: QModelIndexPairList saved_persistent_indexes; - QMap<QModelIndex, Mapping *>::const_iterator create_mapping( + QHash<QModelIndex, Mapping *>::const_iterator create_mapping( const QModelIndex &source_parent) const; QModelIndex proxy_to_source(const QModelIndex &proxyIndex) const; QModelIndex source_to_proxy(const QModelIndex &sourceIndex) const; @@ -150,14 +150,14 @@ public: void remove_from_mapping(const QModelIndex &source_parent); - inline QMap<QModelIndex, Mapping *>::const_iterator index_to_iterator( + inline QHash<QModelIndex, Mapping *>::const_iterator index_to_iterator( const QModelIndex &proxy_index) const { Q_ASSERT(proxy_index.isValid()); Q_ASSERT(proxy_index.model() == q_func()); const void *p = proxy_index.internalPointer(); Q_ASSERT(p); - QMap<QModelIndex, Mapping *>::const_iterator it = + QHash<QModelIndex, Mapping *>::const_iterator it = static_cast<const Mapping*>(p)->map_iter; Q_ASSERT(it != source_index_mapping.constEnd()); Q_ASSERT(it.value()); @@ -165,7 +165,7 @@ public: } inline QModelIndex create_index(int row, int column, - QMap<QModelIndex, Mapping*>::const_iterator it) const + QHash<QModelIndex, Mapping*>::const_iterator it) const { return q_func()->createIndex(row, column, *it); } @@ -246,7 +246,7 @@ public: virtual void _q_sourceModelDestroyed(); }; -typedef QMap<QModelIndex, QSortFilterProxyModelPrivate::Mapping *> IndexMap; +typedef QHash<QModelIndex, QSortFilterProxyModelPrivate::Mapping *> IndexMap; void QSortFilterProxyModelPrivate::_q_sourceModelDestroyed() { @@ -292,11 +292,13 @@ IndexMap::const_iterator QSortFilterProxyModelPrivate::create_mapping( Mapping *m = new Mapping; int source_rows = model->rowCount(source_parent); + m->source_rows.reserve(source_rows); for (int i = 0; i < source_rows; ++i) { if (q->filterAcceptsRow(i, source_parent)) m->source_rows.append(i); } int source_cols = model->columnCount(source_parent); + m->source_columns.reserve(source_cols); for (int i = 0; i < source_cols; ++i) { if (q->filterAcceptsColumn(i, source_parent)) m->source_columns.append(i); diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 0a7ffb7..4135ba0 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2407,9 +2407,9 @@ void QTreeView::reexpand() /*! \internal + This function assume that left is a (grand-)child of the parent of left. */ -static bool treeViewItemLessThan(const QTreeViewItem &left, - const QTreeViewItem &right) +static bool treeViewItemLessThanInInsert(const QTreeViewItem &left, const QTreeViewItem &right) { if (left.level != right.level) { Q_ASSERT(left.level > right.level); @@ -2496,7 +2496,7 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end) QVector<QTreeViewItem>::iterator it; it = qLowerBound(d->viewItems.begin() + firstChildItem, d->viewItems.begin() + lastChildItem + 1, - insertedItems.at(0), treeViewItemLessThan); + insertedItems.at(0), treeViewItemLessThanInInsert); insertPos = it - d->viewItems.begin(); // update stale model indexes of siblings @@ -2662,17 +2662,8 @@ void QTreeView::expandAll() { Q_D(QTreeView); d->viewItems.clear(); - d->expandedIndexes.clear(); d->interruptDelayedItemsLayout(); - d->layout(-1); - for (int i = 0; i < d->viewItems.count(); ++i) { - if (d->viewItems[i].expanded) - continue; - d->viewItems[i].expanded = true; - d->layout(i); - QModelIndex idx = d->viewItems.at(i).index; - d->expandedIndexes.insert(idx); - } + d->layout(-1, true); updateGeometries(); d->viewport->update(); } @@ -3155,7 +3146,14 @@ void QTreeViewPrivate::_q_columnsRemoved(const QModelIndex &parent, int start, i QAbstractItemViewPrivate::_q_columnsRemoved(parent, start, end); } -void QTreeViewPrivate::layout(int i) +/** \internal + creates and initialize the viewItem structure of the children of the element \i + + set \a recursiveExpanding if the function has to expand all the children (called from expandAll) + \a afterIsUninitialized is when we recurse from layout(-1), it means all the items after 'i' are + not yet initialized and need not to be moved + */ +void QTreeViewPrivate::layout(int i, bool recursiveExpanding, bool afterIsUninitialized) { Q_Q(QTreeView); QModelIndex current; @@ -3182,8 +3180,12 @@ void QTreeViewPrivate::layout(int i) defaultItemHeight = q->indexRowSizeHint(index); } viewItems.resize(count); + afterIsUninitialized = true; } else if (viewItems[i].total != (uint)count) { + if (!afterIsUninitialized) insertViewItems(i + 1, count, QTreeViewItem()); // expand + else if (count > 0) + viewItems.resize(viewItems.count() + count); } else { expanding = false; } @@ -3212,9 +3214,11 @@ void QTreeViewPrivate::layout(int i) item->expanded = false; item->total = 0; item->hasMoreSiblings = false; - if (isIndexExpanded(current)) { + if (recursiveExpanding || isIndexExpanded(current)) { + if (recursiveExpanding) + expandedIndexes.insert(current); item->expanded = true; - layout(last); + layout(last, recursiveExpanding, afterIsUninitialized); item = &viewItems[last]; children += item->total; item->hasChildren = item->total > 0; @@ -3226,8 +3230,12 @@ void QTreeViewPrivate::layout(int i) } // remove hidden items - if (hidden > 0) - removeViewItems(last + 1, hidden); // collapse + if (hidden > 0) { + if (!afterIsUninitialized) + removeViewItems(last + 1, hidden); + else + viewItems.resize(viewItems.size() - hidden); + } if (!expanding) return; // nothing changed @@ -3389,46 +3397,39 @@ int QTreeViewPrivate::viewIndex(const QModelIndex &_index) const const int totalCount = viewItems.count(); const QModelIndex index = _index.sibling(_index.row(), 0); + const int row = index.row(); + const quint64 internalId = index.internalId(); - - // A quick check near the last item to see if we are just incrementing - const int start = lastViewedItem > 2 ? lastViewedItem - 2 : 0; - const int end = lastViewedItem < totalCount - 2 ? lastViewedItem + 2 : totalCount; - int row = index.row(); - for (int i = start; i < end; ++i) { - const QModelIndex &idx = viewItems.at(i).index; - if (idx.row() == row) { - if (idx.internalId() == index.internalId()) { - lastViewedItem = i; - return i; - } + // We start nearest to the lastViewedItem + int localCount = qMin(lastViewedItem - 1, totalCount - lastViewedItem); + for (int i = 0; i < localCount; ++i) { + const QModelIndex &idx1 = viewItems.at(lastViewedItem + i).index; + if (idx1.row() == row && idx1.internalId() == internalId) { + lastViewedItem = lastViewedItem + i; + return lastViewedItem; + } + const QModelIndex &idx2 = viewItems.at(lastViewedItem - i - 1).index; + if (idx2.row() == row && idx2.internalId() == internalId) { + lastViewedItem = lastViewedItem - i - 1; + return lastViewedItem; } } - // NOTE: this function is slow if the item is outside the visible area - // search in visible items first and below - int t = firstVisibleItem(); - t = t > 100 ? t - 100 : 0; // start 100 items above the visible area - - for (int i = t; i < totalCount; ++i) { - const QModelIndex &idx = viewItems.at(i).index; - if (idx.row() == row) { - if (idx.internalId() == index.internalId()) { - lastViewedItem = i; - return i; - } + for (int j = qMax(0, lastViewedItem + localCount); j < totalCount; ++j) { + const QModelIndex &idx = viewItems.at(j).index; + if (idx.row() == row && idx.internalId() == internalId) { + lastViewedItem = j; + return j; } } - // search from top to first visible - for (int j = 0; j < t; ++j) { + for (int j = qMin(totalCount, lastViewedItem - localCount) - 1; j >= 0; --j) { const QModelIndex &idx = viewItems.at(j).index; - if (idx.row() == row) { - if (idx.internalId() == index.internalId()) { - lastViewedItem = j; - return j; - } + if (idx.row() == row && idx.internalId() == internalId) { + lastViewedItem = j; + return j; } } + // nothing found return -1; } @@ -3753,7 +3754,6 @@ bool QTreeViewPrivate::hasVisibleChildren(const QModelIndex& parent) const void QTreeViewPrivate::rowsRemoved(const QModelIndex &parent, int start, int end, bool after) { - Q_Q(QTreeView); // if we are going to do a complete relayout anyway, there is no need to update if (delayedPendingLayout) { _q_rowsRemoved(parent, start, end); diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h index 7893e04..48997b7 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/gui/itemviews/qtreeview_p.h @@ -55,6 +55,7 @@ #include "private/qabstractitemview_p.h" #include <QtCore/qvariantanimation.h> +#include <QtCore/qabstractitemmodel.h> #ifndef QT_NO_TREEVIEW @@ -75,6 +76,8 @@ struct QTreeViewItem int height : 16; // row height }; +Q_DECLARE_TYPEINFO(QTreeViewItem, Q_MOVABLE_TYPE); + class QTreeViewPrivate : public QAbstractItemViewPrivate { Q_DECLARE_PUBLIC(QTreeView) @@ -124,7 +127,7 @@ public: void _q_sortIndicatorChanged(int column, Qt::SortOrder order); void _q_modelDestroyed(); - void layout(int item); + void layout(int item, bool recusiveExpanding = false, bool afterIsUninitialized = false); int pageUp(int item) const; int pageDown(int item) const; diff --git a/src/gui/painting/qcups.cpp b/src/gui/painting/qcups.cpp index ac41692..1ea1670 100644 --- a/src/gui/painting/qcups.cpp +++ b/src/gui/painting/qcups.cpp @@ -343,7 +343,8 @@ bool QCUPSSupport::printerHasPPD(const char *printerName) if (!isAvailable()) return false; const char *ppdFile = _cupsGetPPD(printerName); - unlink(ppdFile); + if (ppdFile) + unlink(ppdFile); return (ppdFile != 0); } diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp index 62d7793..a3d8d65 100644 --- a/src/gui/text/qfontdatabase_qws.cpp +++ b/src/gui/text/qfontdatabase_qws.cpp @@ -632,8 +632,9 @@ QFontEngine *loadSingleEngine(int script, const QFontPrivate *fp, #ifndef QT_NO_FREETYPE QScopedPointer<QFontEngineFT> fte(new QFontEngineFT(def)); - if (fte->init(faceId, style->antialiased, - style->antialiased ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono)) { + bool antialias = style->antialiased && !(request.styleStrategy & QFont::NoAntialias); + if (fte->init(faceId, antialias, + antialias ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono)) { #ifdef QT_NO_QWS_QPF2 return fte.take(); #else @@ -793,7 +794,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" - " pixelSize: %d\n" + " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 136737d..a0593cc 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -920,8 +920,18 @@ void QFontEngineQPF::loadGlyph(glyph_t glyph) if (!renderingFontEngine) return; - - QImage img = renderingFontEngine->alphaMapForGlyph(glyph).convertToFormat(QImage::Format_Indexed8); + QImage img = renderingFontEngine->alphaMapForGlyph(glyph); + if (img.format() != QImage::Format_Indexed8) { + bool mono = img.depth() == 1; + img = img.convertToFormat(QImage::Format_Indexed8); + if (mono) { + //### we know that 1 is opaque and 0 is transparent + uchar *byte = img.bits(); + int count = img.byteCount(); + while (count--) + *byte++ *= 0xff; + } + } glyph_metrics_t metrics = renderingFontEngine->boundingBox(glyph); renderingFontEngine->removeGlyphFromCache(glyph); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 7839191..e0030ad 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1583,6 +1583,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) vi = 0; #endif #if defined(QT_OPENGL_ES) + ownsEglContext = false; eglContext = 0; eglSurface = EGL_NO_SURFACE; #endif @@ -1688,14 +1689,12 @@ typedef void (*_qt_image_cleanup_hook_64)(qint64); extern Q_GUI_EXPORT _qt_pixmap_cleanup_hook_64 qt_pixmap_cleanup_hook_64; extern Q_GUI_EXPORT _qt_image_cleanup_hook_64 qt_image_cleanup_hook_64; -static QGLTextureCache *qt_gl_texture_cache = 0; + +Q_GLOBAL_STATIC(QGLTextureCache, qt_gl_texture_cache) QGLTextureCache::QGLTextureCache() : m_cache(64*1024) // cache ~64 MB worth of textures - this is not accurate though { - Q_ASSERT(qt_gl_texture_cache == 0); - qt_gl_texture_cache = this; - QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(cleanupTexturesForPixampData); QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->addImageHook(cleanupTexturesForCacheKey); @@ -1703,8 +1702,7 @@ QGLTextureCache::QGLTextureCache() QGLTextureCache::~QGLTextureCache() { - qt_gl_texture_cache = 0; - + Q_ASSERT(size() == 0); QImagePixmapCleanupHooks::instance()->removePixmapDataModificationHook(cleanupTexturesForPixampData); QImagePixmapCleanupHooks::instance()->removePixmapDataDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->removeImageHook(cleanupTexturesForCacheKey); @@ -1754,22 +1752,14 @@ void QGLTextureCache::removeContextTextures(QGLContext* ctx) } } -QGLTextureCache* QGLTextureCache::instance() -{ - if (!qt_gl_texture_cache) - qt_gl_texture_cache = new QGLTextureCache; - - return qt_gl_texture_cache; -} - /* a hook that removes textures from the cache when a pixmap/image is deref'ed */ void QGLTextureCache::cleanupTexturesForCacheKey(qint64 cacheKey) { - instance()->remove(cacheKey); - Q_ASSERT(instance()->getTexture(cacheKey) == 0); + qt_gl_texture_cache()->remove(cacheKey); + Q_ASSERT(qt_gl_texture_cache()->getTexture(cacheKey) == 0); } @@ -1791,10 +1781,9 @@ void QGLTextureCache::cleanupBeforePixmapDestruction(QPixmapData* pmd) #endif } -void QGLTextureCache::deleteIfEmpty() +QGLTextureCache *QGLTextureCache::instance() { - if (instance()->size() == 0) - delete instance(); + return qt_gl_texture_cache(); } // DDS format structure @@ -1960,7 +1949,6 @@ QGLContext::~QGLContext() { // remove any textures cached in this context QGLTextureCache::instance()->removeContextTextures(this); - QGLTextureCache::deleteIfEmpty(); // ### thread safety d_ptr->group->cleanupResources(this); @@ -5072,6 +5060,20 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() return glExtensions; } + +class QGLDefaultExtensions +{ +public: + QGLDefaultExtensions() { + QGLTemporaryContext tempContext; + extensions = QGLExtensions::currentContextExtensions(); + } + + QGLExtensions::Extensions extensions; +}; + +Q_GLOBAL_STATIC(QGLDefaultExtensions, qtDefaultExtensions) + /* Returns the GL extensions for the current QGLContext. If there is no current QGLContext, a default context will be created and the extensions @@ -5079,34 +5081,19 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() */ QGLExtensions::Extensions QGLExtensions::glExtensions() { - QGLTemporaryContext *tmpContext = 0; - static bool cachedDefault = false; - static Extensions defaultExtensions = 0; + Extensions extensionFlags = 0; QGLContext *currentCtx = const_cast<QGLContext *>(QGLContext::currentContext()); if (currentCtx && currentCtx->d_func()->extension_flags_cached) return currentCtx->d_func()->extension_flags; if (!currentCtx) { - if (cachedDefault) { - return defaultExtensions; - } else { - tmpContext = new QGLTemporaryContext; - cachedDefault = true; - } - } - - Extensions extensionFlags = currentContextExtensions(); - if (currentCtx) { + extensionFlags = qtDefaultExtensions()->extensions; + } else { + extensionFlags = currentContextExtensions(); currentCtx->d_func()->extension_flags_cached = true; currentCtx->d_func()->extension_flags = extensionFlags; - } else { - defaultExtensions = extensionFlags; } - - if (tmpContext) - delete tmpContext; - return extensionFlags; } diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index c08d6fd..822c9f6 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -63,10 +63,8 @@ void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLForma // QGLFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that // type has been requested. So we must check QGLFormat's booleans too if size is -1: - if (glFormat.alpha() && alphaSize <= 0) { - qDebug("QGLFormat::alpha() returned true"); + if (glFormat.alpha() && alphaSize <= 0) alphaSize = 1; - } if (glFormat.depth() && depthSize <= 0) depthSize = 1; if (glFormat.stencil() && stencilSize <= 0) @@ -164,10 +162,11 @@ void QGLContext::reset() return; d->cleanup(); doneCurrent(); - if (d->eglContext) { + if (d->eglContext && d->ownsEglContext) { d->destroyEglSurfaceForDevice(); delete d->eglContext; } + d->ownsEglContext = false; d->eglContext = 0; d->eglSurface = EGL_NO_SURFACE; d->crWin = false; @@ -215,7 +214,7 @@ void QGLContextPrivate::destroyEglSurfaceForDevice() #ifdef Q_WS_X11 // Make sure we don't call eglDestroySurface on a surface which // was created for a different winId: - if (paintDevice->devType() == QInternal::Widget) { + if (paintDevice && paintDevice->devType() == QInternal::Widget) { QGLWidget* w = static_cast<QGLWidget*>(paintDevice); if (w->d_func()->eglSurfaceWindowId == w->winId()) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index ed34f79..45f8f30 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -278,8 +278,6 @@ public: Q_DECLARE_FLAGS(Extensions, Extension) static Extensions glExtensions(); - -private: static Extensions currentContextExtensions(); }; @@ -347,6 +345,7 @@ public: HDC hbitmap_hdc; #endif #if defined(QT_OPENGL_ES) + bool ownsEglContext; QEglContext *eglContext; EGLSurface eglSurface; void destroyEglSurfaceForDevice(); @@ -532,7 +531,6 @@ public: bool remove(QGLContext *ctx, GLuint textureId); void removeContextTextures(QGLContext *ctx); static QGLTextureCache *instance(); - static void deleteIfEmpty(); static void cleanupTexturesForCacheKey(qint64 cacheKey); static void cleanupTexturesForPixampData(QPixmapData* pixmap); static void cleanupBeforePixmapDestruction(QPixmapData* pixmap); diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index 96b2454..38c3774 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -182,6 +182,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Get the display and initialize it. d->eglContext = new QEglContext(); + d->ownsEglContext = true; d->eglContext->setApi(QEgl::OpenGL); // Construct the configuration we need for this surface. diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp index fefcca2..47a19b5 100644 --- a/src/opengl/qgl_wince.cpp +++ b/src/opengl/qgl_wince.cpp @@ -145,6 +145,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Get the display and initialize it. d->eglContext = new QEglContext(); + d->ownsEglContext = true; d->eglContext->setApi(QEgl::OpenGL); // Construct the configuration we need for this surface. diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index fe87c65..0954e69 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -182,6 +182,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Only create the eglContext if we don't already have one: if (d->eglContext == 0) { d->eglContext = new QEglContext(); + d->ownsEglContext = true; d->eglContext->setApi(QEgl::OpenGL); // If the device is a widget with WA_TranslucentBackground set, make sure the glFormat diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp index d7fae16..a01eec4 100644 --- a/src/opengl/qpixmapdata_x11gl_egl.cpp +++ b/src/opengl/qpixmapdata_x11gl_egl.cpp @@ -181,6 +181,8 @@ QX11GLPixmapData::QX11GLPixmapData() QX11GLPixmapData::~QX11GLPixmapData() { + if (ctx) + delete ctx; } #if !defined(QT_OPENGL_ES_1) @@ -245,6 +247,7 @@ void QX11GLPixmapData::beginPaint() if ((EGLSurface)gl_surface == EGL_NO_SURFACE) { QPixmap tmpPixmap(this); EGLConfig cfg = ctx->d_func()->eglContext->config(); + Q_ASSERT(cfg != QEGL_NO_CONFIG); EGLSurface surface = QEgl::createSurface(&tmpPixmap, cfg); if (surface == EGL_NO_SURFACE) { |