Screenshot Effect ported to GLES
This commit is contained in:
parent
22d7c6c5f1
commit
c5c318a342
2 changed files with 6 additions and 14 deletions
|
@ -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 )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue