diff options
author | Aleksandar Sasha Babic <aleksandar.babic@nokia.com> | 2009-09-18 12:11:05 (GMT) |
---|---|---|
committer | Aleksandar Sasha Babic <aleksandar.babic@nokia.com> | 2009-09-18 12:16:30 (GMT) |
commit | ad32d9a2d2c3b1202867f8563a69afb93effecd0 (patch) | |
tree | 371f84075a5c21e664a461ccc3f7db2fc7b320a9 /src/gui/image | |
parent | df062a2df4e9a438b6e876801cbd04a7cab7a569 (diff) | |
download | Qt-ad32d9a2d2c3b1202867f8563a69afb93effecd0.zip Qt-ad32d9a2d2c3b1202867f8563a69afb93effecd0.tar.gz Qt-ad32d9a2d2c3b1202867f8563a69afb93effecd0.tar.bz2 |
Adding support for symbian graphics resources.
This enables us to convert from and to new Symbian type of
graphics resource, namely SgImage. This only supported with
the OpenVG graphics system.
On other graphics systems this will return null QPixmap.
Conflicts:
src/corelib/global/qglobal.h
src/gui/image/qpixmap.h
src/gui/image/qpixmap_s60.cpp
Reviewed-by: Jason Barron
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/image.pri | 2 | ||||
-rw-r--r-- | src/gui/image/qpixmap.h | 5 | ||||
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 58 | ||||
-rw-r--r-- | src/gui/image/qpixmapdata.cpp | 11 | ||||
-rw-r--r-- | src/gui/image/qpixmapdata_p.h | 9 |
5 files changed, 83 insertions, 2 deletions
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index f365f66..b67be55 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -24,7 +24,7 @@ HEADERS += \ image/qpixmap.h \ image/qpixmap_raster_p.h \ image/qpixmapcache.h \ - image/qpixmapcache_p.h \ + image/qpixmapcache_p.h \ image/qpixmapdata_p.h \ image/qpixmapdatafactory_p.h \ image/qpixmapfilter_p.h \ diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 4a8a876..54e89ff 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -54,6 +54,7 @@ QT_BEGIN_HEADER #if defined(Q_OS_SYMBIAN) class CFbsBitmap; +class RSgImage; #endif QT_BEGIN_NAMESPACE @@ -158,9 +159,11 @@ public: #if defined(Q_OS_SYMBIAN) enum ConversionMode { CopyData, DuplicateHandle }; - + CFbsBitmap *toSymbianCFbsBitmap(ConversionMode mode = DuplicateHandle) const; static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap, ConversionMode mode = DuplicateHandle); + RSgImage* toSymbianRSgImage() const; + static QPixmap fromSymbianRSgImage(RSgImage *sgImage); #endif inline QPixmap copy(int x, int y, int width, int height) const; diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 8a6ecb0..0a81ebd 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -42,6 +42,8 @@ #include <w32std.h> #include <fbs.h> +#include <private/qapplication_p.h> +#include <private/qgraphicssystem_p.h> #include <private/qt_s60_p.h> #include <private/qpaintengine_s60_p.h> @@ -895,5 +897,61 @@ void QS60PixmapData::endDataAccess(bool readOnly) const symbianBitmapDataAccess->endDataAccess(cfbsBitmap); } +/*! + \since 4.6 + + Returns a QPixmap that wraps given \c RSgImage \a graphics resource. + The data should be valid even when original RSgImage handle has been + closed. + + \warning This function is only available on Symbian OS. + + \sa toSymbianRSgImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} +*/ + +QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) +{ + // It is expected that RSgImage will + // CURRENTLY be used in conjuction with + // OpenVG graphics system + // + // Surely things might change in future + + if (!sgImage) + return QPixmap(); + + QPixmap pixmap; + pixmap.pixmapData()->fromRSgImage(sgImage); + + return pixmap; +} + +/*! +\since 4.6 + +Returns a \c RSgImage that is equivalent to the QPixmap by copying the data. + +It is the caller's responsibility to close/delete the \c RSgImage after use. + +\warning This function is only available on Symbian OS. + +\sa fromSymbianRSgImage() +*/ + +RSgImage *QPixmap::toSymbianRSgImage() const +{ + // It is expected that RSgImage will + // CURRENTLY be used in conjuction with + // OpenVG graphics system + // + // Surely things might change in future + + if (isNull()) + return 0; + + RSgImage *sgImage = pixmapData()->toRSgImage(); + + return sgImage; +} QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 8ce5447..65899a4 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -223,4 +223,15 @@ QImage* QPixmapData::buffer() return 0; } +#if defined(Q_OS_SYMBIAN) +RSgImage* QPixmapData::toRSgImage() +{ + return 0; +} + +void QPixmapData::fromRSgImage(RSgImage* rsgImage) +{ + return; +} +#endif QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 0af2af8..bac5065 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -56,6 +56,10 @@ #include <QtGui/qpixmap.h> #include <QtCore/qatomic.h> +#if defined(Q_OS_SYMBIAN) +class RSgImage; +#endif + QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QPixmapData @@ -109,6 +113,11 @@ public: inline int depth() const { return d; } inline bool isNull() const { return is_null; } +#if defined(Q_OS_SYMBIAN) + virtual RSgImage* toRSgImage(); + virtual void fromRSgImage(RSgImage* rsgImage); +#endif + protected: void setSerialNumber(int serNo); int w; |