Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
On armel/armhf qreal is typedef'ed to float not double.
This patch adds qreal versions of some functions on arm. It was originally
writen by Konstantinos Margaritis and later fixed by Peter Michael Green.

Bug-Debian: http://bugs.debian.org/691333
  • Loading branch information
sebastic committed Mar 28, 2014
1 parent 984fe0e commit 03b028d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/qgscoordinatetransform.cpp
Expand Up @@ -434,6 +434,17 @@ void QgsCoordinateTransform::transformInPlace(
}
}

#ifdef QT_ARCH_ARM
void QgsCoordinateTransform::transformInPlace( qreal& x, qreal& y, double& z,
TransformDirection direction ) const
{
double xd = (double) x, yd = (double) y;
transformInPlace(xd, yd, z, direction);
x=xd;
y=yd;
}
#endif

#ifdef ANDROID
void QgsCoordinateTransform::transformInPlace( float& x, float& y, float& z,
TransformDirection direction ) const
Expand Down
3 changes: 3 additions & 0 deletions src/core/qgscoordinatetransform.h
Expand Up @@ -156,6 +156,9 @@ class CORE_EXPORT QgsCoordinateTransform : public QObject
// and y variables in place. The second one works with good old-fashioned
// C style arrays.
void transformInPlace( double& x, double& y, double &z, TransformDirection direction = ForwardTransform ) const;
#ifdef QT_ARCH_ARM
void transformInPlace( qreal& x, qreal& y, double &z, TransformDirection direction = ForwardTransform ) const;
#endif

//! @note not available in python bindings
void transformInPlace( QVector<double>& x, QVector<double>& y, QVector<double>& z,
Expand Down
9 changes: 9 additions & 0 deletions src/core/qgsmaptopixel.cpp
Expand Up @@ -138,6 +138,14 @@ void QgsMapToPixel::transformInPlace( double& x, double& y ) const
y = yMax - ( y - yMin ) / mMapUnitsPerPixel;
}

#ifdef QT_ARCH_ARM
void QgsMapToPixel::transformInPlace( qreal& x, qreal& y ) const
{
x = ( x - xMin ) / mMapUnitsPerPixel;
y = yMax - ( y - yMin ) / mMapUnitsPerPixel;
}
#endif

void QgsMapToPixel::transformInPlace( QVector<double>& x,
QVector<double>& y ) const
{
Expand All @@ -161,3 +169,4 @@ void QgsMapToPixel::transformInPlace( QVector<float>& x,
transformInPlace( x[i], y[i] );
}
#endif

3 changes: 3 additions & 0 deletions src/core/qgsmaptopixel.h
Expand Up @@ -66,6 +66,9 @@ class CORE_EXPORT QgsMapToPixel
given coordinates in place. Intended as a fast way to do the
transform. */
void transformInPlace( double& x, double& y ) const;
#ifdef QT_ARCH_ARM
void transformInPlace( qreal& x, qreal& y ) const;
#endif

/* Transform device coordinates to map coordinates. Modifies the
given coordinates in place. Intended as a fast way to do the
Expand Down

0 comments on commit 03b028d

Please sign in to comment.