From bb966fe9dd8be25530da5a66727c7fe2123fafbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 9 Mar 2010 12:26:51 +0100 Subject: Renamed QPainter::Fragment/Hint -> QPainter::PixmapFragment/Hint Reviewed-by: Kim --- .../graphicsitems/qdeclarativeparticles.cpp | 2 +- src/gui/painting/qdrawutil.cpp | 4 +-- src/gui/painting/qpaintengineex.cpp | 4 +-- src/gui/painting/qpaintengineex_p.h | 3 +- src/gui/painting/qpainter.cpp | 40 +++++++++++----------- src/gui/painting/qpainter.h | 12 +++---- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 7 ++-- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 6 ++-- src/openvg/qpaintengine_vg.cpp | 4 +-- src/openvg/qpaintengine_vg_p.h | 3 +- tests/auto/qpainter/tst_qpainter.cpp | 10 +++--- 11 files changed, 50 insertions(+), 45 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeparticles.cpp b/src/declarative/graphicsitems/qdeclarativeparticles.cpp index ec0bf6c..593c80a 100644 --- a/src/declarative/graphicsitems/qdeclarativeparticles.cpp +++ b/src/declarative/graphicsitems/qdeclarativeparticles.cpp @@ -1263,7 +1263,7 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics const int myY = y() + parentItem()->y(); #if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) - QVarLengthArray pixmapData; + QVarLengthArray pixmapData; #else QVarLengthArray pixmapData; #endif diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index d76c709..a62f06b 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1081,7 +1081,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, according to the \a margins structure. */ -typedef QVarLengthArray QPixmapFragmentsArray; +typedef QVarLengthArray QPixmapFragmentsArray; /*! \since 4.6 @@ -1102,7 +1102,7 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin const QPixmap &pixmap, const QRect &sourceRect,const QMargins &sourceMargins, const QTileRules &rules, QDrawBorderPixmap::DrawingHints hints) { - QPainter::Fragment d; + QPainter::PixmapFragment d; d.opacity = 1.0; d.rotation = 0.0; diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 98762f0..1fd622d 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -970,8 +970,8 @@ void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con fill(path, brush); } -void QPaintEngineEx::drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, - const QPixmap &pixmap, QPainter::FragmentHints /*hints*/) +void QPaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, + const QPixmap &pixmap, QPainter::PixmapFragmentHints /*hints*/) { qreal oldOpacity = state()->opacity; QTransform oldTransform = state()->matrix; diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 2401b94..6c654bd 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -197,7 +197,8 @@ public: virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); - virtual void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QFlags hints); + virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, + QFlags hints); virtual void updateState(const QPaintEngineState &state); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 9d83718..50279e4 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -8914,11 +8914,11 @@ QTransform QPainter::combinedTransform() const This function is potentially faster than multiple calls to drawPixmap(), since the backend can optimize state changes. - \sa QPainter::Fragment, QPainter::FragmentHint + \sa QPainter::PixmapFragment, QPainter::PixmapFragmentHint */ -void QPainter::drawPixmapFragments(const Fragment *fragments, int fragmentCount, - const QPixmap &pixmap, FragmentHints hints) +void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount, + const QPixmap &pixmap, PixmapFragmentHints hints) { Q_D(QPainter); @@ -8959,7 +8959,7 @@ void QPainter::drawPixmapFragments(const Fragment *fragments, int fragmentCount, /*! \since 4.7 - \class QPainter::Fragment + \class QPainter::PixmapFragment \brief This class is used in conjunction with the QPainter::drawPixmapFragments() function to specify how a pixmap, or @@ -8980,73 +8980,73 @@ void QPainter::drawPixmapFragments(const Fragment *fragments, int fragmentCount, /*! \since 4.7 - This is a convenience function that returns a QPainter::Fragment that is + This is a convenience function that returns a QPainter::PixmapFragment that is initialized with the \a pos, \a sourceRect, \a scaleX, \a scaleY, \a rotation, \a opacity parameters. */ -QPainter::Fragment QPainter::Fragment::create(const QPointF &pos, const QRectF &sourceRect, +QPainter::PixmapFragment QPainter::PixmapFragment::create(const QPointF &pos, const QRectF &sourceRect, qreal scaleX, qreal scaleY, qreal rotation, qreal opacity) { - Fragment fragment = {pos.x(), pos.y(), sourceRect.x(), sourceRect.y(), sourceRect.width(), - sourceRect.height(), scaleX, scaleY, rotation, opacity}; + PixmapFragment fragment = {pos.x(), pos.y(), sourceRect.x(), sourceRect.y(), sourceRect.width(), + sourceRect.height(), scaleX, scaleY, rotation, opacity}; return fragment; } /*! - \variable QPainter::Fragment::x + \variable QPainter::PixmapFragment::x \brief the x coordinate of center point in the target rectangle. */ /*! - \variable QPainter::Fragment::y + \variable QPainter::PixmapFragment::y \brief the y coordinate of the center point in the target rectangle. */ /*! - \variable QPainter::Fragment::sourceLeft + \variable QPainter::PixmapFragment::sourceLeft \brief the left coordinate of the source rectangle. */ /*! - \variable QPainter::Fragment::sourceTop + \variable QPainter::PixmapFragment::sourceTop \brief the top coordinate of the source rectangle. */ /*! - \variable QPainter::Fragment::width + \variable QPainter::PixmapFragment::width \brief the width of the source rectangle and is used to calculate the width of the target rectangle. */ /*! - \variable QPainter::Fragment::height + \variable QPainter::PixmapFragment::height \brief the height of the source rectangle and is used to calculate the height of the target rectangle. */ /*! - \variable QPainter::Fragment::scaleX + \variable QPainter::PixmapFragment::scaleX \brief the horizontal scale of the target rectangle. */ /*! - \variable QPainter::Fragment::scaleY + \variable QPainter::PixmapFragment::scaleY \brief the vertical scale of the target rectangle. */ /*! - \variable QPainter::Fragment::rotation + \variable QPainter::PixmapFragment::rotation \brief the rotation of the target rectangle in degrees. The target rectangle is rotated after it has been scaled. */ /*! - \variable QPainter::Fragment::opacity + \variable QPainter::PixmapFragment::opacity \brief the opacity of the target rectangle, where 0.0 is fully transparent and 1.0 is fully opaque. @@ -9055,12 +9055,12 @@ QPainter::Fragment QPainter::Fragment::create(const QPointF &pos, const QRectF & /*! \since 4.7 - \enum QPainter::FragmentHint + \enum QPainter::PixmapFragmentHint \value OpaqueHint Indicates that the pixmap fragments to be drawn are opaque. Opaque fragments are potentially faster to draw. - \sa QPainter::drawPixmapFragments(), QPainter::Fragment + \sa QPainter::drawPixmapFragments(), QPainter::PixmapFragment */ void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation) diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index bcb0b50..443925b 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -99,7 +99,7 @@ public: Q_DECLARE_FLAGS(RenderHints, RenderHint) - class Fragment { + class PixmapFragment { public: qreal x; qreal y; @@ -111,16 +111,16 @@ public: qreal scaleY; qreal rotation; qreal opacity; - static Fragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect, + static PixmapFragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect, qreal scaleX = 1, qreal scaleY = 1, qreal rotation = 0, qreal opacity = 1); }; - enum FragmentHint { + enum PixmapFragmentHint { OpaqueHint = 0x01 }; - Q_DECLARE_FLAGS(FragmentHints, FragmentHint) + Q_DECLARE_FLAGS(PixmapFragmentHints, PixmapFragmentHint) QPainter(); explicit QPainter(QPaintDevice *); @@ -375,8 +375,8 @@ public: inline void drawPixmap(const QRect &r, const QPixmap &pm); inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm); - void drawPixmapFragments(const Fragment *fragments, int fragmentCount, - const QPixmap &pixmap, FragmentHints hints = 0); + void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount, + const QPixmap &pixmap, PixmapFragmentHints hints = 0); void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags = Qt::AutoColor); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 8eb72b0..2b5f2f4 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1641,7 +1641,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp s->matrix = old; } -void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints) +void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints) { Q_D(QGL2PaintEngineEx); // Use fallback for extended composition modes. @@ -1655,9 +1656,9 @@ void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::Fragment *fragments, } -void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::Fragment *fragments, +void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, - QPainter::FragmentHints hints) + QPainter::PixmapFragmentHints hints) { GLfloat dx = 1.0f / pixmap.size().width(); GLfloat dy = 1.0f / pixmap.size().height(); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 5d3608b..ed8fbbc 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -125,7 +125,8 @@ public: virtual void drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr); virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - virtual void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints); + virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints); virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags = Qt::AutoColor); virtual void drawTextItem(const QPointF &p, const QTextItem &textItem); @@ -196,7 +197,8 @@ public: void fill(const QVectorPath &path); void stroke(const QVectorPath &path, const QPen &pen); void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false); - void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints); + void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints); void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem, bool includeMatrixInCache); diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 4df894a..2c850c9 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3041,8 +3041,8 @@ void QVGPaintEngine::drawTiledPixmap // (i.e. no opacity), no rotation or scaling, and drawing the full // pixmap rather than parts of the pixmap. Even having just one of // these conditions will improve performance. -void QVGPaintEngine::drawPixmapFragments(const QPainter::Fragment *drawingData, int dataCount, - const QPixmap &pixmap, QFlags hints) +void QVGPaintEngine::drawPixmapFragments(const QPainter::PixmapFragment *drawingData, int dataCount, + const QPixmap &pixmap, QFlags hints) { #if !defined(QT_SHIVAVG) Q_D(QVGPaintEngine); diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index 1203af5..1e7e26c 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -137,7 +137,8 @@ public: void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); - void drawPixmapFragments(const QPainter::Fragment *drawingData, int dataCount, const QPixmap &pixmap, QFlags hints); + void drawPixmapFragments(const QPainter::PixmapFragment *drawingData, int dataCount, const QPixmap &pixmap, + QFlags hints); void drawTextItem(const QPointF &p, const QTextItem &textItem); void drawStaticTextItem(QStaticTextItem *staticTextItem); diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index a03b2c7..701dc2e 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -999,10 +999,10 @@ void tst_QPainter::drawPixmapFragments() { QPixmap origPixmap(20, 20); QPixmap resPixmap(20, 20); - QPainter::Fragment fragments[4] = { {15, 15, 0, 0, 10, 10, 1, 1, 0, 1}, - { 5, 15, 10, 0, 10, 10, 1, 1, 0, 1}, - {15, 5, 0, 10, 10, 10, 1, 1, 0, 1}, - { 5, 5, 10, 10, 10, 10, 1, 1, 0, 1} }; + QPainter::PixmapFragment fragments[4] = { {15, 15, 0, 0, 10, 10, 1, 1, 0, 1}, + { 5, 15, 10, 0, 10, 10, 1, 1, 0, 1}, + {15, 5, 0, 10, 10, 10, 1, 1, 0, 1}, + { 5, 5, 10, 10, 10, 10, 1, 1, 0, 1} }; { QPainter p(&origPixmap); p.fillRect(0, 0, 10, 10, Qt::red); @@ -1025,7 +1025,7 @@ void tst_QPainter::drawPixmapFragments() QVERIFY(resImage.pixel(15, 15) == origImage.pixel(5, 5)); - QPainter::Fragment fragment = QPainter::Fragment::create(QPointF(20, 20), QRectF(30, 30, 2, 2)); + QPainter::PixmapFragment fragment = QPainter::PixmapFragment::create(QPointF(20, 20), QRectF(30, 30, 2, 2)); QVERIFY(fragment.x == 20); QVERIFY(fragment.y == 20); QVERIFY(fragment.sourceLeft == 30); -- cgit v0.12