summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-03-10 09:22:05 (GMT)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-03-10 09:22:05 (GMT)
commite1ce31e9ecf7e773895632fcf3087369a50c04f1 (patch)
tree084704e3f582c62302a640e9d6bcedf3a07cdf9f /src/openvg
parent9c5aa419ba467ff2d59440bafe2ca82d1065afec (diff)
downloadQt-e1ce31e9ecf7e773895632fcf3087369a50c04f1.zip
Qt-e1ce31e9ecf7e773895632fcf3087369a50c04f1.tar.gz
Qt-e1ce31e9ecf7e773895632fcf3087369a50c04f1.tar.bz2
Avoid image conversion in fromSymbianCFbsBitmap for certain formats.
From now on the image data coming from CFbsBitmap will not be forced to RGB32 or ARGB32_Premultiplied in openvg. This allows copy-less creation and drawing of pixmaps not just from bitmaps with display mode EColor16MAP and EColor16MU, but also a few other modes, like EColor64K. Painting into such pixmaps or drawing them via the raster engine is potentially slower in such cases, which is now reflected in the fromSymbianCFbsBitmap documentation. Note that this patch has no effect on extended bitmaps (e.g. skin graphics), those must always be rasterized first regardless of the display mode. Task-number: QTBUG-18027 Reviewed-by: Jani Hautakangas
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/qpaintengine_vg.cpp5
-rw-r--r--src/openvg/qvg_symbian.cpp23
2 files changed, 24 insertions, 4 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index f0f198f..f1b3277 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -4018,6 +4018,8 @@ VGImageFormat qt_vg_image_to_vg_format(QImage::Format format)
switch (format) {
case QImage::Format_MonoLSB:
return VG_BW_1;
+ case QImage::Format_Indexed8:
+ return VG_sL_8;
case QImage::Format_ARGB32_Premultiplied:
return VG_sARGB_8888_PRE;
case QImage::Format_RGB32:
@@ -4028,7 +4030,8 @@ VGImageFormat qt_vg_image_to_vg_format(QImage::Format format)
return VG_sRGB_565;
case QImage::Format_ARGB4444_Premultiplied:
return VG_sARGB_4444;
- default: break;
+ default:
+ break;
}
return VG_sARGB_8888; // XXX
}
diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp
index 5eb64bd..405151d 100644
--- a/src/openvg/qvg_symbian.cpp
+++ b/src/openvg/qvg_symbian.cpp
@@ -150,6 +150,21 @@ void QVGPixmapData::releaseNativeImageHandle()
}
}
+static inline bool conversionLessFormat(QImage::Format format)
+{
+ switch (format) {
+ case QImage::Format_RGB16: // EColor64K
+ case QImage::Format_RGB32: // EColor16MU
+ case QImage::Format_ARGB32: // EColor16MA
+ case QImage::Format_ARGB32_Premultiplied: // EColor16MAP
+ case QImage::Format_MonoLSB: // EGray2
+ case QImage::Format_Indexed8: // EGray256, EColor256
+ return true;
+ default:
+ return false;
+ }
+}
+
void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
{
if (type == QPixmapData::SgImage && pixmap) {
@@ -178,9 +193,11 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
source = QVolatileImage(bitmap); // duplicates only, if possible
if (source.isNull())
return;
- // Here we may need to copy if the formats do not match.
- // (e.g. for display modes other than EColor16MAP and EColor16MU)
- source.ensureFormat(idealFormat(&source.imageRef(), Qt::AutoColor));
+ if (!conversionLessFormat(source.format())) {
+ // Here we may need to copy if the formats do not match.
+ // (e.g. for display modes other than EColor16MAP and EColor16MU)
+ source.ensureFormat(idealFormat(&source.imageRef(), Qt::AutoColor));
+ }
recreate = true;
} else if (type == QPixmapData::VolatileImage && pixmap) {
QVolatileImage *img = static_cast<QVolatileImage *>(pixmap);