diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-30 14:59:03 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-30 14:59:03 (GMT) |
commit | f9c434cd70663db2d1b1c32c8b68ae3ff85d6803 (patch) | |
tree | 32ba957e42491ae7634c6a8999485a43e5f68f42 /src/gui/image | |
parent | e20d18f1982dde2b0fa9bd262e5aadd1e451a7fa (diff) | |
parent | 097b3b3323ab6641c17318057e100543b60bca77 (diff) | |
download | Qt-f9c434cd70663db2d1b1c32c8b68ae3ff85d6803.zip Qt-f9c434cd70663db2d1b1c32c8b68ae3ff85d6803.tar.gz Qt-f9c434cd70663db2d1b1c32c8b68ae3ff85d6803.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qnativeimage.cpp | 4 | ||||
-rw-r--r-- | src/gui/image/qpaintengine_pic.cpp | 21 | ||||
-rw-r--r-- | src/gui/image/qpaintengine_pic_p.h | 2 | ||||
-rw-r--r-- | src/gui/image/qpicture.cpp | 16 | ||||
-rw-r--r-- | src/gui/image/qpicture_p.h | 1 |
5 files changed, 38 insertions, 6 deletions
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 6b74323..33e565c 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -100,7 +100,9 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool is bmi.blueMask = 0; } - hdc = CreateCompatibleDC(qt_win_display_dc()); + HDC display_dc = GetDC(0); + hdc = CreateCompatibleDC(display_dc); + ReleaseDC(0, display_dc); Q_ASSERT(hdc); uchar *bits = 0; diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp index cba9827..a130a1a 100644 --- a/src/gui/image/qpaintengine_pic.cpp +++ b/src/gui/image/qpaintengine_pic.cpp @@ -346,7 +346,7 @@ void QPicturePaintEngine::writeCmdLength(int pos, const QRectF &r, bool corr) if (corr) { // widen bounding rect int w2 = painter()->pen().width() / 2; br.setCoords(br.left() - w2, br.top() - w2, - br.right() + w2, br.bottom() + w2); + br.right() + w2, br.bottom() + w2); } br = painter()->transform().mapRect(br); if (painter()->hasClipping()) { @@ -458,6 +458,25 @@ void QPicturePaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap writeCmdLength(pos, r, false); } +void QPicturePaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr, + Qt::ImageConversionFlags flags) +{ + Q_D(QPicturePaintEngine); +#ifdef QT_PICTURE_DEBUG + qDebug() << " -> drawImage():" << r << sr; +#endif + int pos; + SERIALIZE_CMD(QPicturePrivate::PdcDrawImage); + if (d->pic_d->in_memory_only) { + int index = d->pic_d->image_list.size(); + d->pic_d->image_list.append(image); + d->s << r << index << sr << (quint32) flags; + } else { + d->s << r << image << sr << (quint32) flags; + } + writeCmdLength(pos, r, false); +} + extern int qt_defaultDpi(); void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti) diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h index 3ae0845..745d057 100644 --- a/src/gui/image/qpaintengine_pic_p.h +++ b/src/gui/image/qpaintengine_pic_p.h @@ -100,6 +100,8 @@ public: void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); + void drawImage(const QRectF &r, const QImage &image, const QRectF &sr, + Qt::ImageConversionFlags flags = Qt::AutoColor); void drawTextItem(const QPointF &p, const QTextItem &ti); Type type() const { return Picture; } diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index d5d7cb0..92023e0 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -759,13 +759,21 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) QImage image; if (d->formatMajor < 4) { s >> p >> image; - painter->drawPixmap(p, QPixmap::fromImage(image)); + painter->drawImage(p, image); } else if (d->formatMajor <= 5){ s >> ir >> image; - painter->drawPixmap(ir, QPixmap::fromImage(image), QRect(0, 0, ir.width(), ir.height())); + painter->drawImage(ir, image, QRect(0, 0, ir.width(), ir.height())); } else { - s >> r >> image; - painter->drawPixmap(r, QPixmap::fromImage(image), QRectF(0, 0, r.width(), r.height())); + QRectF sr; + if (d->in_memory_only) { + int index; + s >> r >> index >> sr >> ul; + Q_ASSERT(index < d->image_list.size()); + image = d->image_list.at(index); + } else { + s >> r >> image >> sr >> ul; + } + painter->drawImage(r, image, sr, Qt::ImageConversionFlags(ul)); } } break; diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h index 1da7f07..a3fd34f 100644 --- a/src/gui/image/qpicture_p.h +++ b/src/gui/image/qpicture_p.h @@ -158,6 +158,7 @@ public: QRect override_rect; QPaintEngine *paintEngine; bool in_memory_only; + QList<QImage> image_list; QList<QPixmap> pixmap_list; QList<QBrush> brush_list; QList<QPen> pen_list; |