summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-01-27 14:02:54 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-01-27 14:05:23 (GMT)
commit5bc4ed0c33bad23ce2988e74ae8e7f9a4e5a3250 (patch)
treeb3896c0f12dcf62da0d06a6a3b1540428e0138a9 /src/gui
parent33a5ecd4908690d6a8366d8f7384ad1e8cf86f92 (diff)
downloadQt-5bc4ed0c33bad23ce2988e74ae8e7f9a4e5a3250.zip
Qt-5bc4ed0c33bad23ce2988e74ae8e7f9a4e5a3250.tar.gz
Qt-5bc4ed0c33bad23ce2988e74ae8e7f9a4e5a3250.tar.bz2
Fix QPixmap::fill autotest and cachekey autotest
Also make sure it didn't failed with a QFATAL when drawing bitmaps and tried to make sure all surfaces er unlocked when opperations are being performed on them from the windowsurface. There are still test failuers :(
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qpixmap_blitter.cpp35
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp2
2 files changed, 34 insertions, 3 deletions
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 175c234..6e34fbd 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -5,9 +5,14 @@
#include <private/qapplication_p.h>
#include <private/qgraphicssystem_p.h>
+#include <private/qdrawhelper_p.h>
+
+static int global_ser_no = 0;
+
QBlittablePixmapData::QBlittablePixmapData(QPixmapData::PixelType type)
: QPixmapData(type,BlitterClass), m_engine(0), m_blittable(0)
{
+ setSerialNumber(++global_ser_no);
}
QBlittablePixmapData::~QBlittablePixmapData()
@@ -21,7 +26,6 @@ QBlittable *QBlittablePixmapData::blittable() const
if (!m_blittable) {
QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this);
that->m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,w,h));
- that->setSerialNumber(m_blittable->lock()->serialNumber());
}
return m_blittable;
@@ -77,11 +81,36 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
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
- blittable()->lock()->fill(color.rgba());
+ }else {
+ 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);
+ }
+
}
QImage *QBlittablePixmapData::buffer()
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index 0f6b5cf..1a1d5e0 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -63,6 +63,8 @@ public:
bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const
{
+ if (pm.pixmapData()->classId() != QPixmapData::BlitterClass)
+ return false;
if ((!drawPixmapState) || drawPixmapState & drawPixmapMask) {
if (m_capabilities & (QBlittable::SourceOverPixmapCapability
| QBlittable::SourceOverScaledPixmapCapability)) {