summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-02-15 22:20:23 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-02-16 02:54:13 +0100
commit5afc5d1bfd1bc8ca52d2a03d6b7758c72eb9698e (patch)
tree5a237efb7246ae4c579d3e618ea94074464dfec5 /chart2
parent13dffbb750ef65bfb06f0f9f96bce2e40512539f (diff)
improve text positioning
Change-Id: I9a6d99105ae32a2e03e4756983a87cb4ad174ea2
Diffstat (limited to 'chart2')
-rwxr-xr-xchart2/source/view/main/OpenGLRender.cxx5
-rwxr-xr-xchart2/source/view/main/OpenGLRender.hxx2
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;