diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-11-20 00:22:17 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-11-20 14:37:46 (GMT) |
commit | 0c2a398334980f2bb178714bd3dd21b31115d0b1 (patch) | |
tree | 7163a92f3bf15a5831eb982fb41dbf53c8702aec /src | |
parent | 024969636d269cf7c89766502efee59c0ad3f28a (diff) | |
download | Qt-0c2a398334980f2bb178714bd3dd21b31115d0b1.zip Qt-0c2a398334980f2bb178714bd3dd21b31115d0b1.tar.gz Qt-0c2a398334980f2bb178714bd3dd21b31115d0b1.tar.bz2 |
Prevent a deep copy of QImage::bits() in the OpenVG pixmap implementation
Task-number: QTBUG-5869
Reviewed-by: Sarah Smith
(cherry picked from commit 73477789bdeeba851cf095cbdda5c36d9f5c31df)
Diffstat (limited to 'src')
-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 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); } |