Kaydet (Commit) 5afc5d1b authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

improve text positioning

Change-Id: I9a6d99105ae32a2e03e4756983a87cb4ad174ea2
üst 13dffbb7
......@@ -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);
......
......@@ -81,6 +81,8 @@ struct TextInfo
GLuint texture;
double rotation;
float vertex[12];
long bmpWidth;
long bmpHeight;
};
typedef std::vector<GLfloat> Area2DPointList;
......
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