diff --git a/scene_qpainter.h b/scene_qpainter.h --- a/scene_qpainter.h +++ b/scene_qpainter.h @@ -27,10 +27,6 @@ namespace KWin { -namespace Xcb { - class Shm; -} - class KWIN_EXPORT QPainterBackend { public: @@ -163,7 +159,6 @@ bool update(const QRegion &damage); const QImage &image(); private: - QScopedPointer m_shm; QImage m_image; }; diff --git a/scene_qpainter.cpp b/scene_qpainter.cpp --- a/scene_qpainter.cpp +++ b/scene_qpainter.cpp @@ -31,7 +31,6 @@ #include "wayland_server.h" #include #include -#include "xcbutils.h" #include "decorations/decoratedclient.h" // Qt #include @@ -404,7 +403,6 @@ //**************************************** QPainterWindowPixmap::QPainterWindowPixmap(Scene::Window *window) : WindowPixmap(window) - , m_shm(kwinApp()->shouldUseWaylandForCompositing() ? nullptr : new Xcb::Shm) { } @@ -417,51 +415,27 @@ if (isValid()) { return; } - if (!kwinApp()->shouldUseWaylandForCompositing() && !m_shm->isValid()) { - return; - } KWin::WindowPixmap::create(); if (!isValid()) { return; } - if (kwinApp()->shouldUseWaylandForCompositing()) { - // performing deep copy, this could probably be improved - m_image = buffer()->data().copy(); - return; - } - m_image = QImage((uchar*)m_shm->buffer(), size().width(), size().height(), QImage::Format_ARGB32_Premultiplied); + // performing deep copy, this could probably be improved + m_image = buffer()->data().copy(); } bool QPainterWindowPixmap::update(const QRegion &damage) { - if (kwinApp()->shouldUseWaylandForCompositing()) { - const auto oldBuffer = buffer(); - updateBuffer(); - const auto &b = buffer(); - if (b == oldBuffer || b.isNull()) { - return false; - } - QPainter p(&m_image); - const QImage &data = b->data(); - p.setCompositionMode(QPainter::CompositionMode_Source); - for (const QRect &rect : damage.rects()) { - p.drawImage(rect, data, rect); - } - return true; - } - - if (!m_shm->isValid()) { + const auto oldBuffer = buffer(); + updateBuffer(); + const auto &b = buffer(); + if (b == oldBuffer || b.isNull()) { return false; } - - // TODO: optimize by only updating the damaged areas - xcb_shm_get_image_cookie_t cookie = xcb_shm_get_image_unchecked(connection(), pixmap(), - 0, 0, size().width(), size().height(), - ~0, XCB_IMAGE_FORMAT_Z_PIXMAP, m_shm->segment(), 0); - - ScopedCPointer image(xcb_shm_get_image_reply(connection(), cookie, NULL)); - if (image.isNull()) { - return false; + QPainter p(&m_image); + const QImage &data = b->data(); + p.setCompositionMode(QPainter::CompositionMode_Source); + for (const QRect &rect : damage.rects()) { + p.drawImage(rect, data, rect); } return true; }