Skip to content

Commit 381efba

Browse files
jekhormhugent
authored andcommitted
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>
1 parent 7d8d1d6 commit 381efba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/qgscoordinatetransform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,14 +632,12 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d
632632
if ( direction == ReverseTransform )
633633
{
634634
projResult = pj_transform( mDestinationProjection, mSourceProjection, numPoints, 0, x, y, z );
635-
dir = tr( "inverse transform" );
636635
}
637636
else
638637
{
639638
Q_ASSERT( mSourceProjection != 0 );
640639
Q_ASSERT( mDestinationProjection != 0 );
641640
projResult = pj_transform( mSourceProjection, mDestinationProjection, numPoints, 0, x, y, z );
642-
dir = tr( "forward transform" );
643641
}
644642

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

660+
dir = (direction == ForwardTransform) ? tr( "forward transform" ) : tr( "inverse transform" );
661+
662662
QString msg = tr( "%1 of\n"
663663
"%2"
664664
"PROJ.4: %3 +to %4\n"

0 commit comments

Comments
 (0)