summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/image.pri9
-rw-r--r--src/gui/image/qbitmap.cpp4
-rw-r--r--src/gui/image/qbitmap.h5
-rw-r--r--src/gui/image/qbmphandler.cpp4
-rw-r--r--src/gui/image/qbmphandler_p.h4
-rw-r--r--src/gui/image/qgifhandler.cpp4
-rw-r--r--src/gui/image/qgifhandler_p.h4
-rw-r--r--src/gui/image/qimage.cpp73
-rw-r--r--src/gui/image/qimage.h27
-rw-r--r--src/gui/image/qimage_neon.cpp4
-rw-r--r--src/gui/image/qimage_p.h9
-rw-r--r--src/gui/image/qimage_sse2.cpp4
-rw-r--r--src/gui/image/qimage_ssse3.cpp4
-rw-r--r--src/gui/image/qimageiohandler.cpp4
-rw-r--r--src/gui/image/qimageiohandler.h7
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp4
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks_p.h4
-rw-r--r--src/gui/image/qimagereader.cpp51
-rw-r--r--src/gui/image/qimagereader.h5
-rw-r--r--src/gui/image/qimagewriter.cpp28
-rw-r--r--src/gui/image/qimagewriter.h5
-rw-r--r--src/gui/image/qjpeghandler.cpp4
-rw-r--r--src/gui/image/qjpeghandler_p.h4
-rw-r--r--src/gui/image/qmnghandler.cpp497
-rw-r--r--src/gui/image/qmnghandler.pri10
-rw-r--r--src/gui/image/qmnghandler_p.h83
-rw-r--r--src/gui/image/qmovie.cpp4
-rw-r--r--src/gui/image/qmovie.h5
-rw-r--r--src/gui/image/qnativeimage.cpp4
-rw-r--r--src/gui/image/qnativeimage_p.h4
-rw-r--r--src/gui/image/qpaintengine_pic.cpp4
-rw-r--r--src/gui/image/qpaintengine_pic_p.h4
-rw-r--r--src/gui/image/qpicture.cpp20
-rw-r--r--src/gui/image/qpicture.h5
-rw-r--r--src/gui/image/qpicture_p.h4
-rw-r--r--src/gui/image/qpictureformatplugin.cpp4
-rw-r--r--src/gui/image/qpictureformatplugin.h7
-rw-r--r--src/gui/image/qpixmap.cpp13
-rw-r--r--src/gui/image/qpixmap.h7
-rw-r--r--src/gui/image/qpixmap_blitter.cpp4
-rw-r--r--src/gui/image/qpixmap_blitter_p.h4
-rw-r--r--src/gui/image/qpixmap_qpa.cpp4
-rw-r--r--src/gui/image/qpixmap_raster.cpp4
-rw-r--r--src/gui/image/qpixmap_raster_p.h4
-rw-r--r--src/gui/image/qpixmap_win.cpp6
-rw-r--r--src/gui/image/qpixmapcache.cpp4
-rw-r--r--src/gui/image/qpixmapcache.h5
-rw-r--r--src/gui/image/qpixmapcache_p.h4
-rw-r--r--src/gui/image/qplatformpixmap.cpp6
-rw-r--r--src/gui/image/qplatformpixmap_qpa.h5
-rw-r--r--src/gui/image/qpnghandler.cpp4
-rw-r--r--src/gui/image/qpnghandler_p.h4
-rw-r--r--src/gui/image/qppmhandler.cpp4
-rw-r--r--src/gui/image/qppmhandler_p.h4
-rw-r--r--src/gui/image/qtiffhandler.cpp668
-rw-r--r--src/gui/image/qtiffhandler.pri10
-rw-r--r--src/gui/image/qtiffhandler_p.h78
-rw-r--r--src/gui/image/qvolatileimage.cpp4
-rw-r--r--src/gui/image/qvolatileimage_p.h4
-rw-r--r--src/gui/image/qvolatileimagedata.cpp4
-rw-r--r--src/gui/image/qvolatileimagedata_p.h4
-rw-r--r--src/gui/image/qvolatileimagedata_symbian.cpp474
-rw-r--r--src/gui/image/qxbmhandler.cpp4
-rw-r--r--src/gui/image/qxbmhandler_p.h4
-rw-r--r--src/gui/image/qxpmhandler.cpp4
-rw-r--r--src/gui/image/qxpmhandler_p.h4
66 files changed, 200 insertions, 2074 deletions
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index b8eb546ba5..dd7b665ecc 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -48,12 +48,7 @@ SOURCES += \
SOURCES += image/qpixmap_qpa.cpp
win32: SOURCES += image/qpixmap_win.cpp
-!symbian|contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2) {
- SOURCES += image/qvolatileimagedata.cpp
-}
-else {
- SOURCES += image/qvolatileimagedata_symbian.cpp
-}
+SOURCES += image/qvolatileimagedata.cpp
# Built-in image format support
HEADERS += \
@@ -72,8 +67,6 @@ SOURCES += \
else:DEFINES *= QT_NO_IMAGEFORMAT_PNG
contains(QT_CONFIG, jpeg):include($$PWD/qjpeghandler.pri)
-contains(QT_CONFIG, mng):include($$PWD/qmnghandler.pri)
-contains(QT_CONFIG, tiff):include($$PWD/qtiffhandler.pri)
contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri)
# SIMD
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp
index 6c1320e868..8184200813 100644
--- a/src/gui/image/qbitmap.cpp
+++ b/src/gui/image/qbitmap.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h
index 5740b874db..f67e2ddef8 100644
--- a/src/gui/image/qbitmap.h
+++ b/src/gui/image/qbitmap.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QVariant;
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 3d9f8228f2..f9e11f1390 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h
index f2eb8f69b2..d203a77677 100644
--- a/src/gui/image/qbmphandler_p.h
+++ b/src/gui/image/qbmphandler_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp
index 6968ca6736..3cffe99c86 100644
--- a/src/gui/image/qgifhandler.cpp
+++ b/src/gui/image/qgifhandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
** WARNING:
diff --git a/src/gui/image/qgifhandler_p.h b/src/gui/image/qgifhandler_p.h
index 0d9724a071..05b26d09e7 100644
--- a/src/gui/image/qgifhandler_p.h
+++ b/src/gui/image/qgifhandler_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
** WARNING:
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 564abd2af2..07af19d06a 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -124,7 +124,8 @@ QImageData::QImageData()
dpmx(qt_defaultDpiX() * 100 / qreal(2.54)),
dpmy(qt_defaultDpiY() * 100 / qreal(2.54)),
offset(0, 0), own_data(true), ro_data(false), has_alpha_clut(false),
- is_cached(false), is_locked(false), paintEngine(0)
+ is_cached(false), is_locked(false), cleanupFunction(0), cleanupInfo(0),
+ paintEngine(0)
{
}
@@ -206,6 +207,8 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format, int nu
QImageData::~QImageData()
{
+ if (cleanupFunction)
+ cleanupFunction(cleanupInfo);
if (is_cached)
QImagePixmapCleanupHooks::executeImageHooks((((qint64) ser_no) << 32) | ((qint64) detach_no));
delete paintEngine;
@@ -363,7 +366,6 @@ bool QImageData::checkForAlphaPixels() const
\row \o PBM \o Portable Bitmap \o Read
\row \o PGM \o Portable Graymap \o Read
\row \o PPM \o Portable Pixmap \o Read/write
- \row \o TIFF \o Tagged Image File Format \o Read/write
\row \o XBM \o X11 Bitmap \o Read/write
\row \o XPM \o X11 Pixmap \o Read/write
\endtable
@@ -617,6 +619,18 @@ bool QImageData::checkForAlphaPixels() const
*/
/*!
+ \typedef QImageCleanupFunction
+ \since 5.0
+
+ A function with the following signature that can be used to
+ implement basic image memory management:
+
+ \code
+ void myImageCleanupHandler(void *info);
+ \endcode
+*/
+
+/*!
\enum QImage::InvertMode
This enum type is used to describe how pixel values should be
@@ -772,7 +786,7 @@ QImage::QImage(const QSize &size, Format format)
-QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QImage::Format format, bool readOnly)
+QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
{
QImageData *d = 0;
@@ -815,6 +829,9 @@ QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QIm
d->bytes_per_line = bpl;
d->nbytes = d->bytes_per_line * height;
+ d->cleanupFunction = cleanupFunction;
+ d->cleanupInfo = cleanupInfo;
+
return d;
}
@@ -824,17 +841,21 @@ QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QIm
and \a height must be specified in pixels, \a data must be 32-bit aligned,
and each scanline of data in the image must also be 32-bit aligned.
- The buffer must remain valid throughout the life of the
- QImage. The image does not delete the buffer at destruction.
+ The buffer must remain valid throughout the life of the QImage and
+ all copies that have not been modified or otherwise detached from
+ the original buffer. The image does not delete the buffer at destruction.
+ You can provide a function pointer \a cleanupFunction along with an
+ extra pointer \a cleanupInfo that will be called when the last copy
+ is destroyed.
If \a format is an indexed color format, the image color table is
initially empty and must be sufficiently expanded with
setColorCount() or setColorTable() before the image is used.
*/
-QImage::QImage(uchar* data, int width, int height, Format format)
+QImage::QImage(uchar* data, int width, int height, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
: QPaintDevice()
{
- d = QImageData::create(data, width, height, 0, format, false);
+ d = QImageData::create(data, width, height, 0, format, false, cleanupFunction, cleanupInfo);
}
/*!
@@ -846,8 +867,10 @@ QImage::QImage(uchar* data, int width, int height, Format format)
The buffer must remain valid throughout the life of the QImage and
all copies that have not been modified or otherwise detached from
- the original buffer. The image does not delete the buffer at
- destruction.
+ the original buffer. The image does not delete the buffer at destruction.
+ You can provide a function pointer \a cleanupFunction along with an
+ extra pointer \a cleanupInfo that will be called when the last copy
+ is destroyed.
If \a format is an indexed color format, the image color table is
initially empty and must be sufficiently expanded with
@@ -860,10 +883,10 @@ QImage::QImage(uchar* data, int width, int height, Format format)
constructing a QImage from raw data, without the possibility of the raw
data being changed.
*/
-QImage::QImage(const uchar* data, int width, int height, Format format)
+QImage::QImage(const uchar* data, int width, int height, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
: QPaintDevice()
{
- d = QImageData::create(const_cast<uchar*>(data), width, height, 0, format, true);
+ d = QImageData::create(const_cast<uchar*>(data), width, height, 0, format, true, cleanupFunction, cleanupInfo);
}
/*!
@@ -872,17 +895,21 @@ QImage::QImage(const uchar* data, int width, int height, Format format)
and \a height must be specified in pixels. \a bytesPerLine
specifies the number of bytes per line (stride).
- The buffer must remain valid throughout the life of the
- QImage. The image does not delete the buffer at destruction.
+ The buffer must remain valid throughout the life of the QImage and
+ all copies that have not been modified or otherwise detached from
+ the original buffer. The image does not delete the buffer at destruction.
+ You can provide a function pointer \a cleanupFunction along with an
+ extra pointer \a cleanupInfo that will be called when the last copy
+ is destroyed.
If \a format is an indexed color format, the image color table is
initially empty and must be sufficiently expanded with
setColorCount() or setColorTable() before the image is used.
*/
-QImage::QImage(uchar *data, int width, int height, int bytesPerLine, Format format)
+QImage::QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
:QPaintDevice()
{
- d = QImageData::create(data, width, height, bytesPerLine, format, false);
+ d = QImageData::create(data, width, height, bytesPerLine, format, false, cleanupFunction, cleanupInfo);
}
@@ -892,8 +919,12 @@ QImage::QImage(uchar *data, int width, int height, int bytesPerLine, Format form
and \a height must be specified in pixels. \a bytesPerLine
specifies the number of bytes per line (stride).
- The buffer must remain valid throughout the life of the
- QImage. The image does not delete the buffer at destruction.
+ The buffer must remain valid throughout the life of the QImage and
+ all copies that have not been modified or otherwise detached from
+ the original buffer. The image does not delete the buffer at destruction.
+ You can provide a function pointer \a cleanupFunction along with an
+ extra pointer \a cleanupInfo that will be called when the last copy
+ is destroyed.
If \a format is an indexed color format, the image color table is
initially empty and must be sufficiently expanded with
@@ -907,10 +938,10 @@ QImage::QImage(uchar *data, int width, int height, int bytesPerLine, Format form
data being changed.
*/
-QImage::QImage(const uchar *data, int width, int height, int bytesPerLine, Format format)
+QImage::QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
:QPaintDevice()
{
- d = QImageData::create(const_cast<uchar*>(data), width, height, bytesPerLine, format, true);
+ d = QImageData::create(const_cast<uchar*>(data), width, height, bytesPerLine, format, true, cleanupFunction, cleanupInfo);
}
/*!
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 7a5a732c9a..5a3ae8f886 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -57,7 +57,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QIODevice;
class QStringList;
@@ -71,7 +70,7 @@ struct QImageData;
class QImageDataMisc; // internal
#ifndef QT_NO_IMAGE_TEXT
#if QT_DEPRECATED_SINCE(5, 0)
-class Q_GUI_EXPORT QImageTextKeyLang {
+class QT_DEPRECATED QImageTextKeyLang {
public:
QImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { }
QImageTextKeyLang() { }
@@ -89,6 +88,7 @@ public:
#endif
#endif //QT_NO_IMAGE_TEXT
+typedef void (*QImageCleanupFunction)(void*);
class Q_GUI_EXPORT QImage : public QPaintDevice
{
@@ -129,10 +129,10 @@ public:
QImage();
QImage(const QSize &size, Format format);
QImage(int width, int height, Format format);
- QImage(uchar *data, int width, int height, Format format);
- QImage(const uchar *data, int width, int height, Format format);
- QImage(uchar *data, int width, int height, int bytesPerLine, Format format);
- QImage(const uchar *data, int width, int height, int bytesPerLine, Format format);
+ QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
+ QImage(const uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
+ QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
+ QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
#ifndef QT_NO_IMAGEFORMAT_XPM
explicit QImage(const char * const xpm[]);
@@ -271,11 +271,11 @@ public:
void setText(const QString &key, const QString &value);
#if QT_DEPRECATED_SINCE(5, 0)
- inline QString text(const char* key, const char* lang=0) const;
- inline QList<QImageTextKeyLang> textList() const;
- inline QStringList textLanguages() const;
- inline QString text(const QImageTextKeyLang&) const;
- inline void setText(const char* key, const char* lang, const QString&);
+ QT_DEPRECATED inline QString text(const char* key, const char* lang=0) const;
+ QT_DEPRECATED inline QList<QImageTextKeyLang> textList() const;
+ QT_DEPRECATED inline QStringList textLanguages() const;
+ QT_DEPRECATED inline QString text(const QImageTextKeyLang&) const;
+ QT_DEPRECATED inline void setText(const char* key, const char* lang, const QString&);
#endif
#endif
@@ -383,6 +383,7 @@ inline void QImage::setText(const char* key, const char* lang, const QString &s)
setText(k, s);
}
#endif
+
inline int QImage::numColors() const
{
return colorCount();
diff --git a/src/gui/image/qimage_neon.cpp b/src/gui/image/qimage_neon.cpp
index cdf817b051..b19dfac3ec 100644
--- a/src/gui/image/qimage_neon.cpp
+++ b/src/gui/image/qimage_neon.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 6e846fd0cf..fd1370d1d3 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -69,7 +69,7 @@ struct Q_GUI_EXPORT QImageData { // internal image data
QImageData();
~QImageData();
static QImageData *create(const QSize &size, QImage::Format format, int numColors = 0);
- static QImageData *create(uchar *data, int w, int h, int bpl, QImage::Format format, bool readOnly);
+ static QImageData *create(uchar *data, int w, int h, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
QAtomicInt ref;
@@ -94,6 +94,9 @@ struct Q_GUI_EXPORT QImageData { // internal image data
uint is_cached : 1;
uint is_locked : 1;
+ QImageCleanupFunction cleanupFunction;
+ void* cleanupInfo;
+
bool checkForAlphaPixels() const;
// Convert the image in-place, minimizing memory reallocation
diff --git a/src/gui/image/qimage_sse2.cpp b/src/gui/image/qimage_sse2.cpp
index 872d1d6be7..8a36bfb0d2 100644
--- a/src/gui/image/qimage_sse2.cpp
+++ b/src/gui/image/qimage_sse2.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp
index 95cf694d2a..2ca80ef3bb 100644
--- a/src/gui/image/qimage_ssse3.cpp
+++ b/src/gui/image/qimage_ssse3.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qimageiohandler.cpp b/src/gui/image/qimageiohandler.cpp
index d9691563b1..153412fb29 100644
--- a/src/gui/image/qimageiohandler.cpp
+++ b/src/gui/image/qimageiohandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h
index 188b4ef1a8..0252ec02cc 100644
--- a/src/gui/image/qimageiohandler.h
+++ b/src/gui/image/qimageiohandler.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QImage;
class QRect;
@@ -120,7 +119,7 @@ struct Q_GUI_EXPORT QImageIOHandlerFactoryInterface : public QFactoryInterface
virtual QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const = 0;
};
-#define QImageIOHandlerFactoryInterface_iid "com.trolltech.Qt.QImageIOHandlerFactoryInterface"
+#define QImageIOHandlerFactoryInterface_iid "org.qt-project.Qt.QImageIOHandlerFactoryInterface"
Q_DECLARE_INTERFACE(QImageIOHandlerFactoryInterface, QImageIOHandlerFactoryInterface_iid)
class Q_GUI_EXPORT QImageIOPlugin : public QObject, public QImageIOHandlerFactoryInterface
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index e83897aced..6d8693ffb1 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h
index 11abe173c4..e7fadcabfd 100644
--- a/src/gui/image/qimagepixmapcleanuphooks_p.h
+++ b/src/gui/image/qimagepixmapcleanuphooks_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index b6345191d6..4a9a9b00f4 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -144,12 +144,6 @@
#ifndef QT_NO_IMAGEFORMAT_JPEG
#include <private/qjpeghandler_p.h>
#endif
-#ifndef QT_NO_IMAGEFORMAT_MNG
-#include <private/qmnghandler_p.h>
-#endif
-#ifndef QT_NO_IMAGEFORMAT_TIFF
-#include <private/qtiffhandler_p.h>
-#endif
#ifdef QT_BUILTIN_GIF_READER
#include <private/qgifhandler_p.h>
#endif
@@ -168,12 +162,6 @@ enum _qt_BuiltInFormatType {
#ifndef QT_NO_IMAGEFORMAT_JPEG
_qt_JpgFormat,
#endif
-#ifndef QT_NO_IMAGEFORMAT_MNG
- _qt_MngFormat,
-#endif
-#ifndef QT_NO_IMAGEFORMAT_TIFF
- _qt_TifFormat,
-#endif
#ifdef QT_BUILTIN_GIF_READER
_qt_GifFormat,
#endif
@@ -206,12 +194,6 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
#ifndef QT_NO_IMAGEFORMAT_JPEG
{_qt_JpgFormat, "jpg"},
#endif
-#ifndef QT_NO_IMAGEFORMAT_MNG
- {_qt_MngFormat, "mng"},
-#endif
-#ifndef QT_NO_IMAGEFORMAT_TIFF
- {_qt_TifFormat, "tif"},
-#endif
#ifdef QT_BUILTIN_GIF_READER
{_qt_GifFormat, "gif"},
#endif
@@ -344,14 +326,6 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
} else if (testFormat == "jpg" || testFormat == "jpeg") {
handler = new QJpegHandler;
#endif
-#ifndef QT_NO_IMAGEFORMAT_MNG
- } else if (testFormat == "mng") {
- handler = new QMngHandler;
-#endif
-#ifndef QT_NO_IMAGEFORMAT_TIFF
- } else if (testFormat == "tif" || testFormat == "tiff") {
- handler = new QTiffHandler;
-#endif
#ifdef QT_BUILTIN_GIF_READER
} else if (testFormat == "gif") {
handler = new QGifHandler;
@@ -440,18 +414,6 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
handler = new QJpegHandler;
break;
#endif
-#ifndef QT_NO_IMAGEFORMAT_MNG
- case _qt_MngFormat:
- if (QMngHandler::canRead(device))
- handler = new QMngHandler;
- break;
-#endif
-#ifndef QT_NO_IMAGEFORMAT_TIFF
- case _qt_TifFormat:
- if (QTiffHandler::canRead(device))
- handler = new QTiffHandler;
- break;
-#endif
#ifdef QT_BUILTIN_GIF_READER
case _qt_GifFormat:
if (QGifHandler::canRead(device))
@@ -1466,23 +1428,18 @@ QByteArray QImageReader::imageFormat(QIODevice *device)
\row \o GIF \o Graphic Interchange Format (optional)
\row \o JPG \o Joint Photographic Experts Group
\row \o JPEG \o Joint Photographic Experts Group
- \row \o MNG \o Multiple-image Network Graphics
\row \o PNG \o Portable Network Graphics
\row \o PBM \o Portable Bitmap
\row \o PGM \o Portable Graymap
\row \o PPM \o Portable Pixmap
- \row \o TIFF \o Tagged Image File Format
\row \o XBM \o X11 Bitmap
\row \o XPM \o X11 Pixmap
\row \o SVG \o Scalable Vector Graphics
\endtable
Reading and writing SVG files is supported through Qt's
- \l{QtSvg Module}{SVG Module}.
-
- To configure Qt with GIF support, pass \c -qt-gif to the \c
- configure script or check the appropriate option in the graphical
- installer.
+ \l{QtSvg Module}{SVG Module}. The \l{QtImageFormats Module}{Image Formats Module}
+ provides support for additional image formats.
Note that the QApplication instance must be created before this function is
called.
diff --git a/src/gui/image/qimagereader.h b/src/gui/image/qimagereader.h
index f132991d92..f359cd3e21 100644
--- a/src/gui/image/qimagereader.h
+++ b/src/gui/image/qimagereader.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QColor;
class QIODevice;
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index b7d57fa4d3..966017452c 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -117,12 +117,6 @@
#ifndef QT_NO_IMAGEFORMAT_JPEG
#include <private/qjpeghandler_p.h>
#endif
-#ifndef QT_NO_IMAGEFORMAT_MNG
-#include <private/qmnghandler_p.h>
-#endif
-#ifndef QT_NO_IMAGEFORMAT_TIFF
-#include <private/qtiffhandler_p.h>
-#endif
#ifdef QT_BUILTIN_GIF_READER
#include <private/qgifhandler_p.h>
#endif
@@ -186,14 +180,6 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
} else if (testFormat == "jpg" || testFormat == "jpeg") {
handler = new QJpegHandler;
#endif
-#ifndef QT_NO_IMAGEFORMAT_MNG
- } else if (testFormat == "mng") {
- handler = new QMngHandler;
-#endif
-#ifndef QT_NO_IMAGEFORMAT_TIFF
- } else if (testFormat == "tif" || testFormat == "tiff") {
- handler = new QTiffHandler;
-#endif
#ifdef QT_BUILTIN_GIF_READER
} else if (testFormat == "gif") {
handler = new QGifHandler;
@@ -673,13 +659,13 @@ bool QImageWriter::supportsOption(QImageIOHandler::ImageOption option) const
\row \o JPEG \o Joint Photographic Experts Group
\row \o PNG \o Portable Network Graphics
\row \o PPM \o Portable Pixmap
- \row \o TIFF \o Tagged Image File Format
\row \o XBM \o X11 Bitmap
\row \o XPM \o X11 Pixmap
\endtable
Reading and writing SVG files is supported through Qt's
- \l{QtSvg Module}{SVG Module}.
+ \l{QtSvg Module}{SVG Module}. The \l{QtImageFormats Module}{Image Formats Module}
+ provides support for additional image formats.
Note that the QApplication instance must be created before this function is
called.
@@ -705,12 +691,6 @@ QList<QByteArray> QImageWriter::supportedImageFormats()
#ifndef QT_NO_IMAGEFORMAT_JPEG
formats << "jpg" << "jpeg";
#endif
-#ifndef QT_NO_IMAGEFORMAT_MNG
- formats << "mng";
-#endif
-#ifndef QT_NO_IMAGEFORMAT_TIFF
- formats << "tif" << "tiff";
-#endif
#ifdef QT_BUILTIN_GIF_READER
formats << "gif";
#endif
diff --git a/src/gui/image/qimagewriter.h b/src/gui/image/qimagewriter.h
index 5aac7e8599..a352d20bfd 100644
--- a/src/gui/image/qimagewriter.h
+++ b/src/gui/image/qimagewriter.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QIODevice;
class QImage;
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index f0f9368e22..0260d18217 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qjpeghandler_p.h b/src/gui/image/qjpeghandler_p.h
index 7827804959..145361d2b6 100644
--- a/src/gui/image/qjpeghandler_p.h
+++ b/src/gui/image/qjpeghandler_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qmnghandler.cpp b/src/gui/image/qmnghandler.cpp
deleted file mode 100644
index 6a6ee8d2cf..0000000000
--- a/src/gui/image/qmnghandler.cpp
+++ /dev/null
@@ -1,497 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmnghandler_p.h"
-
-#include "qimage.h"
-#include "qvariant.h"
-#include "qcolor.h"
-
-#define MNG_USE_SO
-#include <libmng.h>
-
-QT_BEGIN_NAMESPACE
-
-class QMngHandlerPrivate
-{
- Q_DECLARE_PUBLIC(QMngHandler)
- public:
- bool haveReadNone;
- bool haveReadAll;
- mng_handle hMNG;
- QImage image;
- int elapsed;
- int nextDelay;
- int iterCount;
- int frameIndex;
- int nextIndex;
- int frameCount;
- mng_uint32 iStyle;
- mng_bool readData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pRead);
- mng_bool writeData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pWritten);
- mng_bool processHeader(mng_uint32 iWidth, mng_uint32 iHeight);
- QMngHandlerPrivate(QMngHandler *q_ptr);
- ~QMngHandlerPrivate();
- bool getNextImage(QImage *result);
- bool writeImage(const QImage &image);
- int currentImageNumber() const;
- int imageCount() const;
- bool jumpToImage(int imageNumber);
- bool jumpToNextImage();
- int nextImageDelay() const;
- bool setBackgroundColor(const QColor &color);
- QColor backgroundColor() const;
- QMngHandler *q_ptr;
-};
-
-static mng_bool myerror(mng_handle /*hMNG*/,
- mng_int32 iErrorcode,
- mng_int8 /*iSeverity*/,
- mng_chunkid iChunkname,
- mng_uint32 /*iChunkseq*/,
- mng_int32 iExtra1,
- mng_int32 iExtra2,
- mng_pchar zErrortext)
-{
- qWarning("MNG error %d: %s; chunk %c%c%c%c; subcode %d:%d",
- iErrorcode,zErrortext,
- (iChunkname>>24)&0xff,
- (iChunkname>>16)&0xff,
- (iChunkname>>8)&0xff,
- (iChunkname>>0)&0xff,
- iExtra1,iExtra2);
- return TRUE;
-}
-
-static mng_ptr myalloc(mng_size_t iSize)
-{
-#if defined(Q_OS_WINCE)
- mng_ptr ptr = malloc(iSize);
- memset(ptr, 0, iSize);
- return ptr;
-#else
- return (mng_ptr)calloc(1, iSize);
-#endif
-}
-
-static void myfree(mng_ptr pPtr, mng_size_t /*iSize*/)
-{
- free(pPtr);
-}
-
-static mng_bool myopenstream(mng_handle)
-{
- return MNG_TRUE;
-}
-
-static mng_bool myclosestream(mng_handle hMNG)
-{
- QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
- pMydata->haveReadAll = true;
- return MNG_TRUE;
-}
-
-static mng_bool myreaddata(mng_handle hMNG,
- mng_ptr pBuf,
- mng_uint32 iSize,
- mng_uint32p pRead)
-{
- QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
- return pMydata->readData(pBuf, iSize, pRead);
-}
-
-static mng_bool mywritedata(mng_handle hMNG,
- mng_ptr pBuf,
- mng_uint32 iSize,
- mng_uint32p pWritten)
-{
- QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
- return pMydata->writeData(pBuf, iSize, pWritten);
-}
-
-static mng_bool myprocessheader(mng_handle hMNG,
- mng_uint32 iWidth,
- mng_uint32 iHeight)
-{
- QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
- return pMydata->processHeader(iWidth, iHeight);
-}
-
-static mng_ptr mygetcanvasline(mng_handle hMNG,
- mng_uint32 iLinenr)
-{
- QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
- return (mng_ptr)pMydata->image.scanLine(iLinenr);
-}
-
-static mng_bool myrefresh(mng_handle /*hMNG*/,
- mng_uint32 /*iX*/,
- mng_uint32 /*iY*/,
- mng_uint32 /*iWidth*/,
- mng_uint32 /*iHeight*/)
-{
- return MNG_TRUE;
-}
-
-static mng_uint32 mygettickcount(mng_handle hMNG)
-{
- QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
- return pMydata->elapsed++;
-}
-
-static mng_bool mysettimer(mng_handle hMNG,
- mng_uint32 iMsecs)
-{
- QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
- pMydata->elapsed += iMsecs;
- pMydata->nextDelay = iMsecs;
- return MNG_TRUE;
-}
-
-static mng_bool myprocessterm(mng_handle hMNG,
- mng_uint8 iTermaction,
- mng_uint8 /*iIteraction*/,
- mng_uint32 /*iDelay*/,
- mng_uint32 iItermax)
-{
- QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
- if (iTermaction == 3)
- pMydata->iterCount = iItermax;
- return MNG_TRUE;
-}
-
-static mng_bool mytrace(mng_handle,
- mng_int32 iFuncnr,
- mng_int32 iFuncseq,
- mng_pchar zFuncname)
-{
- qDebug("mng trace: iFuncnr: %d iFuncseq: %d zFuncname: %s", iFuncnr, iFuncseq, zFuncname);
- return MNG_TRUE;
-}
-
-QMngHandlerPrivate::QMngHandlerPrivate(QMngHandler *q_ptr)
- : haveReadNone(true), haveReadAll(false), elapsed(0), nextDelay(0), iterCount(1),
- frameIndex(-1), nextIndex(0), frameCount(0), q_ptr(q_ptr)
-{
- iStyle = (QSysInfo::ByteOrder == QSysInfo::LittleEndian) ? MNG_CANVAS_BGRA8 : MNG_CANVAS_ARGB8;
- // Initialize libmng
- hMNG = mng_initialize((mng_ptr)this, myalloc, myfree, mytrace);
- if (hMNG) {
- // Set callback functions
- mng_setcb_errorproc(hMNG, myerror);
- mng_setcb_openstream(hMNG, myopenstream);
- mng_setcb_closestream(hMNG, myclosestream);
- mng_setcb_readdata(hMNG, myreaddata);
- mng_setcb_writedata(hMNG, mywritedata);
- mng_setcb_processheader(hMNG, myprocessheader);
- mng_setcb_getcanvasline(hMNG, mygetcanvasline);
- mng_setcb_refresh(hMNG, myrefresh);
- mng_setcb_gettickcount(hMNG, mygettickcount);
- mng_setcb_settimer(hMNG, mysettimer);
- mng_setcb_processterm(hMNG, myprocessterm);
- mng_set_doprogressive(hMNG, MNG_FALSE);
- mng_set_suspensionmode(hMNG, MNG_TRUE);
- }
-}
-
-QMngHandlerPrivate::~QMngHandlerPrivate()
-{
- mng_cleanup(&hMNG);
-}
-
-mng_bool QMngHandlerPrivate::readData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pRead)
-{
- Q_Q(QMngHandler);
- *pRead = q->device()->read((char *)pBuf, iSize);
- return (*pRead > 0) ? MNG_TRUE : MNG_FALSE;
-}
-
-mng_bool QMngHandlerPrivate::writeData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pWritten)
-{
- Q_Q(QMngHandler);
- *pWritten = q->device()->write((char *)pBuf, iSize);
- return MNG_TRUE;
-}
-
-mng_bool QMngHandlerPrivate::processHeader(mng_uint32 iWidth, mng_uint32 iHeight)
-{
- if (mng_set_canvasstyle(hMNG, iStyle) != MNG_NOERROR)
- return MNG_FALSE;
- image = QImage(iWidth, iHeight, QImage::Format_ARGB32);
- image.fill(0);
- return MNG_TRUE;
-}
-
-bool QMngHandlerPrivate::getNextImage(QImage *result)
-{
- mng_retcode ret;
- if (haveReadNone) {
- haveReadNone = false;
- ret = mng_readdisplay(hMNG);
- } else {
- ret = mng_display_resume(hMNG);
- }
- if ((MNG_NOERROR == ret) || (MNG_NEEDTIMERWAIT == ret)) {
- *result = image;
- frameIndex = nextIndex++;
- if (haveReadAll && (frameCount == 0))
- frameCount = nextIndex;
- return true;
- }
- return false;
-}
-
-bool QMngHandlerPrivate::writeImage(const QImage &image)
-{
- mng_reset(hMNG);
- if (mng_create(hMNG) != MNG_NOERROR)
- return false;
-
- this->image = image.convertToFormat(QImage::Format_ARGB32);
- int w = image.width();
- int h = image.height();
-
- if (
- // width, height, ticks, layercount, framecount, playtime, simplicity
- (mng_putchunk_mhdr(hMNG, w, h, 1000, 0, 0, 0, 7) == MNG_NOERROR) &&
- // termination_action, action_after_iterations, delay, iteration_max
- (mng_putchunk_term(hMNG, 3, 0, 1, 0x7FFFFFFF) == MNG_NOERROR) &&
- // width, height, bitdepth, colortype, compression, filter, interlace
- (mng_putchunk_ihdr(hMNG, w, h, 8, 6, 0, 0, 0) == MNG_NOERROR) &&
- // width, height, colortype, bitdepth, compression, filter, interlace, canvasstyle, getcanvasline
- (mng_putimgdata_ihdr(hMNG, w, h, 6, 8, 0, 0, 0, iStyle, mygetcanvasline) == MNG_NOERROR) &&
- (mng_putchunk_iend(hMNG) == MNG_NOERROR) &&
- (mng_putchunk_mend(hMNG) == MNG_NOERROR) &&
- (mng_write(hMNG) == MNG_NOERROR)
- )
- return true;
- return false;
-}
-
-int QMngHandlerPrivate::currentImageNumber() const
-{
-// return mng_get_currentframe(hMNG) % imageCount(); not implemented, apparently
- return frameIndex;
-}
-
-int QMngHandlerPrivate::imageCount() const
-{
-// return mng_get_totalframes(hMNG); not implemented, apparently
- if (haveReadAll)
- return frameCount;
- return 0; // Don't know
-}
-
-bool QMngHandlerPrivate::jumpToImage(int imageNumber)
-{
- if (imageNumber == nextIndex)
- return true;
-
- if ((imageNumber == 0) && haveReadAll && (nextIndex == frameCount)) {
- // Loop!
- nextIndex = 0;
- return true;
- }
- if (mng_display_freeze(hMNG) == MNG_NOERROR) {
- if (mng_display_goframe(hMNG, imageNumber) == MNG_NOERROR) {
- nextIndex = imageNumber;
- return true;
- }
- }
- return false;
-}
-
-bool QMngHandlerPrivate::jumpToNextImage()
-{
- return jumpToImage((currentImageNumber()+1) % imageCount());
-}
-
-int QMngHandlerPrivate::nextImageDelay() const
-{
- return nextDelay;
-}
-
-bool QMngHandlerPrivate::setBackgroundColor(const QColor &color)
-{
- mng_uint16 iRed = (mng_uint16)(color.red() << 8);
- mng_uint16 iBlue = (mng_uint16)(color.blue() << 8);
- mng_uint16 iGreen = (mng_uint16)(color.green() << 8);
- return (mng_set_bgcolor(hMNG, iRed, iBlue, iGreen) == MNG_NOERROR);
-}
-
-QColor QMngHandlerPrivate::backgroundColor() const
-{
- mng_uint16 iRed;
- mng_uint16 iBlue;
- mng_uint16 iGreen;
- if (mng_get_bgcolor(hMNG, &iRed, &iBlue, &iGreen) == MNG_NOERROR)
- return QColor((iRed >> 8) & 0xFF, (iGreen >> 8) & 0xFF, (iBlue >> 8) & 0xFF);
- return QColor();
-}
-
-QMngHandler::QMngHandler()
- : d_ptr(new QMngHandlerPrivate(this))
-{
-}
-
-QMngHandler::~QMngHandler()
-{
-}
-
-/*! \reimp */
-bool QMngHandler::canRead() const
-{
- Q_D(const QMngHandler);
- if ((!d->haveReadNone
- && (!d->haveReadAll || (d->haveReadAll && (d->nextIndex < d->frameCount))))
- || canRead(device()))
- {
- setFormat("mng");
- return true;
- }
- return false;
-}
-
-/*! \internal */
-bool QMngHandler::canRead(QIODevice *device)
-{
- if (!device) {
- qWarning("QMngHandler::canRead() called with no device");
- return false;
- }
-
- return device->peek(8) == "\x8A\x4D\x4E\x47\x0D\x0A\x1A\x0A";
-}
-
-/*! \reimp */
-QByteArray QMngHandler::name() const
-{
- return "mng";
-}
-
-/*! \reimp */
-bool QMngHandler::read(QImage *image)
-{
- Q_D(QMngHandler);
- return canRead() ? d->getNextImage(image) : false;
-}
-
-/*! \reimp */
-bool QMngHandler::write(const QImage &image)
-{
- Q_D(QMngHandler);
- return d->writeImage(image);
-}
-
-/*! \reimp */
-int QMngHandler::currentImageNumber() const
-{
- Q_D(const QMngHandler);
- return d->currentImageNumber();
-}
-
-/*! \reimp */
-int QMngHandler::imageCount() const
-{
- Q_D(const QMngHandler);
- return d->imageCount();
-}
-
-/*! \reimp */
-bool QMngHandler::jumpToImage(int imageNumber)
-{
- Q_D(QMngHandler);
- return d->jumpToImage(imageNumber);
-}
-
-/*! \reimp */
-bool QMngHandler::jumpToNextImage()
-{
- Q_D(QMngHandler);
- return d->jumpToNextImage();
-}
-
-/*! \reimp */
-int QMngHandler::loopCount() const
-{
- Q_D(const QMngHandler);
- if (d->iterCount == 0x7FFFFFFF)
- return -1; // infinite loop
- return d->iterCount-1;
-}
-
-/*! \reimp */
-int QMngHandler::nextImageDelay() const
-{
- Q_D(const QMngHandler);
- return d->nextImageDelay();
-}
-
-/*! \reimp */
-QVariant QMngHandler::option(ImageOption option) const
-{
- Q_D(const QMngHandler);
- if (option == QImageIOHandler::Animation)
- return true;
- else if (option == QImageIOHandler::BackgroundColor)
- return d->backgroundColor();
- return QVariant();
-}
-
-/*! \reimp */
-void QMngHandler::setOption(ImageOption option, const QVariant & value)
-{
- Q_D(QMngHandler);
- if (option == QImageIOHandler::BackgroundColor)
- d->setBackgroundColor(qvariant_cast<QColor>(value));
-}
-
-/*! \reimp */
-bool QMngHandler::supportsOption(ImageOption option) const
-{
- if (option == QImageIOHandler::Animation)
- return true;
- else if (option == QImageIOHandler::BackgroundColor)
- return true;
- return false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/image/qmnghandler.pri b/src/gui/image/qmnghandler.pri
deleted file mode 100644
index ffb98de92b..0000000000
--- a/src/gui/image/qmnghandler.pri
+++ /dev/null
@@ -1,10 +0,0 @@
-# common to plugin and built-in forms
-INCLUDEPATH *= $$PWD
-HEADERS += $$PWD/qmnghandler_p.h
-SOURCES += $$PWD/qmnghandler.cpp
-contains(QT_CONFIG, system-mng) {
- if(unix|win32-g++*):LIBS += -lmng
- else:win32: LIBS += libmng.lib
-} else {
- include($$PWD/../../3rdparty/libmng.pri)
-}
diff --git a/src/gui/image/qmnghandler_p.h b/src/gui/image/qmnghandler_p.h
deleted file mode 100644
index 42b4fd06a8..0000000000
--- a/src/gui/image/qmnghandler_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMNGHANDLER_P_H
-#define QMNGHANDLER_P_H
-
-#include <QtCore/qscopedpointer.h>
-#include <QtGui/qimageiohandler.h>
-
-QT_BEGIN_NAMESPACE
-
-class QImage;
-class QByteArray;
-class QIODevice;
-class QVariant;
-class QMngHandlerPrivate;
-
-class QMngHandler : public QImageIOHandler
-{
- public:
- QMngHandler();
- ~QMngHandler();
- virtual bool canRead() const;
- virtual QByteArray name() const;
- virtual bool read(QImage *image);
- virtual bool write(const QImage &image);
- virtual int currentImageNumber() const;
- virtual int imageCount() const;
- virtual bool jumpToImage(int imageNumber);
- virtual bool jumpToNextImage();
- virtual int loopCount() const;
- virtual int nextImageDelay() const;
- static bool canRead(QIODevice *device);
- virtual QVariant option(ImageOption option) const;
- virtual void setOption(ImageOption option, const QVariant & value);
- virtual bool supportsOption(ImageOption option) const;
-
- private:
- Q_DECLARE_PRIVATE(QMngHandler)
- QScopedPointer<QMngHandlerPrivate> d_ptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QMNGHANDLER_P_H
diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp
index 0be6833a87..8dfcf57dfd 100644
--- a/src/gui/image/qmovie.cpp
+++ b/src/gui/image/qmovie.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h
index eb2b81d0b5..9d4cb87b15 100644
--- a/src/gui/image/qmovie.h
+++ b/src/gui/image/qmovie.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,7 +55,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QByteArray;
class QColor;
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp
index 776a17857e..45a8e29100 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/image/qnativeimage.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qnativeimage_p.h b/src/gui/image/qnativeimage_p.h
index 0d8834cad3..7809d75c47 100644
--- a/src/gui/image/qnativeimage_p.h
+++ b/src/gui/image/qnativeimage_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp
index cf9ecc17da..5cf5a37c5f 100644
--- a/src/gui/image/qpaintengine_pic.cpp
+++ b/src/gui/image/qpaintengine_pic.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h
index 830867d89d..f5145a5305 100644
--- a/src/gui/image/qpaintengine_pic_p.h
+++ b/src/gui/image/qpaintengine_pic_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index 1ca34df356..089cc5011c 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1425,20 +1425,16 @@ QPictureHandler::QPictureHandler(const char *f, const char *h, const QByteArray&
typedef QList<QPictureHandler *> QPHList;
Q_GLOBAL_STATIC(QPHList, pictureHandlers)
-#ifndef QT_NO_LIBRARY
-Q_GLOBAL_STATIC(QMutex, mutex)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, factoryLoader,
- (QPictureFormatInterface_iid,
- QLatin1String("/pictureformats")))
-#endif
void qt_init_picture_plugins()
{
#ifndef QT_NO_LIBRARY
- QMutexLocker locker(mutex());
- QFactoryLoader *loader = factoryLoader();
- QStringList keys = loader->keys();
+ static QBasicMutex mutex;
+ QMutexLocker locker(&mutex);
+ static QFactoryLoader loader(QPictureFormatInterface_iid,
+ QStringLiteral("/pictureformats"));
+ QStringList keys = loader.keys();
for (int i = 0; i < keys.count(); ++i)
- if (QPictureFormatInterface *format = qobject_cast<QPictureFormatInterface*>(loader->instance(keys.at(i))))
+ if (QPictureFormatInterface *format = qobject_cast<QPictureFormatInterface*>(loader.instance(keys.at(i))))
format->installIOHandler(keys.at(i));
#endif
}
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index e408d65cbc..c3dbab25c5 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_PICTURE
diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h
index 8c68d19558..f2d1a88408 100644
--- a/src/gui/image/qpicture_p.h
+++ b/src/gui/image/qpicture_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpictureformatplugin.cpp b/src/gui/image/qpictureformatplugin.cpp
index 558d4febce..cb46790d69 100644
--- a/src/gui/image/qpictureformatplugin.cpp
+++ b/src/gui/image/qpictureformatplugin.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpictureformatplugin.h b/src/gui/image/qpictureformatplugin.h
index 9fd79c001d..7bcd32b4fd 100644
--- a/src/gui/image/qpictureformatplugin.h
+++ b/src/gui/image/qpictureformatplugin.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_PICTURE)
@@ -66,7 +65,7 @@ struct Q_GUI_EXPORT QPictureFormatInterface : public QFactoryInterface
virtual bool installIOHandler(const QString &) = 0;
};
-#define QPictureFormatInterface_iid "com.trolltech.Qt.QPictureFormatInterface"
+#define QPictureFormatInterface_iid "org.qt-project.Qt.QPictureFormatInterface"
Q_DECLARE_INTERFACE(QPictureFormatInterface, QPictureFormatInterface_iid)
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 48d393cc24..f1a06fa33c 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1253,8 +1253,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
screen. Alternatively, if no manipulation is desired, the image
file can be loaded directly into a QPixmap. On Windows, the
QPixmap class also supports conversion between \c HBITMAP and
- QPixmap. On Symbian, the QPixmap class also supports conversion
- between CFbsBitmap and QPixmap.
+ QPixmap.
QPixmap provides a collection of functions that can be used to
obtain a variety of information about the pixmap. In addition,
@@ -1362,12 +1361,6 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
to the QPixmap, and returns the HICON handle. The fromWinHICON()
function returns a QPixmap that is equivalent to the given icon.
- In addition, on Symbian, the QPixmap class supports conversion to
- and from CFbsBitmap: the toSymbianCFbsBitmap() function creates
- CFbsBitmap equivalent to the QPixmap, based on given mode and returns
- a CFbsBitmap object. The fromSymbianCFbsBitmap() function returns a
- QPixmap that is equivalent to the given bitmap and given mode.
-
\section1 Pixmap Transformations
QPixmap supports a number of functions for creating a new pixmap
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 5e8ef70828..de76321f0a 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QImageWriter;
class QImageReader;
@@ -146,7 +145,7 @@ public:
inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = 0);
void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = 0);
-#ifdef QT_DEPRECATED
+#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED int serialNumber() const;
#endif
qint64 cacheKey() const;
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 041c11af3a..e5222fa216 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h
index 42d649642f..95397374c6 100644
--- a/src/gui/image/qpixmap_blitter_p.h
+++ b/src/gui/image/qpixmap_blitter_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpixmap_qpa.cpp b/src/gui/image/qpixmap_qpa.cpp
index 7f2ff2e266..162c5f5286 100644
--- a/src/gui/image/qpixmap_qpa.cpp
+++ b/src/gui/image/qpixmap_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 424572ebd4..3fe5216313 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index de4d0e6f17..864fad42ec 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index 5ee7ca9eba..6b0ec38f53 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,8 +44,8 @@
#include "qpixmap_raster_p.h"
#include <qglobal.h>
-#include <qt_windows.h>
#include <QScopedArrayPointer>
+#include <qt_windows.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 0f874bee6c..7769c45b2e 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index 81f9f4b028..99bc59a50a 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class Q_GUI_EXPORT QPixmapCache
{
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
index 2f609a8471..6ca109b03f 100644
--- a/src/gui/image/qpixmapcache_p.h
+++ b/src/gui/image/qpixmapcache_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp
index 30f1f4819b..5162ea80d9 100644
--- a/src/gui/image/qplatformpixmap.cpp
+++ b/src/gui/image/qplatformpixmap.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -133,6 +133,8 @@ bool QPlatformPixmap::fromData(const uchar *buf, uint len, const char *format, Q
QBuffer b(&a);
b.open(QIODevice::ReadOnly);
QImage image = QImageReader(&b, format).read();
+ if (image.isNull())
+ return false;
fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags);
return !isNull();
}
diff --git a/src/gui/image/qplatformpixmap_qpa.h b/src/gui/image/qplatformpixmap_qpa.h
index 13c3bc2fe8..154c5079a7 100644
--- a/src/gui/image/qplatformpixmap_qpa.h
+++ b/src/gui/image/qplatformpixmap_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,7 +60,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QImageReader;
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index a935ea3a28..7acad067b5 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qpnghandler_p.h b/src/gui/image/qpnghandler_p.h
index 8f17bd18a4..5f04f81ac3 100644
--- a/src/gui/image/qpnghandler_p.h
+++ b/src/gui/image/qpnghandler_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index b08f97a3ca..fc625c044f 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qppmhandler_p.h b/src/gui/image/qppmhandler_p.h
index 43e9b09f70..9cb47d063e 100644
--- a/src/gui/image/qppmhandler_p.h
+++ b/src/gui/image/qppmhandler_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp
deleted file mode 100644
index 475622021b..0000000000
--- a/src/gui/image/qtiffhandler.cpp
+++ /dev/null
@@ -1,668 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtiffhandler_p.h"
-#include <qvariant.h>
-#include <qdebug.h>
-#include <qimage.h>
-#include <qglobal.h>
-extern "C" {
-#include "tiffio.h"
-}
-
-QT_BEGIN_NAMESPACE
-
-tsize_t qtiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
-{
- QIODevice* device = static_cast<QTiffHandler*>(fd)->device();
- return device->isReadable() ? device->read(static_cast<char *>(buf), size) : -1;
-}
-
-tsize_t qtiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
-{
- return static_cast<QTiffHandler*>(fd)->device()->write(static_cast<char *>(buf), size);
-}
-
-toff_t qtiffSeekProc(thandle_t fd, toff_t off, int whence)
-{
- QIODevice *device = static_cast<QTiffHandler*>(fd)->device();
- switch (whence) {
- case SEEK_SET:
- device->seek(off);
- break;
- case SEEK_CUR:
- device->seek(device->pos() + off);
- break;
- case SEEK_END:
- device->seek(device->size() + off);
- break;
- }
-
- return device->pos();
-}
-
-int qtiffCloseProc(thandle_t /*fd*/)
-{
- return 0;
-}
-
-toff_t qtiffSizeProc(thandle_t fd)
-{
- return static_cast<QTiffHandler*>(fd)->device()->size();
-}
-
-int qtiffMapProc(thandle_t /*fd*/, tdata_t* /*pbase*/, toff_t* /*psize*/)
-{
- return 0;
-}
-
-void qtiffUnmapProc(thandle_t /*fd*/, tdata_t /*base*/, toff_t /*size*/)
-{
-}
-
-// for 32 bits images
-inline void rotate_right_mirror_horizontal(QImage *const image)// rotate right->mirrored horizontal
-{
- const int height = image->height();
- const int width = image->width();
- QImage generated(/* width = */ height, /* height = */ width, image->format());
- const uint32 *originalPixel = reinterpret_cast<const uint32*>(image->bits());
- uint32 *const generatedPixels = reinterpret_cast<uint32*>(generated.bits());
- for (int row=0; row < height; ++row) {
- for (int col=0; col < width; ++col) {
- int idx = col * height + row;
- generatedPixels[idx] = *originalPixel;
- ++originalPixel;
- }
- }
- *image = generated;
-}
-
-inline void rotate_right_mirror_vertical(QImage *const image) // rotate right->mirrored vertical
-{
- const int height = image->height();
- const int width = image->width();
- QImage generated(/* width = */ height, /* height = */ width, image->format());
- const int lastCol = width - 1;
- const int lastRow = height - 1;
- const uint32 *pixel = reinterpret_cast<const uint32*>(image->bits());
- uint32 *const generatedBits = reinterpret_cast<uint32*>(generated.bits());
- for (int row=0; row < height; ++row) {
- for (int col=0; col < width; ++col) {
- int idx = (lastCol - col) * height + (lastRow - row);
- generatedBits[idx] = *pixel;
- ++pixel;
- }
- }
- *image = generated;
-}
-
-QTiffHandler::QTiffHandler() : QImageIOHandler()
-{
- compression = NoCompression;
-}
-
-bool QTiffHandler::canRead() const
-{
- if (canRead(device())) {
- setFormat("tiff");
- return true;
- }
- return false;
-}
-
-bool QTiffHandler::canRead(QIODevice *device)
-{
- if (!device) {
- qWarning("QTiffHandler::canRead() called with no device");
- return false;
- }
-
- // current implementation uses TIFFClientOpen which needs to be
- // able to seek, so sequential devices are not supported
- QByteArray header = device->peek(4);
- return header == QByteArray::fromRawData("\x49\x49\x2A\x00", 4)
- || header == QByteArray::fromRawData("\x4D\x4D\x00\x2A", 4);
-}
-
-bool QTiffHandler::read(QImage *image)
-{
- if (!canRead())
- return false;
-
- TIFF *const tiff = TIFFClientOpen("foo",
- "r",
- this,
- qtiffReadProc,
- qtiffWriteProc,
- qtiffSeekProc,
- qtiffCloseProc,
- qtiffSizeProc,
- qtiffMapProc,
- qtiffUnmapProc);
-
- if (!tiff) {
- return false;
- }
- uint32 width;
- uint32 height;
- uint16 photometric;
- if (!TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width)
- || !TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height)
- || !TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric)) {
- TIFFClose(tiff);
- return false;
- }
-
- // BitsPerSample defaults to 1 according to the TIFF spec.
- uint16 bitPerSample;
- if (!TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitPerSample))
- bitPerSample = 1;
- uint16 samplesPerPixel; // they may be e.g. grayscale with 2 samples per pixel
- if (!TIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel))
- samplesPerPixel = 1;
-
- bool grayscale = photometric == PHOTOMETRIC_MINISBLACK || photometric == PHOTOMETRIC_MINISWHITE;
- if (grayscale && bitPerSample == 1 && samplesPerPixel == 1) {
- if (image->size() != QSize(width, height) || image->format() != QImage::Format_Mono)
- *image = QImage(width, height, QImage::Format_Mono);
- QVector<QRgb> colortable(2);
- if (photometric == PHOTOMETRIC_MINISBLACK) {
- colortable[0] = 0xff000000;
- colortable[1] = 0xffffffff;
- } else {
- colortable[0] = 0xffffffff;
- colortable[1] = 0xff000000;
- }
- image->setColorTable(colortable);
-
- if (!image->isNull()) {
- for (uint32 y=0; y<height; ++y) {
- if (TIFFReadScanline(tiff, image->scanLine(y), y, 0) < 0) {
- TIFFClose(tiff);
- return false;
- }
- }
- }
- } else {
- if ((grayscale || photometric == PHOTOMETRIC_PALETTE) && bitPerSample == 8 && samplesPerPixel == 1) {
- if (image->size() != QSize(width, height) || image->format() != QImage::Format_Indexed8)
- *image = QImage(width, height, QImage::Format_Indexed8);
- if (!image->isNull()) {
- const uint16 tableSize = 256;
- QVector<QRgb> qtColorTable(tableSize);
- if (grayscale) {
- for (int i = 0; i<tableSize; ++i) {
- const int c = (photometric == PHOTOMETRIC_MINISBLACK) ? i : (255 - i);
- qtColorTable[i] = qRgb(c, c, c);
- }
- } else {
- // create the color table
- uint16 *redTable = 0;
- uint16 *greenTable = 0;
- uint16 *blueTable = 0;
- if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) {
- TIFFClose(tiff);
- return false;
- }
- if (!redTable || !greenTable || !blueTable) {
- TIFFClose(tiff);
- return false;
- }
-
- for (int i = 0; i<tableSize ;++i) {
- const int red = redTable[i] / 257;
- const int green = greenTable[i] / 257;
- const int blue = blueTable[i] / 257;
- qtColorTable[i] = qRgb(red, green, blue);
- }
- }
-
- image->setColorTable(qtColorTable);
- for (uint32 y=0; y<height; ++y) {
- if (TIFFReadScanline(tiff, image->scanLine(y), y, 0) < 0) {
- TIFFClose(tiff);
- return false;
- }
- }
-
- // free redTable, greenTable and greenTable done by libtiff
- }
- } else {
- if (image->size() != QSize(width, height) || image->format() != QImage::Format_ARGB32)
- *image = QImage(width, height, QImage::Format_ARGB32);
- if (!image->isNull()) {
- const int stopOnError = 1;
- if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(image->bits()), ORIENTATION_TOPLEFT, stopOnError)) {
- for (uint32 y=0; y<height; ++y)
- convert32BitOrder(image->scanLine(y), width);
- } else {
- TIFFClose(tiff);
- return false;
- }
- }
- }
- }
-
- if (image->isNull()) {
- TIFFClose(tiff);
- return false;
- }
-
- float resX = 0;
- float resY = 0;
- uint16 resUnit = RESUNIT_NONE;
- if (TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit)
- && TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &resX)
- && TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &resY)) {
-
- switch(resUnit) {
- case RESUNIT_CENTIMETER:
- image->setDotsPerMeterX(qRound(resX * 100));
- image->setDotsPerMeterY(qRound(resY * 100));
- break;
- case RESUNIT_INCH:
- image->setDotsPerMeterX(qRound(resX * (100 / 2.54)));
- image->setDotsPerMeterY(qRound(resY * (100 / 2.54)));
- break;
- default:
- // do nothing as defaults have already
- // been set within the QImage class
- break;
- }
- }
-
- // rotate the image if the orientation is defined in the file
- uint16 orientationTag;
- if (TIFFGetField(tiff, TIFFTAG_ORIENTATION, &orientationTag)) {
- if (image->format() == QImage::Format_ARGB32) {
- // TIFFReadRGBAImageOriented() flip the image but does not rotate them
- switch (orientationTag) {
- case 5:
- rotate_right_mirror_horizontal(image);
- break;
- case 6:
- rotate_right_mirror_vertical(image);
- break;
- case 7:
- rotate_right_mirror_horizontal(image);
- break;
- case 8:
- rotate_right_mirror_vertical(image);
- break;
- }
- } else {
- switch (orientationTag) {
- case 1: // default orientation
- break;
- case 2: // mirror horizontal
- *image = image->mirrored(true, false);
- break;
- case 3: // mirror both
- *image = image->mirrored(true, true);
- break;
- case 4: // mirror vertical
- *image = image->mirrored(false, true);
- break;
- case 5: // rotate right mirror horizontal
- {
- QMatrix transformation;
- transformation.rotate(90);
- *image = image->transformed(transformation);
- *image = image->mirrored(true, false);
- break;
- }
- case 6: // rotate right
- {
- QMatrix transformation;
- transformation.rotate(90);
- *image = image->transformed(transformation);
- break;
- }
- case 7: // rotate right, mirror vertical
- {
- QMatrix transformation;
- transformation.rotate(90);
- *image = image->transformed(transformation);
- *image = image->mirrored(false, true);
- break;
- }
- case 8: // rotate left
- {
- QMatrix transformation;
- transformation.rotate(270);
- *image = image->transformed(transformation);
- break;
- }
- }
- }
- }
-
-
- TIFFClose(tiff);
- return true;
-}
-
-static bool checkGrayscale(const QVector<QRgb> &colorTable)
-{
- if (colorTable.size() != 256)
- return false;
-
- const bool increasing = (colorTable.at(0) == 0xff000000);
- for (int i = 0; i < 256; ++i) {
- if ((increasing && colorTable.at(i) != qRgb(i, i, i))
- || (!increasing && colorTable.at(i) != qRgb(255 - i, 255 - i, 255 - i)))
- return false;
- }
- return true;
-}
-
-bool QTiffHandler::write(const QImage &image)
-{
- if (!device()->isWritable())
- return false;
-
- TIFF *const tiff = TIFFClientOpen("foo",
- "w",
- this,
- qtiffReadProc,
- qtiffWriteProc,
- qtiffSeekProc,
- qtiffCloseProc,
- qtiffSizeProc,
- qtiffMapProc,
- qtiffUnmapProc);
- if (!tiff)
- return false;
-
- const int width = image.width();
- const int height = image.height();
-
- if (!TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, width)
- || !TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, height)
- || !TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)) {
- TIFFClose(tiff);
- return false;
- }
-
- // set the resolution
- bool resolutionSet = false;
- const int dotPerMeterX = image.dotsPerMeterX();
- const int dotPerMeterY = image.dotsPerMeterY();
- if ((dotPerMeterX % 100) == 0
- && (dotPerMeterY % 100) == 0) {
- resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_CENTIMETER)
- && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, dotPerMeterX/100.0)
- && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, dotPerMeterY/100.0);
- } else {
- resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH)
- && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, static_cast<float>(image.logicalDpiX()))
- && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, static_cast<float>(image.logicalDpiY()));
- }
- if (!resolutionSet) {
- TIFFClose(tiff);
- return false;
- }
-
- // configure image depth
- const QImage::Format format = image.format();
- if (format == QImage::Format_Mono || format == QImage::Format_MonoLSB) {
- uint16 photometric = PHOTOMETRIC_MINISBLACK;
- if (image.colorTable().at(0) == 0xffffffff)
- photometric = PHOTOMETRIC_MINISWHITE;
- if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric)
- || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_CCITTRLE)
- || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 1)) {
- TIFFClose(tiff);
- return false;
- }
-
- // try to do the conversion in chunks no greater than 16 MB
- int chunks = (width * height / (1024 * 1024 * 16)) + 1;
- int chunkHeight = qMax(height / chunks, 1);
-
- int y = 0;
- while (y < height) {
- QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y)).convertToFormat(QImage::Format_Mono);
-
- int chunkStart = y;
- int chunkEnd = y + chunk.height();
- while (y < chunkEnd) {
- if (TIFFWriteScanline(tiff, reinterpret_cast<uint32 *>(chunk.scanLine(y - chunkStart)), y) != 1) {
- TIFFClose(tiff);
- return false;
- }
- ++y;
- }
- }
- TIFFClose(tiff);
- } else if (format == QImage::Format_Indexed8) {
- const QVector<QRgb> colorTable = image.colorTable();
- bool isGrayscale = checkGrayscale(colorTable);
- if (isGrayscale) {
- uint16 photometric = PHOTOMETRIC_MINISBLACK;
- if (image.colorTable().at(0) == 0xffffffff)
- photometric = PHOTOMETRIC_MINISWHITE;
- if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric)
- || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_PACKBITS)
- || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
- TIFFClose(tiff);
- return false;
- }
- } else {
- if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE)
- || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_PACKBITS)
- || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
- TIFFClose(tiff);
- return false;
- }
- //// write the color table
- // allocate the color tables
- uint16 *redTable = static_cast<uint16 *>(malloc(256 * sizeof(uint16)));
- uint16 *greenTable = static_cast<uint16 *>(malloc(256 * sizeof(uint16)));
- uint16 *blueTable = static_cast<uint16 *>(malloc(256 * sizeof(uint16)));
- if (!redTable || !greenTable || !blueTable) {
- free(redTable);
- free(greenTable);
- free(blueTable);
- TIFFClose(tiff);
- return false;
- }
-
- // set the color table
- const int tableSize = colorTable.size();
- Q_ASSERT(tableSize <= 256);
- for (int i = 0; i<tableSize; ++i) {
- const QRgb color = colorTable.at(i);
- redTable[i] = qRed(color) * 257;
- greenTable[i] = qGreen(color) * 257;
- blueTable[i] = qBlue(color) * 257;
- }
-
- const bool setColorTableSuccess = TIFFSetField(tiff, TIFFTAG_COLORMAP, redTable, greenTable, blueTable);
-
- free(redTable);
- free(greenTable);
- free(blueTable);
-
- if (!setColorTableSuccess) {
- TIFFClose(tiff);
- return false;
- }
- }
-
- //// write the data
- // try to do the conversion in chunks no greater than 16 MB
- int chunks = (width * height/ (1024 * 1024 * 16)) + 1;
- int chunkHeight = qMax(height / chunks, 1);
-
- int y = 0;
- while (y < height) {
- QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y));
-
- int chunkStart = y;
- int chunkEnd = y + chunk.height();
- while (y < chunkEnd) {
- if (TIFFWriteScanline(tiff, reinterpret_cast<uint32 *>(chunk.scanLine(y - chunkStart)), y) != 1) {
- TIFFClose(tiff);
- return false;
- }
- ++y;
- }
- }
- TIFFClose(tiff);
-
- } else {
- if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
- || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
- || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 4)
- || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
- TIFFClose(tiff);
- return false;
- }
- // try to do the ARGB32 conversion in chunks no greater than 16 MB
- int chunks = (width * height * 4 / (1024 * 1024 * 16)) + 1;
- int chunkHeight = qMax(height / chunks, 1);
-
- int y = 0;
- while (y < height) {
- QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y)).convertToFormat(QImage::Format_ARGB32);
-
- int chunkStart = y;
- int chunkEnd = y + chunk.height();
- while (y < chunkEnd) {
- if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
- convert32BitOrder(chunk.scanLine(y - chunkStart), width);
- else
- convert32BitOrderBigEndian(chunk.scanLine(y - chunkStart), width);
-
- if (TIFFWriteScanline(tiff, reinterpret_cast<uint32 *>(chunk.scanLine(y - chunkStart)), y) != 1) {
- TIFFClose(tiff);
- return false;
- }
- ++y;
- }
- }
- TIFFClose(tiff);
- }
-
- return true;
-}
-
-QByteArray QTiffHandler::name() const
-{
- return "tiff";
-}
-
-QVariant QTiffHandler::option(ImageOption option) const
-{
- if (option == Size && canRead()) {
- QSize imageSize;
- qint64 pos = device()->pos();
- TIFF *tiff = TIFFClientOpen("foo",
- "r",
- const_cast<QTiffHandler*>(this),
- qtiffReadProc,
- qtiffWriteProc,
- qtiffSeekProc,
- qtiffCloseProc,
- qtiffSizeProc,
- qtiffMapProc,
- qtiffUnmapProc);
-
- if (tiff) {
- uint32 width = 0;
- uint32 height = 0;
- TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width);
- TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height);
- imageSize = QSize(width, height);
- TIFFClose(tiff);
- }
- device()->seek(pos);
- if (imageSize.isValid())
- return imageSize;
- } else if (option == CompressionRatio) {
- return compression;
- } else if (option == ImageFormat) {
- return QImage::Format_ARGB32;
- }
- return QVariant();
-}
-
-void QTiffHandler::setOption(ImageOption option, const QVariant &value)
-{
- if (option == CompressionRatio && value.type() == QVariant::Int)
- compression = value.toInt();
-}
-
-bool QTiffHandler::supportsOption(ImageOption option) const
-{
- return option == CompressionRatio
- || option == Size
- || option == ImageFormat;
-}
-
-void QTiffHandler::convert32BitOrder(void *buffer, int width)
-{
- uint32 *target = reinterpret_cast<uint32 *>(buffer);
- for (int32 x=0; x<width; ++x) {
- uint32 p = target[x];
- // convert between ARGB and ABGR
- target[x] = (p & 0xff000000)
- | ((p & 0x00ff0000) >> 16)
- | (p & 0x0000ff00)
- | ((p & 0x000000ff) << 16);
- }
-}
-
-void QTiffHandler::convert32BitOrderBigEndian(void *buffer, int width)
-{
- uint32 *target = reinterpret_cast<uint32 *>(buffer);
- for (int32 x=0; x<width; ++x) {
- uint32 p = target[x];
- target[x] = (p & 0xff000000) >> 24
- | (p & 0x00ff0000) << 8
- | (p & 0x0000ff00) << 8
- | (p & 0x000000ff) << 8;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/image/qtiffhandler.pri b/src/gui/image/qtiffhandler.pri
deleted file mode 100644
index e1cc3ee2b7..0000000000
--- a/src/gui/image/qtiffhandler.pri
+++ /dev/null
@@ -1,10 +0,0 @@
-# common to plugin and built-in forms
-INCLUDEPATH *= $$PWD
-HEADERS += $$PWD/qtiffhandler_p.h
-SOURCES += $$PWD/qtiffhandler.cpp
-contains(QT_CONFIG, system-tiff) {
- if(unix|win32-g++*):LIBS += -ltiff
- else:win32: LIBS += libtiff.lib
-} else {
- include($$PWD/../../3rdparty/libtiff.pri)
-}
diff --git a/src/gui/image/qtiffhandler_p.h b/src/gui/image/qtiffhandler_p.h
deleted file mode 100644
index 16e68b0ad6..0000000000
--- a/src/gui/image/qtiffhandler_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTIFFHANDLER_P_H
-#define QTIFFHANDLER_P_H
-
-#include <QtGui/qimageiohandler.h>
-
-QT_BEGIN_NAMESPACE
-
-class QTiffHandler : public QImageIOHandler
-{
-public:
- QTiffHandler();
-
- bool canRead() const;
- bool read(QImage *image);
- bool write(const QImage &image);
-
- QByteArray name() const;
-
- static bool canRead(QIODevice *device);
-
- QVariant option(ImageOption option) const;
- void setOption(ImageOption option, const QVariant &value);
- bool supportsOption(ImageOption option) const;
-
- enum Compression {
- NoCompression = 0,
- LzwCompression = 1
- };
-private:
- void convert32BitOrder(void *buffer, int width);
- void convert32BitOrderBigEndian(void *buffer, int width);
- int compression;
-};
-
-QT_END_NAMESPACE
-
-#endif // QTIFFHANDLER_P_H
diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp
index e675e4ca67..8122c9cfe8 100644
--- a/src/gui/image/qvolatileimage.cpp
+++ b/src/gui/image/qvolatileimage.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qvolatileimage_p.h b/src/gui/image/qvolatileimage_p.h
index 8f1664c429..808def7c32 100644
--- a/src/gui/image/qvolatileimage_p.h
+++ b/src/gui/image/qvolatileimage_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qvolatileimagedata.cpp b/src/gui/image/qvolatileimagedata.cpp
index 32f265e9d9..3fcf24e187 100644
--- a/src/gui/image/qvolatileimagedata.cpp
+++ b/src/gui/image/qvolatileimagedata.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qvolatileimagedata_p.h b/src/gui/image/qvolatileimagedata_p.h
index 2890530aaa..59e1be12e3 100644
--- a/src/gui/image/qvolatileimagedata_p.h
+++ b/src/gui/image/qvolatileimagedata_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qvolatileimagedata_symbian.cpp b/src/gui/image/qvolatileimagedata_symbian.cpp
deleted file mode 100644
index f438d96e68..0000000000
--- a/src/gui/image/qvolatileimagedata_symbian.cpp
+++ /dev/null
@@ -1,474 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvolatileimagedata_p.h"
-#include <fbs.h>
-#include <QtGui/private/qt_s60_p.h>
-#include <QtGui/qpaintengine.h>
-#include <QtGui/private/qimage_p.h>
-
-QT_BEGIN_NAMESPACE
-
-static CFbsBitmap *rasterizeBitmap(CFbsBitmap *bitmap, TDisplayMode newMode)
-{
- if (!bitmap) {
- return 0;
- }
- QScopedPointer<CFbsBitmap> newBitmap(new CFbsBitmap);
- if (newBitmap->Create(bitmap->SizeInPixels(), newMode) != KErrNone) {
- qWarning("QVolatileImage: Failed to create new bitmap");
- return 0;
- }
- CFbsBitmapDevice *bitmapDevice = 0;
- CFbsBitGc *bitmapGc = 0;
- QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(newBitmap.data()));
- QScopedPointer<CFbsBitmapDevice> bitmapDevicePtr(bitmapDevice);
- QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
- bitmapGc->Activate(bitmapDevice);
- bitmapGc->BitBlt(TPoint(), bitmap);
- delete bitmapGc;
- return newBitmap.take();
-}
-
-static inline TDisplayMode format2TDisplayMode(QImage::Format format)
-{
- TDisplayMode mode;
- switch (format) {
- case QImage::Format_MonoLSB:
- mode = EGray2;
- break;
- case QImage::Format_Indexed8:
- mode = EColor256;
- break;
- case QImage::Format_RGB444:
- mode = EColor4K;
- break;
- case QImage::Format_RGB16:
- mode = EColor64K;
- break;
- case QImage::Format_RGB888:
- mode = EColor16M;
- break;
- case QImage::Format_RGB32:
- mode = EColor16MU;
- break;
- case QImage::Format_ARGB32:
- mode = EColor16MA;
- break;
- case QImage::Format_ARGB32_Premultiplied:
- mode = Q_SYMBIAN_ECOLOR16MAP;
- break;
- default:
- mode = ENone;
- break;
- }
- return mode;
-}
-
-static CFbsBitmap *imageToBitmap(const QImage &image)
-{
- if (image.isNull()) {
- return 0;
- }
- CFbsBitmap *bitmap = new CFbsBitmap;
- if (bitmap->Create(TSize(image.width(), image.height()),
- format2TDisplayMode(image.format())) == KErrNone) {
- bitmap->BeginDataAccess();
- uchar *dptr = reinterpret_cast<uchar *>(bitmap->DataAddress());
- int bmpLineLen = bitmap->DataStride();
- int imgLineLen = image.bytesPerLine();
- if (bmpLineLen == imgLineLen) {
- qMemCopy(dptr, image.constBits(), image.byteCount());
- } else {
- int len = qMin(bmpLineLen, imgLineLen);
- const uchar *sptr = image.constBits();
- for (int y = 0; y < image.height(); ++y) {
- qMemCopy(dptr, sptr, len);
- dptr += bmpLineLen;
- sptr += imgLineLen;
- }
- }
- bitmap->EndDataAccess();
- } else {
- qWarning("QVolatileImage: Failed to create source bitmap");
- delete bitmap;
- bitmap = 0;
- }
- return bitmap;
-}
-
-static CFbsBitmap *copyData(const QVolatileImageData &source)
-{
- source.beginDataAccess();
- CFbsBitmap *bmp = imageToBitmap(source.image);
- source.endDataAccess();
- return bmp;
-}
-
-static CFbsBitmap *convertData(const QVolatileImageData &source, QImage::Format newFormat)
-{
- source.beginDataAccess();
- QImage img = source.image.convertToFormat(newFormat);
- CFbsBitmap *bmp = imageToBitmap(img);
- source.endDataAccess();
- return bmp;
-}
-
-static CFbsBitmap *duplicateBitmap(const CFbsBitmap &sourceBitmap)
-{
- CFbsBitmap *bitmap = new CFbsBitmap;
- if (bitmap->Duplicate(sourceBitmap.Handle()) != KErrNone) {
- qWarning("QVolatileImage: Failed to duplicate source bitmap");
- delete bitmap;
- bitmap = 0;
- }
- return bitmap;
-}
-
-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);
- delete bitmap;
- bitmap = 0;
- }
- return bitmap;
-}
-
-static inline bool bitmapNeedsCopy(CFbsBitmap *bitmap)
-{
- bool needsCopy = bitmap->IsCompressedInRAM();
-#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
- needsCopy |= (bitmap->ExtendedBitmapType() != KNullUid);
-#endif
- return needsCopy;
-}
-
-static bool cleanup_function_registered = false;
-static QVolatileImageData *firstImageData = 0;
-
-static void cleanup()
-{
- if (RFbsSession::GetSession()) {
- QVolatileImageData *imageData = firstImageData;
- while (imageData) {
- imageData->release();
- imageData = imageData->next;
- }
- }
-}
-
-static void ensureCleanup()
-{
- // Destroy all underlying bitmaps in a post routine to prevent panics.
- // This is a must because CFbsBitmap destructor needs the fbs session,
- // that was used to create the bitmap, to be open still.
- if (!cleanup_function_registered) {
- qAddPostRoutine(cleanup);
- cleanup_function_registered = true;
- }
-}
-
-static void registerImageData(QVolatileImageData *imageData)
-{
- ensureCleanup();
- imageData->next = firstImageData;
- if (firstImageData) {
- firstImageData->prev = imageData;
- }
- firstImageData = imageData;
-}
-
-static void unregisterImageData(QVolatileImageData *imageData)
-{
- if (imageData->prev) {
- imageData->prev->next = imageData->next;
- } else {
- firstImageData = imageData->next;
- }
- if (imageData->next) {
- imageData->next->prev = imageData->prev;
- }
-}
-
-QVolatileImageData::QVolatileImageData()
- : next(0), prev(0), bitmap(0), pengine(0)
-{
- registerImageData(this);
-}
-
-QVolatileImageData::QVolatileImageData(int w, int h, QImage::Format format)
- : next(0), prev(0), bitmap(0), pengine(0)
-{
- registerImageData(this);
- bitmap = createBitmap(w, h, format);
- updateImage();
-}
-
-QVolatileImageData::QVolatileImageData(const QImage &sourceImage)
- : next(0), prev(0), bitmap(0), pengine(0)
-{
- registerImageData(this);
- image = sourceImage;
- // The following is not mandatory, but we do it here to have a bitmap
- // created always in order to reduce local heap usage.
- ensureBitmap();
-}
-
-QVolatileImageData::QVolatileImageData(void *nativeImage, void *nativeMask)
- : next(0), prev(0), bitmap(0), pengine(0)
-{
- registerImageData(this);
- if (nativeImage) {
- CFbsBitmap *source = static_cast<CFbsBitmap *>(nativeImage);
- CFbsBitmap *mask = static_cast<CFbsBitmap *>(nativeMask);
- initWithBitmap(source);
- if (mask) {
- applyMask(mask);
- }
- }
-}
-
-QVolatileImageData::QVolatileImageData(const QVolatileImageData &other)
-{
- bitmap = 0;
- pengine = 0;
- next = prev = 0;
- registerImageData(this);
- if (!other.image.isNull()) {
- bitmap = copyData(other);
- updateImage();
- }
-}
-
-QVolatileImageData::~QVolatileImageData()
-{
- release();
- unregisterImageData(this);
-}
-
-void QVolatileImageData::release()
-{
- delete bitmap;
- bitmap = 0;
- delete pengine;
- pengine = 0;
-}
-
-void QVolatileImageData::beginDataAccess() const
-{
- if (bitmap) {
- bitmap->BeginDataAccess();
- }
-}
-
-void QVolatileImageData::endDataAccess(bool readOnly) const
-{
- if (bitmap) {
- bitmap->EndDataAccess(readOnly);
- }
-}
-
-bool QVolatileImageData::ensureFormat(QImage::Format format)
-{
- if (image.isNull()) {
- return false;
- }
- if (image.format() != format) {
- CFbsBitmap *newBitmap = convertData(*this, format);
- if (newBitmap && newBitmap != bitmap) {
- delete bitmap;
- bitmap = newBitmap;
- updateImage();
- } else {
- return false;
- }
- }
- return true;
-}
-
-void *QVolatileImageData::duplicateNativeImage() const
-{
- const_cast<QVolatileImageData *>(this)->ensureBitmap();
- if (bitmap) {
- if (bitmap->DisplayMode() == EColor16M) {
- // slow path: needs rgb swapping
- beginDataAccess();
- QImage tmp = image.rgbSwapped();
- endDataAccess(true);
- return imageToBitmap(tmp);
- } else if (bitmap->DisplayMode() == EGray2) {
- // slow path: needs inverting pixels
- beginDataAccess();
- QImage tmp = image.copy();
- endDataAccess(true);
- tmp.invertPixels();
- return imageToBitmap(tmp);
- } else {
- // fast path: just duplicate the bitmap
- return duplicateBitmap(*bitmap);
- }
- }
- return 0;
-}
-
-void QVolatileImageData::updateImage()
-{
- if (bitmap) {
- TSize size = bitmap->SizeInPixels();
- beginDataAccess();
- // Use existing buffer, no copy. The data address never changes so it
- // is enough to do this whenever we have a new CFbsBitmap. N.B. never
- // use const uchar* here, that would create a read-only image data which
- // would make a copy in detach() even when refcount is 1.
- image = QImage(reinterpret_cast<uchar *>(bitmap->DataAddress()),
- size.iWidth, size.iHeight, bitmap->DataStride(),
- qt_TDisplayMode2Format(bitmap->DisplayMode()));
- endDataAccess(true);
- } else {
- image = QImage();
- }
-}
-
-void QVolatileImageData::initWithBitmap(CFbsBitmap *source)
-{
- bool needsCopy = bitmapNeedsCopy(source);
- if (source->DisplayMode() == EColor16M) {
- // EColor16M is BGR
- CFbsBitmap *unswappedBmp = source;
- if (needsCopy) {
- unswappedBmp = rasterizeBitmap(source, source->DisplayMode());
- }
- unswappedBmp->BeginDataAccess();
- TSize sourceSize = unswappedBmp->SizeInPixels();
- QImage img((uchar *) unswappedBmp->DataAddress(),
- sourceSize.iWidth, sourceSize.iHeight, unswappedBmp->DataStride(),
- qt_TDisplayMode2Format(unswappedBmp->DisplayMode()));
- img = img.rgbSwapped();
- unswappedBmp->EndDataAccess(true);
- bitmap = imageToBitmap(img);
- if (needsCopy) {
- delete unswappedBmp;
- }
- } else if (needsCopy) {
- // Rasterize extended and compressed bitmaps.
- bitmap = rasterizeBitmap(source, EColor16MAP);
- } else if (source->DisplayMode() == EGray2) {
- // The pixels will be inverted, must make a copy.
- bitmap = rasterizeBitmap(source, source->DisplayMode());
- } else {
- // Efficient path: no pixel data copying. Just duplicate. This of course
- // means the original bitmap's data may get modified, but that's fine
- // and is in accordance with the QPixmap::fromSymbianCFbsBitmap() docs.
- bitmap = duplicateBitmap(*source);
- }
- updateImage();
- if (bitmap && bitmap->DisplayMode() == EGray2) {
- // Symbian thinks set pixels are white/transparent, Qt thinks they are
- // foreground/solid. Invert mono bitmaps so that masks work correctly.
- beginDataAccess();
- image.invertPixels();
- endDataAccess();
- }
-}
-
-void QVolatileImageData::applyMask(CFbsBitmap *mask)
-{
- ensureFormat(QImage::Format_ARGB32_Premultiplied);
- bool destroyMask = false;
- if (bitmapNeedsCopy(mask)) {
- mask = rasterizeBitmap(mask, EColor16MU);
- if (!mask) {
- return;
- }
- destroyMask = true;
- }
- mask->BeginDataAccess();
- TSize maskSize = mask->SizeInPixels();
- QImage maskImg((const uchar *) mask->DataAddress(), maskSize.iWidth, maskSize.iHeight,
- mask->DataStride(), qt_TDisplayMode2Format(mask->DisplayMode()));
- if (mask->DisplayMode() == EGray2) {
- maskImg = maskImg.copy();
- maskImg.invertPixels();
- }
- beginDataAccess();
- image.setAlphaChannel(maskImg);
- endDataAccess();
- mask->EndDataAccess(true);
- ensureImage();
- if (destroyMask) {
- delete mask;
- }
-}
-
-void QVolatileImageData::ensureImage()
-{
- if (bitmap && !image.isNull()) {
- QImageData *imaged = image.data_ptr();
- if (imaged->ref != 1 || imaged->ro_data) {
- // This is bad, the imagedata got shared somehow. Detach, in order to
- // have the next check fail and thus have 'image' recreated.
- beginDataAccess();
- image.detach();
- endDataAccess(true);
- }
- }
- if (bitmap && image.constBits() != reinterpret_cast<const uchar *>(bitmap->DataAddress())) {
- // Should not ever get here. If we do it means that either 'image' has
- // been replaced with a copy (e.g. because some QImage API assigned a
- // new, regular QImage to *this) or the bitmap's data address changed
- // unexpectedly.
- qWarning("QVolatileImageData: Ptr mismatch");
- // Recover by recreating the image so that it uses the bitmap as its buffer.
- updateImage();
- }
-}
-
-void QVolatileImageData::ensureBitmap()
-{
- if (!bitmap && !image.isNull()) {
- bitmap = imageToBitmap(image);
- updateImage();
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp
index dda57239cc..9990c9f4d0 100644
--- a/src/gui/image/qxbmhandler.cpp
+++ b/src/gui/image/qxbmhandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qxbmhandler_p.h b/src/gui/image/qxbmhandler_p.h
index 13ab343f8b..081f3133b2 100644
--- a/src/gui/image/qxbmhandler_p.h
+++ b/src/gui/image/qxbmhandler_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index 48047d2d55..f2fab75d76 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/image/qxpmhandler_p.h b/src/gui/image/qxpmhandler_p.h
index 092d9bb3f1..7acdc49eec 100644
--- a/src/gui/image/qxpmhandler_p.h
+++ b/src/gui/image/qxpmhandler_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/