diff --git a/plugins/scenes/xrender/scene_xrender.h b/plugins/scenes/xrender/scene_xrender.h --- a/plugins/scenes/xrender/scene_xrender.h +++ b/plugins/scenes/xrender/scene_xrender.h @@ -201,6 +201,8 @@ private: QRect mapToScreen(int mask, const WindowPaintData &data, const QRect &rect) const; QPoint mapToScreen(int mask, const WindowPaintData &data, const QPoint &point) const; + QRect bufferToWindowRect(const QRect &rect) const; + QPoint bufferToWindowPoint(const QPoint &point) const; void prepareTempPixmap(); void setPictureFilter(xcb_render_picture_t pic, ImageFilterType filter); SceneXrender *m_scene; diff --git a/plugins/scenes/xrender/scene_xrender.cpp b/plugins/scenes/xrender/scene_xrender.cpp --- a/plugins/scenes/xrender/scene_xrender.cpp +++ b/plugins/scenes/xrender/scene_xrender.cpp @@ -387,6 +387,16 @@ return pt; } +QRect SceneXrender::Window::bufferToWindowRect(const QRect &rect) const +{ + return rect.translated(bufferOffset()); +} + +QPoint SceneXrender::Window::bufferToWindowPoint(const QPoint &point) const +{ + return point + bufferOffset(); +} + void SceneXrender::Window::prepareTempPixmap() { const QSize oldSize = temp_visibleRect.size(); @@ -447,7 +457,7 @@ filter = ImageFilterFast; // do required transformations const QRect wr = mapToScreen(mask, data, QRect(0, 0, width(), height())); - QRect cr = QRect(toplevel->clientPos(), toplevel->clientSize()); // Client rect (in the window) + QRect cr = QRect(toplevel->clientPos(), toplevel->clientSize()); // Content rect (in the buffer) qreal xscale = 1; qreal yscale = 1; bool scaled = false; @@ -510,7 +520,7 @@ transformed_shape.setRects(rects.constData(), rects.count()); } - transformed_shape.translate(mapToScreen(mask, data, QPoint(0, 0))); + transformed_shape.translate(mapToScreen(mask, data, bufferToWindowPoint(QPoint(0, 0)))); PaintClipper pcreg(region); // clip by the region to paint PaintClipper pc(transformed_shape); // clip by window's shape @@ -624,7 +634,7 @@ if (blitInTempPixmap) { dr.translate(-temp_visibleRect.topLeft()); } else { - dr = mapToScreen(mask, data, dr); // Destination rect + dr = mapToScreen(mask, data, bufferToWindowRect(dr)); // Destination rect if (scaled) { cr.moveLeft(cr.x() * xscale); cr.moveTop(cr.y() * yscale);