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_plot_rasteritem.cpp

    r8127 r9383  
    159159    py0 += strippedRect.top() - paintRect.top();
    160160
    161     QImage expanded(sz, image.format());
     161    QImage expanded( sz, image.format() );
     162    if ( image.format() == QImage::Format_Indexed8 )
     163        expanded.setColorTable( image.colorTable() );
    162164
    163165    switch( image.depth() )
     
    191193                }
    192194
    193                 const quint32 *line1 = 
     195                const quint32 *line1 =
    194196                    reinterpret_cast<const quint32 *>( image.scanLine( y1 ) );
    195197
     
    223225                    for ( int y2 = yy1; y2 < yy2; y2++ )
    224226                    {
    225                         quint32 *line2 = reinterpret_cast<quint32 *>( 
     227                        quint32 *line2 = reinterpret_cast<quint32 *>(
    226228                            expanded.scanLine( y2 ) );
    227229
    228                         for ( int x2 = xx1; x2 < xx2; x2++ ) 
     230                        for ( int x2 = xx1; x2 < xx2; x2++ )
    229231                            line2[x2] = rgb;
    230                     }       
    231                 }   
    232             }   
     232                    }
     233                }
     234            }
    233235            break;
    234236        }
     
    241243                {
    242244                    yy1 = 0;
    243                 }   
     245                }
    244246                else
    245247                {
    246248                    yy1 = qRound( y1 * ph - py0 );
    247249                    if ( yy1 < 0 )
    248                         yy1 = 0; 
    249                 }       
    250                
     250                        yy1 = 0;
     251                }
     252
    251253                int yy2;
    252254                if ( y1 == h - 1 )
    253255                {
    254256                    yy2 = sz.height();
    255                 }   
     257                }
    256258                else
    257259                {
     
    260262                        yy2 = sz.height();
    261263                }
    262    
     264
    263265                const uchar *line1 = image.scanLine( y1 );
    264266
     
    293295                        uchar *line2 = expanded.scanLine( y2 );
    294296                        memset( line2 + xx1, line1[x1], xx2 - xx1 );
    295                     }       
    296                 }   
     297                    }
     298                }
    297299            }
    298300            break;
     
    301303            expanded = image;
    302304    }
    303    
     305
    304306    return expanded;
    305 }   
     307}
    306308
    307309static QRectF qwtExpandToPixels(const QRectF &rect, const QRectF &pixelRect)
     
    385387}
    386388
    387 static void qwtToRgba( const QImage* from, QImage* to, 
     389static void qwtToRgba( const QImage* from, QImage* to,
    388390    const QRect& tile, int alpha )
    389391{
     
    573575
    574576   The geometry of a pixel is used to calculated the resolution and
    575    alignment of the rendered image. 
    576 
    577    Width and height of the hint need to be the horizontal 
    578    and vertical distances between 2 neighbored points. 
    579    The center of the hint has to be the position of any point 
     577   alignment of the rendered image.
     578
     579   Width and height of the hint need to be the horizontal
     580   and vertical distances between 2 neighbored points.
     581   The center of the hint has to be the position of any point
    580582   ( it doesn't matter which one ).
    581583
    582584   Limiting the resolution of the image might significantly improve
    583585   the performance and heavily reduce the amount of memory when rendering
    584    a QImage from the raster data. 
     586   a QImage from the raster data.
    585587
    586588   The default implementation returns an empty rectangle (QRectF()),
     
    664666        {
    665667            /*
    666               If only one dimension is of the data pixel is higher 
     668              If only one dimension is of the data pixel is higher
    667669              we expand the pixel rect to the resolution of the target device.
    668670             */
     
    690692        // data pixels we render in resolution of the paint device.
    691693
    692         image = compose(xxMap, yyMap, 
     694        image = compose(xxMap, yyMap,
    693695            area, paintRect, paintRect.size().toSize(), doCache);
    694696        if ( image.isNull() )
     
    698700        // excluded in the intervals
    699701
    700         imageRect = qwtStripRect(paintRect, area, 
     702        imageRect = qwtStripRect(paintRect, area,
    701703            xxMap, yyMap, xInterval, yInterval);
    702704
    703705        if ( imageRect != paintRect )
    704706        {
    705             const QRect r( 
     707            const QRect r(
    706708                qRound( imageRect.x() - paintRect.x()),
    707709                qRound( imageRect.y() - paintRect.y() ),
    708710                qRound( imageRect.width() ),
    709711                qRound( imageRect.height() ) );
    710                
     712
    711713            image = image.copy(r);
    712         }   
     714        }
    713715    }
    714716    else
     
    735737        imageSize.setHeight( qRound( imageArea.height() / pixelRect.height() ) );
    736738
    737         image = compose(xxMap, yyMap, 
     739        image = compose(xxMap, yyMap,
    738740            imageArea, paintRect, imageSize, doCache );
    739741
     
    741743            return;
    742744
    743         imageRect = qwtStripRect(paintRect, area, 
     745        imageRect = qwtStripRect(paintRect, area,
    744746            xxMap, yyMap, xInterval, yInterval);
    745747
     
    747749            testPaintAttribute( PaintInDeviceResolution ) )
    748750        {
    749             // Because of rounding errors the pixels 
    750             // need to be expanded manually to rectangles of 
     751            // Because of rounding errors the pixels
     752            // need to be expanded manually to rectangles of
    751753            // different sizes
    752754
    753             image = qwtExpandImage(image, xxMap, yyMap, 
     755            image = qwtExpandImage(image, xxMap, yyMap,
    754756                imageArea, area, paintRect, xInterval, yInterval );
    755757        }
     
    758760    painter->save();
    759761    painter->setWorldTransform( QTransform() );
    760    
     762
    761763    QwtPainter::drawImage( painter, imageRect, image );
    762764
     
    769771   This method is intended to be reimplemented by derived classes.
    770772   The default implementation returns an invalid interval.
    771    
     773
    772774   \param axis X, Y, or Z axis
    773775*/
     
    817819}
    818820
    819 QImage QwtPlotRasterItem::compose( 
     821QImage QwtPlotRasterItem::compose(
    820822    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    821     const QRectF &imageArea, const QRectF &paintRect, 
     823    const QRectF &imageArea, const QRectF &paintRect,
    822824    const QSize &imageSize, bool doCache) const
    823825{
     
    842844            dx = imageArea.width() / imageSize.width();
    843845
    844         const QwtScaleMap xxMap = 
     846        const QwtScaleMap xxMap =
    845847            imageMap(Qt::Horizontal, xMap, imageArea, imageSize, dx);
    846        
     848
    847849        double dy = 0.0;
    848850        if ( paintRect.toRect().height() > imageSize.height() )
    849851            dy = imageArea.height() / imageSize.height();
    850852
    851         const QwtScaleMap yyMap = 
     853        const QwtScaleMap yyMap =
    852854            imageMap(Qt::Vertical, yMap, imageArea, imageSize, dy);
    853855
     
    937939    }
    938940
    939     if ( pixelSize > 0.0 )
     941    if ( pixelSize > 0.0 || p2 == 1.0 )
    940942    {
    941943        double off = 0.5 * pixelSize;
Note: See TracChangeset for help on using the changeset viewer.