Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_graphic.cpp


Ignore:
Timestamp:
Nov 3, 2026, 10:53:35 AM (3 weeks ago)
Author:
stuerze
Message:

deprecated functions exchanged libs updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_graphic.cpp

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1010#include "qwt_graphic.h"
    1111#include "qwt_painter_command.h"
     12#include "qwt_math.h"
     13
    1214#include <qvector.h>
    1315#include <qpainter.h>
    … …  
    1618#include <qpixmap.h>
    1719#include <qpainterpath.h>
    18 #include <qmath.h>
    19 
    20 static bool qwtHasScalablePen( const QPainter *painter )
     20
     21#if QT_VERSION >= 0x050000
     22
     23#include <qguiapplication.h>
     24
     25static inline qreal qwtDevicePixelRatio()
     26{
     27    return qGuiApp ? qGuiApp->devicePixelRatio() : 1.0;
     28}
     29
     30#endif
     31
     32static bool qwtHasScalablePen( const QPainter* painter )
    2133{
    2234    const QPen pen = painter->pen();
    … …  
    2739    {
    2840        scalablePen = !pen.isCosmetic();
     41#if QT_VERSION < 0x050000
    2942        if ( !scalablePen && pen.widthF() == 0.0 )
    3043        {
    … …  
    3346                scalablePen = true;
    3447        }
     48#endif
    3549    }
    3650
    … …  
    3953
    4054static QRectF qwtStrokedPathRect(
    41     const QPainter *painter, const QPainterPath &path )
     55    const QPainter* painter, const QPainterPath& path )
    4256{
    4357    QPainterPathStroker stroker;
    … …  
    5064    if ( qwtHasScalablePen( painter ) )
    5165    {
    52         QPainterPath stroke = stroker.createStroke(path);
    53         rect = painter->transform().map(stroke).boundingRect();
     66        QPainterPath stroke = stroker.createStroke( path );
     67        rect = painter->transform().map( stroke ).boundingRect();
    5468    }
    5569    else
    5670    {
    57         QPainterPath mappedPath = painter->transform().map(path);
     71        QPainterPath mappedPath = painter->transform().map( path );
    5872        mappedPath = stroker.createStroke( mappedPath );
    5973
    … …  
    6579
    6680static inline void qwtExecCommand(
    67     QPainter *painter, const QwtPainterCommand &cmd,
     81    QPainter* painter, const QwtPainterCommand& cmd,
    6882    QwtGraphic::RenderHints renderHints,
    69     const QTransform &transform,
    70     const QTransform *initialTransform )
     83    const QTransform& transform,
     84    const QTransform* initialTransform )
    7185{
    7286    switch( cmd.type() )
    … …  
    7690            bool doMap = false;
    7791
    78             if ( renderHints.testFlag( QwtGraphic::RenderPensUnscaled )
    79                 && painter->transform().isScaling() )
     92            if ( painter->transform().isScaling() )
    8093            {
    8194                bool isCosmetic = painter->pen().isCosmetic();
     95#if QT_VERSION < 0x050000
    8296                if ( isCosmetic && painter->pen().widthF() == 0.0 )
    8397                {
    … …  
    86100                        isCosmetic = false;
    87101                }
    88 
    89                 doMap = !isCosmetic;
     102#endif
     103
     104                if ( isCosmetic )
     105                {
     106                    // OpenGL2 seems to be buggy for cosmetic pens.
     107                    // It interpolates curves in too rough steps then
     108
     109                    doMap = painter->paintEngine()->type() == QPaintEngine::OpenGL2;
     110                }
     111                else
     112                {
     113                    doMap = renderHints.testFlag( QwtGraphic::RenderPensUnscaled );
     114                }
    90115            }
    91116
    … …  
    115140        case QwtPainterCommand::Pixmap:
    116141        {
    117             const QwtPainterCommand::PixmapData *data = cmd.pixmapData();
     142            const QwtPainterCommand::PixmapData* data = cmd.pixmapData();
    118143            painter->drawPixmap( data->rect, data->pixmap, data->subRect );
    119144            break;
    … …  
    121146        case QwtPainterCommand::Image:
    122147        {
    123             const QwtPainterCommand::ImageData *data = cmd.imageData();
     148            const QwtPainterCommand::ImageData* data = cmd.imageData();
    124149            painter->drawImage( data->rect, data->image,
    125150                data->subRect, data->flags );
    … …  
    128153        case QwtPainterCommand::State:
    129154        {
    130             const QwtPainterCommand::StateData *data = cmd.stateData();
     155            const QwtPainterCommand::StateData* data = cmd.stateData();
    131156
    132157            if ( data->flags & QPaintEngine::DirtyPen )
    … …  
    156181                painter->setClipping( data->isClipEnabled );
    157182
    158             if ( data->flags & QPaintEngine::DirtyClipRegion)
     183            if ( data->flags & QPaintEngine::DirtyClipRegion )
    159184            {
    160185                painter->setClipRegion( data->clipRegion,
    … …  
    167192            }
    168193
    169             if ( data->flags & QPaintEngine::DirtyHints)
     194            if ( data->flags & QPaintEngine::DirtyHints )
    170195            {
    171                 const QPainter::RenderHints hints = data->renderHints;
    172 
    173                 painter->setRenderHint( QPainter::Antialiasing,
    174                     hints.testFlag( QPainter::Antialiasing ) );
    175 
    176                 painter->setRenderHint( QPainter::TextAntialiasing,
    177                     hints.testFlag( QPainter::TextAntialiasing ) );
    178 
    179                 painter->setRenderHint( QPainter::SmoothPixmapTransform,
    180                     hints.testFlag( QPainter::SmoothPixmapTransform ) );
    181 
    182                 painter->setRenderHint( QPainter::HighQualityAntialiasing,
    183                     hints.testFlag( QPainter::HighQualityAntialiasing ) );
    184 
    185                 painter->setRenderHint( QPainter::NonCosmeticDefaultPen,
    186                     hints.testFlag( QPainter::NonCosmeticDefaultPen ) );
     196                for ( int i = 0; i < 8; i++ )
     197                {
     198                    const QPainter::RenderHint hint = static_cast< QPainter::RenderHint >( 1 << i );
     199                    painter->setRenderHint( hint, data->renderHints.testFlag( hint ) );
     200                }
    187201            }
    188202
    189             if ( data->flags & QPaintEngine::DirtyCompositionMode)
     203            if ( data->flags & QPaintEngine::DirtyCompositionMode )
    190204                painter->setCompositionMode( data->compositionMode );
    191205
    192             if ( data->flags & QPaintEngine::DirtyOpacity)
     206            if ( data->flags & QPaintEngine::DirtyOpacity )
    193207                painter->setOpacity( data->opacity );
    194208
    … …  
    198212            break;
    199213    }
    200 
    201214}
    202215
    203216class QwtGraphic::PathInfo
    204217{
    205 public:
    206     PathInfo():
    207         d_scalablePen( false )
     218  public:
     219    PathInfo()
     220        : m_scalablePen( false )
    208221    {
    209222        // QVector needs a default constructor
    210223    }
    211224
    212     PathInfo( const QRectF &pointRect,
    213             const QRectF &boundingRect, bool scalablePen ):
    214         d_pointRect( pointRect ),
    215         d_boundingRect( boundingRect ),
    216         d_scalablePen( scalablePen )
    217     {
    218     }
    219 
    220     inline QRectF scaledBoundingRect( double sx, double sy,
    221         bool scalePens ) const
     225    PathInfo( const QRectF& pointRect,
     226            const QRectF& boundingRect, bool scalablePen )
     227        : m_pointRect( pointRect )
     228        , m_boundingRect( boundingRect )
     229        , m_scalablePen( scalablePen )
     230    {
     231    }
     232
     233    inline QRectF scaledBoundingRect( qreal sx, qreal sy, bool scalePens ) const
    222234    {
    223235        if ( sx == 1.0 && sy == 1.0 )
    224             return d_boundingRect;
     236            return m_boundingRect;
    225237
    226238        QTransform transform;
    … …  
    228240
    229241        QRectF rect;
    230         if ( scalePens && d_scalablePen )
    231         {
    232             rect = transform.mapRect( d_boundingRect );
     242        if ( scalePens && m_scalablePen )
     243        {
     244            rect = transform.mapRect( m_boundingRect );
    233245        }
    234246        else
    235247        {
    236             rect = transform.mapRect( d_pointRect );
    237 
    238             const double l = qAbs( d_pointRect.left() - d_boundingRect.left() );
    239             const double r = qAbs( d_pointRect.right() - d_boundingRect.right() );
    240             const double t = qAbs( d_pointRect.top() - d_boundingRect.top() );
    241             const double b = qAbs( d_pointRect.bottom() - d_boundingRect.bottom() );
     248            rect = transform.mapRect( m_pointRect );
     249
     250            const qreal l = qAbs( m_pointRect.left() - m_boundingRect.left() );
     251            const qreal r = qAbs( m_pointRect.right() - m_boundingRect.right() );
     252            const qreal t = qAbs( m_pointRect.top() - m_boundingRect.top() );
     253            const qreal b = qAbs( m_pointRect.bottom() - m_boundingRect.bottom() );
    242254
    243255            rect.adjust( -l, -t, r, b );
    … …  
    248260
    249261    inline double scaleFactorX( const QRectF& pathRect,
    250         const QRectF &targetRect, bool scalePens ) const
     262        const QRectF& targetRect, bool scalePens ) const
    251263    {
    252264        if ( pathRect.width() <= 0.0 )
    253265            return 0.0;
    254266
    255         const QPointF p0 = d_pointRect.center();
    256 
    257         const double l = qAbs( pathRect.left() - p0.x() );
    258         const double r = qAbs( pathRect.right() - p0.x() );
    259 
    260         const double w = 2.0 * qMin( l, r )
     267        const QPointF p0 = m_pointRect.center();
     268
     269        const qreal l = qAbs( pathRect.left() - p0.x() );
     270        const qreal r = qAbs( pathRect.right() - p0.x() );
     271
     272        const double w = 2.0 * qwtMinF( l, r )
    261273            * targetRect.width() / pathRect.width();
    262274
    263275        double sx;
    264         if ( scalePens && d_scalablePen )
    265         {
    266             sx = w / d_boundingRect.width();
     276        if ( scalePens && m_scalablePen )
     277        {
     278            sx = w / m_boundingRect.width();
    267279        }
    268280        else
    269281        {
    270             const double pw = qMax(
    271                 qAbs( d_boundingRect.left() - d_pointRect.left() ),
    272                 qAbs( d_boundingRect.right() - d_pointRect.right() ) );
    273 
    274             sx = ( w - 2 * pw ) / d_pointRect.width();
     282            const qreal pw = qwtMaxF(
     283                qAbs( m_boundingRect.left() - m_pointRect.left() ),
     284                qAbs( m_boundingRect.right() - m_pointRect.right() ) );
     285
     286            sx = ( w - 2 * pw ) / m_pointRect.width();
    275287        }
    276288
    … …  
    279291
    280292    inline double scaleFactorY( const QRectF& pathRect,
    281         const QRectF &targetRect, bool scalePens ) const
     293        const QRectF& targetRect, bool scalePens ) const
    282294    {
    283295        if ( pathRect.height() <= 0.0 )
    284296            return 0.0;
    285297
    286         const QPointF p0 = d_pointRect.center();
    287 
    288         const double t = qAbs( pathRect.top() - p0.y() );
    289         const double b = qAbs( pathRect.bottom() - p0.y() );
    290 
    291         const double h = 2.0 * qMin( t, b )
     298        const QPointF p0 = m_pointRect.center();
     299
     300        const qreal t = qAbs( pathRect.top() - p0.y() );
     301        const qreal b = qAbs( pathRect.bottom() - p0.y() );
     302
     303        const qreal h = 2.0 * qwtMinF( t, b )
    292304            * targetRect.height() / pathRect.height();
    293305
    294306        double sy;
    295         if ( scalePens && d_scalablePen )
    296         {
    297             sy = h / d_boundingRect.height();
     307        if ( scalePens && m_scalablePen )
     308        {
     309            sy = h / m_boundingRect.height();
    298310        }
    299311        else
    300312        {
    301             const double pw =
    302                 qMax( qAbs( d_boundingRect.top() - d_pointRect.top() ),
    303                 qAbs( d_boundingRect.bottom() - d_pointRect.bottom() ) );
    304 
    305             sy = ( h - 2 * pw ) / d_pointRect.height();
     313            const qreal pw = qwtMaxF(
     314                qAbs( m_boundingRect.top() - m_pointRect.top() ),
     315                qAbs( m_boundingRect.bottom() - m_pointRect.bottom() ) );
     316
     317            sy = ( h - 2 * pw ) / m_pointRect.height();
    306318        }
    307319
    … …  
    309321    }
    310322
    311 private:
    312     QRectF d_pointRect;
    313     QRectF d_boundingRect;
    314     bool d_scalablePen;
     323  private:
     324    QRectF m_pointRect;
     325    QRectF m_boundingRect;
     326    bool m_scalablePen;
    315327};
    316328
    317329class QwtGraphic::PrivateData
    318330{
    319 public:
    320     PrivateData():
    321         boundingRect( 0.0, 0.0, -1.0, -1.0 ),
    322         pointRect( 0.0, 0.0, -1.0, -1.0 ),
    323         initialTransform( NULL )
     331  public:
     332    PrivateData()
     333        : boundingRect( 0.0, 0.0, -1.0, -1.0 )
     334        , pointRect( 0.0, 0.0, -1.0, -1.0 )
    324335    {
    325336    }
    326337
    327338    QSizeF defaultSize;
    328     QVector<QwtPainterCommand> commands;
    329     QVector<QwtGraphic::PathInfo> pathInfos;
     339    QVector< QwtPainterCommand > commands;
     340    QVector< QwtGraphic::PathInfo > pathInfos;
    330341
    331342    QRectF boundingRect;
    332343    QRectF pointRect;
    333344
     345    QwtGraphic::CommandTypes commandTypes;
    334346    QwtGraphic::RenderHints renderHints;
    335     QTransform *initialTransform;
    336347};
    337348
    338349/*!
    339   \brief Constructor
    340 
    341   Initializes a null graphic
    342   \sa isNull()
    343  */
    344 QwtGraphic::QwtGraphic():
    345     QwtNullPaintDevice()
     350   \brief Constructor
     351
     352   Initializes a null graphic
     353   \sa isNull()
     354 */
     355QwtGraphic::QwtGraphic()
    346356{
    347357    setMode( QwtNullPaintDevice::PathMode );
    348     d_data = new PrivateData;
    349 }
    350 
    351 /*!
    352   \brief Copy constructor
    353 
    354   \param other Source
    355   \sa operator=()
    356  */
    357 QwtGraphic::QwtGraphic( const QwtGraphic &other ):
    358     QwtNullPaintDevice()
     358    m_data = new PrivateData;
     359}
     360
     361/*!
     362   \brief Copy constructor
     363
     364   \param other Source
     365   \sa operator=()
     366 */
     367QwtGraphic::QwtGraphic( const QwtGraphic& other )
    359368{
    360369    setMode( other.mode() );
    361     d_data = new PrivateData( *other.d_data );
     370    m_data = new PrivateData( *other.m_data );
    362371}
    363372
    … …  
    365374QwtGraphic::~QwtGraphic()
    366375{
    367     delete d_data;
    368 }
    369 
    370 /*!
    371   \brief Assignment operator
    372 
    373   \param other Source
    374   \return A reference of this object
    375  */
    376 QwtGraphic& QwtGraphic::operator=(const QwtGraphic &other)
     376    delete m_data;
     377}
     378
     379/*!
     380   \brief Assignment operator
     381
     382   \param other Source
     383   \return A reference of this object
     384 */
     385QwtGraphic& QwtGraphic::operator=( const QwtGraphic& other )
    377386{
    378387    setMode( other.mode() );
    379     *d_data = *other.d_data;
     388    *m_data = *other.m_data;
    380389
    381390    return *this;
    … …  
    383392
    384393/*!
    385   \brief Clear all stored commands
    386   \sa isNull()
     394   \brief Clear all stored commands
     395   \sa isNull()
    387396 */
    388397void QwtGraphic::reset()
    389398{
    390     d_data->commands.clear();
    391     d_data->pathInfos.clear();
    392 
    393     d_data->boundingRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
    394     d_data->pointRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
    395     d_data->defaultSize = QSizeF();
    396 
    397 }
    398 
    399 /*!
    400   \return True, when no painter commands have been stored
    401   \sa isEmpty(), commands()
    402 */
     399    m_data->commands.clear();
     400    m_data->pathInfos.clear();
     401
     402    m_data->commandTypes = CommandTypes();
     403
     404    m_data->boundingRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
     405    m_data->pointRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
     406    m_data->defaultSize = QSizeF();
     407}
     408
     409/*!
     410   \return True, when no painter commands have been stored
     411   \sa isEmpty(), commands()
     412 */
    403413bool QwtGraphic::isNull() const
    404414{
    405     return d_data->commands.isEmpty();
    406 }
    407 
    408 /*!
    409   \return True, when the bounding rectangle is empty
    410   \sa boundingRect(), isNull()
    411 */
     415    return m_data->commands.isEmpty();
     416}
     417
     418/*!
     419   \return True, when the bounding rectangle is empty
     420   \sa boundingRect(), isNull()
     421 */
    412422bool QwtGraphic::isEmpty() const
    413423{
    414     return d_data->boundingRect.isEmpty();
    415 }
    416 
    417 /*!
    418   Toggle an render hint
    419 
    420   \param hint Render hint
    421   \param on true/false
    422 
    423   \sa testRenderHint(), RenderHint
    424 */
     424    return m_data->boundingRect.isEmpty();
     425}
     426
     427/*!
     428   \return Types of painter commands being used
     429 */
     430QwtGraphic::CommandTypes QwtGraphic::commandTypes() const
     431{
     432    return m_data->commandTypes;
     433}
     434
     435/*!
     436   Toggle an render hint
     437
     438   \param hint Render hint
     439   \param on true/false
     440
     441   \sa testRenderHint(), RenderHint
     442 */
    425443void QwtGraphic::setRenderHint( RenderHint hint, bool on )
    426444{
    427445    if ( on )
    428         d_data->renderHints |= hint;
     446        m_data->renderHints |= hint;
    429447    else
    430         d_data->renderHints &= ~hint;
    431 }
    432 
    433 /*!
    434   Test a render hint
    435 
    436   \param hint Render hint
    437   \return true/false
    438   \sa setRenderHint(), RenderHint
    439 */
     448        m_data->renderHints &= ~hint;
     449}
     450
     451/*!
     452   Test a render hint
     453
     454   \param hint Render hint
     455   \return true/false
     456   \sa setRenderHint(), RenderHint
     457 */
    440458bool QwtGraphic::testRenderHint( RenderHint hint ) const
    441459{
    442     return d_data->renderHints.testFlag( hint );
    443 }
    444 
    445 /*!
    446   The bounding rectangle is the controlPointRect()
    447   extended by the areas needed for rendering the outlines
    448   with unscaled pens.
    449 
    450   \return Bounding rectangle of the graphic
    451   \sa controlPointRect(), scaledBoundingRect()
     460    return m_data->renderHints.testFlag( hint );
     461}
     462
     463//! \return Render hints
     464QwtGraphic::RenderHints QwtGraphic::renderHints() const
     465{
     466    return m_data->renderHints;
     467}
     468
     469/*!
     470   The bounding rectangle is the controlPointRect()
     471   extended by the areas needed for rendering the outlines
     472   with unscaled pens.
     473
     474   \return Bounding rectangle of the graphic
     475   \sa controlPointRect(), scaledBoundingRect()
    452476 */
    453477QRectF QwtGraphic::boundingRect() const
    454478{
    455     if ( d_data->boundingRect.width() < 0 )
     479    if ( m_data->boundingRect.width() < 0 )
    456480        return QRectF();
    457481
    458     return d_data->boundingRect;
    459 }
    460 
    461 /*!
    462   The control point rectangle is the bounding rectangle
    463   of all control points of the paths and the target
    464   rectangles of the images/pixmaps.
    465 
    466   \return Control point rectangle
    467   \sa boundingRect(), scaledBoundingRect()
     482    return m_data->boundingRect;
     483}
     484
     485/*!
     486   The control point rectangle is the bounding rectangle
     487   of all control points of the paths and the target
     488   rectangles of the images/pixmaps.
     489
     490   \return Control point rectangle
     491   \sa boundingRect(), scaledBoundingRect()
    468492 */
    469493QRectF QwtGraphic::controlPointRect() const
    470494{
    471     if ( d_data->pointRect.width() < 0 )
     495    if ( m_data->pointRect.width() < 0 )
    472496        return QRectF();
    473497
    474     return d_data->pointRect;
    475 }
    476 
    477 /*!
    478   \brief Calculate the target rectangle for scaling the graphic
    479 
    480   \param sx Horizontal scaling factor
    481   \param sy Vertical scaling factor
    482 
    483   \note In case of paths that are painted with a cosmetic pen
     498    return m_data->pointRect;
     499}
     500
     501/*!
     502   \brief Calculate the target rectangle for scaling the graphic
     503
     504   \param sx Horizontal scaling factor
     505   \param sy Vertical scaling factor
     506
     507   \note In case of paths that are painted with a cosmetic pen
    484508        ( see QPen::isCosmetic() ) the target rectangle is different to
    485509        multiplying the bounding rectangle.
    486510
    487   \return Scaled bounding rectangle
    488   \sa boundingRect(), controlPointRect()
    489  */
    490 QRectF QwtGraphic::scaledBoundingRect( double sx, double sy ) const
     511   \return Scaled bounding rectangle
     512   \sa boundingRect(), controlPointRect()
     513 */
     514QRectF QwtGraphic::scaledBoundingRect( qreal sx, qreal sy ) const
    491515{
    492516    if ( sx == 1.0 && sy == 1.0 )
    493         return d_data->boundingRect;
     517        return m_data->boundingRect;
     518
     519    const bool scalePens = !( m_data->renderHints & RenderPensUnscaled );
    494520
    495521    QTransform transform;
    496522    transform.scale( sx, sy );
    497523
    498     QRectF rect = transform.mapRect( d_data->pointRect );
    499 
    500     for ( int i = 0; i < d_data->pathInfos.size(); i++ )
    501     {
    502         rect |= d_data->pathInfos[i].scaledBoundingRect( sx, sy,
    503             !d_data->renderHints.testFlag( RenderPensUnscaled ) );
    504     }
     524    QRectF rect = transform.mapRect( m_data->pointRect );
     525
     526    for ( int i = 0; i < m_data->pathInfos.size(); i++ )
     527        rect |= m_data->pathInfos[i].scaledBoundingRect( sx, sy, scalePens );
    505528
    506529    return rect;
    … …  
    511534{
    512535    const QSizeF sz = defaultSize();
    513     return QSize( qCeil( sz.width() ), qCeil( sz.height() ) );
    514 }
    515 
    516 /*!
    517   \brief Set a default size
    518 
    519   The default size is used in all methods rendering the graphic,
    520   where no size is explicitly specified. Assigning an empty size
    521   means, that the default size will be calculated from the bounding
    522   rectangle.
    523 
    524   The default setting is an empty size.
    525 
    526   \param size Default size
    527 
    528   \sa defaultSize(), boundingRect()
    529  */
    530 void QwtGraphic::setDefaultSize( const QSizeF &size )
    531 {
    532     const double w = qMax( qreal( 0.0 ), size.width() );
    533     const double h = qMax( qreal( 0.0 ), size.height() );
    534 
    535     d_data->defaultSize = QSizeF( w, h );
    536 }
    537 
    538 /*!
    539   \brief Default size
    540 
    541   When a non empty size has been assigned by setDefaultSize() this
    542   size will be returned. Otherwise the default size is the size
    543   of the bounding rectangle.
    544 
    545   The default size is used in all methods rendering the graphic,
    546   where no size is explicitly specified.
    547 
    548   \return Default size
    549   \sa setDefaultSize(), boundingRect()
     536    return QSize( qwtCeil( sz.width() ), qwtCeil( sz.height() ) );
     537}
     538
     539/*!
     540   \brief Set a default size
     541
     542   The default size is used in all methods rendering the graphic,
     543   where no size is explicitly specified. Assigning an empty size
     544   means, that the default size will be calculated from the bounding
     545   rectangle.
     546
     547   The default setting is an empty size.
     548
     549   \param size Default size
     550
     551   \sa defaultSize(), boundingRect()
     552 */
     553void QwtGraphic::setDefaultSize( const QSizeF& size )
     554{
     555    const double w = qwtMaxF( 0.0, size.width() );
     556    const double h = qwtMaxF( 0.0, size.height() );
     557
     558    m_data->defaultSize = QSizeF( w, h );
     559}
     560
     561/*!
     562   \brief Default size
     563
     564   When a non empty size has been assigned by setDefaultSize() this
     565   size will be returned. Otherwise the default size is the size
     566   of the bounding rectangle.
     567
     568   The default size is used in all methods rendering the graphic,
     569   where no size is explicitly specified.
     570
     571   \return Default size
     572   \sa setDefaultSize(), boundingRect()
    550573 */
    551574QSizeF QwtGraphic::defaultSize() const
    552575{
    553     if ( !d_data->defaultSize.isEmpty() )
    554         return d_data->defaultSize;
     576    if ( !m_data->defaultSize.isEmpty() )
     577        return m_data->defaultSize;
    555578
    556579    return boundingRect().size();
    … …  
    558581
    559582/*!
    560   \brief Replay all recorded painter commands
    561   \param painter Qt painter
    562  */
    563 void QwtGraphic::render( QPainter *painter ) const
     583   Find the height for a given width
     584
     585   The height is calculated using the aspect ratio of defaultSize().
     586
     587   \param width Width
     588
     589   \return Calculated height
     590   \sa defaultSize()
     591 */
     592qreal QwtGraphic::heightForWidth( qreal width ) const
     593{
     594    const QSizeF sz = defaultSize();
     595    if ( sz.isEmpty() )
     596        return 0.0;
     597
     598    return sz.height() * width / sz.width();
     599}
     600
     601/*!
     602   Find the width for a given height
     603
     604   The width is calculated using the aspect ratio of defaultSize().
     605
     606   \param height Height
     607
     608   \return Calculated width
     609   \sa defaultSize()
     610 */
     611qreal QwtGraphic::widthForHeight( qreal height ) const
     612{
     613    const QSizeF sz = defaultSize();
     614    if ( sz.isEmpty() )
     615        return 0.0;
     616
     617    return sz.width() * height / sz.height();
     618}
     619
     620/*!
     621   \brief Replay all recorded painter commands
     622   \param painter Qt painter
     623 */
     624void QwtGraphic::render( QPainter* painter ) const
     625{
     626    renderGraphic( painter, NULL );
     627}
     628
     629void QwtGraphic::renderGraphic( QPainter* painter, QTransform* initialTransform ) const
    564630{
    565631    if ( isNull() )
    566632        return;
    567633
    568     const int numCommands = d_data->commands.size();
    569     const QwtPainterCommand *commands = d_data->commands.constData();
     634    const int numCommands = m_data->commands.size();
     635    const QwtPainterCommand* commands = m_data->commands.constData();
    570636
    571637    const QTransform transform = painter->transform();
    … …  
    576642    {
    577643        qwtExecCommand( painter, commands[i],
    578             d_data->renderHints, transform, d_data->initialTransform );
     644            m_data->renderHints, transform, initialTransform );
    579645    }
    580646
    … …  
    583649
    584650/*!
    585   \brief Replay all recorded painter commands
    586 
    587   The graphic is scaled to fit into the rectangle
    588   of the given size starting at ( 0, 0 ).
    589 
    590   \param painter Qt painter
    591   \param size Size for the scaled graphic
    592   \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode
    593  */
    594 void QwtGraphic::render( QPainter *painter, const QSizeF &size,
     651   \brief Replay all recorded painter commands
     652
     653   The graphic is scaled to fit into the rectangle
     654   of the given size starting at ( 0, 0 ).
     655
     656   \param painter Qt painter
     657   \param size Size for the scaled graphic
     658   \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode
     659 */
     660void QwtGraphic::render( QPainter* painter, const QSizeF& size,
    595661    Qt::AspectRatioMode aspectRatioMode ) const
    596662{
    … …  
    600666
    601667/*!
    602   \brief Replay all recorded painter commands
    603 
    604   The graphic is scaled to fit into the given rectangle
    605 
    606   \param painter Qt painter
    607   \param rect Rectangle for the scaled graphic
    608   \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode
    609  */
    610 void QwtGraphic::render( QPainter *painter, const QRectF &rect,
     668   \brief Replay all recorded painter commands
     669
     670   The graphic is scaled to fit into the given rectangle
     671
     672   \param painter Qt painter
     673   \param rect Rectangle for the scaled graphic
     674   \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode
     675 */
     676void QwtGraphic::render( QPainter* painter, const QRectF& rect,
    611677    Qt::AspectRatioMode aspectRatioMode ) const
    612678{
    … …  
    617683    double sy = 1.0;
    618684
    619     if ( d_data->pointRect.width() > 0.0 )
    620         sx = rect.width() / d_data->pointRect.width();
    621 
    622     if ( d_data->pointRect.height() > 0.0 )
    623         sy = rect.height() / d_data->pointRect.height();
    624 
    625     const bool scalePens =
    626         !d_data->renderHints.testFlag( RenderPensUnscaled );
    627 
    628     for ( int i = 0; i < d_data->pathInfos.size(); i++ )
    629     {
    630         const PathInfo info = d_data->pathInfos[i];
     685    if ( m_data->pointRect.width() > 0.0 )
     686        sx = rect.width() / m_data->pointRect.width();
     687
     688    if ( m_data->pointRect.height() > 0.0 )
     689        sy = rect.height() / m_data->pointRect.height();
     690
     691    const bool scalePens = !m_data->renderHints.testFlag( RenderPensUnscaled );
     692
     693    for ( int i = 0; i < m_data->pathInfos.size(); i++ )
     694    {
     695        const PathInfo& info = m_data->pathInfos[i];
    631696
    632697        const double ssx = info.scaleFactorX(
    633             d_data->pointRect, rect, scalePens );
     698            m_data->pointRect, rect, scalePens );
    634699
    635700        if ( ssx > 0.0 )
    636             sx = qMin( sx, ssx );
     701            sx = qwtMinF( sx, ssx );
    637702
    638703        const double ssy = info.scaleFactorY(
    639             d_data->pointRect, rect, scalePens );
     704            m_data->pointRect, rect, scalePens );
    640705
    641706        if ( ssy > 0.0 )
    642             sy = qMin( sy, ssy );
     707            sy = qwtMinF( sy, ssy );
    643708    }
    644709
    645710    if ( aspectRatioMode == Qt::KeepAspectRatio )
    646711    {
    647         const double s = qMin( sx, sy );
     712        const qreal s = qwtMinF( sx, sy );
    648713        sx = s;
    649714        sy = s;
    … …  
    651716    else if ( aspectRatioMode == Qt::KeepAspectRatioByExpanding )
    652717    {
    653         const double s = qMax( sx, sy );
     718        const qreal s = qwtMaxF( sx, sy );
    654719        sx = s;
    655720        sy = s;
    … …  
    657722
    658723    QTransform tr;
    659     tr.translate( rect.center().x() - 0.5 * sx * d_data->pointRect.width(),
    660         rect.center().y() - 0.5 * sy * d_data->pointRect.height() );
     724    tr.translate( rect.center().x() - 0.5 * sx * m_data->pointRect.width(),
     725        rect.center().y() - 0.5 * sy * m_data->pointRect.height() );
    661726    tr.scale( sx, sy );
    662     tr.translate( -d_data->pointRect.x(), -d_data->pointRect.y() );
     727    tr.translate( -m_data->pointRect.x(), -m_data->pointRect.y() );
    663728
    664729    const QTransform transform = painter->transform();
     730
     731    painter->setTransform( tr, true );
     732
    665733    if ( !scalePens && transform.isScaling() )
    666734    {
    … …  
    669737        // painter transformation later
    670738
    671         d_data->initialTransform = new QTransform();
    672         d_data->initialTransform->scale( transform.m11(), transform.m22() );
    673     }
    674 
    675     painter->setTransform( tr, true );
    676     render( painter );
     739        QTransform initialTransform;
     740        initialTransform.scale( transform.m11(), transform.m22() );
     741
     742        renderGraphic( painter, &initialTransform );
     743    }
     744    else
     745    {
     746        renderGraphic( painter, NULL );
     747    }
    677748
    678749    painter->setTransform( transform );
    679 
    680     delete d_data->initialTransform;
    681     d_data->initialTransform = NULL;
    682 }
    683 
    684 /*!
    685   \brief Replay all recorded painter commands
    686 
    687   The graphic is scaled to the defaultSize() and aligned
    688   to a position.
    689 
    690   \param painter Qt painter
    691   \param pos Reference point, where to render
    692   \param alignment Flags how to align the target rectangle
    693                    to pos.
    694  */
    695 void QwtGraphic::render( QPainter *painter,
    696     const QPointF &pos, Qt::Alignment alignment ) const
     750}
     751
     752/*!
     753   \brief Replay all recorded painter commands
     754
     755   The graphic is scaled to the defaultSize() and aligned
     756   to a position.
     757
     758   \param painter Qt painter
     759   \param pos Reference point, where to render
     760   \param alignment Flags how to align the target rectangle to pos.
     761 */
     762void QwtGraphic::render( QPainter* painter,
     763    const QPointF& pos, Qt::Alignment alignment ) const
    697764{
    698765    QRectF r( pos, defaultSize() );
    … …  
    728795
    729796/*!
    730   \brief Convert the graphic to a QPixmap
    731 
    732   All pixels of the pixmap get initialized by Qt::transparent
    733   before the graphic is scaled and rendered on it.
    734 
    735   The size of the pixmap is the default size ( ceiled to integers )
    736   of the graphic.
    737 
    738   \return The graphic as pixmap in default size
    739   \sa defaultSize(), toImage(), render()
    740  */
    741 QPixmap QwtGraphic::toPixmap() const
     797   \brief Convert the graphic to a QPixmap
     798
     799   All pixels of the pixmap get initialized by Qt::transparent
     800   before the graphic is scaled and rendered on it.
     801
     802   The size of the pixmap is the default size ( ceiled to integers )
     803   of the graphic.
     804
     805   \param devicePixelRatio Device pixel ratio for the pixmap.
     806                          If devicePixelRatio <= 0.0 the pixmap
     807                          is initialized with the system default.
     808
     809   \return The graphic as pixmap in default size
     810   \sa defaultSize(), toImage(), render()
     811 */
     812QPixmap QwtGraphic::toPixmap( qreal devicePixelRatio ) const
    742813{
    743814    if ( isNull() )
    … …  
    746817    const QSizeF sz = defaultSize();
    747818
    748     const int w = qCeil( sz.width() );
    749     const int h = qCeil( sz.height() );
     819#if QT_VERSION >= 0x050000
     820    if ( devicePixelRatio <= 0.0 )
     821        devicePixelRatio = qwtDevicePixelRatio();
     822
     823    const int w = qwtCeil( sz.width() * devicePixelRatio );
     824    const int h = qwtCeil( sz.height() * devicePixelRatio );
    750825
    751826    QPixmap pixmap( w, h );
     827    pixmap.setDevicePixelRatio( devicePixelRatio );
     828#else
     829    Q_UNUSED( devicePixelRatio )
     830
     831    const int w = qwtCeil( sz.width() );
     832    const int h = qwtCeil( sz.height() );
     833
     834    QPixmap pixmap( w, h );
     835#endif
     836
    752837    pixmap.fill( Qt::transparent );
    753838
    … …  
    762847
    763848/*!
    764   \brief Convert the graphic to a QPixmap
    765 
    766   All pixels of the pixmap get initialized by Qt::transparent
    767   before the graphic is scaled and rendered on it.
    768 
    769   \param size Size of the image
    770   \param aspectRatioMode Aspect ratio how to scale the graphic
    771 
    772   \return The graphic as pixmap
    773   \sa toImage(), render()
    774  */
    775 QPixmap QwtGraphic::toPixmap( const QSize &size,
    776     Qt::AspectRatioMode aspectRatioMode ) const
    777 {
     849   \brief Convert the graphic to a QPixmap
     850
     851   All pixels of the pixmap get initialized by Qt::transparent
     852   before the graphic is scaled and rendered on it.
     853
     854   \param size Size of the image
     855   \param aspectRatioMode Aspect ratio how to scale the graphic
     856   \param devicePixelRatio Device pixel ratio for the pixmap.
     857                          If devicePixelRatio <= 0.0 the pixmap
     858                          is initialized with the system default.
     859
     860   \return The graphic as pixmap
     861   \sa toImage(), render()
     862 */
     863QPixmap QwtGraphic::toPixmap( const QSize& size,
     864    Qt::AspectRatioMode aspectRatioMode, qreal devicePixelRatio ) const
     865{
     866#if QT_VERSION >= 0x050000
     867    if ( devicePixelRatio <= 0.0 )
     868        devicePixelRatio = qwtDevicePixelRatio();
     869
     870    const int w = qwtCeil( size.width() * devicePixelRatio );
     871    const int h = qwtCeil( size.height() * devicePixelRatio );
     872
     873    QPixmap pixmap( w, h );
     874    pixmap.setDevicePixelRatio( devicePixelRatio );
     875#else
     876    Q_UNUSED( devicePixelRatio )
    778877    QPixmap pixmap( size );
     878#endif
    779879    pixmap.fill( Qt::transparent );
    780880
    … …  
    789889
    790890/*!
    791   \brief Convert the graphic to a QImage
    792 
    793   All pixels of the image get initialized by 0 ( transparent )
    794   before the graphic is scaled and rendered on it.
    795 
    796   The format of the image is QImage::Format_ARGB32_Premultiplied.
    797 
    798   \param size Size of the image
    799   \param aspectRatioMode Aspect ratio how to scale the graphic
    800 
    801   \return The graphic as image
    802   \sa toPixmap(), render()
    803  */
    804 QImage QwtGraphic::toImage( const QSize &size,
    805     Qt::AspectRatioMode aspectRatioMode  ) const
    806 {
     891   \brief Convert the graphic to a QImage
     892
     893   All pixels of the image get initialized by 0 ( transparent )
     894   before the graphic is scaled and rendered on it.
     895
     896   The format of the image is QImage::Format_ARGB32_Premultiplied.
     897
     898   \param size Size of the image ( will be multiplied by the devicePixelRatio )
     899   \param aspectRatioMode Aspect ratio how to scale the graphic
     900   \param devicePixelRatio Device pixel ratio for the image.
     901                          If devicePixelRatio <= 0.0 the pixmap
     902                          is initialized with the system default.
     903
     904   \return The graphic as image
     905   \sa toPixmap(), render()
     906 */
     907QImage QwtGraphic::toImage( const QSize& size,
     908    Qt::AspectRatioMode aspectRatioMode, qreal devicePixelRatio  ) const
     909{
     910#if QT_VERSION >= 0x050000
     911    if ( devicePixelRatio <= 0.0 )
     912        devicePixelRatio = qwtDevicePixelRatio();
     913
     914    const int w = qwtCeil( size.width() * devicePixelRatio );
     915    const int h = qwtCeil( size.height() * devicePixelRatio );
     916
     917    QImage image( w, h, QImage::Format_ARGB32_Premultiplied );
     918    image.setDevicePixelRatio( devicePixelRatio );
     919#else
     920    Q_UNUSED( devicePixelRatio )
    807921    QImage image( size, QImage::Format_ARGB32_Premultiplied );
     922#endif
     923
    808924    image.fill( 0 );
    809925
    … …  
    818934
    819935/*!
    820   \brief Convert the graphic to a QImage
    821 
    822   All pixels of the image get initialized by 0 ( transparent )
    823   before the graphic is scaled and rendered on it.
    824 
    825   The format of the image is QImage::Format_ARGB32_Premultiplied.
    826 
    827   The size of the image is the default size ( ceiled to integers )
    828   of the graphic.
    829 
    830   \return The graphic as image in default size
    831   \sa defaultSize(), toPixmap(), render()
    832  */
    833 QImage QwtGraphic::toImage() const
     936   \brief Convert the graphic to a QImage
     937
     938   All pixels of the image get initialized by 0 ( transparent )
     939   before the graphic is scaled and rendered on it.
     940
     941   The format of the image is QImage::Format_ARGB32_Premultiplied.
     942
     943   The size of the image is the default size ( ceiled to integers )
     944   of the graphic multiplied by the devicePixelRatio.
     945
     946   \param devicePixelRatio Device pixel ratio for the image.
     947                          If devicePixelRatio <= 0.0 the pixmap
     948                          is initialized with the system default.
     949
     950   \return The graphic as image in default size
     951   \sa defaultSize(), toPixmap(), render()
     952 */
     953QImage QwtGraphic::toImage( qreal devicePixelRatio ) const
    834954{
    835955    if ( isNull() )
    … …  
    838958    const QSizeF sz = defaultSize();
    839959
    840     const int w = qCeil( sz.width() );
    841     const int h = qCeil( sz.height() );
     960#if QT_VERSION >= 0x050000
     961    if ( devicePixelRatio <= 0.0 )
     962        devicePixelRatio = qwtDevicePixelRatio();
     963
     964    const int w = qwtCeil( sz.width() * devicePixelRatio );
     965    const int h = qwtCeil( sz.height() * devicePixelRatio );
    842966
    843967    QImage image( w, h, QImage::Format_ARGB32 );
     968    image.setDevicePixelRatio( devicePixelRatio );
     969#else
     970    Q_UNUSED( devicePixelRatio )
     971
     972    const int w = qwtCeil( sz.width() );
     973    const int h = qwtCeil( sz.height() );
     974
     975    QImage image( w, h, QImage::Format_ARGB32 );
     976#endif
     977
    844978    image.fill( 0 );
    845979
    … …  
    854988
    855989/*!
    856   Store a path command in the command list
    857 
    858   \param path Painter path
    859   \sa QPaintEngine::drawPath()
    860 */
    861 void QwtGraphic::drawPath( const QPainterPath &path )
    862 {
    863     const QPainter *painter = paintEngine()->painter();
     990   Store a path command in the command list
     991
     992   \param path Painter path
     993   \sa QPaintEngine::drawPath()
     994 */
     995void QwtGraphic::drawPath( const QPainterPath& path )
     996{
     997    const QPainter* painter = paintEngine()->painter();
    864998    if ( painter == NULL )
    865999        return;
    8661000
    867     d_data->commands += QwtPainterCommand( path );
     1001    m_data->commands += QwtPainterCommand( path );
     1002    m_data->commandTypes |= QwtGraphic::VectorData;
    8681003
    8691004    if ( !path.isEmpty() )
    … …  
    8831018        updateBoundingRect( boundingRect );
    8841019
    885         d_data->pathInfos += PathInfo( pointRect,
     1020        m_data->pathInfos += PathInfo( pointRect,
    8861021            boundingRect, qwtHasScalablePen( painter ) );
    8871022    }
    … …  
    8891024
    8901025/*!
    891   \brief Store a pixmap command in the command list
    892 
    893   \param rect target rectangle
    894   \param pixmap Pixmap to be painted
    895   \param subRect Reactangle of the pixmap to be painted
    896 
    897   \sa QPaintEngine::drawPixmap()
    898 */
    899 void QwtGraphic::drawPixmap( const QRectF &rect,
    900     const QPixmap &pixmap, const QRectF &subRect )
    901 {
    902     const QPainter *painter = paintEngine()->painter();
     1026   \brief Store a pixmap command in the command list
     1027
     1028   \param rect target rectangle
     1029   \param pixmap Pixmap to be painted
     1030   \param subRect Reactangle of the pixmap to be painted
     1031
     1032   \sa QPaintEngine::drawPixmap()
     1033 */
     1034void QwtGraphic::drawPixmap( const QRectF& rect,
     1035    const QPixmap& pixmap, const QRectF& subRect )
     1036{
     1037    const QPainter* painter = paintEngine()->painter();
    9031038    if ( painter == NULL )
    9041039        return;
    9051040
    906     d_data->commands += QwtPainterCommand( rect, pixmap, subRect );
     1041    m_data->commands += QwtPainterCommand( rect, pixmap, subRect );
     1042    m_data->commandTypes |= QwtGraphic::RasterData;
    9071043
    9081044    const QRectF r = painter->transform().mapRect( rect );
    … …  
    9121048
    9131049/*!
    914   \brief Store a image command in the command list
    915 
    916   \param rect traget rectangle
    917   \param image Image to be painted
    918   \param subRect Reactangle of the pixmap to be painted
    919   \param flags Image conversion flags
    920 
    921   \sa QPaintEngine::drawImage()
    922  */
    923 void QwtGraphic::drawImage( const QRectF &rect, const QImage &image,
    924     const QRectF &subRect, Qt::ImageConversionFlags flags)
    925 {
    926     const QPainter *painter = paintEngine()->painter();
     1050   \brief Store a image command in the command list
     1051
     1052   \param rect target rectangle
     1053   \param image Image to be painted
     1054   \param subRect Reactangle of the pixmap to be painted
     1055   \param flags Image conversion flags
     1056
     1057   \sa QPaintEngine::drawImage()
     1058 */
     1059void QwtGraphic::drawImage( const QRectF& rect, const QImage& image,
     1060    const QRectF& subRect, Qt::ImageConversionFlags flags )
     1061{
     1062    const QPainter* painter = paintEngine()->painter();
    9271063    if ( painter == NULL )
    9281064        return;
    9291065
    930     d_data->commands += QwtPainterCommand( rect, image, subRect, flags );
     1066    m_data->commands += QwtPainterCommand( rect, image, subRect, flags );
     1067    m_data->commandTypes |= QwtGraphic::RasterData;
    9311068
    9321069    const QRectF r = painter->transform().mapRect( rect );
    … …  
    9371074
    9381075/*!
    939   \brief Store a state command in the command list
    940 
    941   \param state State to be stored
    942   \sa QPaintEngine::updateState()
    943  */
    944 void QwtGraphic::updateState( const QPaintEngineState &state)
    945 {
    946     d_data->commands += QwtPainterCommand( state );
    947 }
    948 
    949 void QwtGraphic::updateBoundingRect( const QRectF &rect )
     1076   \brief Store a state command in the command list
     1077
     1078   \param state State to be stored
     1079   \sa QPaintEngine::updateState()
     1080 */
     1081void QwtGraphic::updateState( const QPaintEngineState& state )
     1082{
     1083    m_data->commands += QwtPainterCommand( state );
     1084
     1085    if ( state.state() & QPaintEngine::DirtyTransform )
     1086    {
     1087        if ( !( m_data->commandTypes & QwtGraphic::Transformation ) )
     1088        {
     1089            /*
     1090                QTransform::isScaling() returns true for all type
     1091                of transformations beside simple translations
     1092                even if it is f.e a rotation
     1093             */
     1094            if ( state.transform().isScaling() )
     1095                m_data->commandTypes |= QwtGraphic::Transformation;
     1096        }
     1097    }
     1098}
     1099
     1100void QwtGraphic::updateBoundingRect( const QRectF& rect )
    9501101{
    9511102    QRectF br = rect;
    9521103
    953     const QPainter *painter = paintEngine()->painter();
     1104    const QPainter* painter = paintEngine()->painter();
    9541105    if ( painter && painter->hasClipping() )
    9551106    {
    … …  
    9601111    }
    9611112
    962     if ( d_data->boundingRect.width() < 0 )
    963         d_data->boundingRect = br;
     1113    if ( m_data->boundingRect.width() < 0 )
     1114        m_data->boundingRect = br;
    9641115    else
    965         d_data->boundingRect |= br;
    966 }
    967 
    968 void QwtGraphic::updateControlPointRect( const QRectF &rect )
    969 {
    970     if ( d_data->pointRect.width() < 0.0 )
    971         d_data->pointRect = rect;
     1116        m_data->boundingRect |= br;
     1117}
     1118
     1119void QwtGraphic::updateControlPointRect( const QRectF& rect )
     1120{
     1121    if ( m_data->pointRect.width() < 0.0 )
     1122        m_data->pointRect = rect;
    9721123    else
    973         d_data->pointRect |= rect;
    974 }
    975 
    976 /*!
    977   \return List of recorded paint commands
    978   \sa setCommands()
    979  */
    980 const QVector< QwtPainterCommand > &QwtGraphic::commands() const
    981 {
    982     return d_data->commands;
    983 }
    984 
    985 /*!
    986   \brief Append paint commands
    987 
    988   \param commands Paint commands
    989   \sa commands()
    990  */
    991 void QwtGraphic::setCommands( QVector< QwtPainterCommand > &commands )
     1124        m_data->pointRect |= rect;
     1125}
     1126
     1127/*!
     1128   \return List of recorded paint commands
     1129   \sa setCommands()
     1130 */
     1131const QVector< QwtPainterCommand >& QwtGraphic::commands() const
     1132{
     1133    return m_data->commands;
     1134}
     1135
     1136/*!
     1137   \brief Append paint commands
     1138
     1139   \param commands Paint commands
     1140   \sa commands()
     1141 */
     1142void QwtGraphic::setCommands( const QVector< QwtPainterCommand >& commands )
    9921143{
    9931144    reset();
    … …  
    10001151    // the commands.
    10011152
    1002     const QwtPainterCommand *cmds = commands.constData();
     1153    const QwtPainterCommand* cmds = commands.constData();
     1154
     1155    const QTransform noTransform;
     1156    const RenderHints noRenderHints;
    10031157
    10041158    QPainter painter( this );
    10051159    for ( int i = 0; i < numCommands; i++ )
    1006         qwtExecCommand( &painter, cmds[i], RenderHints(), QTransform(), NULL );
     1160        qwtExecCommand( &painter, cmds[i], noRenderHints, noTransform, NULL );
    10071161
    10081162    painter.end();
Note: See TracChangeset for help on using the changeset viewer.