diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-11-20 00:22:17 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-11-20 00:22:17 (GMT) |
commit | 73477789bdeeba851cf095cbdda5c36d9f5c31df (patch) | |
tree | 800581ddb9e79d765fef9867ba9d10a6388c5ac5 /src | |
parent | 6d1abfb719d52fa4427b5a50431076e4ab6a0855 (diff) | |
download | Qt-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')
-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); } |