Beispiel #1
0
void QVGPixmapData::reclaimImages()
{
    if (!inImagePool)
        return;
    forceToImage();
    destroyImages();
}
Beispiel #2
0
void QVGPixmapData::setAlphaChannel(const QPixmap &alphaChannel)
{
    if (!isValid())
        return;
    forceToImage();
    source.setAlphaChannel(alphaChannel);
}
Beispiel #3
0
void QGLPixmapData::reclaimTexture()
{
    if (!inTexturePool)
        return;
    forceToImage();
    destroyTexture();
}
Beispiel #4
0
void QGLPixmapData::fill(const QColor &color)
{
    if (!isValid())
        return;

    bool hasAlpha = color.alpha() != 255;
    if (hasAlpha && !m_hasAlpha) {
        if (m_texture.id) {
            destroyTexture();
            m_dirty = true;
        }
        m_hasAlpha = color.alpha() != 255;
    }

    if (useFramebufferObjects()) {
        m_source = QVolatileImage();
        m_hasFillColor = true;
        m_fillColor = color;
    } else {
        forceToImage();

        if (m_source.depth() == 32) {
            m_source.fill(PREMUL(color.rgba()));

        } else if (m_source.depth() == 1) {
            if (color == Qt::color1)
                m_source.fill(1);
            else
                m_source.fill(0);
        }
    }
}
Beispiel #5
0
void QVGPixmapData::hibernate()
{
    // If the image was imported (e.g, from an SgImage under Symbian),
    // then we cannot copy it back to main memory for storage.
    if (vgImage != VG_INVALID_HANDLE && source.isNull())
        return;

    forceToImage();
    destroyImageAndContext();
}
Beispiel #6
0
void QVGPixmapData::hibernate()
{
    // If the image was imported (e.g, from an SgImage under Symbian), then
    // skip the hibernation, there is no sense in copying it back to main
    // memory because the data is most likely shared between several processes.
    bool skipHibernate = (vgImage != VG_INVALID_HANDLE && source.isNull());
#if defined(Q_OS_SYMBIAN)
    // However we have to proceed normally if the image was retrieved via
    // a handle provider.
    skipHibernate &= !nativeImageHandleProvider;
#endif
    if (skipHibernate)
        return;

    forceToImage(false); // no readback allowed here
    destroyImageAndContext();
}
Beispiel #7
0
void QVGPixmapData::fill(const QColor &color)
{
    if (!isValid())
        return;
    forceToImage();
    if (source.depth() == 1) {
        // Pick the best approximate color in the image's colortable.
        int gray = qGray(color.rgba());
        if (qAbs(qGray(source.imageRef().color(0)) - gray)
            < qAbs(qGray(source.imageRef().color(1)) - gray))
            source.fill(0);
        else
            source.fill(1);
    } else {
        source.fill(PREMUL(color.rgba()));
    }
}
Beispiel #8
0
void QGLPixmapData::hibernate()
{
    // If the image was imported (e.g, from an SgImage under Symbian), then
    // skip the hibernation, there is no sense in copying it back to main
    // memory because the data is most likely shared between several processes.
    bool skipHibernate = (m_texture.id && m_source.isNull());
#if defined(Q_OS_SYMBIAN)
    // However we have to proceed normally if the image was retrieved via
    // a handle provider.
    skipHibernate &= !nativeImageHandleProvider;
#endif
    if (skipHibernate)
        return;

    forceToImage();
    destroyTexture();
}
Beispiel #9
0
QImage *QVGPixmapData::buffer()
{
    forceToImage();
    return &source;
}
Beispiel #10
0
void QVGPixmapData::setAlphaChannel(const QPixmap &alphaChannel)
{
    forceToImage();
    source.setAlphaChannel(alphaChannel.toImage());
}