X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/54b9e2790954b623c99823ab64782d4e39c128bf..9f0676bf1c67c28f7ffb114bcff785d455d7b509:/lib/gdi/grc.cpp diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index 99fe0859..7f884024 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 @@ -55,6 +55,7 @@ gRC::~gRC() void *gRC::thread() { + int need_notify = 0; #ifndef SYNC_PAINT while (1) #else @@ -66,12 +67,17 @@ void *gRC::thread() if (o.opcode==gOpcode::shutdown) break; if (o.opcode==gOpcode::notify) - { - m_notify_pump.send(1); - } else + need_notify = 1; + else o.dc->exec(&o); o.dc->Release(); queue.dequeue(); + + if ((!queue.size()) && need_notify) + { + need_notify = 0; + m_notify_pump.send(1); + } } #ifndef SYNC_PAINT pthread_exit(0); @@ -373,6 +379,10 @@ void gPainter::notify() void gPainter::end() { + gOpcode o; + o.opcode = gOpcode::flush; + o.dc = m_dc.grabRef(); + m_rc->submit(o); } gDC::gDC() @@ -432,7 +442,9 @@ void gDC::exec(gOpcode *o) if (o->parm.renderText->flags & gPainter::RT_VALIGN_CENTER) { eRect bbox = para->getBoundBox(); - offset += ePoint(0, (o->parm.renderText->area.height() - bbox.height()) / 2); + int vcentered_top = (o->parm.renderText->area.height() - bbox.height()) / 2; + int correction = vcentered_top - bbox.top(); + offset += ePoint(0, correction); } para->blit(*this, offset, getRGB(m_background_color), getRGB(m_foreground_color)); delete o->parm.renderText;