[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kwin] /: Add virtual Scene::xrenderBufferPicture method
From: Martin_Flöser <null () kde ! org>
Date: 2017-08-09 5:07:54
Message-ID: E1dfJDm-0002QF-LT () code ! kde ! org
[Download RAW message or body]
Git commit c1892e6c0fd4ccf2309aed8e2c194b7b8ba70aa3 by Martin Flöser.
Committed on 09/08/2017 at 05:07.
Pushed by graesslin into branch 'master'.
Add virtual Scene::xrenderBufferPicture method
Summary:
So far EffectsHandlerImpl directly accessed SceneXrender::bufferPicture
through a dynamic cast. If in future the XRender based compositor should
be moved into a plugin we cannot access it through a dynamic cast.
To solve this problem the bufferPicture method is moved into Scene as
a virtual method returning a sane default value.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7207
M +1 -6 effects.cpp
M +5 -0 scene.cpp
M +6 -0 scene.h
M +3 -3 scene_xrender.cpp
M +2 -2 scene_xrender.h
https://commits.kde.org/kwin/c1892e6c0fd4ccf2309aed8e2c194b7b8ba70aa3
diff --git a/effects.cpp b/effects.cpp
index 8155de6b3..4454c61e4 100644
--- a/effects.cpp
+++ b/effects.cpp
@@ -32,7 +32,6 @@ along with this program. If not, see \
<http://www.gnu.org/licenses/>. #include "group.h"
#include "osd.h"
#include "pointer_input.h"
-#include "scene_xrender.h"
#include "scene_qpainter.h"
#include "unmanaged.h"
#ifdef KWIN_BUILD_TABBOX
@@ -1324,11 +1323,7 @@ void EffectsHandlerImpl::unregisterTouchBorder(ElectricBorder \
border, QAction *a
unsigned long EffectsHandlerImpl::xrenderBufferPicture()
{
-#ifdef KWIN_HAVE_XRENDER_COMPOSITING
- if (SceneXrender* s = dynamic_cast< SceneXrender* >(m_scene))
- return s->bufferPicture();
-#endif
- return None;
+ return m_scene->xrenderBufferPicture();
}
QPainter *EffectsHandlerImpl::scenePainter()
diff --git a/scene.cpp b/scene.cpp
index c4b372757..4b95cf603 100644
--- a/scene.cpp
+++ b/scene.cpp
@@ -652,6 +652,11 @@ QMatrix4x4 Scene::screenProjectionMatrix() const
return QMatrix4x4();
}
+xcb_render_picture_t Scene::xrenderBufferPicture() const
+{
+ return XCB_RENDER_PICTURE_NONE;
+}
+
//****************************************
// Scene::Window
//****************************************
diff --git a/scene.h b/scene.h
index 29a5dceb4..c1fc0d6eb 100644
--- a/scene.h
+++ b/scene.h
@@ -157,6 +157,12 @@ public:
**/
virtual bool animationsSupported() const = 0;
+ /**
+ * The render buffer used by an XRender based compositor scene.
+ * Default implementation returns XCB_RENDER_PICTURE_NONE
+ **/
+ virtual xcb_render_picture_t xrenderBufferPicture() const;
+
Q_SIGNALS:
void frameRendered();
diff --git a/scene_xrender.cpp b/scene_xrender.cpp
index 98295f054..263c75f14 100644
--- a/scene_xrender.cpp
+++ b/scene_xrender.cpp
@@ -280,7 +280,7 @@ void SceneXrender::paintBackground(QRegion region)
{
xcb_render_color_t col = { 0, 0, 0, 0xffff }; // black
const QVector<xcb_rectangle_t> &rects = Xcb::regionToRects(region);
- xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, \
bufferPicture(), col, rects.count(), rects.data()); + \
xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, \
xrenderBufferPicture(), col, rects.count(), rects.data()); }
Scene::Window *SceneXrender::createWindow(Toplevel *toplevel)
@@ -515,7 +515,7 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, \
WindowPaintDat
const bool blitInTempPixmap = xRenderOffscreen() || (data.crossFadeProgress() < \
1.0 && !opaque) ||
(scaled && (wantShadow || (client && \
!client->noBorder()) || (deleted && !deleted->noBorder())));
- xcb_render_picture_t renderTarget = m_scene->bufferPicture();
+ xcb_render_picture_t renderTarget = m_scene->xrenderBufferPicture();
if (blitInTempPixmap) {
if (scene_xRenderOffscreenTarget()) {
temp_visibleRect = toplevel->visibleRect().translated(-toplevel->pos());
@@ -729,7 +729,7 @@ xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, \
m_xrenderShadow->pic
xcb_render_set_picture_transform(connection(), *s_tempPicture, xform);
setPictureFilter(*s_tempPicture, filter);
xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, \
*s_tempPicture,
- XCB_RENDER_PICTURE_NONE, m_scene->bufferPicture(),
+ XCB_RENDER_PICTURE_NONE, \
m_scene->xrenderBufferPicture(),
0, 0, 0, 0, r.x(), r.y(), r.width(), r.height());
xcb_render_set_picture_transform(connection(), *s_tempPicture, \
identity); }
diff --git a/scene_xrender.h b/scene_xrender.h
index a9eee6bf1..d4dacd361 100644
--- a/scene_xrender.h
+++ b/scene_xrender.h
@@ -160,7 +160,7 @@ public:
virtual Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame);
virtual Shadow *createShadow(Toplevel *toplevel);
virtual void screenGeometryChanged(const QSize &size);
- xcb_render_picture_t bufferPicture();
+ xcb_render_picture_t xrenderBufferPicture() const override;
virtual OverlayWindow *overlayWindow() {
return m_backend->overlayWindow();
}
@@ -253,7 +253,7 @@ private:
};
inline
-xcb_render_picture_t SceneXrender::bufferPicture()
+xcb_render_picture_t SceneXrender::xrenderBufferPicture() const
{
return m_backend->buffer();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic