summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-08-13 06:14:30 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-08-13 06:21:35 +0200
commit0da2a52dc13e594c9196de9b28cd12c6800001b9 (patch)
treea7d4a00c2016487f3a228ede2958332fa42d94fe /chart2
parent80fe3e318b6ca4f179dc82a35078888533480afa (diff)
use references where possible
Change-Id: Ie629d3d8b6d3048a0b34bb80f27eba6044d7f695
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx18
-rw-r--r--chart2/source/view/inc/GL3DBarChart.hxx4
2 files changed, 11 insertions, 11 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 0d5dd1367869..0299b9284ca5 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -928,11 +928,11 @@ void GL3DBarChart::contextDestroyed()
mbValidContext = false;
}
-void GL3DBarChart::addScreenTextShape(OUString &nStr, glm::vec2 rLeftTop, float nTextHeight, glm::vec3 rPos, sal_uInt32 nEvent)
+void GL3DBarChart::addScreenTextShape(OUString &nStr, glm::vec2 rLeftTop, float nTextHeight, const glm::vec3& rPos, sal_uInt32 nEvent)
{
maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, nStr, nEvent));
- opengl3D::TextCacheItem aTextCache = mpTextCache->getText(nStr);
- float nRectWidth = (float)aTextCache.maSize.Width() / (float)aTextCache.maSize.Height() * 0.05;
+ const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(nStr);
+ float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.05;
opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back());
pScreenText->setPosition(rLeftTop, glm::vec2(rLeftTop.x + nRectWidth, rLeftTop.y - nTextHeight), rPos);
}
@@ -1018,8 +1018,8 @@ void GL3DBarChart::updateClickEvent()
{
aBarValue = OUString("Value: ") + OUString::number(*it);
maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aBarValue, CALC_POS_EVENT_ID));
- opengl3D::TextCacheItem aTextCache = mpTextCache->getText(aBarValue);
- float nRectWidth = (float)aTextCache.maSize.Width() / (float)aTextCache.maSize.Height() * 0.03;
+ const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue);
+ float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.03;
std::map<sal_uInt32, const BarInformation>::const_iterator itr = maBarMap.find(mSelectBarId);
const BarInformation& rBarInfo = itr->second;
glm::vec3 aTextPos = glm::vec3(rBarInfo.maPos.x + BAR_SIZE_X / 2.0f,
@@ -1038,9 +1038,9 @@ void GL3DBarChart::updateClickEvent()
}
}
-float GL3DBarChart::calcScrollDistance(glm::mat4& rMVP, glm::vec3 aPos)
+float GL3DBarChart::calcScrollDistance(const glm::mat4& rMVP, const glm::vec3& rPos)
{
- glm::vec4 aScreenPos = rMVP * glm::vec4(aPos, 1.0);
+ glm::vec4 aScreenPos = rMVP * glm::vec4(rPos, 1.0);
glm::vec3 aActualPos = glm::vec3(aScreenPos.x / aScreenPos.w, aScreenPos.y / aScreenPos.w, 0.0);
return glm::length(aActualPos);
}
@@ -1159,8 +1159,8 @@ void GL3DBarChart::updateScroll()
{
OUString aBarValue = OUString("Value: ") + OUString::number(aBarInfoList[i].mnVal);
maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aBarValue, CALC_POS_EVENT_ID));
- opengl3D::TextCacheItem aTextCache = mpTextCache->getText(aBarValue);
- float nRectWidth = (float)aTextCache.maSize.Width() / (float)aTextCache.maSize.Height() * 0.03;
+ const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue);
+ float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.03;
glm::vec3 aTextPos = glm::vec3(aBarInfoList[i].maPos.x + BAR_SIZE_X / 2.0f,
aBarInfoList[i].maPos.y + BAR_SIZE_Y / 2.0f,
aBarInfoList[i].maPos.z);
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index f50895f9bd44..3f8ea1df0fa3 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -90,11 +90,11 @@ private:
void updateDataUpdateFPS();
DECL_LINK(updateTimer, void*);
int calcTimeInterval(TimeValue &startTime, TimeValue &endTime);
- void addScreenTextShape(OUString &nStr, glm::vec2 rLeftTop, float nTextHeight, glm::vec3 rPos = glm::vec3(0.0f, 0.0f, 0.0f), sal_uInt32 nEvent = 0);
+ void addScreenTextShape(OUString &nStr, glm::vec2 rLeftTop, float nTextHeight, const glm::vec3& rPos = glm::vec3(0.0f, 0.0f, 0.0f), sal_uInt32 nEvent = 0);
void recordBarHistory(sal_uInt32 &nBarID, float &nVal);
void updateClickEvent();
void calcDistance(std::vector<sal_uInt32> &vectorNearest);
- float calcScrollDistance(glm::mat4 &mvp, glm::vec3 pos);
+ float calcScrollDistance(const glm::mat4 &mvp, const glm::vec3& rPos);
void initDistanceHeap(std::vector<sal_uInt32> &vectorNearest);
void keepHeap(std::vector<sal_uInt32> &vectorNearest, int index);
void swapVector(int i, int j, std::vector<sal_uInt32> &vectorNearest);