[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kwin_composite
From: Rivo Laks <rivolaks () hot ! ee>
Date: 2007-04-20 15:53:33
Message-ID: 1177084413.443562.21169.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 656210 by rivol:
Support having multiple rendertarget-using effects active at once
M +22 -0 effects.cpp
M +6 -0 effects.h
M +3 -2 effects/demo_liquid.cpp
M +3 -2 effects/test_fbo.cpp
M +4 -0 lib/kwineffects.h
--- branches/work/kwin_composite/effects.cpp #656209:656210
@@ -16,6 +16,7 @@
#include "scene_xrender.h"
#include "scene_opengl.h"
#include "workspace.h"
+#include "kwinglutils.h"
#include <QFile>
@@ -393,6 +394,27 @@
return NULL;
}
+void EffectsHandlerImpl::pushRenderTarget(GLRenderTarget* target)
+{
+#ifdef HAVE_OPENGL
+ target->enable();
+ render_targets.push(target);
+#endif
+}
+
+GLRenderTarget* EffectsHandlerImpl::popRenderTarget()
+{
+#ifdef HAVE_OPENGL
+ GLRenderTarget* ret = render_targets.pop();
+ ret->disable();
+ if( !render_targets.isEmpty() )
+ render_targets.top()->enable();
+ return ret;
+#else
+ return 0;
+#endif
+}
+
void EffectsHandlerImpl::addRepaintFull()
{
Workspace::self()->addRepaintFull();
--- branches/work/kwin_composite/effects.h #656209:656210
@@ -15,8 +15,10 @@
#include "scene.h"
+#include <QStack>
+
namespace KWin
{
@@ -60,6 +62,9 @@
virtual int currentTabBoxDesktop() const;
virtual EffectWindow* currentTabBoxWindow() const;
+ virtual void pushRenderTarget(GLRenderTarget* target);
+ virtual GLRenderTarget* popRenderTarget();
+
virtual void addRepaintFull();
virtual void addRepaint( const QRect& r );
virtual void addRepaint( int x, int y, int w, int h );
@@ -107,6 +112,7 @@
protected:
KLibrary* findEffectLibrary( const QString& effectname );
Effect* keyboard_grab_effect;
+ QStack<GLRenderTarget*> render_targets;
};
class EffectWindowImpl : public EffectWindow
--- branches/work/kwin_composite/effects/demo_liquid.cpp #656209:656210
@@ -17,6 +17,7 @@
#include <KStandardDirs>
#include <kdebug.h>
+#include <assert.h>
namespace KWin
@@ -79,7 +80,7 @@
{
*mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
// Start rendering to texture
- mRenderTarget->enable();
+ effects->pushRenderTarget(mRenderTarget);
}
effects->prePaintScreen(mask, region, time);
@@ -93,7 +94,7 @@
if(mValid)
{
// Disable render texture
- mRenderTarget->disable();
+ assert( effects->popRenderTarget() == mRenderTarget );
mTexture->bind();
// Use the shader
--- branches/work/kwin_composite/effects/test_fbo.cpp #656209:656210
@@ -13,6 +13,7 @@
#include <kwinglutils.h>
+#include <assert.h>
namespace KWin
{
@@ -47,7 +48,7 @@
{
*mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
// Start rendering to texture
- mRenderTarget->enable();
+ effects->pushRenderTarget(mRenderTarget);
}
effects->prePaintScreen(mask, region, time);
@@ -61,7 +62,7 @@
if(mValid)
{
// Disable render texture
- mRenderTarget->disable();
+ assert( effects->popRenderTarget() == mRenderTarget );
mTexture->bind();
// Render fullscreen quad with screen contents
--- branches/work/kwin_composite/lib/kwineffects.h #656209:656210
@@ -36,6 +36,7 @@
class EffectWindowGroup;
class Effect;
class Vertex;
+class GLRenderTarget;
typedef QPair< QString, Effect* > EffectPair;
typedef QPair< Effect*, Window > InputWindowPair;
@@ -208,6 +209,9 @@
virtual int currentTabBoxDesktop() const = 0;
virtual EffectWindow* currentTabBoxWindow() const = 0;
+ virtual void pushRenderTarget(GLRenderTarget* target) = 0;
+ virtual GLRenderTarget* popRenderTarget() = 0;
+
// Repaints the entire workspace
virtual void addRepaintFull() = 0;
virtual void addRepaint( const QRect& r ) = 0;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic