summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-08 09:59:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-08 10:54:50 +0200
commit22cf68296387eb613e3ee3b888ef1bfa0a6dd1e0 (patch)
tree564d6084777188462a68434c774bd180f2764a53 /chart2
parent4df450c276a7895c24ed022a23d236cd88dbad1c (diff)
clang-tidy performance-type-promotion-in-math-fn
Change-Id: I71405f1dbf0a1524e4e367ae5e05edaf6a8e98b8 Reviewed-on: https://gerrit.libreoffice.org/38559 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx11
-rw-r--r--chart2/source/view/main/GL3DRenderer.cxx9
-rw-r--r--chart2/source/view/main/OpenGLRender.cxx5
3 files changed, 14 insertions, 11 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 8c547b99e90c..8a91a62ef1f9 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -11,6 +11,7 @@
#include <epoxy/gl.h>
+#include <cmath>
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
@@ -821,7 +822,7 @@ void GL3DBarChart::create3DShapes(const std::vector<std::unique_ptr<VDataSeries>
mnMaxY = nSeriesIndex * (BAR_SIZE_Y + BAR_DISTANCE_Y) + 40;
if (!mbCameraInit)
{
- mnDistance = sqrt(mnMaxX * mnMaxX + mnMaxY * mnMaxY + DEFAULT_CAMERA_HEIGHT * DEFAULT_CAMERA_HEIGHT);
+ mnDistance = std::sqrt(mnMaxX * mnMaxX + mnMaxY * mnMaxY + DEFAULT_CAMERA_HEIGHT * DEFAULT_CAMERA_HEIGHT);
maDefaultCameraDirection = glm::vec3(mnMaxX * 0.4, mnMaxY * 0.35, 0);
maDefaultCameraPosition = glm::vec3(maDefaultCameraDirection.x, maDefaultCameraDirection.y - mnDistance, DEFAULT_CAMERA_HEIGHT * 2);
mnCornerId = 0;
@@ -1063,22 +1064,22 @@ glm::vec3 GL3DBarChart::getCornerPosition(sal_Int8 nId)
{
case 0:
{
- return glm::vec3(mnMaxX / 2 - mnDistance * sin(pi / 4), mnMaxY / 2 - mnDistance * cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
+ return glm::vec3(mnMaxX / 2 - mnDistance * std::sin(pi / 4), mnMaxY / 2 - mnDistance * std::cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
}
break;
case 1:
{
- return glm::vec3(mnMaxX / 2 + mnDistance * sin(pi / 4), mnMaxY / 2 - mnDistance * cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
+ return glm::vec3(mnMaxX / 2 + mnDistance * std::sin(pi / 4), mnMaxY / 2 - mnDistance * std::cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
}
break;
case 2:
{
- return glm::vec3(mnMaxX / 2 + mnDistance * sin(pi / 4), mnMaxY / 2 + mnDistance * cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
+ return glm::vec3(mnMaxX / 2 + mnDistance * std::sin(pi / 4), mnMaxY / 2 + mnDistance * std::cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
}
break;
case 3:
{
- return glm::vec3(mnMaxX / 2 - mnDistance * sin(pi / 4), mnMaxY / 2 + mnDistance * cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
+ return glm::vec3(mnMaxX / 2 - mnDistance * std::sin(pi / 4), mnMaxY / 2 + mnDistance * std::cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
}
break;
default:
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 6e6e2fcaa601..8c92ccd9a9b2 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -11,6 +11,7 @@
#include "GL3DRenderer.hxx"
+#include <cmath>
#include <vcl/opengl/OpenGLHelper.hxx>
#include <vcl/font.hxx>
#include <vcl/virdev.hxx>
@@ -606,8 +607,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
{
fNextAngleY = 360.0f;
}
- float fSineY = sin(fCurAngleY/180.0f*PI), fCosY = cos(fCurAngleY/180.0f*PI);
- float fNextSineY = sin(fNextAngleY/180.0f*PI), fNextCosY = cos(fNextAngleY/180.0f*PI);
+ float fSineY = std::sin(fCurAngleY/180.0f*PI), fCosY = std::cos(fCurAngleY/180.0f*PI);
+ float fNextSineY = std::sin(fNextAngleY/180.0f*PI), fNextCosY = std::cos(fNextAngleY/180.0f*PI);
glm::vec3 vDirY(fCosY, 0.0f, -fSineY), vNextDirY(fNextCosY, 0.0f, -fNextSineY);
float fCurAngleZ = 0.0f;
int iStepsZ = 1;
@@ -633,8 +634,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
int yIndex = 0;
float fNextAngleZ = fCurAngleZ+fAddAngleZ;
- float fSineZ = sin(fCurAngleZ/180.0f*PI), fCosZ = cos(fCurAngleZ/180.0f*PI);
- float fNextSineZ = sin(fNextAngleZ/180.0f*PI), fNextCosZ = cos(fNextAngleZ/180.0f*PI);
+ float fSineZ = std::sin(fCurAngleZ/180.0f*PI), fCosZ = std::cos(fCurAngleZ/180.0f*PI);
+ float fNextSineZ = std::sin(fNextAngleZ/180.0f*PI), fNextCosZ = std::cos(fNextAngleZ/180.0f*PI);
if ((fCurAngleZ < 90.0f) && (fNextAngleZ >= 90.0f))
{
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 27085513680f..c3a2c489efb5 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -8,6 +8,7 @@
*/
#include <epoxy/gl.h>
+#include <cmath>
#include <vector>
#include "OpenGLRender.hxx"
#include <vcl/graph.hxx>
@@ -387,8 +388,8 @@ int OpenGLRender::Create2DCircle(int detail)
m_Bubble2DCircle.push_back(0);
for(angle = 2.0f * GL_PI; angle > -(2.0f * GL_PI / detail); angle -= (2.0f * GL_PI / detail))
{
- m_Bubble2DCircle.push_back(sin(angle));
- m_Bubble2DCircle.push_back(cos(angle));
+ m_Bubble2DCircle.push_back(std::sin(angle));
+ m_Bubble2DCircle.push_back(std::cos(angle));
}
return 0;
}