summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-11-20 00:22:17 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-11-20 00:22:17 (GMT)
commit73477789bdeeba851cf095cbdda5c36d9f5c31df (patch)
tree800581ddb9e79d765fef9867ba9d10a6388c5ac5 /src/openvg
parent6d1abfb719d52fa4427b5a50431076e4ab6a0855 (diff)
downloadQt-73477789bdeeba851cf095cbdda5c36d9f5c31df.zip
Qt-73477789bdeeba851cf095cbdda5c36d9f5c31df.tar.gz
Qt-73477789bdeeba851cf095cbdda5c36d9f5c31df.tar.bz2
Prevent a deep copy of QImage::bits() in the OpenVG pixmap implementation
Task-number: QTBUG-5869 Reviewed-by: Sarah Smith
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/qpixmapdata_vg.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index 3254aa3..fad5bb5 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -202,6 +202,14 @@ QPaintEngine* QVGPixmapData::paintEngine() const
return source.paintEngine();
}
+// This function works around QImage::bits() making a deep copy if the
+// QImage is not const. We force it to be const and then get the bits.
+// XXX: Should add a QImage::constBits() in the future to replace this.
+static inline const uchar *qt_vg_imageBits(const QImage& image)
+{
+ return image.bits();
+}
+
VGImage QVGPixmapData::toVGImage()
{
if (!isValid())
@@ -232,7 +240,7 @@ VGImage QVGPixmapData::toVGImage()
if (!source.isNull() && recreate) {
vgImageSubData
(vgImage,
- source.bits(), source.bytesPerLine(),
+ qt_vg_imageBits(source), source.bytesPerLine(),
VG_sARGB_8888_PRE, 0, 0, w, h);
}
@@ -272,7 +280,7 @@ VGImage QVGPixmapData::toVGImage(qreal opacity)
if (!source.isNull() && recreate) {
vgImageSubData
(vgImage,
- source.bits(), source.bytesPerLine(),
+ qt_vg_imageBits(source), source.bytesPerLine(),
VG_sARGB_8888_PRE, 0, 0, w, h);
}