diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-25 11:58:56 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-25 11:58:56 (GMT) |
commit | d9dd68c4400c3ca590ea425d6f3d070ea6094099 (patch) | |
tree | cdfbec67e182670673ac957f11708ddbaf2fc26b /src | |
parent | 978daedf73ba7aecf9ea9f83c9108308e4303d6e (diff) | |
parent | 19ebb3f5b2f599018594e9f0dd3b9de81f584262 (diff) | |
download | Qt-d9dd68c4400c3ca590ea425d6f3d070ea6094099.zip Qt-d9dd68c4400c3ca590ea425d6f3d070ea6094099.tar.gz Qt-d9dd68c4400c3ca590ea425d6f3d070ea6094099.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public:
Remove enums from bitfield, since all compilers do not support them.
Fixed compile error in runonphone.
Use QImage 'convertInPlace' versions in QVGPixmapData load functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qaction_p.h | 8 | ||||
-rw-r--r-- | src/openvg/qpixmapdata_vg.cpp | 53 | ||||
-rw-r--r-- | src/openvg/qpixmapdata_vg_p.h | 8 |
3 files changed, 64 insertions, 5 deletions
diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h index 899b01b..5764318 100644 --- a/src/gui/kernel/qaction_p.h +++ b/src/gui/kernel/qaction_p.h @@ -112,12 +112,12 @@ public: //for soft keys management uint forceEnabledInSoftkeys : 1; uint menuActionSoftkeys : 1; - - QAction::MenuRole menuRole : 3; - QAction::SoftKeyRole softKeyRole : 2; - QAction::Priority priority : 14; int iconVisibleInMenu : 3; // Only has values -1, 0, and 1 + QAction::MenuRole menuRole; + QAction::SoftKeyRole softKeyRole; + QAction::Priority priority; + QList<QWidget *> widgets; #ifndef QT_NO_GRAPHICSVIEW QList<QGraphicsWidget *> graphicsWidgets; diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index cb413d0..e8ec333 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -47,6 +47,9 @@ #endif #include "qvg_p.h" #include "qvgimagepool_p.h" +#include <QBuffer> +#include <QImageReader> +#include <QtGui/private/qimage_p.h> QT_BEGIN_NAMESPACE @@ -152,11 +155,59 @@ void QVGPixmapData::resize(int wid, int ht) void QVGPixmapData::fromImage (const QImage &image, Qt::ImageConversionFlags flags) { + QImage img = image; + createPixmapForImage(img, flags, false); +} + +void QVGPixmapData::fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags) +{ + QImage image = imageReader->read(); + if (image.isNull()) + return; + + createPixmapForImage(image, flags, true); +} + +bool QVGPixmapData::fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags) +{ + QImage image = QImageReader(filename, format).read(); + if (image.isNull()) + return false; + + createPixmapForImage(image, flags, true); + + return !isNull(); +} + +bool QVGPixmapData::fromData(const uchar *buffer, uint len, const char *format, + Qt::ImageConversionFlags flags) +{ + QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer), len); + QBuffer b(&a); + b.open(QIODevice::ReadOnly); + QImage image = QImageReader(&b, format).read(); + if (image.isNull()) + return false; + + createPixmapForImage(image, flags, true); + + return !isNull(); +} + +void QVGPixmapData::createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace) +{ if (image.size() == QSize(w, h)) setSerialNumber(++qt_vg_pixmap_serial); else resize(image.width(), image.height()); - source = image.convertToFormat(sourceFormat(), flags); + + if (inPlace && image.data_ptr()->convertInPlace(sourceFormat(), flags)) + source = image; + else + source = image.convertToFormat(sourceFormat()); + recreate = true; } diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h index c21b48f..114d545 100644 --- a/src/openvg/qpixmapdata_vg_p.h +++ b/src/openvg/qpixmapdata_vg_p.h @@ -64,6 +64,7 @@ QT_BEGIN_NAMESPACE class QEglContext; class QVGImagePool; +class QImageReader; #if !defined(QT_NO_EGL) class QVGPixmapData; @@ -87,6 +88,12 @@ public: void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); + void fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags); + bool fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags); + bool fromData(const uchar *buffer, uint len, const char *format, + Qt::ImageConversionFlags flags); void fill(const QColor &color); bool hasAlphaChannel() const; @@ -126,6 +133,7 @@ public: protected: int metric(QPaintDevice::PaintDeviceMetric metric) const; + void createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace); #if defined(Q_OS_SYMBIAN) void cleanup(); |