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


Ignore:
Timestamp:
Mar 19, 2021, 9:15:03 AM (3 years ago)
Author:
stoecker
Message:

update to qwt verion 6.1.1 to fix build with newer Qt5

File:
1 edited

Legend:

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

    r8127 r9383  
    3838}
    3939
    40 static QRectF qwtStrokedPathRect( 
     40static QRectF qwtStrokedPathRect(
    4141    const QPainter *painter, const QPainterPath &path )
    4242{
     
    6464}
    6565
    66 static inline void qwtExecCommand( 
    67     QPainter *painter, const QwtPainterCommand &cmd, 
     66static inline void qwtExecCommand(
     67    QPainter *painter, const QwtPainterCommand &cmd,
    6868    QwtGraphic::RenderHints renderHints,
    6969    const QTransform &transform,
     
    122122        {
    123123            const QwtPainterCommand::ImageData *data = cmd.imageData();
    124             painter->drawImage( data->rect, data->image, 
     124            painter->drawImage( data->rect, data->image,
    125125                data->subRect, data->flags );
    126126            break;
     
    130130            const QwtPainterCommand::StateData *data = cmd.stateData();
    131131
    132             if ( data->flags & QPaintEngine::DirtyPen ) 
     132            if ( data->flags & QPaintEngine::DirtyPen )
    133133                painter->setPen( data->pen );
    134134
    135             if ( data->flags & QPaintEngine::DirtyBrush ) 
     135            if ( data->flags & QPaintEngine::DirtyBrush )
    136136                painter->setBrush( data->brush );
    137137
    138             if ( data->flags & QPaintEngine::DirtyBrushOrigin ) 
     138            if ( data->flags & QPaintEngine::DirtyBrushOrigin )
    139139                painter->setBrushOrigin( data->brushOrigin );
    140140
    141             if ( data->flags & QPaintEngine::DirtyFont ) 
     141            if ( data->flags & QPaintEngine::DirtyFont )
    142142                painter->setFont( data->font );
    143143
    144             if ( data->flags & QPaintEngine::DirtyBackground ) 
     144            if ( data->flags & QPaintEngine::DirtyBackground )
    145145            {
    146146                painter->setBackgroundMode( data->backgroundMode );
     
    148148            }
    149149
    150             if ( data->flags & QPaintEngine::DirtyTransform ) 
     150            if ( data->flags & QPaintEngine::DirtyTransform )
    151151            {
    152152                painter->setTransform( data->transform * transform );
    153153            }
    154154
    155             if ( data->flags & QPaintEngine::DirtyClipEnabled ) 
     155            if ( data->flags & QPaintEngine::DirtyClipEnabled )
    156156                painter->setClipping( data->isClipEnabled );
    157157
    158             if ( data->flags & QPaintEngine::DirtyClipRegion) 
     158            if ( data->flags & QPaintEngine::DirtyClipRegion)
    159159            {
    160                 painter->setClipRegion( data->clipRegion, 
     160                painter->setClipRegion( data->clipRegion,
    161161                    data->clipOperation );
    162162            }
    163163
    164             if ( data->flags & QPaintEngine::DirtyClipPath ) 
     164            if ( data->flags & QPaintEngine::DirtyClipPath )
    165165            {
    166166                painter->setClipPath( data->clipPath, data->clipOperation );
    167167            }
    168168
    169             if ( data->flags & QPaintEngine::DirtyHints) 
     169            if ( data->flags & QPaintEngine::DirtyHints)
    170170            {
    171171                const QPainter::RenderHints hints = data->renderHints;
     
    187187            }
    188188
    189             if ( data->flags & QPaintEngine::DirtyCompositionMode) 
     189            if ( data->flags & QPaintEngine::DirtyCompositionMode)
    190190                painter->setCompositionMode( data->compositionMode );
    191191
    192             if ( data->flags & QPaintEngine::DirtyOpacity) 
     192            if ( data->flags & QPaintEngine::DirtyOpacity)
    193193                painter->setOpacity( data->opacity );
    194194
     
    210210    }
    211211
    212     PathInfo( const QRectF &pointRect, 
     212    PathInfo( const QRectF &pointRect,
    213213            const QRectF &boundingRect, bool scalablePen ):
    214214        d_pointRect( pointRect ),
     
    247247    }
    248248
    249     inline double scaleFactorX( const QRectF& pathRect, 
     249    inline double scaleFactorX( const QRectF& pathRect,
    250250        const QRectF &targetRect, bool scalePens ) const
    251251    {
     
    258258        const double r = qAbs( pathRect.right() - p0.x() );
    259259
    260         const double w = 2.0 * qMin( l, r ) 
     260        const double w = 2.0 * qMin( l, r )
    261261            * targetRect.width() / pathRect.width();
    262262
     
    268268        else
    269269        {
    270             const double pw = qMax( 
     270            const double pw = qMax(
    271271                qAbs( d_boundingRect.left() - d_pointRect.left() ),
    272272                qAbs( d_boundingRect.right() - d_pointRect.right() ) );
     
    278278    }
    279279
    280     inline double scaleFactorY( const QRectF& pathRect, 
     280    inline double scaleFactorY( const QRectF& pathRect,
    281281        const QRectF &targetRect, bool scalePens ) const
    282282    {
     
    289289        const double b = qAbs( pathRect.bottom() - p0.y() );
    290290
    291         const double h = 2.0 * qMin( t, b ) 
     291        const double h = 2.0 * qMin( t, b )
    292292            * targetRect.height() / pathRect.height();
    293293
     
    299299        else
    300300        {
    301             const double pw = 
     301            const double pw =
    302302                qMax( qAbs( d_boundingRect.top() - d_pointRect.top() ),
    303303                qAbs( d_boundingRect.bottom() - d_pointRect.bottom() ) );
     
    352352  \brief Copy constructor
    353353
    354   \param other Source 
     354  \param other Source
    355355  \sa operator=()
    356356 */
     
    371371  \brief Assignment operator
    372372
    373   \param other Source 
     373  \param other Source
    374374  \return A reference of this object
    375375 */
     
    383383
    384384/*!
    385   \brief Clear all stored commands 
     385  \brief Clear all stored commands
    386386  \sa isNull()
    387387 */
    388 void QwtGraphic::reset() 
     388void QwtGraphic::reset()
    389389{
    390390    d_data->commands.clear();
     
    460460
    461461/*!
    462   The control point rectangle is the bounding rectangle 
     462  The control point rectangle is the bounding rectangle
    463463  of all control points of the paths and the target
    464464  rectangles of the images/pixmaps.
     
    478478  \brief Calculate the target rectangle for scaling the graphic
    479479
    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 
     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
    484484        ( see QPen::isCosmetic() ) the target rectangle is different to
    485485        multiplying the bounding rectangle.
     
    500500    for ( int i = 0; i < d_data->pathInfos.size(); i++ )
    501501    {
    502         rect |= d_data->pathInfos[i].scaledBoundingRect( sx, sy, 
     502        rect |= d_data->pathInfos[i].scaledBoundingRect( sx, sy,
    503503            !d_data->renderHints.testFlag( RenderPensUnscaled ) );
    504504    }
     
    519519  The default size is used in all methods rendering the graphic,
    520520  where no size is explicitly specified. Assigning an empty size
    521   means, that the default size will be calculated from the bounding 
     521  means, that the default size will be calculated from the bounding
    522522  rectangle.
    523523
    524524  The default setting is an empty size.
    525    
     525
    526526  \param size Default size
    527527
     
    544544
    545545  The default size is used in all methods rendering the graphic,
    546   where no size is explicitly specified. 
     546  where no size is explicitly specified.
    547547
    548548  \return Default size
     
    575575    for ( int i = 0; i < numCommands; i++ )
    576576    {
    577         qwtExecCommand( painter, commands[i], 
     577        qwtExecCommand( painter, commands[i],
    578578            d_data->renderHints, transform, d_data->initialTransform );
    579579    }
     
    592592  \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode
    593593 */
    594 void QwtGraphic::render( QPainter *painter, const QSizeF &size, 
     594void QwtGraphic::render( QPainter *painter, const QSizeF &size,
    595595    Qt::AspectRatioMode aspectRatioMode ) const
    596596{
     
    608608  \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode
    609609 */
    610 void QwtGraphic::render( QPainter *painter, const QRectF &rect, 
     610void QwtGraphic::render( QPainter *painter, const QRectF &rect,
    611611    Qt::AspectRatioMode aspectRatioMode ) const
    612612{
     
    614614        return;
    615615
    616     double sx = 1.0; 
     616    double sx = 1.0;
    617617    double sy = 1.0;
    618618
     
    623623        sy = rect.height() / d_data->pointRect.height();
    624624
    625     const bool scalePens = 
     625    const bool scalePens =
    626626        !d_data->renderHints.testFlag( RenderPensUnscaled );
    627627
     
    630630        const PathInfo info = d_data->pathInfos[i];
    631631
    632         const double ssx = info.scaleFactorX( 
     632        const double ssx = info.scaleFactorX(
    633633            d_data->pointRect, rect, scalePens );
    634634
     
    636636            sx = qMin( sx, ssx );
    637637
    638         const double ssy = info.scaleFactorY( 
     638        const double ssy = info.scaleFactorY(
    639639            d_data->pointRect, rect, scalePens );
    640640
     
    666666    {
    667667        // we don't want to scale pens according to sx/sy,
    668         // but we want to apply the scaling from the 
     668        // but we want to apply the scaling from the
    669669        // painter transformation later
    670670
     
    690690  \param painter Qt painter
    691691  \param pos Reference point, where to render
    692   \param alignment Flags how to align the target rectangle 
     692  \param alignment Flags how to align the target rectangle
    693693                   to pos.
    694694 */
    695 void QwtGraphic::render( QPainter *painter, 
     695void QwtGraphic::render( QPainter *painter,
    696696    const QPointF &pos, Qt::Alignment alignment ) const
    697697{
     
    729729/*!
    730730  \brief Convert the graphic to a QPixmap
    731    
     731
    732732  All pixels of the pixmap get initialized by Qt::transparent
    733733  before the graphic is scaled and rendered on it.
    734    
     734
    735735  The size of the pixmap is the default size ( ceiled to integers )
    736736  of the graphic.
     
    738738  \return The graphic as pixmap in default size
    739739  \sa defaultSize(), toImage(), render()
    740  */ 
     740 */
    741741QPixmap QwtGraphic::toPixmap() const
    742742{
     
    819819/*!
    820820  \brief Convert the graphic to a QImage
    821    
     821
    822822  All pixels of the image get initialized by 0 ( transparent )
    823823  before the graphic is scaled and rendered on it.
     
    827827  The size of the image is the default size ( ceiled to integers )
    828828  of the graphic.
    829    
     829
    830830  \return The graphic as image in default size
    831831  \sa defaultSize(), toPixmap(), render()
     
    874874        QRectF boundingRect = pointRect;
    875875
    876         if ( painter->pen().style() != Qt::NoPen 
     876        if ( painter->pen().style() != Qt::NoPen
    877877            && painter->pen().brush().style() != Qt::NoBrush )
    878878        {
     
    883883        updateBoundingRect( boundingRect );
    884884
    885         d_data->pathInfos += PathInfo( pointRect, 
     885        d_data->pathInfos += PathInfo( pointRect,
    886886            boundingRect, qwtHasScalablePen( painter ) );
    887887    }
     
    897897  \sa QPaintEngine::drawPixmap()
    898898*/
    899 void QwtGraphic::drawPixmap( const QRectF &rect, 
     899void QwtGraphic::drawPixmap( const QRectF &rect,
    900900    const QPixmap &pixmap, const QRectF &subRect )
    901901{
     
    997997        return;
    998998
    999     // to calculate a proper bounding rectangle we don't simply copy 
    1000     // the commands. 
     999    // to calculate a proper bounding rectangle we don't simply copy
     1000    // the commands.
    10011001
    10021002    const QwtPainterCommand *cmds = commands.constData();
Note: See TracChangeset for help on using the changeset viewer.