summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@nokia.com>2011-06-24 09:52:41 (GMT)
committerLiang Qi <liang.qi@nokia.com>2011-06-24 09:52:41 (GMT)
commitcf2f72f4f61f3a9e0e7573379c33bb341eeba7be (patch)
tree06fbd459f62f87344e7db973a0a9f3050cece825 /src/gui/image
parent164728f711136356a6c3482f762321b01c9d82dd (diff)
parent705b0f958a6071341b10cbd51917e1378356491b (diff)
downloadQt-cf2f72f4f61f3a9e0e7573379c33bb341eeba7be.zip
Qt-cf2f72f4f61f3a9e0e7573379c33bb341eeba7be.tar.gz
Qt-cf2f72f4f61f3a9e0e7573379c33bb341eeba7be.tar.bz2
Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts: src/gui/image/qpixmap_raster_symbian.cpp src/gui/image/qpixmapdatafactory.cpp src/gui/painting/qgraphicssystem.cpp src/gui/styles/qs60style.cpp src/network/bearer/qnetworkconfigmanager_p.h src/s60installs/bwins/QtGuiu.def src/s60installs/bwins/QtOpenGLu.def src/s60installs/bwins/QtOpenVGu.def src/s60installs/eabi/QtGuiu.def src/s60installs/eabi/QtOpenVGu.def tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/image.pri4
-rw-r--r--src/gui/image/qimage.cpp8
-rw-r--r--src/gui/image/qpixmap.h2
-rw-r--r--src/gui/image/qpixmap_raster_symbian.cpp (renamed from src/gui/image/qpixmap_s60.cpp)73
-rw-r--r--src/gui/image/qpixmap_raster_symbian_p.h (renamed from src/gui/image/qpixmap_s60_p.h)23
-rw-r--r--src/gui/image/qpixmapdata.cpp5
-rw-r--r--src/gui/image/qpixmapdata_p.h4
-rw-r--r--src/gui/image/qpixmapdatafactory.cpp4
-rw-r--r--src/gui/image/qvolatileimage.cpp35
-rw-r--r--src/gui/image/qvolatileimage_p.h1
-rw-r--r--src/gui/image/qvolatileimagedata_symbian.cpp27
11 files changed, 111 insertions, 75 deletions
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 72738c9..17b7da3 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -77,8 +77,8 @@ else:mac {
SOURCES += image/qpixmap_mac.cpp
}
else:symbian {
- HEADERS += image/qpixmap_s60_p.h
- SOURCES += image/qpixmap_s60.cpp
+ HEADERS += image/qpixmap_raster_symbian_p.h
+ SOURCES += image/qpixmap_raster_symbian.cpp
}
!symbian|contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2) {
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 14322dc..a3378de 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -62,7 +62,11 @@
#include <qhash.h>
+#if defined(Q_OS_SYMBIAN)
+#include <private/qpaintengine_raster_symbian_p.h>
+#else
#include <private/qpaintengine_raster_p.h>
+#endif
#include <private/qimage_p.h>
#include <private/qfont_p.h>
@@ -5779,7 +5783,11 @@ QPaintEngine *QImage::paintEngine() const
return 0;
if (!d->paintEngine) {
+#ifdef Q_OS_SYMBIAN
+ d->paintEngine = new QSymbianRasterPaintEngine(const_cast<QImage *>(this));
+#else
d->paintEngine = new QRasterPaintEngine(const_cast<QImage *>(this));
+#endif
}
return d->paintEngine;
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 76c23c8..4668913 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -271,7 +271,7 @@ private:
friend class QPixmapData;
friend class QX11PixmapData;
friend class QMacPixmapData;
- friend class QS60PixmapData;
+ friend class QSymbianRasterPixmapData;
friend class QBitmap;
friend class QPaintDevice;
friend class QPainter;
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_raster_symbian.cpp
index ac29f5d..ae2682b 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_raster_symbian.cpp
@@ -45,13 +45,13 @@
#include <private/qapplication_p.h>
#include <private/qgraphicssystem_p.h>
#include <private/qt_s60_p.h>
-#include <private/qpaintengine_s60_p.h>
#include <private/qfont_p.h>
+#include <private/qpaintengine_raster_symbian_p.h>
#include "qpixmap.h"
#include "qpixmap_raster_p.h"
#include <qwidget.h>
-#include "qpixmap_s60_p.h"
+#include "qpixmap_raster_symbian_p.h"
#include "qnativeimage_p.h"
#include "qbitmap.h"
#include "qimage.h"
@@ -65,10 +65,10 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
0x10, 0x20, 0x40, 0x80 };
static bool cleanup_function_registered = false;
-static QS60PixmapData *firstPixmap = 0;
+static QSymbianRasterPixmapData *firstPixmap = 0;
// static
-void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd)
+void QSymbianRasterPixmapData::qt_symbian_register_pixmap(QSymbianRasterPixmapData *pd)
{
if (!cleanup_function_registered) {
qAddPostRoutine(qt_symbian_release_pixmaps);
@@ -83,7 +83,7 @@ void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd)
}
// static
-void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd)
+void QSymbianRasterPixmapData::qt_symbian_unregister_pixmap(QSymbianRasterPixmapData *pd)
{
if (pd->next)
pd->next->prev = pd->prev;
@@ -94,10 +94,10 @@ void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd)
}
// static
-void QS60PixmapData::qt_symbian_release_pixmaps()
+void QSymbianRasterPixmapData::qt_symbian_release_pixmaps()
{
- // Scan all QS60PixmapData objects in the system and destroy them.
- QS60PixmapData *pd = firstPixmap;
+ // Scan all QSymbianRasterPixmapData objects in the system and destroy them.
+ QSymbianRasterPixmapData *pd = firstPixmap;
while (pd != 0) {
pd->release();
pd = pd->next;
@@ -393,7 +393,7 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
return pixmap;
}
-QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
+QSymbianRasterPixmapData::QSymbianRasterPixmapData(PixelType type) : QRasterPixmapData(type),
symbianBitmapDataAccess(new QSymbianBitmapDataAccess),
cfbsBitmap(0),
pengine(0),
@@ -405,14 +405,14 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
qt_symbian_register_pixmap(this);
}
-QS60PixmapData::~QS60PixmapData()
+QSymbianRasterPixmapData::~QSymbianRasterPixmapData()
{
release();
delete symbianBitmapDataAccess;
qt_symbian_unregister_pixmap(this);
}
-void QS60PixmapData::resize(int width, int height)
+void QSymbianRasterPixmapData::resize(int width, int height)
{
if (width <= 0 || height <= 0) {
w = width;
@@ -446,7 +446,7 @@ void QS60PixmapData::resize(int width, int height)
}
}
-void QS60PixmapData::release()
+void QSymbianRasterPixmapData::release()
{
if (cfbsBitmap) {
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
@@ -464,7 +464,7 @@ void QS60PixmapData::release()
/*!
* Takes ownership of bitmap. Used by window surface
*/
-void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat)
+void QSymbianRasterPixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat)
{
Q_ASSERT(bitmap);
@@ -496,9 +496,9 @@ void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat)
}
}
-QImage QS60PixmapData::toImage(const QRect &r) const
+QImage QSymbianRasterPixmapData::toImage(const QRect &r) const
{
- QS60PixmapData *that = const_cast<QS60PixmapData*>(this);
+ QSymbianRasterPixmapData *that = const_cast<QSymbianRasterPixmapData*>(this);
that->beginDataAccess();
QImage copy = that->image.copy(r);
that->endDataAccess();
@@ -506,7 +506,7 @@ QImage QS60PixmapData::toImage(const QRect &r) const
return copy;
}
-void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
+void QSymbianRasterPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
{
release();
@@ -588,13 +588,13 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags
}
}
-void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect)
+void QSymbianRasterPixmapData::copy(const QPixmapData *data, const QRect &rect)
{
- const QS60PixmapData *s60Data = static_cast<const QS60PixmapData*>(data);
+ const QSymbianRasterPixmapData *s60Data = static_cast<const QSymbianRasterPixmapData*>(data);
fromImage(s60Data->toImage(rect), Qt::AutoColor | Qt::OrderedAlphaDither);
}
-bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect)
+bool QSymbianRasterPixmapData::scroll(int dx, int dy, const QRect &rect)
{
beginDataAccess();
bool res = QRasterPixmapData::scroll(dx, dy, rect);
@@ -602,7 +602,10 @@ bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect)
return res;
}
-int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
+
+int QSymbianRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
{
if (!cfbsBitmap)
return 0;
@@ -633,7 +636,7 @@ int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
}
-void QS60PixmapData::fill(const QColor &color)
+void QSymbianRasterPixmapData::fill(const QColor &color)
{
if (color.alpha() != 255) {
QImage im(width(), height(), QImage::Format_ARGB32_Premultiplied);
@@ -647,7 +650,7 @@ void QS60PixmapData::fill(const QColor &color)
}
}
-void QS60PixmapData::setMask(const QBitmap &mask)
+void QSymbianRasterPixmapData::setMask(const QBitmap &mask)
{
if (mask.size().isEmpty()) {
if (image.depth() != 1) {
@@ -678,7 +681,7 @@ void QS60PixmapData::setMask(const QBitmap &mask)
}
}
-void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel)
+void QSymbianRasterPixmapData::setAlphaChannel(const QPixmap &alphaChannel)
{
QImage img(toImage());
img.setAlphaChannel(alphaChannel.toImage());
@@ -686,21 +689,21 @@ void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel)
fromImage(img, Qt::OrderedDither | Qt::OrderedAlphaDither);
}
-QImage QS60PixmapData::toImage() const
+QImage QSymbianRasterPixmapData::toImage() const
{
return toImage(QRect());
}
-QPaintEngine* QS60PixmapData::paintEngine() const
+QPaintEngine* QSymbianRasterPixmapData::paintEngine() const
{
if (!pengine) {
- QS60PixmapData *that = const_cast<QS60PixmapData*>(this);
- that->pengine = new QS60PaintEngine(&that->image, that);
+ QSymbianRasterPixmapData *that = const_cast<QSymbianRasterPixmapData*>(this);
+ that->pengine = new QSymbianRasterPaintEngine(&that->image, that);
}
return pengine;
}
-void QS60PixmapData::beginDataAccess()
+void QSymbianRasterPixmapData::beginDataAccess()
{
if(!cfbsBitmap)
return;
@@ -740,12 +743,12 @@ void QS60PixmapData::beginDataAccess()
is_null = (w <= 0 || h <= 0);
if (pengine) {
- QS60PaintEngine *engine = static_cast<QS60PaintEngine *>(pengine);
+ QSymbianRasterPaintEngine *engine = static_cast<QSymbianRasterPaintEngine *>(pengine);
engine->prepare(&image);
}
}
-void QS60PixmapData::endDataAccess(bool readOnly) const
+void QSymbianRasterPixmapData::endDataAccess(bool readOnly) const
{
Q_UNUSED(readOnly);
@@ -812,7 +815,7 @@ RSgImage *QPixmap::toSymbianRSgImage() const
return sgImage;
}
-void* QS60PixmapData::toNativeType(NativeType type)
+void* QSymbianRasterPixmapData::toNativeType(NativeType type)
{
if (type == QPixmapData::SgImage) {
return 0;
@@ -895,7 +898,7 @@ void* QS60PixmapData::toNativeType(NativeType type)
return 0;
}
-void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
+void QSymbianRasterPixmapData::fromNativeType(void* pixmap, NativeType nativeType)
{
if (nativeType == QPixmapData::SgImage) {
return;
@@ -1005,7 +1008,7 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
}
}
-void QS60PixmapData::convertToDisplayMode(int mode)
+void QSymbianRasterPixmapData::convertToDisplayMode(int mode)
{
const TDisplayMode displayMode = static_cast<TDisplayMode>(mode);
if (!cfbsBitmap || cfbsBitmap->DisplayMode() == displayMode)
@@ -1032,9 +1035,9 @@ void QS60PixmapData::convertToDisplayMode(int mode)
UPDATE_BUFFER();
}
-QPixmapData *QS60PixmapData::createCompatiblePixmapData() const
+QPixmapData *QSymbianRasterPixmapData::createCompatiblePixmapData() const
{
- return new QS60PixmapData(pixelType());
+ return new QSymbianRasterPixmapData(pixelType());
}
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_raster_symbian_p.h
index e481549..7f4e53a 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_raster_symbian_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QPIXMAPDATA_S60_P_H
-#define QPIXMAPDATA_S60_P_H
+#ifndef QPIXMAP_RASTER_SYMBIAN_P_H
+#define QPIXMAP_RASTER_SYMBIAN_P_H
//
// W A R N I N G
@@ -81,11 +81,11 @@ private:
bool wasLocked;
};
-class QS60PixmapData : public QRasterPixmapData
+class QSymbianRasterPixmapData : public QRasterPixmapData
{
public:
- QS60PixmapData(PixelType type);
- ~QS60PixmapData();
+ QSymbianRasterPixmapData(PixelType type);
+ ~QSymbianRasterPixmapData();
QPixmapData *createCompatiblePixmapData() const;
@@ -122,20 +122,19 @@ private:
bool formatLocked;
- QS60PixmapData *next;
- QS60PixmapData *prev;
+ QSymbianRasterPixmapData *next;
+ QSymbianRasterPixmapData *prev;
- static void qt_symbian_register_pixmap(QS60PixmapData *pd);
- static void qt_symbian_unregister_pixmap(QS60PixmapData *pd);
+ static void qt_symbian_register_pixmap(QSymbianRasterPixmapData *pd);
+ static void qt_symbian_unregister_pixmap(QSymbianRasterPixmapData *pd);
static void qt_symbian_release_pixmaps();
friend class QPixmap;
friend class QS60WindowSurface;
- friend class QS60PaintEngine;
+ friend class QSymbianRasterPaintEngine;
friend class QS60Data;
};
QT_END_NAMESPACE
-#endif // QPIXMAPDATA_S60_P_H
-
+#endif // QPIXMAP_RASTER_SYMBIAN_P_H
diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp
index c46429c..934dbb8 100644
--- a/src/gui/image/qpixmapdata.cpp
+++ b/src/gui/image/qpixmapdata.cpp
@@ -276,6 +276,11 @@ QImage* QPixmapData::buffer()
}
#if defined(Q_OS_SYMBIAN)
+QVolatileImage QPixmapData::toVolatileImage() const
+{
+ return QVolatileImage();
+}
+
void* QPixmapData::toNativeType(NativeType /* type */)
{
return 0;
diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h
index f07843d..960eb8f 100644
--- a/src/gui/image/qpixmapdata_p.h
+++ b/src/gui/image/qpixmapdata_p.h
@@ -139,7 +139,7 @@ public:
}
#if defined(Q_OS_SYMBIAN)
- virtual QVolatileImage toVolatileImage() const { return QVolatileImage(); }
+ virtual QVolatileImage toVolatileImage() const;
virtual void* toNativeType(NativeType type);
virtual void fromNativeType(void* pixmap, NativeType type);
#endif
@@ -159,7 +159,7 @@ protected:
private:
friend class QPixmap;
friend class QX11PixmapData;
- friend class QS60PixmapData;
+ friend class QSymbianRasterPixmapData;
friend class QImagePixmapCleanupHooks; // Needs to set is_cached
friend class QGLTextureCache; //Needs to check the reference count
friend class QExplicitlySharedDataPointer<QPixmapData>;
diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp
index f7c79880..ebe89e4 100644
--- a/src/gui/image/qpixmapdatafactory.cpp
+++ b/src/gui/image/qpixmapdatafactory.cpp
@@ -57,7 +57,7 @@
# include <private/qpixmap_raster_p.h>
#endif
#ifdef Q_OS_SYMBIAN
-# include <private/qpixmap_s60_p.h>
+# include <private/qpixmap_raster_symbian_p.h>
#endif
#include "private/qapplication_p.h"
@@ -88,7 +88,7 @@ QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type)
#elif defined(Q_WS_QPA)
return new QRasterPixmapData(type);
#elif defined(Q_OS_SYMBIAN)
- return new QS60PixmapData(type);
+ return new QSymbianRasterPixmapData(type);
#else
#error QSimplePixmapDataFactory::create() not implemented
#endif
diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp
index b8612b1..9734c82 100644
--- a/src/gui/image/qvolatileimage.cpp
+++ b/src/gui/image/qvolatileimage.cpp
@@ -200,6 +200,16 @@ QImage &QVolatileImage::imageRef() // non-const, in order to cause a detach
return d->image;
}
+/*!
+ Non-detaching version, for read-only access only.
+ Must be guarded by begin/endDataAccess().
+ */
+const QImage &QVolatileImage::constImageRef() const
+{
+ const_cast<QVolatileImageData *>(d.data())->ensureImage();
+ return d->image;
+}
+
void *QVolatileImage::duplicateNativeImage() const
{
return d->duplicateNativeImage();
@@ -289,12 +299,14 @@ bool QVolatileImagePaintEngine::end()
void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
{
#ifdef Q_OS_SYMBIAN
- void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage);
- if (nativeData) {
- QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
- img->beginDataAccess();
- QRasterPaintEngine::drawImage(p, img->imageRef());
- img->endDataAccess(true);
+ QVolatileImage img = pm.pixmapData()->toVolatileImage();
+ if (!img.isNull()) {
+ img.beginDataAccess();
+ // imageRef() would detach and since we received the QVolatileImage from
+ // toVolatileImage() by value, it would cause a copy which would ruin
+ // our goal. So use constImageRef() instead.
+ QRasterPaintEngine::drawImage(p, img.constImageRef());
+ img.endDataAccess(true);
} else {
QRasterPaintEngine::drawPixmap(p, pm);
}
@@ -306,12 +318,11 @@ void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
void QVolatileImagePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
{
#ifdef Q_OS_SYMBIAN
- void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage);
- if (nativeData) {
- QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
- img->beginDataAccess();
- QRasterPaintEngine::drawImage(r, img->imageRef(), sr);
- img->endDataAccess(true);
+ QVolatileImage img = pm.pixmapData()->toVolatileImage();
+ if (!img.isNull()) {
+ img.beginDataAccess();
+ QRasterPaintEngine::drawImage(r, img.constImageRef(), sr);
+ img.endDataAccess(true);
} else {
QRasterPaintEngine::drawPixmap(r, pm, sr);
}
diff --git a/src/gui/image/qvolatileimage_p.h b/src/gui/image/qvolatileimage_p.h
index 97d6ea6..bed2e91 100644
--- a/src/gui/image/qvolatileimage_p.h
+++ b/src/gui/image/qvolatileimage_p.h
@@ -87,6 +87,7 @@ public:
bool ensureFormat(QImage::Format format);
QImage toImage() const;
QImage &imageRef();
+ const QImage &constImageRef() const;
QPaintEngine *paintEngine();
void setAlphaChannel(const QPixmap &alphaChannel);
void fill(uint pixelValue);
diff --git a/src/gui/image/qvolatileimagedata_symbian.cpp b/src/gui/image/qvolatileimagedata_symbian.cpp
index 6984722..c20c417 100644
--- a/src/gui/image/qvolatileimagedata_symbian.cpp
+++ b/src/gui/image/qvolatileimagedata_symbian.cpp
@@ -53,8 +53,11 @@ static CFbsBitmap *rasterizeBitmap(CFbsBitmap *bitmap, TDisplayMode newMode)
return 0;
}
QScopedPointer<CFbsBitmap> newBitmap(new CFbsBitmap);
- if (newBitmap->Create(bitmap->SizeInPixels(), newMode) != KErrNone) {
- qWarning("QVolatileImage: Failed to create new bitmap");
+ const TSize size = bitmap->SizeInPixels();
+ TInt err = newBitmap->Create(size, newMode);
+ if (err != KErrNone) {
+ qWarning("QVolatileImage: Failed to create new bitmap (w %d h %d dispmode %d err %d)",
+ size.iWidth, size.iHeight, newMode, err);
return 0;
}
CFbsBitmapDevice *bitmapDevice = 0;
@@ -97,6 +100,7 @@ static inline TDisplayMode format2TDisplayMode(QImage::Format format)
mode = Q_SYMBIAN_ECOLOR16MAP;
break;
default:
+ qWarning("QVolatileImage: Unknown image format %d", format);
mode = ENone;
break;
}
@@ -109,8 +113,9 @@ static CFbsBitmap *imageToBitmap(const QImage &image)
return 0;
}
CFbsBitmap *bitmap = new CFbsBitmap;
- if (bitmap->Create(TSize(image.width(), image.height()),
- format2TDisplayMode(image.format())) == KErrNone) {
+ TInt err = bitmap->Create(TSize(image.width(), image.height()),
+ format2TDisplayMode(image.format()));
+ if (err == KErrNone) {
bitmap->BeginDataAccess();
uchar *dptr = reinterpret_cast<uchar *>(bitmap->DataAddress());
int bmpLineLen = bitmap->DataStride();
@@ -128,7 +133,8 @@ static CFbsBitmap *imageToBitmap(const QImage &image)
}
bitmap->EndDataAccess();
} else {
- qWarning("QVolatileImage: Failed to create source bitmap");
+ qWarning("QVolatileImage: Failed to create source bitmap (w %d h %d fmt %d err %d)",
+ image.width(), image.height(), image.format(), err);
delete bitmap;
bitmap = 0;
}
@@ -155,8 +161,9 @@ static CFbsBitmap *convertData(const QVolatileImageData &source, QImage::Format
static CFbsBitmap *duplicateBitmap(const CFbsBitmap &sourceBitmap)
{
CFbsBitmap *bitmap = new CFbsBitmap;
- if (bitmap->Duplicate(sourceBitmap.Handle()) != KErrNone) {
- qWarning("QVolatileImage: Failed to duplicate source bitmap");
+ TInt err = bitmap->Duplicate(sourceBitmap.Handle());
+ if (err != KErrNone) {
+ qWarning("QVolatileImage: Failed to duplicate source bitmap (%d)", err);
delete bitmap;
bitmap = 0;
}
@@ -166,8 +173,10 @@ static CFbsBitmap *duplicateBitmap(const CFbsBitmap &sourceBitmap)
static CFbsBitmap *createBitmap(int w, int h, QImage::Format format)
{
CFbsBitmap *bitmap = new CFbsBitmap;
- if (bitmap->Create(TSize(w, h), format2TDisplayMode(format)) != KErrNone) {
- qWarning("QVolatileImage: Failed to create source bitmap %d,%d (%d)", w, h, format);
+ TInt err = bitmap->Create(TSize(w, h), format2TDisplayMode(format));
+ if (err != KErrNone) {
+ qWarning("QVolatileImage: Failed to create source bitmap (w %d h %d fmt %d err %d)",
+ w, h, format, err);
delete bitmap;
bitmap = 0;
}