show private message on screen

* disable GL blending in some situations to speedup on older hardware
* fix wrap size in CachedText
This commit is contained in:
Eduardo Bart
2012-06-09 10:00:08 -03:00
parent 205aefe12f
commit 1a2e97bb5e
12 changed files with 65 additions and 63 deletions

View File

@@ -55,6 +55,8 @@ void CachedText::update()
void CachedText::wrapText(int maxWidth)
{
if(m_font)
if(m_font) {
m_text = m_font->wrapText(m_text, maxWidth);
update();
}
}

View File

@@ -148,10 +148,10 @@ void FrameBuffer::internalRelease()
// restore screen original content
if(m_backuping) {
Painter::CompositionMode oldComposition = g_painter->getCompositionMode();
g_painter->setCompositionMode(Painter::CompositionMode_Replace);
glDisable(GL_BLEND);
g_painter->setColor(Color::white);
g_painter->drawTexturedRect(screenRect, m_screenBackup, screenRect);
g_painter->setCompositionMode(oldComposition);
glEnable(GL_BLEND);
}
}
}

View File

@@ -79,13 +79,6 @@ void Graphics::init()
// blending is always enabled
glEnable(GL_BLEND);
// face culling may improve performance
/*
glCullFace(GL_BACK);
glFrontFace(GL_CW);
glEnable(GL_CULL_FACE);
*/
// determine max texture size
GLint maxTextureSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);

View File

@@ -162,9 +162,8 @@ void Painter::updateGlCompositionMode()
case CompositionMode_Normal:
if(g_graphics.canUseBlendFuncSeparate())
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
else {
else
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
break;
case CompositionMode_Multiply:
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);

View File

@@ -125,9 +125,8 @@ void MapView::draw(const Rect& rect)
drawOffset.y += (srcVisible.height() - srcSize.height()) / 2;
Rect srcRect = Rect(drawOffset, srcSize);
g_painter->saveState();
g_painter->setColor(Color::white);
g_painter->setCompositionMode(Painter::CompositionMode_Replace);
glDisable(GL_BLEND);
#if 0
// debug source area
g_painter->saveAndResetState();
@@ -140,7 +139,7 @@ void MapView::draw(const Rect& rect)
#else
m_framebuffer->draw(rect, srcRect);
#endif
g_painter->restoreSavedState();
glEnable(GL_BLEND);
//g_painter->resetShaderProgram();

View File

@@ -55,11 +55,10 @@ void UIMap::drawSelf(Fw::DrawPane drawPane)
g_painter->drawBoundingRect(m_mapRect.expanded(1));
if(drawPane != Fw::BothPanes) {
g_painter->saveState();
g_painter->setCompositionMode(Painter::CompositionMode_Replace);
glDisable(GL_BLEND);
g_painter->setColor(Color::alpha);
g_painter->drawFilledRect(m_mapRect);
g_painter->restoreSavedState();
glEnable(GL_BLEND);
}
}