Fix rendering of text and unstyled frames in OpenGL mode. Now it looks
identical to what it is in XRender mode. svn path=/trunk/KDE/kdebase/workspace/; revision=933999
This commit is contained in:
parent
b85565f6c0
commit
6a9b6692e8
1 changed files with 24 additions and 3 deletions
|
@ -1454,11 +1454,17 @@ void EffectFrame::render( QRegion region, double opacity, double frameOpacity )
|
||||||
|
|
||||||
glColor4f( 0.0, 0.0, 0.0, opacity * frameOpacity );
|
glColor4f( 0.0, 0.0, 0.0, opacity * frameOpacity );
|
||||||
|
|
||||||
|
// Our unstyled frame texture is premultiplied
|
||||||
|
// TODO: Fix GLTexture::convertToGLFormat()
|
||||||
|
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
|
||||||
|
|
||||||
m_unstyledTexture->bind();
|
m_unstyledTexture->bind();
|
||||||
m_unstyledTexture->enableNormalizedTexCoords();
|
m_unstyledTexture->enableNormalizedTexCoords();
|
||||||
renderGLGeometry( verts.count() / 2, verts.data(), texCoords.data() );
|
renderGLGeometry( verts.count() / 2, verts.data(), texCoords.data() );
|
||||||
m_unstyledTexture->disableNormalizedTexCoords();
|
m_unstyledTexture->disableNormalizedTexCoords();
|
||||||
m_unstyledTexture->unbind();
|
m_unstyledTexture->unbind();
|
||||||
|
|
||||||
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||||
}
|
}
|
||||||
else if( m_style == Styled )
|
else if( m_style == Styled )
|
||||||
{
|
{
|
||||||
|
@ -1491,6 +1497,10 @@ void EffectFrame::render( QRegion region, double opacity, double frameOpacity )
|
||||||
// Render text
|
// Render text
|
||||||
if( !m_text.isEmpty() )
|
if( !m_text.isEmpty() )
|
||||||
{
|
{
|
||||||
|
// Our text texture is premultiplied
|
||||||
|
// TODO: Fix GLTexture::convertToGLFormat()
|
||||||
|
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
|
||||||
|
|
||||||
if( !m_textTexture ) // Lazy creation
|
if( !m_textTexture ) // Lazy creation
|
||||||
updateTextTexture();
|
updateTextTexture();
|
||||||
m_textTexture->bind();
|
m_textTexture->bind();
|
||||||
|
@ -1747,7 +1757,8 @@ void EffectFrame::updateTextTexture()
|
||||||
text = metrics.elidedText( text, Qt::ElideRight, rect.width() );
|
text = metrics.elidedText( text, Qt::ElideRight, rect.width() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Use QPixmap for this once GLTexture has been converted to it
|
// TODO: Use QPixmap for this once GLTexture has been converted to it. This will
|
||||||
|
// allow us to change the contents without creating a completely new texture.
|
||||||
QImage pixmap( m_geometry.size(), QImage::Format_ARGB32 );
|
QImage pixmap( m_geometry.size(), QImage::Format_ARGB32 );
|
||||||
pixmap.fill( Qt::transparent );
|
pixmap.fill( Qt::transparent );
|
||||||
QPainter p( &pixmap );
|
QPainter p( &pixmap );
|
||||||
|
@ -1804,8 +1815,18 @@ void EffectFrame::updateUnstyledTexture()
|
||||||
{
|
{
|
||||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
||||||
delete m_unstyledTexture;
|
delete m_unstyledTexture;
|
||||||
QString filename = KGlobal::dirs()->findResource( "data", "kwin/circle.png" );
|
// Based off circle() from kwinxrenderutils.cpp
|
||||||
m_unstyledTexture = new GLTexture( filename );
|
#define CS 8
|
||||||
|
QImage tmp( 2 * CS, 2 * CS, QImage::Format_ARGB32 );
|
||||||
|
tmp.fill( Qt::transparent );
|
||||||
|
QPainter p( &tmp );
|
||||||
|
p.setRenderHint( QPainter::Antialiasing );
|
||||||
|
p.setPen( Qt::NoPen );
|
||||||
|
p.setBrush( Qt::black );
|
||||||
|
p.drawEllipse( tmp.rect() );
|
||||||
|
p.end();
|
||||||
|
#undef CS
|
||||||
|
m_unstyledTexture = new GLTexture( tmp );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue