Exemple #1
0
void QVGPixmapData::destroyImageAndContext()
{
    if (vgImage != VG_INVALID_HANDLE) {
        // We need to have a context current to destroy the image.
#if !defined(QT_NO_EGL)
        if (!context)
            context = qt_vg_create_context(0, QInternal::Pixmap);
        if (context->isCurrent()) {
            destroyImages();
        } else {
            // We don't currently have a widget surface active, but we
            // need a surface to make the context current.  So use the
            // shared pbuffer surface instead.
            context->makeCurrent(qt_vg_shared_surface());
            destroyImages();
            context->lazyDoneCurrent();
        }
#else
        destroyImages();
#endif
    } else {
#if defined(Q_OS_SYMBIAN)
        releaseNativeImageHandle();
#endif
    }
#if !defined(QT_NO_EGL)
    if (context) {
        qt_vg_destroy_context(context, QInternal::Pixmap);
        context = 0;
    }
#endif
    recreate = true;
}
Exemple #2
0
void QGLPixmapData::destroyTexture()
{
    if (inTexturePool) {
        QGLTexturePool *pool = QGLTexturePool::instance();
        if (m_texture.id)
            pool->releaseTexture(this, m_texture.id);
    } else {
        if (m_texture.id) {
            QGLWidget *shareWidget = qt_gl_share_widget();
            if (shareWidget) {
                QGLShareContextScope ctx(shareWidget->context());
                glDeleteTextures(1, &m_texture.id);
            }
        }
    }
    m_texture.id = 0;
    inTexturePool = false;

    releaseNativeImageHandle();
}
Exemple #3
0
void QVGPixmapData::destroyImages()
{
    if (inImagePool) {
        QVGImagePool *pool = QVGImagePool::instance();
        if (vgImage != VG_INVALID_HANDLE)
            pool->releaseImage(this, vgImage);
        if (vgImageOpacity != VG_INVALID_HANDLE)
            pool->releaseImage(this, vgImageOpacity);
    } else {
        if (vgImage != VG_INVALID_HANDLE)
            vgDestroyImage(vgImage);
        if (vgImageOpacity != VG_INVALID_HANDLE)
            vgDestroyImage(vgImageOpacity);
    }
    vgImage = VG_INVALID_HANDLE;
    vgImageOpacity = VG_INVALID_HANDLE;
    inImagePool = false;

#if defined(Q_OS_SYMBIAN)
    releaseNativeImageHandle();
#endif
}