summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap_blitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image/qpixmap_blitter.cpp')
-rw-r--r--src/gui/image/qpixmap_blitter.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index f8fb538..c73e6a9 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -58,6 +58,7 @@ static int global_ser_no = 0;
QBlittablePixmapData::QBlittablePixmapData()
: QPixmapData(QPixmapData::PixmapType,BlitterClass)
+ , m_alpha(false)
#ifdef QT_BLITTER_RASTEROVERLAY
,m_rasterOverlay(0), m_unmergedCopy(0)
#endif //QT_BLITTER_RASTEROVERLAY
@@ -77,7 +78,7 @@ QBlittable *QBlittablePixmapData::blittable() const
{
if (!m_blittable) {
QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this);
- that->m_blittable.reset(this->createBlittable(QSize(w,h)));
+ that->m_blittable.reset(this->createBlittable(QSize(w,h), m_alpha));
}
return m_blittable.data();
@@ -136,7 +137,16 @@ void QBlittablePixmapData::fill(const QColor &color)
if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) {
blittable()->unlock();
blittable()->fillRect(QRectF(0,0,w,h),color);
- }else {
+ } 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:
@@ -182,6 +192,7 @@ bool QBlittablePixmapData::hasAlphaChannel() const
void QBlittablePixmapData::fromImage(const QImage &image,
Qt::ImageConversionFlags flags)
{
+ m_alpha = image.hasAlphaChannel();
resize(image.width(),image.height());
markRasterOverlay(QRect(0,0,w,h));
QImage *thisImg = buffer();