diff options
author | weigao <weigao@multicorewareinc.com> | 2014-08-09 13:38:11 +0800 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-08-13 06:21:33 +0200 |
commit | 76fa54819b0445c9e6b85db2729540a07b4601ce (patch) | |
tree | 78343eb425fc59ffd7e9297f4e30cef795144951 /chart2 | |
parent | 212dfdbb92344cac86f8a511697b148ddd00678d (diff) |
add function of adding screen text shape
Change-Id: I0f40081a0855bc8e43a8d4761222bd351b5d6f0c
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/charttypes/GL3DBarChart.cxx | 15 | ||||
-rw-r--r-- | chart2/source/view/inc/GL3DBarChart.hxx | 1 |
2 files changed, 11 insertions, 5 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 532868386d04..70417c29011c 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -912,6 +912,15 @@ void GL3DBarChart::contextDestroyed() mbValidContext = false; } +void GL3DBarChart::addScreenTextShape(OUString &nStr, glm::vec2 rLeftTop, float nTextHeight, glm::vec3 rPos) +{ + maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, nStr, 0)); + opengl3D::TextCacheItem tmpTextCache = mpTextCache->getText(nStr); + float rectWidth = (float)tmpTextCache.maSize.Width() / (float)tmpTextCache.maSize.Height() * 0.05; + opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back()); + pScreenText->setPosition(rLeftTop, glm::vec2(rLeftTop.x + rectWidth, rLeftTop.y - nTextHeight), rPos); +} + void GL3DBarChart::updateRenderFPS() { int aDeltaMs = calcTimeInterval(mafpsRenderStartTime, mafpsRenderEndTime); @@ -925,11 +934,7 @@ void GL3DBarChart::updateRenderFPS() osl_getSystemTime(&mafpsRenderStartTime); } osl_getSystemTime(&mafpsRenderEndTime); - maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, maFPS, 0)); - opengl3D::TextCacheItem tmpTextCache = mpTextCache->getText(maFPS); - float rectWidth = (float)tmpTextCache.maSize.Width() / (float)tmpTextCache.maSize.Height() * 0.05; - opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back()); - pScreenText->setPosition(glm::vec2(-0.99f, 0.99f), glm::vec2(-0.99f + rectWidth, 0.89f)); + addScreenTextShape(maFPS, glm::vec2(-0.99f, 0.99f), 0.1f, glm::vec3(0.0, 0.0, 0.0)); } int GL3DBarChart::calcTimeInterval(TimeValue &startTime, TimeValue &endTime) diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx index 27712609877d..88de9e0cc5ac 100644 --- a/chart2/source/view/inc/GL3DBarChart.hxx +++ b/chart2/source/view/inc/GL3DBarChart.hxx @@ -90,6 +90,7 @@ private: void updateRenderFPS(); DECL_LINK(updateTimer, void*); int calcTimeInterval(TimeValue &startTime, TimeValue &endTime); + void addScreenTextShape(OUString &nStr, glm::vec2 rLeftTop, float nTextHeight, glm::vec3 rPos); css::uno::Reference<css::chart2::XChartType> mxChartType; boost::ptr_vector<opengl3D::Renderable3DObject> maShapes; |