diff --git a/commands/imagelib/transforms/kpTransformResizeScaleCommand.cpp b/commands/imagelib/transforms/kpTransformResizeScaleCommand.cpp --- a/commands/imagelib/transforms/kpTransformResizeScaleCommand.cpp +++ b/commands/imagelib/transforms/kpTransformResizeScaleCommand.cpp @@ -41,7 +41,6 @@ #include "layers/selections/image/kpRectangularImageSelection.h" #include "layers/selections/text/kpTextSelection.h" -#include #include #include diff --git a/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.cpp b/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.cpp --- a/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.cpp +++ b/dialogs/imagelib/transforms/kpTransformResizeScaleDialog.cpp @@ -31,7 +31,6 @@ #include "kpTransformResizeScaleDialog.h" -#include #include #include diff --git a/document/kpDocument.cpp b/document/kpDocument.cpp --- a/document/kpDocument.cpp +++ b/document/kpDocument.cpp @@ -46,7 +46,6 @@ #include "widgets/toolbars/kpToolToolBar.h" #include "lgpl/generic/kpUrlFormatter.h" -#include #include "kpLogCategories.h" #include // kdelibs4support diff --git a/document/kpDocument_Open.cpp b/document/kpDocument_Open.cpp --- a/document/kpDocument_Open.cpp +++ b/document/kpDocument_Open.cpp @@ -43,7 +43,6 @@ #include "lgpl/generic/kpUrlFormatter.h" #include "views/manager/kpViewManager.h" -#include #include #include diff --git a/document/kpDocument_Save.cpp b/document/kpDocument_Save.cpp --- a/document/kpDocument_Save.cpp +++ b/document/kpDocument_Save.cpp @@ -31,7 +31,6 @@ #include "kpDocument.h" #include "kpDocumentPrivate.h" -#include #include #include diff --git a/document/kpDocument_Selection.cpp b/document/kpDocument_Selection.cpp --- a/document/kpDocument_Selection.cpp +++ b/document/kpDocument_Selection.cpp @@ -32,7 +32,6 @@ #include "kpDocument.h" #include "kpDocumentPrivate.h" -#include #include #include diff --git a/imagelib/effects/kpEffectBalance.cpp b/imagelib/effects/kpEffectBalance.cpp --- a/imagelib/effects/kpEffectBalance.cpp +++ b/imagelib/effects/kpEffectBalance.cpp @@ -68,7 +68,7 @@ static inline int gamma (int base, int strength) { - return between0And255 (qRound (255.0 * pow (base / 255.0, 1.0 / pow (10., strength / 50.0)))); + return between0And255 (qRound (255.0 * std::pow (base / 255.0, 1.0 / std::pow (10., strength / 50.0)))); } diff --git a/imagelib/effects/kpEffectHSV.cpp b/imagelib/effects/kpEffectHSV.cpp --- a/imagelib/effects/kpEffectHSV.cpp +++ b/imagelib/effects/kpEffectHSV.cpp @@ -143,7 +143,7 @@ const int alpha = qAlpha(pix); h += static_cast (hueDiv360); - h -= floor(h); + h -= std::floor(h); s = qMax(0.0f, qMin(1.0f, s + static_cast (saturation))); diff --git a/imagelib/kpDocumentMetaInfo.cpp b/imagelib/kpDocumentMetaInfo.cpp --- a/imagelib/kpDocumentMetaInfo.cpp +++ b/imagelib/kpDocumentMetaInfo.cpp @@ -47,7 +47,7 @@ // (round up to guarantee at least 1 dot per inch) const int kpDocumentMetaInfo::MinDotsPerMeter = - int (ceil (1/*single dot per inch - a very low DPI*/ * KP_INCHES_PER_METER) + 0.1); + int (std::ceil (1/*single dot per inch - a very low DPI*/ * KP_INCHES_PER_METER) + 0.1); const int kpDocumentMetaInfo::MaxDotsPerMeter = int ((600 * 100)/*a lot of DPI*/ * KP_INCHES_PER_METER); diff --git a/kpDefs.h b/kpDefs.h --- a/kpDefs.h +++ b/kpDefs.h @@ -42,13 +42,6 @@ #define KP_BIG_IMAGE_SIZE (32 * 1048576) -#define KP_PI 3.141592653589793238462 - - -#define KP_DEGREES_TO_RADIANS(deg) ((deg) * KP_PI / 180.0) -#define KP_RADIANS_TO_DEGREES(rad) ((rad) * 180.0 / KP_PI) - - #define KP_INVALID_POINT QPoint (INT_MIN / 8, INT_MIN / 8) #define KP_INVALID_WIDTH (INT_MIN / 8) #define KP_INVALID_HEIGHT (INT_MIN / 8) diff --git a/pixmapfx/kpPixmapFX_DrawShapes.cpp b/pixmapfx/kpPixmapFX_DrawShapes.cpp --- a/pixmapfx/kpPixmapFX_DrawShapes.cpp +++ b/pixmapfx/kpPixmapFX_DrawShapes.cpp @@ -31,7 +31,6 @@ #include "kpPixmapFX.h" -#include #include #include diff --git a/pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp b/pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp --- a/pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp +++ b/pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp @@ -31,7 +31,6 @@ #include "kpPixmapFX.h" -#include #include #include diff --git a/pixmapfx/kpPixmapFX_Transforms.cpp b/pixmapfx/kpPixmapFX_Transforms.cpp --- a/pixmapfx/kpPixmapFX_Transforms.cpp +++ b/pixmapfx/kpPixmapFX_Transforms.cpp @@ -31,7 +31,7 @@ #include "kpPixmapFX.h" -#include +#include #include #include @@ -126,7 +126,7 @@ // public static const double kpPixmapFX::AngleInDegreesEpsilon = - KP_RADIANS_TO_DEGREES (atan (1.0 / 10000.0)) + qRadiansToDegrees (std::tan (1.0 / 10000.0)) / (2.0/*max error allowed*/ * 2.0/*for good measure*/); @@ -235,7 +235,7 @@ // QPainter::SmoothPixmapTransform is disabled. static double TrueMatrixFixInts (double x) { - if (fabs (x - qRound (x)) < TrueMatrixEpsilon) + if (std::fabs (x - qRound (x)) < TrueMatrixEpsilon) return qRound (x); else return x; @@ -470,8 +470,8 @@ // public static QMatrix kpPixmapFX::skewMatrix (int width, int height, double hangle, double vangle) { - if (fabs (hangle - 0) < kpPixmapFX::AngleInDegreesEpsilon && - fabs (vangle - 0) < kpPixmapFX::AngleInDegreesEpsilon) + if (std::fabs (hangle - 0) < kpPixmapFX::AngleInDegreesEpsilon && + std::fabs (vangle - 0) < kpPixmapFX::AngleInDegreesEpsilon) { return QMatrix (); } @@ -508,8 +508,8 @@ //QMatrix matrix (1, tan (KP_DEGREES_TO_RADIANS (vangle)), tan (KP_DEGREES_TO_RADIANS (hangle)), 1, 0, 0); // I think this is clearer than above :) QMatrix matrix; - matrix.shear (tan (KP_DEGREES_TO_RADIANS (hangle)), - tan (KP_DEGREES_TO_RADIANS (vangle))); + matrix.shear (std::tan (qDegreesToRadians (hangle)), + std::tan (qDegreesToRadians (vangle))); return ::MatrixWithZeroOrigin (matrix, width, height); } @@ -555,15 +555,15 @@ << endl; #endif - if (fabs (hangle - 0) < kpPixmapFX::AngleInDegreesEpsilon && - fabs (vangle - 0) < kpPixmapFX::AngleInDegreesEpsilon && + if (std::fabs (hangle - 0) < kpPixmapFX::AngleInDegreesEpsilon && + std::fabs (vangle - 0) < kpPixmapFX::AngleInDegreesEpsilon && (targetWidth <= 0 && targetHeight <= 0)/*don't want to scale?*/) { return pm; } - if (fabs (hangle) > 90 - kpPixmapFX::AngleInDegreesEpsilon || - fabs (vangle) > 90 - kpPixmapFX::AngleInDegreesEpsilon) + if (std::fabs (hangle) > 90 - kpPixmapFX::AngleInDegreesEpsilon || + std::fabs (vangle) > 90 - kpPixmapFX::AngleInDegreesEpsilon) { qCCritical(kpLogPixmapfx) << "kpPixmapFX::skew() passed hangle and/or vangle out of range (-90 < x < 90)" << endl; return pm; @@ -581,7 +581,7 @@ // public static QMatrix kpPixmapFX::rotateMatrix (int width, int height, double angle) { - if (fabs (angle - 0) < kpPixmapFX::AngleInDegreesEpsilon) + if (std::fabs (angle - 0) < kpPixmapFX::AngleInDegreesEpsilon) { return QMatrix (); } @@ -659,7 +659,7 @@ const kpColor &backgroundColor, int targetWidth, int targetHeight) { - if (fabs (angle - 0) < kpPixmapFX::AngleInDegreesEpsilon && + if (std::fabs (angle - 0) < kpPixmapFX::AngleInDegreesEpsilon && (targetWidth <= 0 && targetHeight <= 0)/*don't want to scale?*/) { return pm; diff --git a/tools/polygonal/kpToolPolygonalBase.cpp b/tools/polygonal/kpToolPolygonalBase.cpp --- a/tools/polygonal/kpToolPolygonalBase.cpp +++ b/tools/polygonal/kpToolPolygonalBase.cpp @@ -32,7 +32,7 @@ #include "kpToolPolygonalBase.h" #include -#include +#include #include #include @@ -232,43 +232,43 @@ int numAngles = 0; angles [numAngles++] = 0; if (controlPressed ()) - angles [numAngles++] = KP_PI / 6; + angles [numAngles++] = M_PI / 6; if (shiftPressed ()) - angles [numAngles++] = KP_PI / 4; + angles [numAngles++] = M_PI / 4; if (controlPressed ()) - angles [numAngles++] = KP_PI / 3; - angles [numAngles++] = KP_PI / 2; + angles [numAngles++] = M_PI / 3; + angles [numAngles++] = M_PI / 2; Q_ASSERT (numAngles <= int (sizeof (angles) / sizeof (angles [0]))); double angle = angles [numAngles - 1]; for (int i = 0; i < numAngles - 1; i++) { - double acceptingRatio = tan ((angles [i] + angles [i + 1]) / 2.0); + double acceptingRatio = std::tan ((angles [i] + angles [i + 1]) / 2.0); if (ratio < acceptingRatio) { angle = angles [i]; break; } } // horizontal (dist from start not maintained) - if (fabs (KP_RADIANS_TO_DEGREES (angle) - 0) + if (std::fabs (qRadiansToDegrees (angle) - 0) < kpPixmapFX::AngleInDegreesEpsilon) { lineEndPoint = QPoint (lineEndPoint.x (), lineStartPoint.y ()); } // vertical (dist from start not maintained) - else if (fabs (KP_RADIANS_TO_DEGREES (angle) - 90) + else if (std::fabs (qRadiansToDegrees (angle) - 90) < kpPixmapFX::AngleInDegreesEpsilon) { lineEndPoint = QPoint (lineStartPoint.x (), lineEndPoint.y ()); } // diagonal (dist from start maintained) else { - const double dist = sqrt (static_cast (diffx * diffx + diffy * diffy)); + const double dist = std::sqrt (static_cast (diffx * diffx + diffy * diffy)); #define sgn(a) ((a)<0?-1:1) // Round distances _before_ adding to any coordinate diff --git a/views/kpView.cpp b/views/kpView.cpp --- a/views/kpView.cpp +++ b/views/kpView.cpp @@ -35,7 +35,6 @@ #include "kpView.h" #include "kpViewPrivate.h" -#include #include #include diff --git a/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.cpp b/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.cpp --- a/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.cpp +++ b/widgets/colorSimilarity/kpColorSimilarityCubeRenderer.cpp @@ -31,7 +31,7 @@ #include "kpColorSimilarityCubeRenderer.h" -#include +#include #include #include @@ -185,20 +185,20 @@ // // - const double angle = KP_DEGREES_TO_RADIANS (45); + const double angle = qDegreesToRadians (45.0); // S + S sin A = cubeRectSize // (1 + sin A) x S = cubeRectSize - const double side = double(cubeRectSize) / (1.0 + sin(angle)); + const double side = double(cubeRectSize) / (1.0 + std::sin(angle)); - const QPointF pointP(x + (side * cos (angle)), + const QPointF pointP(x + (side * std::cos (angle)), y); const QPointF pointQ(x + cubeRectSize - 1, y); const QPointF pointR(x, - y + (side * sin (angle))); + y + (side * std::sin (angle))); const QPointF pointS(x + (side), - y + (side * sin (angle))); + y + (side * std::sin (angle))); const QPointF pointT(x + cubeRectSize - 1, y + (side)); const QPointF pointU(x, diff --git a/widgets/colorSimilarity/kpColorSimilarityHolder.cpp b/widgets/colorSimilarity/kpColorSimilarityHolder.cpp --- a/widgets/colorSimilarity/kpColorSimilarityHolder.cpp +++ b/widgets/colorSimilarity/kpColorSimilarityHolder.cpp @@ -47,7 +47,7 @@ // public static const double kpColorSimilarityHolder::ColorCubeDiagonalDistance = - sqrt (255.0 * 255 * 3); + std::sqrt (255.0 * 255 * 3); // public static const double kpColorSimilarityHolder::MaxColorSimilarity = 0.30; diff --git a/widgets/imagelib/effects/kpEffectBalanceWidget.cpp b/widgets/imagelib/effects/kpEffectBalanceWidget.cpp --- a/widgets/imagelib/effects/kpEffectBalanceWidget.cpp +++ b/widgets/imagelib/effects/kpEffectBalanceWidget.cpp @@ -235,7 +235,7 @@ { m_gammaLabel->setText ( QLatin1String (" ") + - QString::number (pow (10, gamma () / 50.0), + QString::number (std::pow (10, gamma () / 50.0), 'f'/*[-]9.9*/, 2/*precision*/) + QLatin1String (" ")); diff --git a/widgets/imagelib/effects/kpNumInput.cpp b/widgets/imagelib/effects/kpNumInput.cpp --- a/widgets/imagelib/effects/kpNumInput.cpp +++ b/widgets/imagelib/effects/kpNumInput.cpp @@ -604,7 +604,7 @@ d->spin->setSingleStep(singleStep); const double range = spin->maximum() - spin->minimum(); - const double steps = range * pow(10.0, spin->decimals()); + const double steps = range * std::pow(10.0, spin->decimals()); if (!priv->slider) { priv->slider = new QSlider(Qt::Horizontal, this); priv->slider->setTickPosition(QSlider::TicksBelow);