Skip to content

Commit c6068c8

Browse files
committedJul 16, 2018
Hillshade: log rendering time if main debug option is on
1 parent 0ac35a6 commit c6068c8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed
 

‎src/core/raster/qgshillshaderenderer.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "qgsrasterinterface.h"
2323
#include "qgsrasterblock.h"
2424
#include "qgsrectangle.h"
25+
#include "qgssettings.h"
2526
#include <memory>
2627

2728
#ifdef QGISDEBUG
@@ -246,7 +247,7 @@ QgsRasterBlock *QgsHillshadeRenderer::block( int bandNo, const QgsRectangle &ext
246247
const float xx = derX * derX;
247248
const float yy = derY * derY;
248249
const float xx_plus_yy = xx + yy;
249-
// Flat? -> white
250+
// Flat?
250251
if ( xx_plus_yy == 0.0 )
251252
{
252253
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
305306
}
306307

307308
#ifdef QGISDEBUG
308-
QgsMessageLog::logMessage( QStringLiteral( "CPU Rendering time for hillshade (%2 x %3 ): %4 ms" )
309-
.arg( width )
310-
.arg( height )
311-
.arg( std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::system_clock::now() - startTime ).count() ) );
309+
if ( QgsSettings().value( QStringLiteral( "Map/logCanvasRefreshEvent" ), false ).toBool() )
310+
{
311+
QgsMessageLog::logMessage( QStringLiteral( "CPU processing time for hillshade (%2 x %3 ): %4 ms" )
312+
.arg( width )
313+
.arg( height )
314+
.arg( std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::system_clock::now() - startTime ).count() ),
315+
tr( "Rendering" ) );
316+
}
312317
#endif
313318

314319
return outputBlock.release();

0 commit comments

Comments
 (0)
Please sign in to comment.