Kaydet (Commit) 0da2a52d authored tarafından Markus Mohrhard's avatar Markus Mohrhard

use references where possible

Change-Id: Ie629d3d8b6d3048a0b34bb80f27eba6044d7f695
üst 80fe3e31
...@@ -928,11 +928,11 @@ void GL3DBarChart::contextDestroyed() ...@@ -928,11 +928,11 @@ void GL3DBarChart::contextDestroyed()
mbValidContext = false; 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)); maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, nStr, nEvent));
opengl3D::TextCacheItem aTextCache = mpTextCache->getText(nStr); const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(nStr);
float nRectWidth = (float)aTextCache.maSize.Width() / (float)aTextCache.maSize.Height() * 0.05; float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.05;
opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back()); opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back());
pScreenText->setPosition(rLeftTop, glm::vec2(rLeftTop.x + nRectWidth, rLeftTop.y - nTextHeight), rPos); pScreenText->setPosition(rLeftTop, glm::vec2(rLeftTop.x + nRectWidth, rLeftTop.y - nTextHeight), rPos);
} }
...@@ -1018,8 +1018,8 @@ void GL3DBarChart::updateClickEvent() ...@@ -1018,8 +1018,8 @@ void GL3DBarChart::updateClickEvent()
{ {
aBarValue = OUString("Value: ") + OUString::number(*it); aBarValue = OUString("Value: ") + OUString::number(*it);
maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aBarValue, CALC_POS_EVENT_ID)); maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aBarValue, CALC_POS_EVENT_ID));
opengl3D::TextCacheItem aTextCache = mpTextCache->getText(aBarValue); const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue);
float nRectWidth = (float)aTextCache.maSize.Width() / (float)aTextCache.maSize.Height() * 0.03; float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.03;
std::map<sal_uInt32, const BarInformation>::const_iterator itr = maBarMap.find(mSelectBarId); std::map<sal_uInt32, const BarInformation>::const_iterator itr = maBarMap.find(mSelectBarId);
const BarInformation& rBarInfo = itr->second; const BarInformation& rBarInfo = itr->second;
glm::vec3 aTextPos = glm::vec3(rBarInfo.maPos.x + BAR_SIZE_X / 2.0f, glm::vec3 aTextPos = glm::vec3(rBarInfo.maPos.x + BAR_SIZE_X / 2.0f,
...@@ -1038,9 +1038,9 @@ void GL3DBarChart::updateClickEvent() ...@@ -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); glm::vec3 aActualPos = glm::vec3(aScreenPos.x / aScreenPos.w, aScreenPos.y / aScreenPos.w, 0.0);
return glm::length(aActualPos); return glm::length(aActualPos);
} }
...@@ -1159,8 +1159,8 @@ void GL3DBarChart::updateScroll() ...@@ -1159,8 +1159,8 @@ void GL3DBarChart::updateScroll()
{ {
OUString aBarValue = OUString("Value: ") + OUString::number(aBarInfoList[i].mnVal); OUString aBarValue = OUString("Value: ") + OUString::number(aBarInfoList[i].mnVal);
maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aBarValue, CALC_POS_EVENT_ID)); maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aBarValue, CALC_POS_EVENT_ID));
opengl3D::TextCacheItem aTextCache = mpTextCache->getText(aBarValue); const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue);
float nRectWidth = (float)aTextCache.maSize.Width() / (float)aTextCache.maSize.Height() * 0.03; 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, 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.y + BAR_SIZE_Y / 2.0f,
aBarInfoList[i].maPos.z); aBarInfoList[i].maPos.z);
......
...@@ -90,11 +90,11 @@ private: ...@@ -90,11 +90,11 @@ private:
void updateDataUpdateFPS(); void updateDataUpdateFPS();
DECL_LINK(updateTimer, void*); DECL_LINK(updateTimer, void*);
int calcTimeInterval(TimeValue &startTime, TimeValue &endTime); 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 recordBarHistory(sal_uInt32 &nBarID, float &nVal);
void updateClickEvent(); void updateClickEvent();
void calcDistance(std::vector<sal_uInt32> &vectorNearest); 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 initDistanceHeap(std::vector<sal_uInt32> &vectorNearest);
void keepHeap(std::vector<sal_uInt32> &vectorNearest, int index); void keepHeap(std::vector<sal_uInt32> &vectorNearest, int index);
void swapVector(int i, int j, std::vector<sal_uInt32> &vectorNearest); void swapVector(int i, int j, std::vector<sal_uInt32> &vectorNearest);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment