Skip to content
Permalink
Browse files

Hillshade: log rendering time if main debug option is on

  • Loading branch information
elpaso committed Jul 16, 2018
1 parent 0ac35a6 commit c6068c824e6c4926f892e9db0fa2943f4aafff73
Showing with 10 additions and 5 deletions.
  1. +10 −5 src/core/raster/qgshillshaderenderer.cpp
@@ -22,6 +22,7 @@
#include "qgsrasterinterface.h"
#include "qgsrasterblock.h"
#include "qgsrectangle.h"
#include "qgssettings.h"
#include <memory>

#ifdef QGISDEBUG
@@ -246,7 +247,7 @@ QgsRasterBlock *QgsHillshadeRenderer::block( int bandNo, const QgsRectangle &ext
const float xx = derX * derX;
const float yy = derY * derY;
const float xx_plus_yy = xx + yy;
// Flat? -> white
// Flat?
if ( xx_plus_yy == 0.0 )
{
grayValue = qBound( 0.0f, static_cast<float>( 1.0 + sinZenithRad_mul_254 ), 255.0f );
@@ -305,10 +306,14 @@ QgsRasterBlock *QgsHillshadeRenderer::block( int bandNo, const QgsRectangle &ext
}

#ifdef QGISDEBUG
QgsMessageLog::logMessage( QStringLiteral( "CPU Rendering time for hillshade (%2 x %3 ): %4 ms" )
.arg( width )
.arg( height )
.arg( std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::system_clock::now() - startTime ).count() ) );
if ( QgsSettings().value( QStringLiteral( "Map/logCanvasRefreshEvent" ), false ).toBool() )
{
QgsMessageLog::logMessage( QStringLiteral( "CPU processing time for hillshade (%2 x %3 ): %4 ms" )
.arg( width )
.arg( height )
.arg( std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::system_clock::now() - startTime ).count() ),
tr( "Rendering" ) );
}
#endif

return outputBlock.release();

0 comments on commit c6068c8

Please sign in to comment.
You can’t perform that action at this time.