diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-02-15 22:20:23 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-02-16 02:54:13 +0100 |
commit | 5afc5d1bfd1bc8ca52d2a03d6b7758c72eb9698e (patch) | |
tree | 5a237efb7246ae4c579d3e618ea94074464dfec5 /chart2 | |
parent | 13dffbb750ef65bfb06f0f9f96bce2e40512539f (diff) |
improve text positioning
Change-Id: I9a6d99105ae32a2e03e4756983a87cb4ad174ea2
Diffstat (limited to 'chart2')
-rwxr-xr-x | chart2/source/view/main/OpenGLRender.cxx | 5 | ||||
-rwxr-xr-x | chart2/source/view/main/OpenGLRender.hxx | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 8ecc8880dcc4..a4184323dcce 100755 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -1290,6 +1290,9 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point& aTextInfo.vertex[10] = (rTrans.Line2.Column3 + aSize.Height) / OPENGL_SCALE_VALUE; aTextInfo.vertex[11] = m_fZStep; + aTextInfo.bmpWidth = bmpWidth; + aTextInfo.bmpHeight = bmpHeight; + //if has ratotion, we must re caculate the central pos if (!rtl::math::approxEqual(0, rotation)) { @@ -1324,7 +1327,7 @@ int OpenGLRender::RenderTextShape() for (size_t i = 0; i < listNum; i++) { TextInfo &textInfo = m_TextInfoList.front(); - PosVecf3 trans = {0, 0, 0}; + PosVecf3 trans = { (float)-textInfo.bmpWidth/2.0f, (float)-textInfo.bmpHeight/2.0f, 0}; PosVecf3 angle = {0.0f, 0.0f, float(textInfo.rotation)}; PosVecf3 scale = {1.0, 1.0, 1.0f}; MoveModelf(trans, angle, scale); diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index 2a934cf39399..b91d5f3aec99 100755 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -81,6 +81,8 @@ struct TextInfo GLuint texture; double rotation; float vertex[12]; + long bmpWidth; + long bmpHeight; }; typedef std::vector<GLfloat> Area2DPointList; |