The nice things about unstable ABIs is that you can remove deprecated paintText* methods, which are not used by any effect.
svn path=/trunk/KDE/kdebase/workspace/; revision=1146500
This commit is contained in:
parent
8777c45677
commit
5aba1baddb
2 changed files with 1 additions and 162 deletions
|
@ -386,113 +386,6 @@ KConfigGroup EffectsHandler::effectConfig( const QString& effectname )
|
|||
return kwinconfig->group( "Effect-" + effectname );
|
||||
}
|
||||
|
||||
bool EffectsHandler::paintText( const QString& text, const QRect& rect, const QColor& color,
|
||||
const QFont& font, const Qt::Alignment& alignment )
|
||||
{
|
||||
QPainter p;
|
||||
// Calculate size of the text
|
||||
QFontMetrics fm( font );
|
||||
QString painttext = fm.elidedText( text, Qt::ElideRight, rect.width() );
|
||||
QRect textrect = fm.boundingRect( painttext );
|
||||
|
||||
// Create temporary QImage where the text will be drawn onto
|
||||
QImage textImage( textrect.width(), textrect.height(), QImage::Format_ARGB32 );
|
||||
textImage.fill( Qt::transparent );
|
||||
|
||||
// Draw the text
|
||||
p.begin( &textImage );
|
||||
p.setFont( font );
|
||||
p.setRenderHint( QPainter::TextAntialiasing );
|
||||
p.setPen( color );
|
||||
p.drawText( -textrect.topLeft(), painttext );
|
||||
p.end();
|
||||
|
||||
// Area covered by text
|
||||
int rectX, rectY;
|
||||
if( alignment & Qt::AlignLeft )
|
||||
rectX = rect.x();
|
||||
else if( alignment & Qt::AlignRight )
|
||||
rectX = rect.right() - textrect.width();
|
||||
else
|
||||
rectX = rect.center().x() - textrect.width() / 2;
|
||||
if( alignment & Qt::AlignTop )
|
||||
rectY = rect.y();
|
||||
else if( alignment & Qt::AlignBottom )
|
||||
rectY = rect.bottom() - textrect.height();
|
||||
else
|
||||
rectY = rect.center().y() - textrect.height() / 2;
|
||||
QRect area( rectX, rectY, textrect.width(), textrect.height() );
|
||||
|
||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
||||
if( effects->compositingType() == OpenGLCompositing )
|
||||
{
|
||||
GLTexture textTexture( textImage, GL_TEXTURE_RECTANGLE_ARB );
|
||||
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT );
|
||||
glEnable( GL_BLEND );
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
textTexture.bind();
|
||||
textTexture.render( infiniteRegion(), area );
|
||||
textTexture.unbind();
|
||||
glPopAttrib();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
if( effects->compositingType() == XRenderCompositing )
|
||||
{
|
||||
XRenderPicture textPicture( QPixmap::fromImage( textImage ));
|
||||
XRenderComposite( display(), textImage.depth() == 32 ? PictOpOver : PictOpSrc,
|
||||
textPicture, None, effects->xrenderBufferPicture(),
|
||||
0, 0, 0, 0, area.x(), area.y(), area.width(), area.height());
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EffectsHandler::paintTextWithBackground( const QString& text, const QRect& rect, const QColor& color,
|
||||
const QColor& bgcolor, const QFont& font, const Qt::Alignment& alignment )
|
||||
{
|
||||
// Calculate size of the text
|
||||
QFontMetrics fm( font );
|
||||
QString painttext = fm.elidedText( text, Qt::ElideRight, rect.width() );
|
||||
QRect textrect = fm.boundingRect( painttext );
|
||||
|
||||
// Area covered by text
|
||||
int rectX, rectY;
|
||||
if( alignment & Qt::AlignLeft )
|
||||
rectX = rect.x();
|
||||
else if( alignment & Qt::AlignRight )
|
||||
rectX = rect.right() - textrect.width();
|
||||
else
|
||||
rectX = rect.center().x() - textrect.width() / 2;
|
||||
if( alignment & Qt::AlignTop )
|
||||
rectY = rect.y();
|
||||
else if( alignment & Qt::AlignBottom )
|
||||
rectY = rect.bottom() - textrect.height();
|
||||
else
|
||||
rectY = rect.center().y() - textrect.height() / 2;
|
||||
QRect area( rectX, rectY, textrect.width(), textrect.height() );
|
||||
|
||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
||||
if( effects->compositingType() == OpenGLCompositing )
|
||||
{
|
||||
glColor4f( bgcolor.redF(), bgcolor.greenF(), bgcolor.blueF(), bgcolor.alphaF() );
|
||||
renderRoundBox( area.adjusted( -8, -3, 8, 3 ), 5 );
|
||||
|
||||
return paintText( text, rect, color, font, alignment );
|
||||
}
|
||||
#endif
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
if( effects->compositingType() == XRenderCompositing )
|
||||
{
|
||||
xRenderRoundBox( effects->xrenderBufferPicture(), area.adjusted( -8, -3, 8, 3 ), 5, bgcolor );
|
||||
return paintText( text, rect, color, font, alignment );
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EffectsHandler::checkDriverBlacklist( const KConfigGroup& blacklist )
|
||||
{
|
||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
||||
|
|
|
@ -169,7 +169,7 @@ X-KDE-Library=kwin4_effect_cooleffect
|
|||
|
||||
#define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
|
||||
#define KWIN_EFFECT_API_VERSION_MAJOR 0
|
||||
#define KWIN_EFFECT_API_VERSION_MINOR 150
|
||||
#define KWIN_EFFECT_API_VERSION_MINOR 151
|
||||
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
|
||||
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
|
||||
|
||||
|
@ -757,39 +757,6 @@ class KWIN_EXPORT EffectsHandler
|
|||
*/
|
||||
virtual bool decorationsHaveAlpha() const = 0;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see EffectFrame
|
||||
* Paints given text onto screen, possibly in elided form
|
||||
* @param text
|
||||
* @param center center point of the painted text
|
||||
* @param maxwidth if text is longer than this, is will be elided
|
||||
* @param color color of the text, may contain alpha
|
||||
* @param font font for the text
|
||||
**/
|
||||
bool paintText( const QString& text, const QPoint& center, int maxwidth,
|
||||
const QColor& color, const QFont& font = QFont() );
|
||||
/**
|
||||
* @deprecated
|
||||
* @see EffectFrame
|
||||
*/
|
||||
bool paintText( const QString& text, const QRect& rect, const QColor& color,
|
||||
const QFont& font = QFont(), const Qt::Alignment& alignment = Qt::AlignCenter );
|
||||
/**
|
||||
* @deprecated
|
||||
* @see EffectFrame
|
||||
*/
|
||||
bool paintTextWithBackground( const QString& text, const QPoint& center, int maxwidth,
|
||||
const QColor& color, const QColor& bgcolor,
|
||||
const QFont& font = QFont() );
|
||||
/**
|
||||
* @deprecated
|
||||
* @see EffectFrame
|
||||
*/
|
||||
bool paintTextWithBackground( const QString& text, const QRect& rect, const QColor& color,
|
||||
const QColor& bgcolor, const QFont& font = QFont(),
|
||||
const Qt::Alignment& alignment = Qt::AlignCenter );
|
||||
|
||||
/**
|
||||
* Checks if the driver is on given blacklist.
|
||||
* The format of the blacklist is driver identifier as key (e.g. Intel) with a list of
|
||||
|
@ -1806,27 +1773,6 @@ class KWIN_EXPORT EffectFrame : public QObject
|
|||
**/
|
||||
extern KWIN_EXPORT EffectsHandler* effects;
|
||||
|
||||
/***************************************************************
|
||||
EffectsHandler
|
||||
***************************************************************/
|
||||
|
||||
inline
|
||||
bool EffectsHandler::paintText( const QString& text, const QPoint& center, int maxwidth,
|
||||
const QColor& color, const QFont& font )
|
||||
{
|
||||
return paintText( text, QRect( center.x() - maxwidth / 2, center.y() - 5000, maxwidth, 10000 ),
|
||||
color, font, Qt::AlignCenter );
|
||||
}
|
||||
|
||||
inline
|
||||
bool EffectsHandler::paintTextWithBackground( const QString& text, const QPoint& center, int maxwidth,
|
||||
const QColor& color, const QColor& bgcolor, const QFont& font )
|
||||
{
|
||||
return paintTextWithBackground( text,
|
||||
QRect( center.x() - maxwidth / 2, center.y() - 5000, maxwidth, 10000 ),
|
||||
color, bgcolor, font, Qt::AlignCenter );
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
WindowVertex
|
||||
***************************************************************/
|
||||
|
|
Loading…
Reference in a new issue