From deff95c0f90e4d341e0d519c5d5576b2f1edeb32 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 11 Nov 2016 01:10:39 +0000 Subject: [PATCH] get rid of QPicture Signed-off-by: Ivailo Monev --- CMakeLists.txt | 2 +- README | 2 +- src/core/global/qconfig.h.cmake | 4 +- src/core/global/qnamespace.h | 21 +- src/gui/CMakeLists.txt | 1 - src/gui/graphicsview/qgraphicsitem.cpp | 10 +- src/gui/graphicsview/qgraphicsscene.cpp | 5 +- src/gui/graphicsview/qgraphicsview.cpp | 5 +- src/gui/image/image.cmake | 5 - src/gui/image/qimage.cpp | 10 +- src/gui/image/qpaintengine_pic.cpp | 527 ---------- src/gui/image/qpaintengine_pic_p.h | 122 --- src/gui/image/qpicture.cpp | 984 ------------------ src/gui/image/qpicture.h | 137 --- src/gui/image/qpicture_p.h | 165 --- src/gui/image/qpixmap.cpp | 13 +- src/gui/kernel/qwindowdefs.h | 1 - src/gui/painting/qpaintdevice.qdoc | 7 +- src/gui/painting/qpaintengine.cpp | 7 - src/gui/painting/qpaintengine_alpha.cpp | 14 +- src/gui/painting/qpaintengine_alpha_p.h | 3 +- src/gui/painting/qpaintengine_preview.cpp | 12 +- src/gui/painting/qpaintengine_preview_p.h | 2 +- src/gui/painting/qpainter.cpp | 71 +- src/gui/painting/qpainter.h | 25 +- src/gui/painting/qprinter.cpp | 11 +- src/gui/painting/qprinter_p.h | 4 +- src/gui/text/qfont.cpp | 2 +- src/gui/text/qfont.h | 1 - src/gui/text/qfontmetrics.cpp | 4 +- src/gui/widgets/qlabel.cpp | 74 +- src/gui/widgets/qlabel.h | 6 - src/gui/widgets/qlabel_p.h | 4 - src/gui/widgets/qprintpreviewwidget.cpp | 8 +- .../accessible/widgets/simplewidgets.cpp | 4 - src/shared/qclass_lib_map.h | 3 +- src/svg/qsvgfont.cpp | 1 - src/svg/qsvgrenderer.cpp | 2 +- src/svg/qsvgwidget.cpp | 2 +- 39 files changed, 67 insertions(+), 2214 deletions(-) delete mode 100644 src/gui/image/qpaintengine_pic.cpp delete mode 100644 src/gui/image/qpaintengine_pic_p.h delete mode 100644 src/gui/image/qpicture.cpp delete mode 100644 src/gui/image/qpicture.h delete mode 100644 src/gui/image/qpicture_p.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 13693be51..d51a4dec9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "4") set(CPACK_PACKAGE_VERSION_MINOR "9") set(CPACK_PACKAGE_VERSION_PATCH "0") set(CPACK_SET_DESTDIR TRUE) -set(CPACK_SOURCE_IGNORE_FILES "/build/;/.git;${CPACK_SOURCE_IGNORE_FILES}") +set(CPACK_SOURCE_IGNORE_FILES "/build/;/minsize/;/.git;${CPACK_SOURCE_IGNORE_FILES}") set(CPACK_STRIP_FILES TRUE) set(CPACK_GENERATOR "TXZ") set(CPACK_SOURCE_GENERATOR "TXZ") diff --git a/README b/README index 4bc4b9af7..411a10d10 100644 --- a/README +++ b/README @@ -27,7 +27,7 @@ There are several things you should be aware before considering Katie: - OpenVG is no longer supported graphics output - Blitter is no longer supported painting engine - native graphics system is no more, rasterizer is just as fast as native - - QPictureIO and plugins for it are no longer supported + - QPicture, QPictureIO and plugins for it are no longer supported - QML debugger and inspector have been removed, potentially dangerous - no SIMD, zero performance impact with decent compiler - state machine is no more diff --git a/src/core/global/qconfig.h.cmake b/src/core/global/qconfig.h.cmake index 6694db97f..dbed95a82 100644 --- a/src/core/global/qconfig.h.cmake +++ b/src/core/global/qconfig.h.cmake @@ -49,6 +49,7 @@ #define QT_NO_DIRECTPAINTER #define QT_NO_COP #define QT_NO_BLITTABLE +#define QT_NO_PICTURE #define QT_NO_PICTUREIO #define QT_NO_SOFTKEYMANAGER #define QT_NO_SXE @@ -225,7 +226,6 @@ #cmakedefine QT_NO_NSL #cmakedefine QT_NO_PAINT_DEBUG #cmakedefine QT_NO_PDF -#cmakedefine QT_NO_PICTURE #cmakedefine QT_NO_PLUGIN_CHECK #cmakedefine QT_NO_PRINTDIALOG #cmakedefine QT_NO_PRINTER @@ -530,7 +530,7 @@ #endif // QPrinter -#if !defined(QT_NO_PRINTER) && (defined(QT_NO_TEXTSTREAM) || defined(QT_NO_PICTURE) || defined(QT_NO_TEMPORARYFILE)) +#if !defined(QT_NO_PRINTER) && (defined(QT_NO_TEXTSTREAM) || defined(QT_NO_TEMPORARYFILE)) #define QT_NO_PRINTER #endif diff --git a/src/core/global/qnamespace.h b/src/core/global/qnamespace.h index 5ce7d081e..291c96d67 100644 --- a/src/core/global/qnamespace.h +++ b/src/core/global/qnamespace.h @@ -1464,17 +1464,16 @@ typedef bool (*qInternalCallback)(void **); class Q_CORE_EXPORT QInternal { public: enum PaintDeviceFlags { - UnknownDevice = 0x00, - Widget = 0x01, - Pixmap = 0x02, - Image = 0x03, - Printer = 0x04, - Picture = 0x05, - Pbuffer = 0x06, // GL pbuffer - FramebufferObject = 0x07, // GL framebuffer object - CustomRaster = 0x08, - PaintBuffer = 0x09, - OpenGL = 0x0a + UnknownDevice = 0, + Widget = 1, + Pixmap = 2, + Image = 3, + Printer = 4, + Pbuffer = 5, // GL pbuffer + FramebufferObject = 6, // GL framebuffer object + CustomRaster = 7, + PaintBuffer = 8, + OpenGL = 9 }; enum RelayoutType { RelayoutNormal, diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 984bd5d29..a1de856f8 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -169,7 +169,6 @@ set(GUI_PUBLIC_HEADERS QPalette QPanGesture QPen - QPicture QPixmap QPixmapCache QPlainTextDocumentLayout diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 448407d47..b630d6547 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5140,11 +5140,11 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c // ### Ideally we would have a better way to generate this region, // preferably something in the lines of QPainterPath::toRegion(QTransform) // coupled with a way to generate a painter path from a set of painter - // operations (e.g., QPicture::toPainterPath() or so). The current - // approach generates a bitmap with the size of the item's bounding rect - // in device coordinates, scaled by b.r.granularity, then paints the item - // into the bitmap, converts the result to a QRegion and scales the region - // back to device space with inverse granularity. + // operations. The current approach generates a bitmap with the size of + // the item's bounding rect in device coordinates, scaled by + // b.r.granularity, then paints the item into the bitmap, converts the + // result to a QRegion and scales the region back to device space with + // inverse granularity. qreal granularity = boundingRegionGranularity(); QRect deviceRect = itemToDeviceTransform.mapRect(boundingRect()).toRect(); _q_adjustRect(&deviceRect); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index b21c835ac..4ac4d9725 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1722,10 +1722,7 @@ void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRect // Default target rect = device rect QRectF targetRect = target; if (targetRect.isNull()) { - if (painter->device()->devType() == QInternal::Picture) - targetRect = sourceRect; - else - targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); + targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); } // Find the ideal x / y scaling ratio to fit \a source into \a target. diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 1eeb1ed9e..1da7a7005 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -2060,10 +2060,7 @@ void QGraphicsView::render(QPainter *painter, const QRectF &target, const QRect // Default target rect = device rect QRectF targetRect = target; if (target.isNull()) { - if (painter->device()->devType() == QInternal::Picture) - targetRect = sourceRect; - else - targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); + targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); } // Find the ideal x / y scaling ratio to fit \a source into \a target. diff --git a/src/gui/image/image.cmake b/src/gui/image/image.cmake index 7a696085d..ec94660ba 100644 --- a/src/gui/image/image.cmake +++ b/src/gui/image/image.cmake @@ -12,9 +12,6 @@ set(GUI_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/image/qimagereader.h ${CMAKE_CURRENT_SOURCE_DIR}/image/qimagewriter.h ${CMAKE_CURRENT_SOURCE_DIR}/image/qmovie.h - ${CMAKE_CURRENT_SOURCE_DIR}/image/qpaintengine_pic_p.h - ${CMAKE_CURRENT_SOURCE_DIR}/image/qpicture.h - ${CMAKE_CURRENT_SOURCE_DIR}/image/qpicture_p.h ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap.h ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap_raster_p.h ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmapcache.h @@ -38,8 +35,6 @@ set(GUI_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/image/qimageiohandler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image/qimagereader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image/qimagewriter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/image/qpaintengine_pic.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/image/qpicture.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmapcache.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmapdata.cpp diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index d21495259..4efda2e11 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -294,12 +294,10 @@ bool QImageData::checkForAlphaPixels() const can be used as a paint device. Qt provides four classes for handling image data: QImage, QPixmap, - QBitmap and QPicture. QImage is designed and optimized for I/O, - and for direct pixel access and manipulation, while QPixmap is - designed and optimized for showing images on screen. QBitmap is - only a convenience class that inherits QPixmap, ensuring a - depth of 1. Finally, the QPicture class is a paint device that - records and replays QPainter commands. + and QBitmap. QImage is designed and optimized for I/O, and for + direct pixel access and manipulation, while QPixmap is designed + and optimized for showing images on screen. QBitmap is only a + convenience class that inherits QPixmap, ensuring a depth of 1. Because QImage is a QPaintDevice subclass, QPainter can be used to draw directly onto images. When using QPainter on a QImage, the diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp deleted file mode 100644 index 6541d11b3..000000000 --- a/src/gui/image/qpaintengine_pic.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpaintengine_p.h" -#include "qpainter_p.h" -#include "qpicture_p.h" -#include "qfont_p.h" - -#ifndef QT_NO_PICTURE - -#include "qbuffer.h" -#include "qbytearray.h" -#include "qdatastream.h" -#include "qmath.h" -#include "qpaintengine_pic_p.h" -#include "qpicture.h" -#include "qpolygon.h" -#include "qrect.h" -#include - -//#define QT_PICTURE_DEBUG -#include - -// keep in sync with qpicture.cpp -static const char *qt_mfhdr_tag = "QPIC"; // header tag - -QT_BEGIN_NAMESPACE - -class QPicturePaintEnginePrivate : public QPaintEnginePrivate -{ - Q_DECLARE_PUBLIC(QPicturePaintEngine) -public: - QDataStream s; - QPainter *pt; - QPicturePrivate *pic_d; -}; - -QPicturePaintEngine::QPicturePaintEngine() - : QPaintEngine(*(new QPicturePaintEnginePrivate), AllFeatures) -{ - Q_D(QPicturePaintEngine); - d->pt = 0; -} - -QPicturePaintEngine::QPicturePaintEngine(QPaintEnginePrivate &dptr) - : QPaintEngine(dptr, AllFeatures) -{ - Q_D(QPicturePaintEngine); - d->pt = 0; -} - -QPicturePaintEngine::~QPicturePaintEngine() -{ -} - -bool QPicturePaintEngine::begin(QPaintDevice *pd) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << "QPicturePaintEngine::begin()"; -#endif - Q_ASSERT(pd); - QPicture *pic = static_cast(pd); - - d->pdev = pd; - d->pic_d = pic->d_func(); - Q_ASSERT(d->pic_d); - - d->s.setDevice(&d->pic_d->pictb); - - d->pic_d->pictb.open(QIODevice::WriteOnly | QIODevice::Truncate); - d->s.writeRawData(qt_mfhdr_tag, 4); - d->s << (quint8) QPicturePrivate::PdcBegin << (quint8) sizeof(qint32); - d->pic_d->brect = QRect(); - QRect r = pic->boundingRect(); - d->s << (qint32) r.left() << (qint32) r.top() << (qint32) r.width() - << (qint32) r.height(); - d->pic_d->trecs = 0; - d->s << (quint32)d->pic_d->trecs; // total number of records - d->pic_d->formatOk = false; - setActive(true); - return true; -} - -bool QPicturePaintEngine::end() -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << "QPicturePaintEngine::end()"; -#endif - d->pic_d->trecs++; - d->s << (quint8) QPicturePrivate::PdcEnd << (quint8) 0; - int cs_start = sizeof(quint32); // pos of checksum word - int data_start = cs_start + sizeof(quint16); - int brect_start = data_start + 2*sizeof(qint16) + 2*sizeof(quint8); - int pos = d->pic_d->pictb.pos(); - d->pic_d->pictb.seek(brect_start); - // bounding rectangle - QRect r = static_cast(d->pdev)->boundingRect(); - d->s << (qint32) r.left() << (qint32) r.top() << (qint32) r.width() - << (qint32) r.height(); - // end bounding rectangle - d->s << (quint32) d->pic_d->trecs; // write number of records - d->pic_d->pictb.seek(cs_start); - QByteArray buf = d->pic_d->pictb.buffer(); - quint16 cs = (quint16) qChecksum(buf.constData() + data_start, pos - data_start); - d->s << cs; // write checksum - d->pic_d->pictb.close(); - setActive(false); - return true; -} - -#define SERIALIZE_CMD(c) \ - d->pic_d->trecs++; \ - d->s << (quint8) c; \ - d->s << (quint8) 0; \ - pos = d->pic_d->pictb.pos() - -void QPicturePaintEngine::updatePen(const QPen &pen) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updatePen(): width:" << pen.width() << "style:" - << pen.style() << "color:" << pen.color(); -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetPen); - if (d->pic_d->in_memory_only) { - int index = d->pic_d->pen_list.size(); - d->pic_d->pen_list.append(pen); - d->s << index; - } else { - d->s << pen; - } - writeCmdLength(pos, QRect(), false); -} - -void QPicturePaintEngine::updateCompositionMode(QPainter::CompositionMode cmode) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateCompositionMode():" << cmode; -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetCompositionMode); - d->s << (qint32)cmode; - writeCmdLength(pos, QRectF(), false); -} - -void QPicturePaintEngine::updateClipEnabled(bool enabled) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateClipEnabled():" << enabled; -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetClipEnabled); - d->s << enabled; - writeCmdLength(pos, QRectF(), false); -} - -void QPicturePaintEngine::updateOpacity(qreal opacity) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateOpacity():" << opacity; -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetOpacity); - d->s << double(opacity); - writeCmdLength(pos, QRectF(), false); -} - -void QPicturePaintEngine::updateBrush(const QBrush &brush) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateBrush(): style:" << brush.style(); -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetBrush); - if (d->pic_d->in_memory_only) { - int index = d->pic_d->brush_list.size(); - d->pic_d->brush_list.append(brush); - d->s << index; - } else { - d->s << brush; - } - writeCmdLength(pos, QRect(), false); -} - -void QPicturePaintEngine::updateBrushOrigin(const QPointF &p) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateBrushOrigin(): " << p; -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetBrushOrigin); - d->s << p; - writeCmdLength(pos, QRect(), false); -} - -void QPicturePaintEngine::updateFont(const QFont &font) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateFont(): pt sz:" << font.pointSize(); -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetFont); - QFont fnt = font; - d->s << fnt; - writeCmdLength(pos, QRectF(), false); -} - -void QPicturePaintEngine::updateBackground(Qt::BGMode bgMode, const QBrush &bgBrush) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateBackground(): mode:" << bgMode << "style:" << bgBrush.style(); -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetBkColor); - d->s << bgBrush.color(); - writeCmdLength(pos, QRect(), false); - - SERIALIZE_CMD(QPicturePrivate::PdcSetBkMode); - d->s << (qint8) bgMode; - writeCmdLength(pos, QRectF(), false); -} - -void QPicturePaintEngine::updateMatrix(const QTransform &matrix) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateMatrix():" << matrix; -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetWMatrix); - d->s << matrix << (qint8) false; - writeCmdLength(pos, QRectF(), false); -} - -void QPicturePaintEngine::updateClipRegion(const QRegion ®ion, Qt::ClipOperation op) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateClipRegion(): op:" << op - << "bounding rect:" << region.boundingRect(); -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetClipRegion); - d->s << region << qint8(op); - writeCmdLength(pos, QRectF(), false); -} - -void QPicturePaintEngine::updateClipPath(const QPainterPath &path, Qt::ClipOperation op) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateClipPath(): op:" << op - << "bounding rect:" << path.boundingRect(); -#endif - int pos; - - SERIALIZE_CMD(QPicturePrivate::PdcSetClipPath); - d->s << path << qint8(op); - writeCmdLength(pos, QRectF(), false); -} - -void QPicturePaintEngine::updateRenderHints(QPainter::RenderHints hints) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> updateRenderHints(): " << hints; -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcSetRenderHint); - d->s << (quint32) hints; - writeCmdLength(pos, QRect(), false); -} - -void QPicturePaintEngine::writeCmdLength(int pos, const QRectF &r, bool corr) -{ - Q_D(QPicturePaintEngine); - int newpos = d->pic_d->pictb.pos(); // new position - int length = newpos - pos; - QRectF br(r); - - if (length < 255) { // write 8-bit length - d->pic_d->pictb.seek(pos - 1); // position to right index - d->s << (quint8)length; - } else { // write 32-bit length - d->s << (quint32)0; // extend the buffer - d->pic_d->pictb.seek(pos - 1); // position to right index - d->s << (quint8)255; // indicate 32-bit length - char *p = d->pic_d->pictb.buffer().data(); - memmove(p+pos+4, p+pos, length); // make room for 4 byte - d->s << (quint32)length; - newpos += 4; - } - d->pic_d->pictb.seek(newpos); // set to new position - - if (br.width() > 0.0 || br.height() > 0.0) { - 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 = painter()->transform().mapRect(br); - if (painter()->hasClipping()) { - QRect cr = painter()->clipRegion().boundingRect(); - br &= cr; - } - - if (br.width() > 0.0 || br.height() > 0.0) { - int minx = qFloor(br.left()); - int miny = qFloor(br.top()); - int maxx = qCeil(br.right()); - int maxy = qCeil(br.bottom()); - - if (d->pic_d->brect.width() > 0 || d->pic_d->brect.height() > 0) { - minx = qMin(minx, d->pic_d->brect.left()); - miny = qMin(miny, d->pic_d->brect.top()); - maxx = qMax(maxx, d->pic_d->brect.x() + d->pic_d->brect.width()); - maxy = qMax(maxy, d->pic_d->brect.y() + d->pic_d->brect.height()); - d->pic_d->brect = QRect(minx, miny, maxx - minx, maxy - miny); - } else { - d->pic_d->brect = QRect(minx, miny, maxx - minx, maxy - miny); - } - } - } -} - -void QPicturePaintEngine::drawEllipse(const QRectF &rect) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> drawEllipse():" << rect; -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcDrawEllipse); - d->s << rect; - writeCmdLength(pos, rect, true); -} - -void QPicturePaintEngine::drawPath(const QPainterPath &path) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> drawPath():" << path.boundingRect(); -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcDrawPath); - d->s << path; - writeCmdLength(pos, path.boundingRect(), true); -} - -void QPicturePaintEngine::drawPolygon(const QPointF *points, int numPoints, PolygonDrawMode mode) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> drawPolygon(): size=" << numPoints; -#endif - int pos; - - QPolygonF polygon; - for (int i=0; is << polygon; - } else { - SERIALIZE_CMD(QPicturePrivate::PdcDrawPolygon); - d->s << polygon; - d->s << (qint8)(mode == OddEvenMode ? 0 : 1); - } - - writeCmdLength(pos, polygon.boundingRect(), true); -} - -void QPicturePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> drawPixmap():" << r; -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcDrawPixmap); - - if (d->pic_d->in_memory_only) { - int index = d->pic_d->pixmap_list.size(); - d->pic_d->pixmap_list.append(pm); - d->s << r << index << sr; - } else { - d->s << r << pm << sr; - } - writeCmdLength(pos, r, false); -} - -void QPicturePaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> drawTiledPixmap():" << r << s; -#endif - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcDrawTiledPixmap); - if (d->pic_d->in_memory_only) { - int index = d->pic_d->pixmap_list.size(); - d->pic_d->pixmap_list.append(pixmap); - d->s << r << index << s; - } else { - d->s << r << pixmap << s; - } - 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); -} - -void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti) -{ - Q_D(QPicturePaintEngine); -#ifdef QT_PICTURE_DEBUG - qDebug() << " -> drawTextItem():" << p << ti.text(); -#endif - - const QTextItemInt &si = static_cast(ti); - if (si.chars == 0) - QPaintEngine::drawTextItem(p, ti); // Draw as path - - int pos; - SERIALIZE_CMD(QPicturePrivate::PdcDrawTextItem); - QFont fnt = ti.font(); - fnt.setUnderline(false); - fnt.setStrikeOut(false); - fnt.setOverline(false); - - qreal justificationWidth = 0; - if (si.justified) - justificationWidth = si.width.toReal(); - - d->s << p << ti.text() << fnt << ti.renderFlags() << double(fnt.d->dpi)/qt_defaultDpi() << justificationWidth; - writeCmdLength(pos, /*brect=*/QRectF(), /*corr=*/false); -} - -void QPicturePaintEngine::updateState(const QPaintEngineState &state) -{ - QPaintEngine::DirtyFlags flags = state.state(); - if (flags & DirtyPen) updatePen(state.pen()); - if (flags & DirtyBrush) updateBrush(state.brush()); - if (flags & DirtyBrushOrigin) updateBrushOrigin(state.brushOrigin()); - if (flags & DirtyFont) updateFont(state.font()); - if (flags & DirtyBackground) updateBackground(state.backgroundMode(), state.backgroundBrush()); - if (flags & DirtyTransform) updateMatrix(state.transform()); - if (flags & DirtyClipEnabled) updateClipEnabled(state.isClipEnabled()); - if (flags & DirtyClipRegion) updateClipRegion(state.clipRegion(), state.clipOperation()); - if (flags & DirtyClipPath) updateClipPath(state.clipPath(), state.clipOperation()); - if (flags & DirtyHints) updateRenderHints(state.renderHints()); - if (flags & DirtyCompositionMode) updateCompositionMode(state.compositionMode()); - if (flags & DirtyOpacity) updateOpacity(state.opacity()); -} - -QT_END_NAMESPACE - -#endif // QT_NO_PICTURE - - - - diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h deleted file mode 100644 index c3c7e1d2e..000000000 --- a/src/gui/image/qpaintengine_pic_p.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPAINTENGINE_PIC_P_H -#define QPAINTENGINE_PIC_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of QAbstractItemModel*. This header file may change from version -// to version without notice, or even be removed. -// -// We mean it. -// -// - -#include "QtGui/qpaintengine.h" - -#ifndef QT_NO_PICTURE - -QT_BEGIN_NAMESPACE - -class QPicturePaintEnginePrivate; -class QBuffer; - -class QPicturePaintEngine : public QPaintEngine -{ - Q_DECLARE_PRIVATE(QPicturePaintEngine) -public: - QPicturePaintEngine(); - ~QPicturePaintEngine(); - - bool begin(QPaintDevice *pdev); - bool end(); - - void updateState(const QPaintEngineState &state); - - void updatePen(const QPen &pen); - void updateBrush(const QBrush &brush); - void updateBrushOrigin(const QPointF &origin); - void updateFont(const QFont &font); - void updateBackground(Qt::BGMode bgmode, const QBrush &bgBrush); - void updateMatrix(const QTransform &matrix); - void updateClipRegion(const QRegion ®ion, Qt::ClipOperation op); - void updateClipPath(const QPainterPath &path, Qt::ClipOperation op); - void updateRenderHints(QPainter::RenderHints hints); - void updateCompositionMode(QPainter::CompositionMode cmode); - void updateClipEnabled(bool enabled); - void updateOpacity(qreal opacity); - - void drawEllipse(const QRectF &rect); - void drawPath(const QPainterPath &path); - void drawPolygon(const QPointF *points, int numPoints, PolygonDrawMode mode); -#ifdef Q_NO_USING_KEYWORD - inline void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) - { QPaintEngine::drawPolygon(points, pointCount, mode); } -#else - using QPaintEngine::drawPolygon; -#endif - - 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; } - -protected: - QPicturePaintEngine(QPaintEnginePrivate &dptr); - -private: - Q_DISABLE_COPY(QPicturePaintEngine) - - void writeCmdLength(int pos, const QRectF &r, bool corr); -}; - -QT_END_NAMESPACE - -#endif // QT_NO_PICTURE - -#endif // QPAINTENGINE_PIC_P_H diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp deleted file mode 100644 index 2ae2e5771..000000000 --- a/src/gui/image/qpicture.cpp +++ /dev/null @@ -1,984 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpicture.h" -#include - -#ifndef QT_NO_PICTURE - -#include -#include -#include -#include - -#include "qdatastream.h" -#include "qfile.h" -#include "qimage.h" -#include "qmutex.h" -#include "qpainter.h" -#include "qpainterpath.h" -#include "qpixmap.h" -#include "qregion.h" -#include "qdebug.h" - -QT_BEGIN_NAMESPACE - -void qt_format_text(const QFont &fnt, const QRectF &_r, - int tf, const QTextOption *opt, const QString& str, QRectF *brect, - int tabstops, int *, int tabarraylen, - QPainter *painter); - -/*! - \class QPicture - \brief The QPicture class is a paint device that records and - replays QPainter commands. - - \ingroup painting - \ingroup shared - - - A picture serializes painter commands to an IO device in a - platform-independent format. They are sometimes referred to as meta-files. - - Qt pictures use a proprietary binary format. Unlike native picture - (meta-file) formats on many window systems, Qt pictures have no - limitations regarding their contents. Everything that can be - painted on a widget or pixmap (e.g., fonts, pixmaps, regions, - transformed graphics, etc.) can also be stored in a picture. - - QPicture is resolution independent, i.e. a QPicture can be - displayed on different devices (for example svg, pdf, ps, printer - and screen) looking the same. This is, for instance, needed for - WYSIWYG print preview. QPicture runs in the default system dpi, - and scales the painter to match differences in resolution - depending on the window system. - - Example of how to record a picture: - \snippet doc/src/snippets/picture/picture.cpp 0 - - Note that the list of painter commands is reset on each call to - the QPainter::begin() function. - - Example of how to replay a picture: - \snippet doc/src/snippets/picture/picture.cpp 1 - - Pictures can also be drawn using play(). Some basic data about a - picture is available, for example, size(), isNull() and - boundingRect(). - - \sa QMovie -*/ - -// keep in sync with qpaintengine_pic.cpp -static const char *qt_mfhdr_tag = "QPIC"; // header tag - -/*! - Constructs an empty picture. -*/ - -QPicture::QPicture() - : QPaintDevice(), - d_ptr(new QPicturePrivate) -{ - Q_D(QPicture); - - d->formatOk = false; -} - -/*! - Constructs a copy of \a pic. - - This constructor is fast thanks to \l{implicit sharing}. -*/ - -QPicture::QPicture(const QPicture &pic) - : QPaintDevice(), d_ptr(pic.d_ptr) -{ -} - -/*! \internal */ -QPicture::QPicture(QPicturePrivate &dptr) - : QPaintDevice(), - d_ptr(&dptr) -{ -} - -/*! - Destroys the picture. -*/ -QPicture::~QPicture() -{ -} - -/*! - ### document what this is returning -*/ -int QPicture::devType() const -{ - return QInternal::Picture; -} - -/*! - \fn bool QPicture::isNull() const - - Returns true if the picture contains no data; otherwise returns - false. -*/ - -/*! - \fn uint QPicture::size() const - - Returns the size of the picture data. - - \sa data() -*/ - -/*! - \fn const char* QPicture::data() const - - Returns a pointer to the picture data. The pointer is only valid - until the next non-const function is called on this picture. The - returned pointer is 0 if the picture contains no data. - - \sa size(), isNull() -*/ - - -bool QPicture::isNull() const -{ - return d_func()->pictb.buffer().isNull(); -} - -uint QPicture::size() const -{ - return d_func()->pictb.buffer().size(); -} - -const char* QPicture::data() const -{ - return d_func()->pictb.buffer(); -} - -void QPicture::detach() -{ - d_ptr.detach(); -} - -bool QPicture::isDetached() const -{ - return d_func()->ref == 1; -} - -/*! - Sets the picture data directly from \a data and \a size. This - function copies the input data. - - \sa data(), size() -*/ - -void QPicture::setData(const char* data, uint size) -{ - detach(); - d_func()->pictb.setData(data, size); - d_func()->formatOk = false; // we'll have to check -} - - -/*! - Loads a picture from the file specified by \a fileName and returns - true if successful; otherwise returns false. - - \sa save() -*/ - -bool QPicture::load(const QString &fileName) -{ - QFile f(fileName); - if (!f.open(QIODevice::ReadOnly)) - return false; - return load(&f); -} - -/*! - \overload - - \a dev is the device to use for loading. -*/ - -bool QPicture::load(QIODevice *dev) -{ - detach(); - QByteArray a = dev->readAll(); - - d_func()->pictb.setData(a); // set byte array in buffer - return d_func()->checkFormat(); -} - -/*! - Saves a picture to the file specified by \a fileName and returns - true if successful; otherwise returns false. - - \sa load() -*/ - -bool QPicture::save(const QString &fileName) -{ - if (paintingActive()) { - qWarning("QPicture::save: still being painted on. " - "Call QPainter::end() first"); - return false; - } - - QFile f(fileName); - if (!f.open(QIODevice::WriteOnly)) - return false; - return save(&f); -} - -/*! - \overload - - \a dev is the device to use for saving. -*/ - -bool QPicture::save(QIODevice *dev) -{ - if (paintingActive()) { - qWarning("QPicture::save: still being painted on. " - "Call QPainter::end() first"); - return false; - } - - dev->write(d_func()->pictb.buffer(), d_func()->pictb.buffer().size()); - return true; -} - -/*! - Returns the picture's bounding rectangle or an invalid rectangle - if the picture contains no data. -*/ - -QRect QPicture::boundingRect() const -{ - Q_D(const QPicture); - // Use override rect where possible. - if (!d->override_rect.isEmpty()) - return d->override_rect; - - if (!d->formatOk) - d_ptr->checkFormat(); - - return d->brect; -} - -/*! - Sets the picture's bounding rectangle to \a r. The automatically - calculated value is overridden. -*/ - -void QPicture::setBoundingRect(const QRect &r) -{ - d_func()->override_rect = r; -} - -/*! - Replays the picture using \a painter, and returns true if - successful; otherwise returns false. - - This function does exactly the same as QPainter::drawPicture() - with (x, y) = (0, 0). -*/ - -bool QPicture::play(QPainter *painter) -{ - Q_D(QPicture); - - if (d->pictb.size() == 0) // nothing recorded - return true; - - if (!d->formatOk && !d->checkFormat()) - return false; - - d->pictb.open(QIODevice::ReadOnly); // open buffer device - QDataStream s; - s.setDevice(&d->pictb); // attach data stream to buffer - s.device()->seek(10); // go directly to the data - - quint8 c, clen; - quint32 nrecords; - s >> c >> clen; - Q_ASSERT(c == QPicturePrivate::PdcBegin); - // bounding rect was introduced in ver 4. Read in checkFormat(). - qint32 dummy; - s >> dummy >> dummy >> dummy >> dummy; - s >> nrecords; - if (!exec(painter, s, nrecords)) { - qWarning("QPicture::play: Format error"); - d->pictb.close(); - return false; - } - d->pictb.close(); - return true; // no end-command -} - - -// -// QFakeDevice is used to create fonts with a custom DPI -// -class QFakeDevice : public QPaintDevice -{ -public: - QFakeDevice() { dpi_x = qt_defaultDpiX(); dpi_y = qt_defaultDpiY(); } - void setDpiX(int dpi) { dpi_x = dpi; } - void setDpiY(int dpi) { dpi_y = dpi; } - QPaintEngine *paintEngine() const { return 0; } - int metric(PaintDeviceMetric m) const - { - switch(m) { - case PdmPhysicalDpiX: - case PdmDpiX: - return dpi_x; - case PdmPhysicalDpiY: - case PdmDpiY: - return dpi_y; - default: - return QPaintDevice::metric(m); - } - } - -private: - int dpi_x; - int dpi_y; -}; - -/*! - \internal - Iterates over the internal picture data and draws the picture using - \a painter. -*/ - -bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) -{ - Q_D(QPicture); -#if defined(QT_DEBUG) - int strm_pos; -#endif - quint8 c; // command id - quint8 tiny_len; // 8-bit length descriptor - qint32 len; // 32-bit length descriptor - qint16 i_16, i1_16, i2_16; // parameters... - qint8 i_8; - quint32 ul; - double dbl; - bool bl; - QByteArray str1; - QString str; - QPointF p, p1, p2; - QPoint ip, ip1, ip2; - QRect ir; - QRectF r; - QPolygonF a; - QPolygon ia; - QColor color; - QFont font; - QPen pen; - QBrush brush; - QRegion rgn; - QMatrix wmatrix; - QTransform matrix; - - QTransform worldMatrix = painter->transform(); - worldMatrix.scale(qreal(painter->device()->logicalDpiX()) / qreal(qt_defaultDpiX()), - qreal(painter->device()->logicalDpiY()) / qreal(qt_defaultDpiY())); - painter->setTransform(worldMatrix); - - while (nrecords-- && !s.atEnd()) { - s >> c; // read cmd - s >> tiny_len; // read param length - if (tiny_len == 255) // longer than 254 bytes - s >> len; - else - len = tiny_len; -#if defined(QT_DEBUG) - strm_pos = s.device()->pos(); -#endif - switch (c) { // exec cmd - case QPicturePrivate::PdcNOP: - break; - case QPicturePrivate::PdcDrawPoint: - s >> p; - painter->drawPoint(p); - break; - case QPicturePrivate::PdcDrawPoints: -// ## implement me in the picture paint engine -// s >> a >> i1_32 >> i2_32; -// painter->drawPoints(a.mid(i1_32, i2_32)); - break; - case QPicturePrivate::PdcDrawPath: { - QPainterPath path; - s >> path; - painter->drawPath(path); - break; - } - case QPicturePrivate::PdcDrawLine: - s >> p1 >> p2; - painter->drawLine(p1, p2); - break; - case QPicturePrivate::PdcDrawRect: - s >> r; - painter->drawRect(r); - break; - case QPicturePrivate::PdcDrawRoundRect: - s >> r >> i1_16 >> i2_16; - painter->drawRoundedRect(r, i1_16, i2_16, Qt::RelativeSize); - break; - case QPicturePrivate::PdcDrawEllipse: - s >> r; - painter->drawEllipse(r); - break; - case QPicturePrivate::PdcDrawArc: - s >> r >> i1_16 >> i2_16; - painter->drawArc(r, i1_16, i2_16); - break; - case QPicturePrivate::PdcDrawPie: - s >> r >> i1_16 >> i2_16; - painter->drawPie(r, i1_16, i2_16); - break; - case QPicturePrivate::PdcDrawChord: - s >> r >> i1_16 >> i2_16; - painter->drawChord(r, i1_16, i2_16); - break; - case QPicturePrivate::PdcDrawLineSegments: - s >> ia; - painter->drawLines(ia); - ia.clear(); - break; - case QPicturePrivate::PdcDrawPolyline: - s >> a; - painter->drawPolyline(a); - a.clear(); - break; - case QPicturePrivate::PdcDrawPolygon: - s >> a >> i_8; - painter->drawPolygon(a, i_8 ? Qt::WindingFill : Qt::OddEvenFill); - a.clear(); - break; - case QPicturePrivate::PdcDrawCubicBezier: { - s >> ia; - QPainterPath path; - Q_ASSERT(ia.size() == 4); - path.moveTo(ia.at(0)); - path.cubicTo(ia.at(1), ia.at(2), ia.at(3)); - painter->strokePath(path, painter->pen()); - a.clear(); - } - break; - case QPicturePrivate::PdcDrawText: - s >> ip >> str1; - painter->drawText(ip, QString::fromLatin1(str1)); - break; - case QPicturePrivate::PdcDrawTextFormatted: - s >> ir >> i_16 >> str1; - painter->drawText(ir, i_16, QString::fromLatin1(str1)); - break; - case QPicturePrivate::PdcDrawText2: - s >> p >> str; - painter->drawText(p, str); - break; - case QPicturePrivate::PdcDrawText2Formatted: - s >> ir; - s >> i_16; - s >> str; - painter->drawText(ir, i_16, str); - break; - case QPicturePrivate::PdcDrawTextItem: { - s >> p >> str >> font >> ul; - - // the text layout direction is not used here because it's already - // aligned when QPicturePaintEngine::drawTextItem() serializes the - // drawText() call, therefore ul is unsed in this context - s >> dbl; - QFont fnt(font); - if (dbl != 1.0) { - QFakeDevice fake; - fake.setDpiX(qRound(dbl*qt_defaultDpiX())); - fake.setDpiY(qRound(dbl*qt_defaultDpiY())); - fnt = QFont(font, &fake); - } - - qreal justificationWidth; - s >> justificationWidth; - - int flags = Qt::TextSingleLine | Qt::TextDontClip | Qt::TextForceLeftToRight; - - QSizeF size(1, 1); - if (justificationWidth > 0) { - size.setWidth(justificationWidth); - flags |= Qt::TextJustificationForced; - flags |= Qt::AlignJustify; - } - - QFontMetrics fm(fnt); - QPointF pt(p.x(), p.y() - fm.ascent()); - qt_format_text(fnt, QRectF(pt, size), flags, /*opt*/0, - str, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter); - - break; - } - case QPicturePrivate::PdcDrawPixmap: { - QPixmap pixmap; - QRectF sr; - if (d->in_memory_only) { - int index; - s >> r >> index >> sr; - Q_ASSERT(index < d->pixmap_list.size()); - pixmap = d->pixmap_list.at(index); - } else { - s >> r >> pixmap >> sr; - } - painter->drawPixmap(r, pixmap, sr); - } - break; - case QPicturePrivate::PdcDrawTiledPixmap: { - QPixmap pixmap; - if (d->in_memory_only) { - int index; - s >> r >> index >> p; - Q_ASSERT(index < d->pixmap_list.size()); - pixmap = d->pixmap_list.at(index); - } else { - s >> r >> pixmap >> p; - } - painter->drawTiledPixmap(r, pixmap, p); - } - break; - case QPicturePrivate::PdcDrawImage: { - QImage image; - 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; - case QPicturePrivate::PdcBegin: - s >> ul; // number of records - if (!exec(painter, s, ul)) - return false; - break; - case QPicturePrivate::PdcEnd: - if (nrecords == 0) - return true; - break; - case QPicturePrivate::PdcSave: - painter->save(); - break; - case QPicturePrivate::PdcRestore: - painter->restore(); - break; - case QPicturePrivate::PdcSetBkColor: - s >> color; - painter->setBackground(color); - break; - case QPicturePrivate::PdcSetBkMode: - s >> i_8; - painter->setBackgroundMode((Qt::BGMode)i_8); - break; - case QPicturePrivate::PdcSetROP: // NOP - s >> i_8; - break; - case QPicturePrivate::PdcSetBrushOrigin: - s >> p; - painter->setBrushOrigin(p); - break; - case QPicturePrivate::PdcSetFont: - s >> font; - painter->setFont(font); - break; - case QPicturePrivate::PdcSetPen: - if (d->in_memory_only) { - int index; - s >> index; - Q_ASSERT(index < d->pen_list.size()); - pen = d->pen_list.at(index); - } else { - s >> pen; - } - painter->setPen(pen); - break; - case QPicturePrivate::PdcSetBrush: - if (d->in_memory_only) { - int index; - s >> index; - Q_ASSERT(index < d->brush_list.size()); - brush = d->brush_list.at(index); - } else { - s >> brush; - } - painter->setBrush(brush); - break; - case QPicturePrivate::PdcSetVXform: - s >> i_8; - painter->setViewTransformEnabled(i_8); - break; - case QPicturePrivate::PdcSetWindow: - s >> r; - painter->setWindow(r.toRect()); - break; - case QPicturePrivate::PdcSetViewport: - s >> r; - painter->setViewport(r.toRect()); - break; - case QPicturePrivate::PdcSetWXform: - s >> i_8; - painter->setMatrixEnabled(i_8); - break; - case QPicturePrivate::PdcSetWMatrix: - s >> matrix >> i_8; - // i_8 is always false due to updateXForm() in qpaintengine_pic.cpp - painter->setTransform(matrix * worldMatrix, i_8); - break; - case QPicturePrivate::PdcSetClip: - s >> i_8; - painter->setClipping(i_8); - break; - case QPicturePrivate::PdcSetClipRegion: - s >> rgn >> i_8; - painter->setClipRegion(rgn, Qt::ClipOperation(i_8)); - break; - case QPicturePrivate::PdcSetClipPath: - { - QPainterPath path; - s >> path >> i_8; - painter->setClipPath(path, Qt::ClipOperation(i_8)); - break; - } - case QPicturePrivate::PdcSetRenderHint: - s >> ul; - painter->setRenderHint(QPainter::Antialiasing, - bool(ul & QPainter::Antialiasing)); - painter->setRenderHint(QPainter::SmoothPixmapTransform, - bool(ul & QPainter::SmoothPixmapTransform)); - break; - case QPicturePrivate::PdcSetCompositionMode: - s >> ul; - painter->setCompositionMode((QPainter::CompositionMode)ul); - break; - case QPicturePrivate::PdcSetClipEnabled: - s >> bl; - painter->setClipping(bl); - break; - case QPicturePrivate::PdcSetOpacity: - s >> dbl; - painter->setOpacity(qreal(dbl)); - break; - default: - qWarning("QPicture::play: Invalid command %d", c); - if (len) // skip unknown command - s.device()->seek(s.device()->pos()+len); - } -#if defined(QT_DEBUG) - //qDebug("device->at(): %i, strm_pos: %i len: %i", (int)s.device()->pos(), strm_pos, len); - Q_ASSERT(qint32(s.device()->pos() - strm_pos) == len); -#endif - } - return false; -} - -/*! - \internal - - Internal implementation of the virtual QPaintDevice::metric() - function. - - A picture has the following hard-coded values: numcolors=16777216 - and depth=24. - - \a m is the metric to get. -*/ - -int QPicture::metric(PaintDeviceMetric m) const -{ - int val; - QRect brect = boundingRect(); - switch (m) { - case PdmWidth: - val = brect.width(); - break; - case PdmHeight: - val = brect.height(); - break; - case PdmWidthMM: - val = int(25.4/qt_defaultDpiX()*brect.width()); - break; - case PdmHeightMM: - val = int(25.4/qt_defaultDpiY()*brect.height()); - break; - case PdmDpiX: - case PdmPhysicalDpiX: - val = qt_defaultDpiX(); - break; - case PdmDpiY: - case PdmPhysicalDpiY: - val = qt_defaultDpiY(); - break; - case PdmNumColors: - val = 16777216; - break; - case PdmDepth: - val = 24; - break; - default: - val = 0; - qWarning("QPicture::metric: Invalid metric command"); - } - return val; -} - -/*! - \fn void QPicture::detach() - \internal - Detaches from shared picture data and makes sure that this picture - is the only one referring to the data. - - If multiple pictures share common data, this picture makes a copy - of the data and detaches itself from the sharing mechanism. - Nothing is done if there is just a single reference. -*/ - -/*! \fn bool QPicture::isDetached() const -\internal -*/ - -/*! - Assigns picture \a p to this picture and returns a reference to - this picture. -*/ -QPicture& QPicture::operator=(const QPicture &p) -{ - d_ptr = p.d_ptr; - return *this; -} - -/*! - \fn void QPicture::swap(QPicture &other) - \since 4.8 - - Swaps picture \a other with this picture. This operation is very - fast and never fails. -*/ - -/*! - \internal - - Constructs a QPicturePrivate -*/ -QPicturePrivate::QPicturePrivate() - : in_memory_only(false) -{ -} - -/*! - \internal - - Copy-Constructs a QPicturePrivate. Needed when detaching. -*/ -QPicturePrivate::QPicturePrivate(const QPicturePrivate &other) - : trecs(other.trecs), - formatOk(other.formatOk), - brect(other.brect), - override_rect(other.override_rect), - in_memory_only(false) -{ - pictb.setData(other.pictb.data(), other.pictb.size()); - if (other.pictb.isOpen()) { - pictb.open(other.pictb.openMode()); - pictb.seek(other.pictb.pos()); - } -} - -/*! - \internal - - Checks data integrity and format version number. Set formatOk to - true on success, to false otherwise. Returns the resulting formatOk - value. -*/ -bool QPicturePrivate::checkFormat() -{ - formatOk = false; - - // can't check anything in an empty buffer - if (pictb.size() == 0 || pictb.isOpen()) - return false; - - pictb.open(QIODevice::ReadOnly); // open buffer device - QDataStream s; - s.setDevice(&pictb); // attach data stream to buffer - - char mf_id[4]; // picture header tag - s.readRawData(mf_id, 4); // read actual tag - if (memcmp(mf_id, qt_mfhdr_tag, 4) != 0) { // wrong header id - qWarning("QPicturePaintEngine::checkFormat: Incorrect header"); - pictb.close(); - return false; - } - - int cs_start = sizeof(quint32); // pos of checksum word - int data_start = cs_start + sizeof(quint16); - quint16 cs,ccs; - QByteArray buf = pictb.buffer(); // pointer to data - - s >> cs; // read checksum - ccs = (quint16) qChecksum(buf.constData() + data_start, buf.size() - data_start); - if (ccs != cs) { - qWarning("QPicturePaintEngine::checkFormat: Invalid checksum %x, %x expected", - ccs, cs); - pictb.close(); - return false; - } - - quint8 c, clen; - s >> c >> clen; - if (c == QPicturePrivate::PdcBegin) { - qint32 l, t, w, h; - s >> l >> t >> w >> h; - brect = QRect(l, t, w, h); - } else { - qWarning("QPicturePaintEngine::checkFormat: Format error"); - pictb.close(); - return false; - } - pictb.close(); - - formatOk = true; // picture seems to be ok - return true; -} - -/*! \internal */ -QPaintEngine *QPicture::paintEngine() const -{ - if (!d_func()->paintEngine) - const_cast(this)->d_func()->paintEngine.reset(new QPicturePaintEngine); - return d_func()->paintEngine.data(); -} - -/***************************************************************************** - QPicture stream functions - *****************************************************************************/ - -#ifndef QT_NO_DATASTREAM -/*! - \relates QPicture - - Writes picture \a r to the stream \a s and returns a reference to - the stream. -*/ - -QDataStream &operator<<(QDataStream &s, const QPicture &r) -{ - quint32 size = r.d_func()->pictb.buffer().size(); - s << size; - // null picture ? - if (size == 0) - return s; - // just write the whole buffer to the stream - s.writeRawData (r.d_func()->pictb.buffer(), r.d_func()->pictb.buffer().size()); - return s; -} - -/*! - \relates QPicture - - Reads a picture from the stream \a s into picture \a r and returns - a reference to the stream. -*/ - -QDataStream &operator>>(QDataStream &s, QPicture &r) -{ - QDataStream sr; - - // "init"; this code is similar to the beginning of QPicture::cmd() - sr.setDevice(&r.d_func()->pictb); - quint32 len; - s >> len; - QByteArray data; - if (len > 0) { - data.resize(len); - s.readRawData(data.data(), len); - } - - r.d_func()->pictb.setData(data); - r.d_func()->formatOk = false; - return s; -} -#endif // QT_NO_DATASTREAM - -/*! - \fn QPicture QPicture::copy() const - - Use simple assignment instead. -*/ - -QT_END_NAMESPACE - -#endif // QT_NO_PICTURE - -/*! - \typedef QPicture::DataPtr - \internal -*/ - -/*! - \fn DataPtr &QPicture::data_ptr() - \internal -*/ - - - - - - diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h deleted file mode 100644 index 59ad86781..000000000 --- a/src/gui/image/qpicture.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPICTURE_H -#define QPICTURE_H - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - - -#ifndef QT_NO_PICTURE - -class QPicturePrivate; -class Q_GUI_EXPORT QPicture : public QPaintDevice -{ - Q_DECLARE_PRIVATE(QPicture) -public: - explicit QPicture(); - QPicture(const QPicture &); - ~QPicture(); - - bool isNull() const; - - int devType() const; - uint size() const; - const char* data() const; - virtual void setData(const char* data, uint size); - - bool play(QPainter *p); - - bool load(QIODevice *dev); - bool load(const QString &fileName); - bool save(QIODevice *dev); - bool save(const QString &fileName); - - QRect boundingRect() const; - void setBoundingRect(const QRect &r); - - QPicture& operator=(const QPicture &p); -#ifdef Q_COMPILER_RVALUE_REFS - inline QPicture &operator=(QPicture &&other) - { qSwap(d_ptr, other.d_ptr); return *this; } -#endif - inline void swap(QPicture &other) { d_ptr.swap(other.d_ptr); } - void detach(); - bool isDetached() const; - - friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QPicture &p); - friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QPicture &p); - - static const char* pictureFormat(const QString &fileName); - static QList inputFormats(); - static QList outputFormats(); - static QStringList inputFormatList(); - static QStringList outputFormatList(); - - QPaintEngine *paintEngine() const; - -protected: - QPicture(QPicturePrivate &data); - - int metric(PaintDeviceMetric m) const; - -private: - bool exec(QPainter *p, QDataStream &ds, int i); - - QExplicitlySharedDataPointer d_ptr; - friend class QPicturePaintEngine; - friend class QAlphaPaintEngine; - friend class QPreviewPaintEngine; - -public: - typedef QExplicitlySharedDataPointer DataPtr; - inline DataPtr &data_ptr() { return d_ptr; } -}; - -Q_DECLARE_SHARED(QPicture) - -/***************************************************************************** - QPicture stream functions - *****************************************************************************/ - -#ifndef QT_NO_DATASTREAM -Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPicture &); -Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPicture &); -#endif - -#endif // QT_NO_PICTURE - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QPICTURE_H diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h deleted file mode 100644 index abc3d29af..000000000 --- a/src/gui/image/qpicture_p.h +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPICTURE_P_H -#define QPICTURE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "QtCore/qatomic.h" -#include "QtCore/qbuffer.h" -#include "QtCore/qobjectdefs.h" -#include "QtGui/qpicture.h" -#include "QtGui/qpixmap.h" -#include "QtGui/qpen.h" -#include "QtGui/qbrush.h" -#include "QtCore/qrect.h" -#include "qobject_p.h" - -QT_BEGIN_NAMESPACE - -class QPaintEngine; - -class QPicturePrivate -{ - friend class QPicturePaintEngine; - friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s, const QPicture &r); - friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &s, QPicture &r); - -public: - enum PaintCommand { - PdcNOP = 0, // - PdcDrawPoint = 1, // point - PdcDrawFirst = PdcDrawPoint, - PdcMoveTo = 2, // point - PdcLineTo = 3, // point - PdcDrawLine = 4, // point,point - PdcDrawRect = 5, // rect - PdcDrawRoundRect = 6, // rect,ival,ival - PdcDrawEllipse = 7, // rect - PdcDrawArc = 8, // rect,ival,ival - PdcDrawPie = 9, // rect,ival,ival - PdcDrawChord = 10, // rect,ival,ival - PdcDrawLineSegments = 11, // ptarr - PdcDrawPolyline = 12, // ptarr - PdcDrawPolygon = 13, // ptarr,ival - PdcDrawCubicBezier = 14, // ptarr - PdcDrawText = 15, // point,str - PdcDrawTextFormatted = 16, // rect,ival,str - PdcDrawPixmap = 17, // rect,pixmap - PdcDrawImage = 18, // rect,image - PdcDrawText2 = 19, // point,str - PdcDrawText2Formatted = 20, // rect,ival,str - PdcDrawTextItem = 21, // pos,text,font,flags - PdcDrawLast = PdcDrawTextItem, - PdcDrawPoints = 22, // ptarr,ival,ival - PdcDrawWinFocusRect = 23, // rect,color - PdcDrawTiledPixmap = 24, // rect,pixmap,point - PdcDrawPath = 25, // path - - // no painting commands below PdcDrawLast. - - PdcBegin = 30, // - PdcEnd = 31, // - PdcSave = 32, // - PdcRestore = 33, // - PdcSetdev = 34, // device - PRIVATE - PdcSetBkColor = 40, // color - PdcSetBkMode = 41, // ival - PdcSetROP = 42, // ival - PdcSetBrushOrigin = 43, // point - PdcSetFont = 45, // font - PdcSetPen = 46, // pen - PdcSetBrush = 47, // brush - PdcSetTabStops = 48, // ival - PdcSetTabArray = 49, // ival,ivec - PdcSetUnit = 50, // ival - PdcSetVXform = 51, // ival - PdcSetWindow = 52, // rect - PdcSetViewport = 53, // rect - PdcSetWXform = 54, // ival - PdcSetWMatrix = 55, // matrix,ival - PdcSaveWMatrix = 56, - PdcRestoreWMatrix = 57, - PdcSetClip = 60, // ival - PdcSetClipRegion = 61, // rgn - PdcSetClipPath = 62, // path - PdcSetRenderHint = 63, // ival - PdcSetCompositionMode = 64, // ival - PdcSetClipEnabled = 65, // bool - PdcSetOpacity = 66, // qreal - - PdcReservedStart = 0, // codes 0-199 are reserved - PdcReservedStop = 199 // for Qt - }; - - QPicturePrivate(); - QPicturePrivate(const QPicturePrivate &other); - QAtomicInt ref; - - bool checkFormat(); - void resetFormat(); - - QBuffer pictb; - int trecs; - bool formatOk; - QRect brect; - QRect override_rect; - QScopedPointer paintEngine; - bool in_memory_only; - QList image_list; - QList pixmap_list; - QList brush_list; - QList pen_list; -}; - -QT_END_NAMESPACE - -#endif // QPICTURE_P_H diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 08fc199b2..5d5cc770c 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1366,13 +1366,12 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) Qt provides four classes for handling image data: QImage, QPixmap, - QBitmap and QPicture. QImage is designed and optimized for I/O, - and for direct pixel access and manipulation, while QPixmap is - designed and optimized for showing images on screen. QBitmap is - only a convenience class that inherits QPixmap, ensuring a depth - of 1. The isQBitmap() function returns true if a QPixmap object is - really a bitmap, otherwise returns false. Finally, the QPicture class - is a paint device that records and replays QPainter commands. + and QBitmap. QImage is designed and optimized for I/O, and for direct + pixel access and manipulation, while QPixmap is designed and + optimized for showing images on screen. QBitmap is only a convenience + class that inherits QPixmap, ensuring a depth of 1. The isQBitmap() + function returns true if a QPixmap object is really a bitmap, + otherwise returns false. A QPixmap can easily be displayed on the screen using QLabel or one of QAbstractButton's subclasses (such as QPushButton and diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h index ae7856030..52f7cb6ff 100644 --- a/src/gui/kernel/qwindowdefs.h +++ b/src/gui/kernel/qwindowdefs.h @@ -84,7 +84,6 @@ class QPixmap; class QBitmap; class QMovie; class QImage; -class QPicture; class QPrinter; class QTimer; class QTime; diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index 53bbdbc8f..f119bbb03 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -38,8 +38,8 @@ right and Y increases downwards. The unit is one pixel. The drawing capabilities of QPaintDevice are currently implemented - by the QWidget, QImage, QPixmap, QGLPixelBuffer, QPicture, and - QPrinter subclasses. + by the QWidget, QImage, QPixmap, QGLPixelBuffer, and QPrinter + subclasses. To implement support for a new backend, you must derive from QPaintDevice and reimplement the virtual paintEngine() function to @@ -136,8 +136,7 @@ Returns the device type identifier, which is QInternal::Widget if the device is a QWidget, QInternal::Pixmap if it's a - QPixmap, QInternal::Printer if it's a QPrinter, - QInternal::Picture if it's a QPicture, or + QPixmap, QInternal::Printer if it's a QPrinter, or QInternal::UnknownDevice in other cases. */ diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index 485520499..e623f001a 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -358,17 +358,10 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw \enum QPaintEngine::Type \value X11 - \value Windows - \value MacPrinter - \value CoreGraphics Mac OS X's Quartz2D (CoreGraphics) - \value QuickDraw Mac OS X's QuickDraw - \value QWindowSystem Qt for Embedded Linux \value PostScript \value OpenGL - \value Picture QPicture format \value SVG Scalable Vector Graphics XML format \value Raster - \value Direct3D Windows only, Direct3D based engine \value Pdf Portable Document Format \value User First user type ID \value MaxUser Last user type ID diff --git a/src/gui/painting/qpaintengine_alpha.cpp b/src/gui/painting/qpaintengine_alpha.cpp index f8e10faed..a5aeadcf7 100644 --- a/src/gui/painting/qpaintengine_alpha.cpp +++ b/src/gui/painting/qpaintengine_alpha.cpp @@ -44,10 +44,7 @@ #ifndef QT_NO_PRINTER #include #include "qpaintengine_alpha_p.h" - -#include "qpicture_p.h" #include "qfont_p.h" -#include "QtGui/qpicture.h" QT_BEGIN_NAMESPACE @@ -314,7 +311,7 @@ void QAlphaPaintEngine::flushAndInit(bool init) d->m_cliprgn = d->m_alphargn; - // now replay the QPicture + // now replay the QImage ++d->m_pass; // we are now doing pass #2 // reset states @@ -323,12 +320,12 @@ void QAlphaPaintEngine::flushAndInit(bool init) painter()->save(); d->resetState(painter()); - // make sure the output from QPicture is unscaled + // make sure the output from QImage is unscaled QTransform mtx; mtx.scale(1.0f / (qreal(d->m_pdev->logicalDpiX()) / qreal(qt_defaultDpiX())), 1.0f / (qreal(d->m_pdev->logicalDpiY()) / qreal(qt_defaultDpiY()))); painter()->setTransform(mtx); - painter()->drawPicture(0, 0, *d->m_pic); + painter()->drawImage(0, 0, *d->m_pic); d->m_cliprgn = QRegion(); d->resetState(painter()); @@ -349,8 +346,7 @@ void QAlphaPaintEngine::flushAndInit(bool init) if (init) { gccaps = PaintEngineFeatures(AllFeatures & ~QPaintEngine::ObjectBoundingModeGradients); - d->m_pic = new QPicture(); - d->m_pic->d_ptr->in_memory_only = true; + d->m_pic = new QImage(); d->m_picpainter = new QPainter(d->m_pic); d->m_picengine = d->m_picpainter->paintEngine(); @@ -476,7 +472,7 @@ void QAlphaPaintEnginePrivate::drawAlphaImage(const QRectF &rect) QPainter imgpainter(&img); imgpainter.setTransform(picscale); QPointF picpos(qreal(-xpos), qreal(-ypos)); - imgpainter.drawPicture(picpos, *m_pic); + imgpainter.drawImage(picpos, *m_pic); imgpainter.end(); q->painter()->setTransform(QTransform()); diff --git a/src/gui/painting/qpaintengine_alpha_p.h b/src/gui/painting/qpaintengine_alpha_p.h index f841864be..4783080b1 100644 --- a/src/gui/painting/qpaintengine_alpha_p.h +++ b/src/gui/painting/qpaintengine_alpha_p.h @@ -55,6 +55,7 @@ #ifndef QT_NO_PRINTER #include "qpaintengine_p.h" +#include "qimage.h" #include "qpen.h" QT_BEGIN_NAMESPACE @@ -98,7 +99,7 @@ class QAlphaPaintEnginePrivate : public QPaintEnginePrivate ~QAlphaPaintEnginePrivate(); int m_pass; - QPicture *m_pic; + QImage *m_pic; QPaintEngine *m_picengine; QPainter *m_picpainter; diff --git a/src/gui/painting/qpaintengine_preview.cpp b/src/gui/painting/qpaintengine_preview.cpp index 19efca021..a14d44563 100644 --- a/src/gui/painting/qpaintengine_preview.cpp +++ b/src/gui/painting/qpaintengine_preview.cpp @@ -42,11 +42,9 @@ #include #include #include -#include #include #include -#include #ifndef QT_NO_PRINTPREVIEWWIDGET QT_BEGIN_NAMESPACE @@ -58,7 +56,7 @@ class QPreviewPaintEnginePrivate : public QPaintEnginePrivate QPreviewPaintEnginePrivate() : state(QPrinter::Idle) {} ~QPreviewPaintEnginePrivate() {} - QList pages; + QList pages; QPaintEngine *engine; QPainter *painter; QPrinter::PrinterState state; @@ -90,8 +88,7 @@ bool QPreviewPaintEngine::begin(QPaintDevice *) qDeleteAll(d->pages); d->pages.clear(); - QPicture *page = new QPicture; - page->d_func()->in_memory_only = true; + QImage *page = new QImage; d->painter = new QPainter(page); d->engine = d->painter->paintEngine(); d->pages.append(page); @@ -150,8 +147,7 @@ bool QPreviewPaintEngine::newPage() { Q_D(QPreviewPaintEngine); - QPicture *page = new QPicture; - page->d_func()->in_memory_only = true; + QImage *page = new QImage; QPainter *tmp_painter = new QPainter(page); QPaintEngine *tmp_engine = tmp_painter->paintEngine(); @@ -181,7 +177,7 @@ bool QPreviewPaintEngine::abort() return true; } -QList QPreviewPaintEngine::pages() +QList QPreviewPaintEngine::pages() { Q_D(QPreviewPaintEngine); return d->pages; diff --git a/src/gui/painting/qpaintengine_preview_p.h b/src/gui/painting/qpaintengine_preview_p.h index d43ba21c3..312743fc0 100644 --- a/src/gui/painting/qpaintengine_preview_p.h +++ b/src/gui/painting/qpaintengine_preview_p.h @@ -82,7 +82,7 @@ class QPreviewPaintEngine : public QPaintEngine, public QPrintEngine void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &p); - QList pages(); + QList pages(); QPaintEngine::Type type() const { return Picture; } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 576193e97..883590dd9 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -52,7 +52,6 @@ #include "qpainter.h" #include "qpainter_p.h" #include "qpainterpath.h" -#include "qpicture.h" #include "qpixmapcache.h" #include "qpolygon.h" #include "qtextlayout.h" @@ -115,7 +114,6 @@ static bool qt_painter_thread_test(int devType, const char *what, bool extraCond switch (devType) { case QInternal::Image: case QInternal::Printer: - case QInternal::Picture: // can be drawn onto these devices safely from any thread if (extraCondition) break; @@ -846,11 +844,6 @@ void QPainterPrivate::updateState(QPainterState *newState) fine-grained positioning, boundingRect() tells you where a given drawText() command will draw. - There is a drawPicture() function that draws the contents of an - entire QPicture. The drawPicture() function is the only function - that disregards all the painter's settings as QPicture has its own - settings. - \section1 Rendering Quality To get the optimal rendering result using QPainter, you should use @@ -1456,7 +1449,7 @@ bool QPainter::begin(QPaintDevice *pd) if (!rpd) rpd = redirected(pd, &redirectionOffset); - else + if (rpd) pd = rpd; #ifdef QT_DEBUG_DRAW @@ -2631,12 +2624,6 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 4 - Note that when using setWorldMatrix() function you should always have - \a combine be true when you are drawing into a QPicture. Otherwise - it may not be possible to replay the picture with additional - transformations; using the translate(), scale(), etc. convenience - functions is safe. - For more information about the coordinate system, transformations and window-viewport conversion, see \l {Coordinate System}. @@ -6233,62 +6220,6 @@ void QPainter::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPo pixmap that is to be drawn; this defaults to (0, 0). */ -#ifndef QT_NO_PICTURE - -/*! - \fn void QPainter::drawPicture(const QPointF &point, const QPicture &picture) - - Replays the given \a picture at the given \a point. - - The QPicture class is a paint device that records and replays - QPainter commands. A picture serializes the painter commands to an - IO device in a platform-independent format. Everything that can be - painted on a widget or pixmap can also be stored in a picture. - - This function does exactly the same as QPicture::play() when - called with \a point = QPoint(0, 0). - - \table 100% - \row - \o - \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 18 - \endtable - - \sa QPicture::play() -*/ - -void QPainter::drawPicture(const QPointF &p, const QPicture &picture) -{ - Q_D(QPainter); - - if (!d->engine) - return; - - if (!d->extended) - d->updateState(d->state); - - save(); - translate(p); - const_cast(&picture)->play(this); - restore(); -} - -/*! - \fn void QPainter::drawPicture(const QPoint &point, const QPicture &picture) - \overload - - Replays the given \a picture at the given \a point. -*/ - -/*! - \fn void QPainter::drawPicture(int x, int y, const QPicture &picture) - \overload - - Draws the given \a picture at point (\a x, \a y). -*/ - -#endif // QT_NO_PICTURE - /*! \fn void QPainter::eraseRect(const QRectF &rectangle) diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index 82ef7cec1..35c0b09de 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -355,11 +355,6 @@ class Q_GUI_EXPORT QPainter void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF()); inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0); inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint()); -#ifndef QT_NO_PICTURE - void drawPicture(const QPointF &p, const QPicture &picture); - inline void drawPicture(int x, int y, const QPicture &picture); - inline void drawPicture(const QPoint &p, const QPicture &picture); -#endif void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect); inline void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect); @@ -410,9 +405,9 @@ class Q_GUI_EXPORT QPainter void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding); - void drawText(const QRectF &r, int flags, const QString &text, QRectF *br=0); - void drawText(const QRect &r, int flags, const QString &text, QRect *br=0); - inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br=0); + void drawText(const QRectF &r, int flags, const QString &text, QRectF *br = Q_NULLPTR); + void drawText(const QRect &r, int flags, const QString &text, QRect *br = Q_NULLPTR); + inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br = Q_NULLPTR); void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption()); @@ -455,7 +450,7 @@ class Q_GUI_EXPORT QPainter static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement, const QPoint& offset = QPoint()); - static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = 0); + static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = Q_NULLPTR); static void restoreRedirected(const QPaintDevice *device); void beginNativePainting(); @@ -908,18 +903,6 @@ inline void QPainter::setWindow(int x, int y, int w, int h) setWindow(QRect(x, y, w, h)); } -#ifndef QT_NO_PICTURE -inline void QPainter::drawPicture(int x, int y, const QPicture &p) -{ - drawPicture(QPoint(x, y), p); -} - -inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p) -{ - drawPicture(QPointF(pt), p); -} -#endif - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index 354b645cd..46fdb8a29 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -53,11 +53,6 @@ #ifndef QT_NO_PRINTER -#if defined (Q_WS_WIN) -#include -#elif defined (Q_WS_MAC) -#include -#endif #include #if defined(Q_WS_X11) @@ -68,7 +63,7 @@ #include "qprintengine_pdf_p.h" #endif -#include +#include #include @@ -182,11 +177,11 @@ void QPrinterPrivate::createDefaultEngines() } #ifndef QT_NO_PRINTPREVIEWWIDGET -QList QPrinterPrivate::previewPages() const +QList QPrinterPrivate::previewPages() const { if (previewEngine) return previewEngine->pages(); - return QList(); + return QList(); } void QPrinterPrivate::setPreviewMode(bool enable) diff --git a/src/gui/painting/qprinter_p.h b/src/gui/painting/qprinter_p.h index 2bbb74a72..58f25371b 100644 --- a/src/gui/painting/qprinter_p.h +++ b/src/gui/painting/qprinter_p.h @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE class QPrintEngine; class QPreviewPaintEngine; -class QPicture; +class QImage; class QPrinterPrivate { @@ -99,7 +99,7 @@ class QPrinterPrivate void createDefaultEngines(); #ifndef QT_NO_PRINTPREVIEWWIDGET - QList previewPages() const; + QList previewPages() const; void setPreviewMode(bool); #endif diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index e36de40c2..a4185d0bd 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2260,7 +2260,7 @@ QDataStream &operator>>(QDataStream &s, QFont &font) The font must be screen-compatible, i.e. a font you use when drawing text in \link QWidget widgets\endlink or \link QPixmap - pixmaps\endlink, not QPicture or QPrinter. + pixmaps\endlink, not QPrinter. The font info object holds the information for the font that is passed in the constructor at the time it is created, and is not diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 7cc7c706c..2786080a4 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -306,7 +306,6 @@ class Q_GUI_EXPORT QFont friend class QAlphaPaintEngine; friend class QPainterPath; friend class QTextItemInt; - friend class QPicturePaintEngine; friend class QPainterReplayer; friend class QCommandLinkButtonPrivate; friend class QFontEngine; diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 867bed3ca..26e2e3473 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -173,7 +173,7 @@ QFontMetrics::QFontMetrics(const QFont &font) If the \a paintdevice is 0, the metrics will be screen-compatible, ie. the metrics you get if you use the font for drawing text on a \link QWidget widgets\endlink or \link QPixmap pixmaps\endlink, - not on a QPicture or QPrinter. + not on a QPrinter. The font metrics object holds the information for the font that is passed in the constructor at the time it is created, and is not @@ -1054,7 +1054,7 @@ QFontMetricsF::QFontMetricsF(const QFont &font) If the \a paintdevice is 0, the metrics will be screen-compatible, ie. the metrics you get if you use the font for drawing text on a \link QWidget widgets\endlink or \link QPixmap pixmaps\endlink, - not on a QPicture or QPrinter. + not on a QPrinter. The font metrics object holds the information for the font that is passed in the constructor at the time it is created, and is not diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index 5f291416f..1b1989f63 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -147,20 +147,6 @@ QT_BEGIN_NAMESPACE {fowler}{GUI Design Handbook: Label} */ -#ifndef QT_NO_PICTURE -/*! - Returns the label's picture or 0 if the label doesn't have a - picture. -*/ - -const QPicture *QLabel::picture() const -{ - Q_D(const QLabel); - return d->picture; -} -#endif - - /*! Constructs an empty label. @@ -219,9 +205,6 @@ void QLabelPrivate::init() pixmap = 0; scaledpixmap = 0; cachedimage = 0; -#ifndef QT_NO_PICTURE - picture = 0; -#endif align = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextExpandTabs; indent = -1; scaledcontents = false; @@ -365,26 +348,6 @@ const QPixmap *QLabel::pixmap() const return d->pixmap; } -#ifndef QT_NO_PICTURE -/*! - Sets the label contents to \a picture. Any previous content is - cleared. - - The buddy shortcut, if any, is disabled. - - \sa picture(), setBuddy() -*/ - -void QLabel::setPicture(const QPicture &picture) -{ - Q_D(QLabel); - d->clearContents(); - d->picture = new QPicture(picture); - - d->updateLabel(); -} -#endif // QT_NO_PICTURE - /*! Sets the label contents to plain text containing the textual representation of integer \a num. Any previous content is cleared. @@ -559,10 +522,6 @@ QSize QLabelPrivate::sizeForWidth(int w) const if (pixmap && !pixmap->isNull()) br = pixmap->rect(); -#ifndef QT_NO_PICTURE - else if (picture && !picture->isNull()) - br = picture->boundingRect(); -#endif #ifndef QT_NO_MOVIE else if (movie && !movie->currentPixmap().isNull()) br = movie->currentPixmap().rect(); @@ -1058,34 +1017,7 @@ void QLabel::paintEvent(QPaintEvent *) } style->drawItemText(&painter, lr.toRect(), flags, opt.palette, isEnabled(), d->text, foregroundRole()); } - } else -#ifndef QT_NO_PICTURE - if (d->picture) { - QRect br = d->picture->boundingRect(); - int rw = br.width(); - int rh = br.height(); - if (d->scaledcontents) { - painter.save(); - painter.translate(cr.x(), cr.y()); - painter.scale((double)cr.width()/rw, (double)cr.height()/rh); - painter.drawPicture(-br.x(), -br.y(), *d->picture); - painter.restore(); - } else { - int xo = 0; - int yo = 0; - if (align & Qt::AlignVCenter) - yo = (cr.height()-rh)/2; - else if (align & Qt::AlignBottom) - yo = cr.height()-rh; - if (align & Qt::AlignRight) - xo = cr.width()-rw; - else if (align & Qt::AlignHCenter) - xo = (cr.width()-rw)/2; - painter.drawPicture(cr.x()+xo-br.x(), cr.y()+yo-br.y(), *d->picture); - } - } else -#endif - if (d->pixmap && !d->pixmap->isNull()) { + } else if (d->pixmap && !d->pixmap->isNull()) { QPixmap pix; if (d->scaledcontents) { if (!d->scaledpixmap || d->scaledpixmap->size() != cr.size()) { @@ -1276,10 +1208,6 @@ void QLabelPrivate::clearContents() isTextLabel = false; hasShortcut = false; -#ifndef QT_NO_PICTURE - delete picture; - picture = 0; -#endif delete scaledpixmap; scaledpixmap = 0; delete cachedimage; diff --git a/src/gui/widgets/qlabel.h b/src/gui/widgets/qlabel.h index d8f1c4c29..fdda5c8aa 100644 --- a/src/gui/widgets/qlabel.h +++ b/src/gui/widgets/qlabel.h @@ -74,9 +74,6 @@ class Q_GUI_EXPORT QLabel : public QFrame QString text() const; const QPixmap *pixmap() const; -#ifndef QT_NO_PICTURE - const QPicture *picture() const; -#endif #ifndef QT_NO_MOVIE QMovie *movie() const; #endif @@ -120,9 +117,6 @@ class Q_GUI_EXPORT QLabel : public QFrame public Q_SLOTS: void setText(const QString &); void setPixmap(const QPixmap &); -#ifndef QT_NO_PICTURE - void setPicture(const QPicture &); -#endif #ifndef QT_NO_MOVIE void setMovie(QMovie *movie); #endif diff --git a/src/gui/widgets/qlabel_p.h b/src/gui/widgets/qlabel_p.h index 52ea39c4b..76587caa7 100644 --- a/src/gui/widgets/qlabel_p.h +++ b/src/gui/widgets/qlabel_p.h @@ -63,7 +63,6 @@ #include "qmovie.h" #include "qimage.h" #include "qbitmap.h" -#include "qpicture.h" #include "qmenu.h" QT_BEGIN_NAMESPACE @@ -88,9 +87,6 @@ class QLabelPrivate : public QFramePrivate QPixmap *pixmap; QPixmap *scaledpixmap; QImage *cachedimage; -#ifndef QT_NO_PICTURE - QPicture *picture; -#endif #ifndef QT_NO_MOVIE QPointer movie; void _q_movieUpdated(const QRect&); diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/gui/widgets/qprintpreviewwidget.cpp index 98503ad14..7ddf9aab3 100644 --- a/src/gui/widgets/qprintpreviewwidget.cpp +++ b/src/gui/widgets/qprintpreviewwidget.cpp @@ -58,7 +58,7 @@ namespace { class PageItem : public QGraphicsItem { public: - PageItem(int _pageNum, const QPicture* _pagePicture, QSize _paperSize, QRect _pageRect) + PageItem(int _pageNum, const QImage* _pagePicture, QSize _paperSize, QRect _pageRect) : pageNum(_pageNum), pagePicture(_pagePicture), paperSize(_paperSize), pageRect(_pageRect) { @@ -78,7 +78,7 @@ class PageItem : public QGraphicsItem private: int pageNum; - const QPicture* pagePicture; + const QImage* pagePicture; QSize paperSize; QRect pageRect; QRectF brect; @@ -125,7 +125,7 @@ void PageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, painter->fillRect(paperRect, Qt::white); if (!pagePicture) return; - painter->drawPicture(pageRect.topLeft(), *pagePicture); + painter->drawImage(pageRect.topLeft(), *pagePicture); // Effect: make anything drawn in the margins look washed out. QPainterPath path; @@ -203,7 +203,7 @@ class QPrintPreviewWidgetPrivate : public QWidgetPrivate QGraphicsScene *scene; int curPage; - QList pictures; + QList pictures; QList pages; QPrintPreviewWidget::ViewMode viewMode; diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index fa01d48d4..9ab215ec2 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -514,10 +514,6 @@ QAccessible::Role QAccessibleDisplay::role(int child) const if (l) { if (l->pixmap()) return Graphic; -#ifndef QT_NO_PICTURE - if (l->picture()) - return Graphic; -#endif #ifndef QT_NO_MOVIE if (l->movie()) return Animation; diff --git a/src/shared/qclass_lib_map.h b/src/shared/qclass_lib_map.h index 9758918dc..c15f42da7 100644 --- a/src/shared/qclass_lib_map.h +++ b/src/shared/qclass_lib_map.h @@ -185,7 +185,6 @@ static const ClassInfoEntry qclass_lib_map[] = { { "QImageReader", "QtGui/qimagereader.h"}, { "QImageWriter", "QtGui/qimagewriter.h"}, { "QMovie", "QtGui/qmovie.h"}, - { "QPicture", "QtGui/qpicture.h"}, { "QPixmap", "QtGui/qpixmap.h"}, { "QPixmapCache", "QtGui/qpixmapcache.h"}, { "Key", "QtGui/qpixmapcache.h"}, @@ -719,6 +718,6 @@ static const ClassInfoEntry qclass_lib_map[] = { { "QSqlRecord", "QtSql/qsqlrecord.h"}, { "QSqlResult", "QtSql/qsqlresult.h"}, }; -static const int qclass_lib_count = 713; +static const int qclass_lib_count = 712; #endif diff --git a/src/svg/qsvgfont.cpp b/src/svg/qsvgfont.cpp index 702c01a35..d3b3b3437 100644 --- a/src/svg/qsvgfont.cpp +++ b/src/svg/qsvgfont.cpp @@ -46,7 +46,6 @@ #include "qpainter.h" #include "qpen.h" #include "qdebug.h" -#include "qpicture.h" QT_BEGIN_NAMESPACE diff --git a/src/svg/qsvgrenderer.cpp b/src/svg/qsvgrenderer.cpp index e86f2ef5d..aad8ca5a5 100644 --- a/src/svg/qsvgrenderer.cpp +++ b/src/svg/qsvgrenderer.cpp @@ -98,7 +98,7 @@ QT_BEGIN_NAMESPACE Finally, the QSvgRenderer class provides the repaintNeeded() signal which is emitted whenever the rendering of the document needs to be updated. - \sa QSvgWidget, {QtSvg Module}, {SVG Viewer Example}, QPicture + \sa QSvgWidget, {QtSvg Module}, {SVG Viewer Example} */ class QSvgRendererPrivate : public QObjectPrivate diff --git a/src/svg/qsvgwidget.cpp b/src/svg/qsvgwidget.cpp index a4cb286c8..a8e83f96e 100644 --- a/src/svg/qsvgwidget.cpp +++ b/src/svg/qsvgwidget.cpp @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE displays. If no data has been loaded, the widget provides the default QWidget size hint. Subclass this class and reimplement sizeHint() if you need to customize this behavior. - \sa QSvgRenderer, {QtSvg Module}, QPicture + \sa QSvgRenderer, {QtSvg Module} */ class QSvgWidgetPrivate : public QWidgetPrivate