Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 9, 2013
1 parent 7d8d1d6 commit 381efba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgscoordinatetransform.cpp
Expand Up @@ -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 )
Expand All @@ -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"
Expand Down

0 comments on commit 381efba

Please sign in to comment.