Ejemplo n.º 1
0
void QBlittablePlatformPixmap::fill(const QColor &color)
{
    if (blittable()->capabilities() & QBlittable::AlphaFillRectCapability) {
        blittable()->unlock();
        blittable()->alphaFillRect(QRectF(0,0,w,h),color,QPainter::CompositionMode_Source);
    } else if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) {
        blittable()->unlock();
        blittable()->fillRect(QRectF(0,0,w,h),color);
    } else {
        // Need to be backed with an alpha channel now. It would be nice
        // if we could just change the format, e.g. when going from
        // RGB32 -> ARGB8888.
        if (color.alpha() != 255 && !hasAlphaChannel()) {
            m_blittable.reset(0);
            m_engine.reset(0);
            m_alpha = true;
        }

        uint pixel = PREMUL(color.rgba());
        const QPixelLayout *layout = &qPixelLayouts[blittable()->lock()->format()];
        Q_ASSERT(layout->convertFromARGB32PM);
        layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0);

        //so premultiplied formats are supported and ARGB32 and RGB32
        blittable()->lock()->fill(pixel);
    }

}
Ejemplo n.º 2
0
void QBlittablePixmapData::fill(const QColor &color)
{
    //jlind: todo: change when blittables can support non opaque fillRects
    if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) {
        blittable()->unlock();
        blittable()->fillRect(QRectF(0,0,w,h),color);
    } else {
        // Need to be backed with an alpha channel now. It would be nice
        // if we could just change the format, e.g. when going from
        // RGB32 -> ARGB8888.
        if (color.alpha() != 255 && !hasAlphaChannel()) {
            m_blittable.reset(0);
            m_engine.reset(0);
            m_alpha = true;
        }

        uint pixel;
        switch (blittable()->lock()->format()) {
        case QImage::Format_ARGB32_Premultiplied:
            pixel = PREMUL(color.rgba());
            break;
        case QImage::Format_ARGB8565_Premultiplied:
            pixel = qargb8565(color.rgba()).rawValue();
            break;
        case QImage::Format_ARGB8555_Premultiplied:
            pixel = qargb8555(color.rgba()).rawValue();
            break;
        case QImage::Format_ARGB6666_Premultiplied:
            pixel = qargb6666(color.rgba()).rawValue();
            break;
        case QImage::Format_ARGB4444_Premultiplied:
            pixel = qargb4444(color.rgba()).rawValue();
            break;
        default:
            pixel = color.rgba();
            break;
        }
        //so premultiplied formats are supported and ARGB32 and RGB32
        blittable()->lock()->fill(pixel);
    }

}
Ejemplo n.º 3
0
bool QBlittablePixmapData::hasAlphaChannel() const
{
    return blittable()->lock()->hasAlphaChannel();
}
Ejemplo n.º 4
0
QImage QBlittablePixmapData::toImage() const
{
    return blittable()->lock()->copy();
}
Ejemplo n.º 5
0
QImage *QBlittablePixmapData::buffer()
{
    return blittable()->lock();
}
Ejemplo n.º 6
0
bool QBlittablePlatformPixmap::hasAlphaChannel() const
{
    return blittable()->lock()->hasAlphaChannel();
}
Ejemplo n.º 7
0
QImage QBlittablePlatformPixmap::toImage() const
{
    return blittable()->lock()->copy();
}
Ejemplo n.º 8
0
QImage *QBlittablePlatformPixmap::buffer()
{
    return blittable()->lock();
}