Commit 4f445a75 authored by Martin Flöser's avatar Martin Flöser

Screenshot Effect ported to GLES

parent 34f37400
......@@ -94,6 +94,7 @@ if( KWIN_HAVE_OPENGL_COMPOSITING )
include( flipswitch/CMakeLists.txt )
include( glide/CMakeLists.txt )
include( mousemark/CMakeLists.txt )
include( screenshot/CMakeLists.txt )
include( sheet/CMakeLists.txt )
include( snaphelper/CMakeLists.txt )
include( trackmouse/CMakeLists.txt )
......@@ -105,7 +106,6 @@ if( KWIN_HAVE_OPENGL_COMPOSITING AND NOT KWIN_HAVE_OPENGLES_COMPOSITING )
include( invert/CMakeLists.txt )
include( lookingglass/CMakeLists.txt )
include( magnifier/CMakeLists.txt )
include( screenshot/CMakeLists.txt )
include( sharpen/CMakeLists.txt )
include( snow/CMakeLists.txt )
include( startupfeedback/CMakeLists.txt )
......
......@@ -112,22 +112,14 @@ void ScreenShotEffect::postPaintScreen()
// render window into offscreen texture
int mask = PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_TRANSLUCENT;
effects->pushRenderTarget( target );
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear( GL_COLOR_BUFFER_BIT );
glClearColor(0.0, 0.0, 0.0, 1.0);
effects->drawWindow( m_scheduledScreenshot, mask, QRegion( 0, 0, width, height ), d );
// Create a scratch texture and copy the rendered window into it
GLTexture* tex = new GLTexture( width, height );
tex->setFilter( GL_LINEAR );
tex->setWrapMode( GL_CLAMP_TO_EDGE );
tex->bind();
glCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, offscreenTexture->height() - height, width, height );
effects->popRenderTarget();
// copy content from GL texture into image
// copy content from framebuffer into image
QImage img( QSize( width, height ), QImage::Format_ARGB32 );
tex->bind();
glGetTexImage( GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.bits() );
tex->unbind();
delete tex;
glReadPixels(0, offscreenTexture->height() - height, width, height, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
effects->popRenderTarget();
ScreenShotEffect::convertFromGLImage( img, width, height );
if( m_type & INCLUDE_CURSOR )
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment