From 83d33a9f64d1472926c61e472655182e539a8e10 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 24 Mar 2011 16:29:26 +0200 Subject: Fix an issue with VGImage readback in openvg. The special case of creating a pixmap from RSgImage via a native handle provider needs extra attention when hibernating: In this case the hibernating happens as usual, however doing a readback would produce unwanted results and must be avoided. Reviewed-by: Jani Hautakangas --- src/openvg/qpixmapdata_vg.cpp | 7 ++++--- src/openvg/qpixmapdata_vg_p.h | 2 +- src/s60installs/bwins/QtOpenVGu.def | 3 ++- src/s60installs/eabi/QtOpenVGu.def | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 3f67c79..80f5b2f 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -458,7 +458,7 @@ void QVGPixmapData::hibernate() if (skipHibernate) return; - forceToImage(); + forceToImage(false); // no readback allowed here destroyImageAndContext(); } @@ -502,12 +502,13 @@ int QVGPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const // Ensures that the pixmap is backed by some valid data and forces the data to // be re-uploaded to the VGImage when toVGImage() is called next time. -void QVGPixmapData::forceToImage() +void QVGPixmapData::forceToImage(bool allowReadback) { if (!isValid()) return; - ensureReadback(false); + if (allowReadback) + ensureReadback(false); if (source.isNull()) source = QVolatileImage(w, h, sourceFormat()); diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h index 15ff889..c284596 100644 --- a/src/openvg/qpixmapdata_vg_p.h +++ b/src/openvg/qpixmapdata_vg_p.h @@ -188,7 +188,7 @@ protected: QString nativeImageType; #endif - void forceToImage(); + void forceToImage(bool allowReadback = true); QImage::Format sourceFormat() const; QImage::Format idealFormat(QImage *image, Qt::ImageConversionFlags flags) const; void updateSerial(); diff --git a/src/s60installs/bwins/QtOpenVGu.def b/src/s60installs/bwins/QtOpenVGu.def index 18f576b..f2433d6 100644 --- a/src/s60installs/bwins/QtOpenVGu.def +++ b/src/s60installs/bwins/QtOpenVGu.def @@ -134,7 +134,7 @@ EXPORTS ?drawTextItem@QVGPaintEngine@@UAEXABVQPointF@@ABVQTextItem@@@Z @ 133 NONAME ; void QVGPaintEngine::drawTextItem(class QPointF const &, class QTextItem const &) ?clearScissor@QVGCompositionHelper@@QAEXXZ @ 134 NONAME ; void QVGCompositionHelper::clearScissor(void) ?fill@QVGPaintEngine@@UAEXABVQVectorPath@@ABVQBrush@@@Z @ 135 NONAME ; void QVGPaintEngine::fill(class QVectorPath const &, class QBrush const &) - ?forceToImage@QVGPixmapData@@IAEXXZ @ 136 NONAME ; void QVGPixmapData::forceToImage(void) + ?forceToImage@QVGPixmapData@@IAEXXZ @ 136 NONAME ABSENT ; void QVGPixmapData::forceToImage(void) ?drawPoints@QVGPaintEngine@@UAEXPBVQPoint@@H@Z @ 137 NONAME ; void QVGPaintEngine::drawPoints(class QPoint const *, int) ??_EQVGPaintEngine@@UAE@I@Z @ 138 NONAME ; QVGPaintEngine::~QVGPaintEngine(unsigned int) ?clip@QVGPaintEngine@@UAEXABVQPainterPath@@W4ClipOperation@Qt@@@Z @ 139 NONAME ; void QVGPaintEngine::clip(class QPainterPath const &, enum Qt::ClipOperation) @@ -183,4 +183,5 @@ EXPORTS ?initFromNativeImageHandle@QVGPixmapData@@QAE_NPAXABVQString@@@Z @ 182 NONAME ; bool QVGPixmapData::initFromNativeImageHandle(void *, class QString const &) ?createFromNativeImageHandleProvider@QVGPixmapData@@QAEXXZ @ 183 NONAME ; void QVGPixmapData::createFromNativeImageHandleProvider(void) ?releaseNativeImageHandle@QVGPixmapData@@QAEXXZ @ 184 NONAME ; void QVGPixmapData::releaseNativeImageHandle(void) + ?forceToImage@QVGPixmapData@@IAEX_N@Z @ 185 NONAME ; void QVGPixmapData::forceToImage(bool) diff --git a/src/s60installs/eabi/QtOpenVGu.def b/src/s60installs/eabi/QtOpenVGu.def index 25c53b8..08afd61 100644 --- a/src/s60installs/eabi/QtOpenVGu.def +++ b/src/s60installs/eabi/QtOpenVGu.def @@ -8,7 +8,7 @@ EXPORTS _Z25qt_vg_create_paint_enginev @ 7 NONAME _Z26qt_vg_destroy_paint_engineP14QVGPaintEngine @ 8 NONAME _Z28qt_vg_config_to_image_formatP11QEglContext @ 9 NONAME - _ZN13QVGPixmapData12forceToImageEv @ 10 NONAME + _ZN13QVGPixmapData12forceToImageEv @ 10 NONAME ABSENT _ZN13QVGPixmapData12toNativeTypeEN11QPixmapData10NativeTypeE @ 11 NONAME _ZN13QVGPixmapData14fromNativeTypeEPvN11QPixmapData10NativeTypeE @ 12 NONAME _ZN13QVGPixmapData15setAlphaChannelERK7QPixmap @ 13 NONAME @@ -213,4 +213,5 @@ EXPORTS _ZN13QVGPixmapData24releaseNativeImageHandleEv @ 212 NONAME _ZN13QVGPixmapData25initFromNativeImageHandleEPvRK7QString @ 213 NONAME _ZN13QVGPixmapData35createFromNativeImageHandleProviderEv @ 214 NONAME + _ZN13QVGPixmapData12forceToImageEb @ 215 NONAME -- cgit v0.12