X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/ba02fb4aced5868d047a5bffbd2ed87583daee4d..dba614edd2aad3c17e244914eaef3809d8300cb1:/lib/gdi/grc.cpp diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index cb2a6de9..a63aef92 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -1,5 +1,5 @@ // for debugging use: - #define SYNC_PAINT +// #define SYNC_PAINT #include #ifndef SYNC_PAINT #include @@ -342,8 +342,23 @@ void gDC::exec(gOpcode *o) ePtr para = new eTextPara(o->parm.renderText->area); assert(m_current_font); para->setFont(m_current_font); - para->renderString(o->parm.renderText->text, o->parm.renderText->flags); - para->blit(*this, m_current_offset, getRGB(m_background_color), getRGB(m_foreground_color)); + para->renderString(o->parm.renderText->text, 0); + + if (o->parm.renderText->flags & gPainter::RT_HALIGN_RIGHT) + para->realign(eTextPara::dirRight); + else if (o->parm.renderText->flags & gPainter::RT_HALIGN_CENTER) + para->realign(eTextPara::dirCenter); + else if (o->parm.renderText->flags & gPainter::RT_HALIGN_BLOCK) + para->realign(eTextPara::dirBlock); + + ePoint offset = m_current_offset; + + if (o->parm.renderText->flags & gPainter::RT_VALIGN_CENTER) + { + eRect bbox = para->getBoundBox(); + offset += ePoint(0, (o->parm.renderText->area.height() - bbox.height()) / 2); + } + para->blit(*this, offset, getRGB(m_background_color), getRGB(m_foreground_color)); delete o->parm.renderText; break; }