void qt_vg_hibernate_pixmaps(QVGSharedContext *shared) { // Artificially increase the reference count to prevent the // context from being destroyed until after we have finished // the hibernation process. ++(shared->refCount); // We need a context current to hibernate the VGImage objects. shared->context->makeCurrent(qt_vg_shared_surface()); // Scan all QVGPixmapData objects in the system and hibernate them. QVGPixmapData *pd = shared->firstPixmap; while (pd != 0) { pd->hibernate(); pd = pd->next; } // Hibernate any remaining VGImage's in the image pool. QVGImagePool::instance()->hibernate(); // Don't need the current context any more. shared->context->lazyDoneCurrent(); // Decrease the reference count and destroy the context if necessary. if (--(shared->refCount) <= 0) qt_vg_destroy_shared_context(shared); }
void tst_NativeImageHandleProvider::hibernate() { #if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) QPixmap tmp(10, 20); if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { BitmapProvider prov; prov.bmp = new CFbsBitmap; QCOMPARE(prov.bmp->Create(TSize(prov.w, prov.h), EColor16MAP), KErrNone); QPixmap pm = pixmapFromNativeImageHandleProvider(&prov); QCOMPARE(prov.refCount, 1); QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pm.pixmapData()); vgpd->hibernate(); QCOMPARE(prov.refCount, 0); // Calling toVGImage() may cause some warnings as we don't have a gui initialized, // but the only thing we care about here is get() being called. vgpd->toVGImage(); QCOMPARE(prov.refCount, 1); pm = QPixmap(); QCOMPARE(prov.refCount, 0); delete prov.bmp; } else { QSKIP("Not openvg", SkipSingle); } #else QSKIP("Not applicable", SkipSingle); #endif }
void QVGImagePool::hibernate() { Q_D(QVGImagePool); QVGPixmapData *pd = d->lruLast; while (pd) { QVGPixmapData *prevLRU = pd->prevLRU; pd->inImagePool = false; pd->inLRU = false; pd->nextLRU = 0; pd->prevLRU = 0; pd->hibernate(); pd = prevLRU; } d->lruFirst = 0; d->lruLast = 0; }