ShowPaint uses the shared buffer
This commit is contained in:
parent
45f42cdea9
commit
ecc4f83c09
2 changed files with 4 additions and 19 deletions
|
@ -45,26 +45,11 @@ static QColor colors[] = { Qt::red, Qt::green, Qt::blue, Qt::cyan, Qt::magenta,
|
||||||
|
|
||||||
ShowPaintEffect::ShowPaintEffect()
|
ShowPaintEffect::ShowPaintEffect()
|
||||||
: color_index( 0 )
|
: color_index( 0 )
|
||||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
|
||||||
, vbo( 0 )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
|
||||||
if (effects->compositingType() == OpenGLCompositing) {
|
|
||||||
vbo = new GLVertexBuffer(GLVertexBuffer::Stream);
|
|
||||||
vbo->setUseColor(true);
|
|
||||||
if (ShaderManager::instance()->isValid()) {
|
|
||||||
vbo->setUseShader(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowPaintEffect::~ShowPaintEffect()
|
ShowPaintEffect::~ShowPaintEffect()
|
||||||
{
|
{
|
||||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
|
||||||
delete vbo;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowPaintEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
|
void ShowPaintEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
|
||||||
|
@ -95,8 +80,12 @@ void ShowPaintEffect::paintGL()
|
||||||
#ifndef KWIN_HAVE_OPENGLES
|
#ifndef KWIN_HAVE_OPENGLES
|
||||||
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT );
|
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT );
|
||||||
#endif
|
#endif
|
||||||
|
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
|
||||||
|
vbo->reset();
|
||||||
|
vbo->setUseColor(true);
|
||||||
if (ShaderManager::instance()->isValid()) {
|
if (ShaderManager::instance()->isValid()) {
|
||||||
ShaderManager::instance()->pushShader(ShaderManager::ColorShader);
|
ShaderManager::instance()->pushShader(ShaderManager::ColorShader);
|
||||||
|
vbo->setUseShader(true);
|
||||||
}
|
}
|
||||||
glEnable( GL_BLEND );
|
glEnable( GL_BLEND );
|
||||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||||
|
|
|
@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
class GLVertexBuffer;
|
|
||||||
|
|
||||||
class ShowPaintEffect
|
class ShowPaintEffect
|
||||||
: public Effect
|
: public Effect
|
||||||
|
@ -40,9 +39,6 @@ class ShowPaintEffect
|
||||||
void paintXrender();
|
void paintXrender();
|
||||||
QRegion painted; // what's painted in one pass
|
QRegion painted; // what's painted in one pass
|
||||||
int color_index;
|
int color_index;
|
||||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
|
||||||
GLVertexBuffer *vbo;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in a new issue