Skip to content
Permalink
Browse files

Eliminate creating of unused QString objects in transformCoords

Every call of transformCoords() Qstring dir object is created. It uses
only for output information about errors, so move its creation to error
handling block.

Perfomance gain is ~7%.

Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
  • Loading branch information
jekhor authored and mhugent committed Dec 8, 2013
1 parent 7d8d1d6 commit 381efba4b3f8c3ca93aa8c6f1e70470892e08b4a
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/qgscoordinatetransform.cpp
@@ -632,14 +632,12 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d
if ( direction == ReverseTransform )
{
projResult = pj_transform( mDestinationProjection, mSourceProjection, numPoints, 0, x, y, z );
dir = tr( "inverse transform" );
}
else
{
Q_ASSERT( mSourceProjection != 0 );
Q_ASSERT( mDestinationProjection != 0 );
projResult = pj_transform( mSourceProjection, mDestinationProjection, numPoints, 0, x, y, z );
dir = tr( "forward transform" );
}

if ( projResult != 0 )
@@ -659,6 +657,8 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d
}
}

dir = (direction == ForwardTransform) ? tr( "forward transform" ) : tr( "inverse transform" );

QString msg = tr( "%1 of\n"
"%2"
"PROJ.4: %3 +to %4\n"

0 comments on commit 381efba

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