2010-07-31 20:55:48 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
2013-03-12 12:17:53 +00:00
|
|
|
Copyright (C) 2010 Martin Gräßlin <mgraesslin@kde.org>
|
2010-07-31 20:55:48 +00:00
|
|
|
Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#include "screenshot.h"
|
2015-10-30 09:14:55 +00:00
|
|
|
#include <kwinglplatform.h>
|
2010-07-31 20:55:48 +00:00
|
|
|
#include <kwinglutils.h>
|
2012-03-04 08:53:12 +00:00
|
|
|
#include <kwinxrenderutils.h>
|
2013-08-10 21:19:41 +00:00
|
|
|
#include <QtCore/QTemporaryFile>
|
|
|
|
#include <QtCore/QDir>
|
2010-09-14 19:52:44 +00:00
|
|
|
#include <QtDBus/QDBusConnection>
|
2013-02-26 08:00:51 +00:00
|
|
|
#include <QVarLengthArray>
|
2010-09-14 19:52:44 +00:00
|
|
|
#include <QtGui/QPainter>
|
2013-02-26 07:02:27 +00:00
|
|
|
#include <QMatrix4x4>
|
2013-02-13 07:10:55 +00:00
|
|
|
#include <xcb/xcb_image.h>
|
2010-07-31 20:55:48 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
bool ScreenShotEffect::supported()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-03-04 08:53:12 +00:00
|
|
|
return effects->compositingType() == XRenderCompositing ||
|
2012-09-20 09:33:32 +00:00
|
|
|
(effects->isOpenGLCompositing() && GLRenderTarget::supported());
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2010-07-31 20:55:48 +00:00
|
|
|
|
|
|
|
ScreenShotEffect::ScreenShotEffect()
|
2011-01-30 14:34:42 +00:00
|
|
|
: m_scheduledScreenshot(0)
|
|
|
|
{
|
2012-01-29 11:29:24 +00:00
|
|
|
connect ( effects, SIGNAL(windowClosed(KWin::EffectWindow*)), SLOT(windowClosed(KWin::EffectWindow*)) );
|
2013-07-23 05:02:52 +00:00
|
|
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Screenshot"), this, QDBusConnection::ExportScriptableContents);
|
|
|
|
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kwin.Screenshot"));
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2010-07-31 20:55:48 +00:00
|
|
|
|
|
|
|
ScreenShotEffect::~ScreenShotEffect()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-07-23 05:02:52 +00:00
|
|
|
QDBusConnection::sessionBus().unregisterObject(QStringLiteral("/Screenshot"));
|
|
|
|
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.kwin.Screenshot"));
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2013-02-13 07:10:55 +00:00
|
|
|
|
|
|
|
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
|
|
|
static QImage xPictureToImage(xcb_render_picture_t srcPic, const QRect &geometry, xcb_image_t **xImage)
|
|
|
|
{
|
2014-04-16 13:58:06 +00:00
|
|
|
xcb_connection_t *c = effects->xcbConnection();
|
|
|
|
xcb_pixmap_t xpix = xcb_generate_id(c);
|
|
|
|
xcb_create_pixmap(c, 32, xpix, effects->x11RootWindow(), geometry.width(), geometry.height());
|
2013-02-13 07:10:55 +00:00
|
|
|
XRenderPicture pic(xpix, 32);
|
2014-04-16 13:58:06 +00:00
|
|
|
xcb_render_composite(c, XCB_RENDER_PICT_OP_SRC, srcPic, XCB_RENDER_PICTURE_NONE, pic,
|
2013-02-13 07:10:55 +00:00
|
|
|
geometry.x(), geometry.y(), 0, 0, 0, 0, geometry.width(), geometry.height());
|
2014-04-16 13:58:06 +00:00
|
|
|
xcb_flush(c);
|
|
|
|
*xImage = xcb_image_get(c, xpix, 0, 0, geometry.width(), geometry.height(), ~0, XCB_IMAGE_FORMAT_Z_PIXMAP);
|
2013-02-13 07:10:55 +00:00
|
|
|
QImage img((*xImage)->data, (*xImage)->width, (*xImage)->height, (*xImage)->stride, QImage::Format_ARGB32_Premultiplied);
|
|
|
|
// TODO: byte order might need swapping
|
2014-04-16 13:58:06 +00:00
|
|
|
xcb_free_pixmap(c, xpix);
|
2013-02-13 07:10:55 +00:00
|
|
|
return img;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-07-31 20:55:48 +00:00
|
|
|
void ScreenShotEffect::postPaintScreen()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2010-07-31 20:55:48 +00:00
|
|
|
effects->postPaintScreen();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (m_scheduledScreenshot) {
|
2013-01-08 09:46:10 +00:00
|
|
|
WindowPaintData d(m_scheduledScreenshot);
|
|
|
|
double left = 0;
|
|
|
|
double top = 0;
|
|
|
|
double right = m_scheduledScreenshot->width();
|
|
|
|
double bottom = m_scheduledScreenshot->height();
|
|
|
|
if (m_scheduledScreenshot->hasDecoration() && m_type & INCLUDE_DECORATION) {
|
|
|
|
foreach (const WindowQuad & quad, d.quads) {
|
|
|
|
// we need this loop to include the decoration padding
|
|
|
|
left = qMin(left, quad.left());
|
|
|
|
top = qMin(top, quad.top());
|
|
|
|
right = qMax(right, quad.right());
|
|
|
|
bottom = qMax(bottom, quad.bottom());
|
|
|
|
}
|
|
|
|
} else if (m_scheduledScreenshot->hasDecoration()) {
|
|
|
|
WindowQuadList newQuads;
|
|
|
|
left = m_scheduledScreenshot->width();
|
|
|
|
top = m_scheduledScreenshot->height();
|
|
|
|
right = 0;
|
|
|
|
bottom = 0;
|
|
|
|
foreach (const WindowQuad & quad, d.quads) {
|
|
|
|
if (quad.type() == WindowQuadContents) {
|
|
|
|
newQuads << quad;
|
|
|
|
left = qMin(left, quad.left());
|
|
|
|
top = qMin(top, quad.top());
|
|
|
|
right = qMax(right, quad.right());
|
|
|
|
bottom = qMax(bottom, quad.bottom());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d.quads = newQuads;
|
|
|
|
}
|
|
|
|
const int width = right - left;
|
|
|
|
const int height = bottom - top;
|
2012-03-04 08:53:12 +00:00
|
|
|
bool validTarget = true;
|
2013-01-08 09:46:10 +00:00
|
|
|
QScopedPointer<GLTexture> offscreenTexture;
|
|
|
|
QScopedPointer<GLRenderTarget> target;
|
2012-09-20 09:33:32 +00:00
|
|
|
if (effects->isOpenGLCompositing()) {
|
2014-12-13 13:28:33 +00:00
|
|
|
offscreenTexture.reset(new GLTexture(GL_RGBA8, width, height));
|
2012-03-04 08:53:12 +00:00
|
|
|
offscreenTexture->setFilter(GL_LINEAR);
|
|
|
|
offscreenTexture->setWrapMode(GL_CLAMP_TO_EDGE);
|
2013-01-08 09:46:10 +00:00
|
|
|
target.reset(new GLRenderTarget(*offscreenTexture));
|
2012-03-04 08:53:12 +00:00
|
|
|
validTarget = target->valid();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2012-03-04 08:53:12 +00:00
|
|
|
if (validTarget) {
|
2012-05-28 12:45:46 +00:00
|
|
|
d.setXTranslation(-m_scheduledScreenshot->x() - left);
|
|
|
|
d.setYTranslation(-m_scheduledScreenshot->y() - top);
|
2012-03-04 08:53:12 +00:00
|
|
|
|
2010-07-31 20:55:48 +00:00
|
|
|
// render window into offscreen texture
|
|
|
|
int mask = PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_TRANSLUCENT;
|
2012-03-04 08:53:12 +00:00
|
|
|
QImage img;
|
2012-09-20 09:33:32 +00:00
|
|
|
if (effects->isOpenGLCompositing()) {
|
2013-01-08 09:46:10 +00:00
|
|
|
GLRenderTarget::pushRenderTarget(target.data());
|
2012-03-04 08:53:12 +00:00
|
|
|
glClearColor(0.0, 0.0, 0.0, 0.0);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
glClearColor(0.0, 0.0, 0.0, 1.0);
|
2014-04-01 16:09:02 +00:00
|
|
|
|
|
|
|
QMatrix4x4 projection;
|
|
|
|
projection.ortho(QRect(0, 0, offscreenTexture->width(), offscreenTexture->height()));
|
|
|
|
d.setProjectionMatrix(projection);
|
|
|
|
|
2013-01-08 09:46:10 +00:00
|
|
|
effects->drawWindow(m_scheduledScreenshot, mask, infiniteRegion(), d);
|
2014-04-01 16:09:02 +00:00
|
|
|
|
2012-03-04 08:53:12 +00:00
|
|
|
// copy content from framebuffer into image
|
|
|
|
img = QImage(QSize(width, height), QImage::Format_ARGB32);
|
2015-10-30 13:50:27 +00:00
|
|
|
kwinGlReadnPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, img.byteCount(), (GLvoid*)img.bits());
|
2012-03-04 08:53:12 +00:00
|
|
|
GLRenderTarget::popRenderTarget();
|
|
|
|
ScreenShotEffect::convertFromGLImage(img, width, height);
|
|
|
|
}
|
2012-03-24 07:08:12 +00:00
|
|
|
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
2013-02-13 07:10:55 +00:00
|
|
|
xcb_image_t *xImage = NULL;
|
2012-03-04 08:53:12 +00:00
|
|
|
if (effects->compositingType() == XRenderCompositing) {
|
|
|
|
setXRenderOffscreen(true);
|
|
|
|
effects->drawWindow(m_scheduledScreenshot, mask, QRegion(0, 0, width, height), d);
|
2013-02-11 20:01:41 +00:00
|
|
|
if (xRenderOffscreenTarget()) {
|
2013-02-13 07:10:55 +00:00
|
|
|
img = xPictureToImage(xRenderOffscreenTarget(), QRect(0, 0, width, height), &xImage);
|
2013-02-11 20:01:41 +00:00
|
|
|
}
|
2012-03-04 08:53:12 +00:00
|
|
|
setXRenderOffscreen(false);
|
|
|
|
}
|
2012-03-24 07:08:12 +00:00
|
|
|
#endif
|
2012-03-04 08:53:12 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (m_type & INCLUDE_CURSOR) {
|
|
|
|
grabPointerImage(img, m_scheduledScreenshot->x() + left, m_scheduledScreenshot->y() + top);
|
2010-07-31 20:55:48 +00:00
|
|
|
}
|
2012-03-04 08:53:12 +00:00
|
|
|
|
2013-02-13 07:10:55 +00:00
|
|
|
const int depth = img.depth();
|
2014-04-16 13:58:06 +00:00
|
|
|
xcb_pixmap_t xpix = xcb_generate_id(xcbConnection());
|
|
|
|
xcb_create_pixmap(xcbConnection(), depth, xpix, x11RootWindow(), img.width(), img.height());
|
2013-02-13 07:10:55 +00:00
|
|
|
|
2014-04-16 13:58:06 +00:00
|
|
|
xcb_gcontext_t cid = xcb_generate_id(xcbConnection());
|
|
|
|
xcb_create_gc(xcbConnection(), cid, xpix, 0, NULL);
|
|
|
|
xcb_put_image(xcbConnection(), XCB_IMAGE_FORMAT_Z_PIXMAP, xpix, cid, img.width(), img.height(),
|
2013-02-13 07:10:55 +00:00
|
|
|
0, 0, 0, depth, img.byteCount(), img.constBits());
|
2014-04-16 13:58:06 +00:00
|
|
|
xcb_free_gc(xcbConnection(), cid);
|
|
|
|
xcb_flush(xcbConnection());
|
2013-02-13 07:10:55 +00:00
|
|
|
emit screenshotCreated(xpix);
|
|
|
|
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
|
|
|
if (xImage) {
|
|
|
|
xcb_image_destroy(xImage);
|
2011-05-12 16:52:38 +00:00
|
|
|
}
|
2013-02-13 07:10:55 +00:00
|
|
|
#endif
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2010-07-31 20:55:48 +00:00
|
|
|
m_scheduledScreenshot = NULL;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2010-07-31 20:55:48 +00:00
|
|
|
|
2010-09-14 19:52:44 +00:00
|
|
|
void ScreenShotEffect::screenshotWindowUnderCursor(int mask)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2010-09-14 19:52:44 +00:00
|
|
|
m_type = (ScreenShotType)mask;
|
|
|
|
const QPoint cursor = effects->cursorPos();
|
2011-12-07 14:04:11 +00:00
|
|
|
EffectWindowList order = effects->stackingOrder();
|
|
|
|
EffectWindowList::const_iterator it = order.constEnd(), first = order.constBegin();
|
|
|
|
while( it != first ) {
|
|
|
|
m_scheduledScreenshot = *(--it);
|
|
|
|
if (m_scheduledScreenshot->isOnCurrentDesktop() &&
|
|
|
|
!m_scheduledScreenshot->isMinimized() && !m_scheduledScreenshot->isDeleted() &&
|
|
|
|
m_scheduledScreenshot->geometry().contains(cursor))
|
|
|
|
break;
|
|
|
|
m_scheduledScreenshot = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (m_scheduledScreenshot) {
|
2010-09-14 19:52:44 +00:00
|
|
|
m_scheduledScreenshot->addRepaintFull();
|
2010-07-31 20:55:48 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2011-08-17 17:20:15 +00:00
|
|
|
|
2012-04-12 11:13:49 +00:00
|
|
|
void ScreenShotEffect::screenshotForWindow(qulonglong winid, int mask)
|
|
|
|
{
|
|
|
|
m_type = (ScreenShotType) mask;
|
|
|
|
EffectWindow* w = effects->findWindow(winid);
|
|
|
|
if(w && !w->isMinimized() && !w->isDeleted()) {
|
|
|
|
m_scheduledScreenshot = w;
|
|
|
|
m_scheduledScreenshot->addRepaintFull();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-17 17:20:15 +00:00
|
|
|
QString ScreenShotEffect::screenshotFullscreen()
|
|
|
|
{
|
2014-02-24 15:13:30 +00:00
|
|
|
return blitScreenshot(effects->virtualScreenGeometry());
|
2011-08-17 17:20:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString ScreenShotEffect::screenshotScreen(int screen)
|
|
|
|
{
|
|
|
|
return blitScreenshot(effects->clientArea(FullScreenArea, screen, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ScreenShotEffect::screenshotArea(int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
return blitScreenshot(QRect(x, y, width, height));
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ScreenShotEffect::blitScreenshot(const QRect &geometry)
|
|
|
|
{
|
2012-03-04 08:53:12 +00:00
|
|
|
QImage img;
|
2012-09-20 09:33:32 +00:00
|
|
|
if (effects->isOpenGLCompositing())
|
2012-03-04 08:53:12 +00:00
|
|
|
{
|
|
|
|
if (!GLRenderTarget::blitSupported()) {
|
2013-11-29 05:18:28 +00:00
|
|
|
qCDebug(KWINEFFECTS) << "Framebuffer Blit not supported";
|
2012-03-04 08:53:12 +00:00
|
|
|
return QString();
|
|
|
|
}
|
2014-12-13 13:28:33 +00:00
|
|
|
GLTexture tex(GL_RGBA8, geometry.width(), geometry.height());
|
2012-03-04 08:53:12 +00:00
|
|
|
GLRenderTarget target(tex);
|
|
|
|
target.blitFromFramebuffer(geometry);
|
|
|
|
// copy content from framebuffer into image
|
|
|
|
tex.bind();
|
|
|
|
img = QImage(geometry.size(), QImage::Format_ARGB32);
|
2015-10-30 09:14:55 +00:00
|
|
|
if (GLPlatform::instance()->isGLES()) {
|
|
|
|
glReadPixels(0, 0, img.width(), img.height(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
|
|
|
|
} else {
|
|
|
|
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
|
|
|
|
}
|
2012-03-04 08:53:12 +00:00
|
|
|
tex.unbind();
|
|
|
|
ScreenShotEffect::convertFromGLImage(img, geometry.width(), geometry.height());
|
|
|
|
}
|
|
|
|
|
2013-02-13 07:10:55 +00:00
|
|
|
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
|
|
|
xcb_image_t *xImage = NULL;
|
|
|
|
#endif
|
2012-03-04 08:53:12 +00:00
|
|
|
if (effects->compositingType() == XRenderCompositing) {
|
2012-05-26 08:24:11 +00:00
|
|
|
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
2013-02-13 07:10:55 +00:00
|
|
|
img = xPictureToImage(effects->xrenderBufferPicture(), geometry, &xImage);
|
2012-05-26 08:24:11 +00:00
|
|
|
#endif
|
2012-03-04 08:53:12 +00:00
|
|
|
}
|
|
|
|
|
2013-08-10 21:19:41 +00:00
|
|
|
QTemporaryFile temp(QDir::tempPath() + QDir::separator() + QLatin1String("kwin_screenshot_XXXXXX.png"));
|
2011-08-17 17:20:15 +00:00
|
|
|
temp.setAutoRemove(false);
|
|
|
|
if (!temp.open()) {
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
img.save(&temp);
|
2013-02-13 07:10:55 +00:00
|
|
|
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
|
|
|
if (xImage) {
|
|
|
|
xcb_image_destroy(xImage);
|
|
|
|
}
|
|
|
|
#endif
|
2011-08-17 17:20:15 +00:00
|
|
|
temp.close();
|
|
|
|
return temp.fileName();
|
|
|
|
}
|
2010-07-31 20:55:48 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void ScreenShotEffect::grabPointerImage(QImage& snapshot, int offsetx, int offsety)
|
2010-09-14 19:52:44 +00:00
|
|
|
// Uses the X11_EXTENSIONS_XFIXES_H extension to grab the pointer image, and overlays it onto the snapshot.
|
|
|
|
{
|
2013-02-13 07:10:55 +00:00
|
|
|
QScopedPointer<xcb_xfixes_get_cursor_image_reply_t, QScopedPointerPodDeleter> cursor(
|
2014-04-16 13:58:06 +00:00
|
|
|
xcb_xfixes_get_cursor_image_reply(xcbConnection(),
|
|
|
|
xcb_xfixes_get_cursor_image_unchecked(xcbConnection()),
|
2013-02-13 07:10:55 +00:00
|
|
|
NULL));
|
|
|
|
if (cursor.isNull())
|
2011-01-30 14:34:42 +00:00
|
|
|
return;
|
2010-09-14 19:52:44 +00:00
|
|
|
|
2013-02-13 07:10:55 +00:00
|
|
|
QImage qcursorimg((uchar *) xcb_xfixes_get_cursor_image_cursor_image(cursor.data()), cursor->width, cursor->height,
|
2011-01-30 14:34:42 +00:00
|
|
|
QImage::Format_ARGB32_Premultiplied);
|
2010-09-14 19:52:44 +00:00
|
|
|
|
|
|
|
QPainter painter(&snapshot);
|
2013-02-13 07:10:55 +00:00
|
|
|
painter.drawImage(QPointF(cursor->x - cursor->xhot - offsetx, cursor->y - cursor ->yhot - offsety), qcursorimg);
|
2010-09-14 19:52:44 +00:00
|
|
|
}
|
|
|
|
|
2010-07-31 20:55:48 +00:00
|
|
|
void ScreenShotEffect::convertFromGLImage(QImage &img, int w, int h)
|
|
|
|
{
|
|
|
|
// from QtOpenGL/qgl.cpp
|
|
|
|
// Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
|
|
|
|
// see http://qt.gitorious.org/qt/qt/blobs/master/src/opengl/qgl.cpp
|
|
|
|
if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
|
|
|
|
// OpenGL gives RGBA; Qt wants ARGB
|
|
|
|
uint *p = (uint*)img.bits();
|
2011-01-30 14:34:42 +00:00
|
|
|
uint *end = p + w * h;
|
2010-07-31 20:55:48 +00:00
|
|
|
while (p < end) {
|
|
|
|
uint a = *p << 24;
|
|
|
|
*p = (*p >> 8) | a;
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// OpenGL gives ABGR (i.e. RGBA backwards); Qt wants ARGB
|
|
|
|
for (int y = 0; y < h; y++) {
|
|
|
|
uint *q = (uint*)img.scanLine(y);
|
2011-01-30 14:34:42 +00:00
|
|
|
for (int x = 0; x < w; ++x) {
|
2010-07-31 20:55:48 +00:00
|
|
|
const uint pixel = *q;
|
|
|
|
*q = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff)
|
2011-01-30 14:34:42 +00:00
|
|
|
| (pixel & 0xff00ff00);
|
2010-07-31 20:55:48 +00:00
|
|
|
|
|
|
|
q++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
img = img.mirrored();
|
|
|
|
}
|
|
|
|
|
2011-08-27 09:21:31 +00:00
|
|
|
bool ScreenShotEffect::isActive() const
|
|
|
|
{
|
2013-01-30 12:07:59 +00:00
|
|
|
return m_scheduledScreenshot != NULL && !effects->isScreenLocked();
|
2011-08-27 09:21:31 +00:00
|
|
|
}
|
|
|
|
|
2011-12-07 14:04:11 +00:00
|
|
|
void ScreenShotEffect::windowClosed( EffectWindow* w )
|
|
|
|
{
|
|
|
|
if (w == m_scheduledScreenshot) {
|
|
|
|
m_scheduledScreenshot = NULL;
|
|
|
|
screenshotWindowUnderCursor(m_type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-31 20:55:48 +00:00
|
|
|
} // namespace
|