diff options
Diffstat (limited to 'src/openvg/qpixmapdata_vg.cpp')
-rw-r--r-- | src/openvg/qpixmapdata_vg.cpp | 12 |
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); } |