Changeset View
Changeset View
Standalone View
Standalone View
effects/screenshot/screenshot.cpp
Show First 20 Lines • Show All 363 Lines • ▼ Show 20 Line(s) | 360 | xcb_image_t *xImage = NULL; | |||
---|---|---|---|---|---|
364 | } | 364 | } | ||
365 | } | 365 | } | ||
366 | #endif | 366 | #endif | ||
367 | 367 | | |||
368 | return img; | 368 | return img; | ||
369 | } | 369 | } | ||
370 | 370 | | |||
371 | void ScreenShotEffect::grabPointerImage(QImage& snapshot, int offsetx, int offsety) | 371 | void ScreenShotEffect::grabPointerImage(QImage& snapshot, int offsetx, int offsety) | ||
372 | // Uses the X11_EXTENSIONS_XFIXES_H extension to grab the pointer image, and overlays it onto the snapshot. | | |||
373 | { | 372 | { | ||
374 | QScopedPointer<xcb_xfixes_get_cursor_image_reply_t, QScopedPointerPodDeleter> cursor( | 373 | const auto cursor = effects->cursorImage(); | ||
375 | xcb_xfixes_get_cursor_image_reply(xcbConnection(), | 374 | if (cursor.image().isNull()) | ||
376 | xcb_xfixes_get_cursor_image_unchecked(xcbConnection()), | | |||
377 | NULL)); | | |||
378 | if (cursor.isNull()) | | |||
379 | return; | 375 | return; | ||
380 | 376 | | |||
381 | QImage qcursorimg((uchar *) xcb_xfixes_get_cursor_image_cursor_image(cursor.data()), cursor->width, cursor->height, | | |||
382 | QImage::Format_ARGB32_Premultiplied); | | |||
383 | | ||||
384 | QPainter painter(&snapshot); | 377 | QPainter painter(&snapshot); | ||
385 | painter.drawImage(QPointF(cursor->x - cursor->xhot - offsetx, cursor->y - cursor ->yhot - offsety), qcursorimg); | 378 | painter.drawImage(effects->cursorPos() - cursor.hotSpot() - QPoint(offsetx, offsety), cursor.image()); | ||
386 | } | 379 | } | ||
387 | 380 | | |||
388 | void ScreenShotEffect::convertFromGLImage(QImage &img, int w, int h) | 381 | void ScreenShotEffect::convertFromGLImage(QImage &img, int w, int h) | ||
389 | { | 382 | { | ||
390 | // from QtOpenGL/qgl.cpp | 383 | // from QtOpenGL/qgl.cpp | ||
391 | // Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 384 | // Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | ||
392 | // see http://qt.gitorious.org/qt/qt/blobs/master/src/opengl/qgl.cpp | 385 | // see http://qt.gitorious.org/qt/qt/blobs/master/src/opengl/qgl.cpp | ||
393 | if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { | 386 | if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { | ||
Show All 39 Lines |