summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 9ca9749..3518ce1 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);
}