diff options
author | Jason Barron <jason.barron@nokia.com> | 2010-09-24 14:47:41 (GMT) |
---|---|---|
committer | Jason Barron <jason.barron@nokia.com> | 2010-10-07 07:01:23 (GMT) |
commit | 45134e5dda238e42b89a407464911ac05f214cac (patch) | |
tree | 0bb15ca9f8cde1d96e5e98c3d39f9c479a21fff6 /src/gui/painting/qpaintengine_s60.cpp | |
parent | 84ff17b7e2ea50af3274ac659bc9d67a8e2e3798 (diff) | |
download | Qt-45134e5dda238e42b89a407464911ac05f214cac.zip Qt-45134e5dda238e42b89a407464911ac05f214cac.tar.gz Qt-45134e5dda238e42b89a407464911ac05f214cac.tar.bz2 |
Make sure the QS60PaintEngine can draw other classes of pixmap data
The QS60PaintEngine should not assume that the pixmap is always of type
'Raster'. It should check the classId and if it is not 'Raster' it
should forward the call to QRasterPaintEngine which already handles
this scenario by converting the pixmap to a QImage and drawing that
instead.
Reviewed-by: Jani Hautakangas
Diffstat (limited to 'src/gui/painting/qpaintengine_s60.cpp')
-rw-r--r-- | src/gui/painting/qpaintengine_s60.cpp | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/src/gui/painting/qpaintengine_s60.cpp b/src/gui/painting/qpaintengine_s60.cpp index 068ca0c..d7fc0af 100644 --- a/src/gui/painting/qpaintengine_s60.cpp +++ b/src/gui/painting/qpaintengine_s60.cpp @@ -59,44 +59,63 @@ bool QS60PaintEngine::begin(QPaintDevice *device) { Q_D(QS60PaintEngine); - pixmapData->beginDataAccess(); - bool ret = QRasterPaintEngine::begin(device); - // Make sure QPaintEngine::paintDevice() returns the proper device. - // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPixmapData - // which is incorrect in Symbian. - d->pdev = device; - return ret; + if (pixmapData->classId() == QPixmapData::RasterClass) { + pixmapData->beginDataAccess(); + bool ret = QRasterPaintEngine::begin(device); + // Make sure QPaintEngine::paintDevice() returns the proper device. + // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPixmapData + // which is incorrect in Symbian. + d->pdev = device; + return ret; + } + + return QRasterPaintEngine::begin(device); } bool QS60PaintEngine::end() { - bool ret = QRasterPaintEngine::end(); - pixmapData->endDataAccess(); - return ret; + if (pixmapData->classId() == QPixmapData::RasterClass) { + bool ret = QRasterPaintEngine::end(); + pixmapData->endDataAccess(); + return ret; + } + return QRasterPaintEngine::end(); } void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); - srcData->beginDataAccess(); - QRasterPaintEngine::drawPixmap(p, pm); - srcData->endDataAccess(); + if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { + QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + srcData->beginDataAccess(); + QRasterPaintEngine::drawPixmap(p, pm); + srcData->endDataAccess(); + } else { + QRasterPaintEngine::drawPixmap(p, pm); + } } void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); - srcData->beginDataAccess(); - QRasterPaintEngine::drawPixmap(r, pm, sr); - srcData->endDataAccess(); + if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { + QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + srcData->beginDataAccess(); + QRasterPaintEngine::drawPixmap(r, pm, sr); + srcData->endDataAccess(); + } else { + QRasterPaintEngine::drawPixmap(r, pm, sr); + } } void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); - srcData->beginDataAccess(); - QRasterPaintEngine::drawTiledPixmap(r, pm, sr); - srcData->endDataAccess(); + if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { + QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + srcData->beginDataAccess(); + QRasterPaintEngine::drawTiledPixmap(r, pm, sr); + srcData->endDataAccess(); + } else { + QRasterPaintEngine::drawTiledPixmap(r, pm, sr); + } } void QS60PaintEngine::prepare(QImage *image) |