diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 9c046c17ad..abfae98fcf 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -93,6 +93,7 @@ if( KWIN_HAVE_OPENGL_COMPOSITING ) include( cube/CMakeLists.txt ) include( flipswitch/CMakeLists.txt ) include( glide/CMakeLists.txt ) + include( magnifier/CMakeLists.txt ) include( mousemark/CMakeLists.txt ) include( screenshot/CMakeLists.txt ) include( sheet/CMakeLists.txt ) @@ -106,7 +107,6 @@ if( KWIN_HAVE_OPENGL_COMPOSITING AND NOT KWIN_HAVE_OPENGLES_COMPOSITING ) include( explosion/CMakeLists.txt ) include( invert/CMakeLists.txt ) include( lookingglass/CMakeLists.txt ) - include( magnifier/CMakeLists.txt ) include( sharpen/CMakeLists.txt ) include( snow/CMakeLists.txt ) endif( KWIN_HAVE_OPENGL_COMPOSITING AND NOT KWIN_HAVE_OPENGLES_COMPOSITING ) diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index 01463a7e99..e285c1d2d4 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -44,6 +44,7 @@ along with this program. If not, see . #include "cube/cubeslide_config.h" #include "flipswitch/flipswitch_config.h" #include "glide/glide_config.h" +#include "magnifier/magnifier_config.h" #include "mousemark/mousemark_config.h" #include "trackmouse/trackmouse_config.h" #include "wobblywindows/wobblywindows_config.h" @@ -51,7 +52,6 @@ along with this program. If not, see . #include "blur/blur_config.h" #include "invert/invert_config.h" #include "lookingglass/lookingglass_config.h" -#include "magnifier/magnifier_config.h" #include "sharpen/sharpen_config.h" #include "snow/snow_config.h" #endif @@ -86,6 +86,7 @@ KWIN_EFFECT_CONFIG_MULTIPLE( builtins, KWIN_EFFECT_CONFIG_SINGLE( cubeslide, CubeSlideEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( flipswitch, FlipSwitchEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( glide, GlideEffectConfig ) + KWIN_EFFECT_CONFIG_SINGLE( magnifier, MagnifierEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( mousemark, MouseMarkEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( trackmouse, TrackMouseEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( wobblywindows, WobblyWindowsEffectConfig ) @@ -93,7 +94,6 @@ KWIN_EFFECT_CONFIG_MULTIPLE( builtins, KWIN_EFFECT_CONFIG_SINGLE( blur, BlurEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( invert, InvertEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( lookingglass, LookingGlassEffectConfig ) - KWIN_EFFECT_CONFIG_SINGLE( magnifier, MagnifierEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( sharpen, SharpenEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( snow, SnowEffectConfig ) #endif diff --git a/effects/magnifier/magnifier.cpp b/effects/magnifier/magnifier.cpp index de16d7e4f0..b1f862ea4d 100644 --- a/effects/magnifier/magnifier.cpp +++ b/effects/magnifier/magnifier.cpp @@ -28,9 +28,7 @@ along with this program. If not, see . #include #include -#ifdef KWIN_HAVE_OPENGL_COMPOSITING -#include -#endif +#include namespace KWin { @@ -96,37 +94,46 @@ void MagnifierEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da data2.yTranslate = - int( cursor.y() * ( zoom - 1 )); effects->paintScreen( mask, region, data2 ); PaintClipper::pop( area ); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING - if( effects->compositingType() == KWin::OpenGLCompositing ) - { - glPushAttrib( GL_CURRENT_BIT ); - glColor4f( 0, 0, 0, 1 ); // black - for( PaintClipper::Iterator iterator; - !iterator.isDone(); - iterator.next()) - { - glBegin( GL_QUADS ); - glVertex2i( area.left() - FRAME_WIDTH, area.top() - FRAME_WIDTH ); // top frame - glVertex2i( area.right() + FRAME_WIDTH, area.top() - FRAME_WIDTH ); - glVertex2i( area.right() + FRAME_WIDTH, area.top() - 1 ); - glVertex2i( area.left() - FRAME_WIDTH, area.top() - 1 ); - glVertex2i( area.left() - FRAME_WIDTH, area.top() - FRAME_WIDTH ); // left frame - glVertex2i( area.left() - 1, area.top() - FRAME_WIDTH ); - glVertex2i( area.left() - 1, area.bottom() + FRAME_WIDTH ); - glVertex2i( area.left() - FRAME_WIDTH, area.bottom() + FRAME_WIDTH ); - glVertex2i( area.right() + 1, area.top() - FRAME_WIDTH ); // right frame - glVertex2i( area.right() + FRAME_WIDTH, area.top() - FRAME_WIDTH ); - glVertex2i( area.right() + FRAME_WIDTH, area.bottom() + FRAME_WIDTH ); - glVertex2i( area.right() + 1, area.bottom() + FRAME_WIDTH ); - glVertex2i( area.left() - FRAME_WIDTH, area.bottom() + 1 ); // bottom frame - glVertex2i( area.right() + FRAME_WIDTH, area.bottom() + 1 ); - glVertex2i( area.right() + FRAME_WIDTH, area.bottom() + FRAME_WIDTH ); - glVertex2i( area.left() - FRAME_WIDTH, area.bottom() + FRAME_WIDTH ); - glEnd(); - } - glPopAttrib(); - } -#endif + QVector verts; + GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); + vbo->reset(); + vbo->setColor(QColor(0, 0, 0)); + // top frame + verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH; + verts << area.left() - FRAME_WIDTH << area.top() - FRAME_WIDTH; + verts << area.left() - FRAME_WIDTH << area.top() - 1; + verts << area.left() - FRAME_WIDTH << area.top() - 1; + verts << area.right() + FRAME_WIDTH << area.top() - 1; + verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH; + // left frame + verts << area.left() - 1 << area.top() - FRAME_WIDTH; + verts << area.left() - FRAME_WIDTH << area.top() - FRAME_WIDTH; + verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH; + verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH; + verts << area.left() - 1 << area.bottom() + FRAME_WIDTH; + verts << area.left() - 1 << area.top() - FRAME_WIDTH; + // right frame + verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH; + verts << area.right() + 1 << area.top() - FRAME_WIDTH; + verts << area.right() + 1 << area.bottom() + FRAME_WIDTH; + verts << area.right() + 1 << area.bottom() + FRAME_WIDTH; + verts << area.right() + FRAME_WIDTH << area.bottom() + FRAME_WIDTH; + verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH; + // bottom frame + verts << area.right() + FRAME_WIDTH << area.bottom() + 1; + verts << area.left() - FRAME_WIDTH << area.bottom() + 1; + verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH; + verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH; + verts << area.right() + FRAME_WIDTH << area.bottom() + FRAME_WIDTH; + verts << area.right() + FRAME_WIDTH << area.bottom() + 1; + vbo->setData(verts.size()/2, 2, verts.constData(), NULL); + if (ShaderManager::instance()->isValid()) { + ShaderManager::instance()->pushShader(ShaderManager::ColorShader); + } + vbo->render(GL_TRIANGLES); + if (ShaderManager::instance()->isValid()) { + ShaderManager::instance()->popShader(); + } } }