MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / renderTile

Method renderTile

3rdparty/qwt/src/qwt_plot_spectrogram.cpp:572–644  ·  view source on GitHub ↗

! \brief Render a tile of an image. Rendering in tiles can be used to composite an image in parallel threads. \param xMap X-Scale Map \param yMap Y-Scale Map \param tile Geometry of the tile in image coordinates \param image Image to be rendered */

Source from the content-addressed store, hash-verified

570 \param image Image to be rendered
571 */
572void QwtPlotSpectrogram::renderTile(
573 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
574 const QRect& tile, QImage* image ) const
575{
576 const QwtInterval range = m_data->data->interval( Qt::ZAxis );
577 if ( range.width() <= 0.0 )
578 return;
579
580 const bool hasGaps = !m_data->data->testAttribute( QwtRasterData::WithoutGaps );
581
582 if ( m_data->colorMap->format() == QwtColorMap::RGB )
583 {
584 const int numColors = m_data->colorTable.size();
585 const QRgb* rgbTable = m_data->colorTable.constData();
586 const QwtColorMap* colorMap = m_data->colorMap;
587
588 for ( int y = tile.top(); y <= tile.bottom(); y++ )
589 {
590 const double ty = yMap.invTransform( y );
591
592 QRgb* line = reinterpret_cast< QRgb* >( image->scanLine( y ) );
593 line += tile.left();
594
595 for ( int x = tile.left(); x <= tile.right(); x++ )
596 {
597 const double tx = xMap.invTransform( x );
598
599 const double value = m_data->data->value( tx, ty );
600
601 if ( hasGaps && qwtIsNaN( value ) )
602 {
603 *line++ = 0u;
604 }
605 else if ( numColors == 0 )
606 {
607 *line++ = colorMap->rgb( range, value );
608 }
609 else
610 {
611 const uint index = colorMap->colorIndex( numColors, range, value );
612 *line++ = rgbTable[index];
613 }
614 }
615 }
616 }
617 else if ( m_data->colorMap->format() == QwtColorMap::Indexed )
618 {
619 for ( int y = tile.top(); y <= tile.bottom(); y++ )
620 {
621 const double ty = yMap.invTransform( y );
622
623 unsigned char* line = image->scanLine( y );
624 line += tile.left();
625
626 for ( int x = tile.left(); x <= tile.right(); x++ )
627 {
628 const double tx = xMap.invTransform( x );
629

Callers

nothing calls this directly

Calls 10

qwtIsNaNFunction · 0.85
formatMethod · 0.80
rgbMethod · 0.80
colorIndexMethod · 0.80
intervalMethod · 0.45
widthMethod · 0.45
testAttributeMethod · 0.45
sizeMethod · 0.45
invTransformMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected