Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/xrender/scene_xrender.h
Show All 35 Lines | |||||
36 | } | 36 | } | ||
37 | 37 | | |||
38 | /** | 38 | /** | ||
39 | * @brief Backend for the SceneXRender to hold the compositing buffer and take care of buffer | 39 | * @brief Backend for the SceneXRender to hold the compositing buffer and take care of buffer | ||
40 | * swapping. | 40 | * swapping. | ||
41 | * | 41 | * | ||
42 | * This class is intended as a small abstraction to support multiple compositing backends in the | 42 | * This class is intended as a small abstraction to support multiple compositing backends in the | ||
43 | * SceneXRender. | 43 | * SceneXRender. | ||
44 | * | 44 | **/ | ||
45 | */ | | |||
46 | class XRenderBackend | 45 | class XRenderBackend | ||
47 | { | 46 | { | ||
48 | public: | 47 | public: | ||
49 | virtual ~XRenderBackend(); | 48 | virtual ~XRenderBackend(); | ||
50 | virtual void present(int mask, const QRegion &damage) = 0; | 49 | virtual void present(int mask, const QRegion &damage) = 0; | ||
51 | 50 | | |||
52 | /** | 51 | /** | ||
53 | * @brief Returns the OverlayWindow used by the backend. | 52 | * @brief Returns the OverlayWindow used by the backend. | ||
54 | * | 53 | * | ||
55 | * A backend does not have to use an OverlayWindow, this is mostly for the X world. | 54 | * A backend does not have to use an OverlayWindow, this is mostly for the X world. | ||
56 | * In case the backend does not use an OverlayWindow it is allowed to return @c null. | 55 | * In case the backend does not use an OverlayWindow it is allowed to return @c null. | ||
57 | * It's the task of the caller to check whether it is @c null. | 56 | * It's the task of the caller to check whether it is @c null. | ||
58 | * | 57 | * | ||
59 | * @return :OverlayWindow* | 58 | * @return :OverlayWindow* | ||
60 | **/ | 59 | **/ | ||
61 | virtual OverlayWindow *overlayWindow(); | 60 | virtual OverlayWindow *overlayWindow(); | ||
62 | virtual bool usesOverlayWindow() const = 0; | 61 | virtual bool usesOverlayWindow() const = 0; | ||
63 | /** | 62 | /** | ||
64 | * @brief Shows the Overlay Window | 63 | * @brief Shows the Overlay Window | ||
65 | * | 64 | * | ||
66 | * Default implementation does nothing. | 65 | * Default implementation does nothing. | ||
67 | */ | 66 | **/ | ||
68 | virtual void showOverlay(); | 67 | virtual void showOverlay(); | ||
69 | /** | 68 | /** | ||
70 | * @brief React on screen geometry changes. | 69 | * @brief React on screen geometry changes. | ||
71 | * | 70 | * | ||
72 | * Default implementation does nothing. Override if specific functionality is required. | 71 | * Default implementation does nothing. Override if specific functionality is required. | ||
73 | * | 72 | * | ||
74 | * @param size The new screen size | 73 | * @param size The new screen size | ||
75 | */ | 74 | **/ | ||
76 | virtual void screenGeometryChanged(const QSize &size); | 75 | virtual void screenGeometryChanged(const QSize &size); | ||
77 | /** | 76 | /** | ||
78 | * @brief The compositing buffer hold by this backend. | 77 | * @brief The compositing buffer hold by this backend. | ||
79 | * | 78 | * | ||
80 | * The Scene composites the new frame into this buffer. | 79 | * The Scene composites the new frame into this buffer. | ||
81 | * | 80 | * | ||
82 | * @return xcb_render_picture_t | 81 | * @return xcb_render_picture_t | ||
83 | */ | 82 | **/ | ||
84 | xcb_render_picture_t buffer() const { | 83 | xcb_render_picture_t buffer() const { | ||
85 | return m_buffer; | 84 | return m_buffer; | ||
86 | } | 85 | } | ||
87 | /** | 86 | /** | ||
88 | * @brief Whether the creation of the Backend failed. | 87 | * @brief Whether the creation of the Backend failed. | ||
89 | * | 88 | * | ||
90 | * The SceneXRender should test whether the Backend got constructed correctly. If this method | 89 | * The SceneXRender should test whether the Backend got constructed correctly. If this method | ||
91 | * returns @c true, the SceneXRender should not try to start the rendering. | 90 | * returns @c true, the SceneXRender should not try to start the rendering. | ||
92 | * | 91 | * | ||
93 | * @return bool @c true if the creation of the Backend failed, @c false otherwise. | 92 | * @return bool @c true if the creation of the Backend failed, @c false otherwise. | ||
94 | **/ | 93 | **/ | ||
95 | bool isFailed() const { | 94 | bool isFailed() const { | ||
96 | return m_failed; | 95 | return m_failed; | ||
97 | } | 96 | } | ||
98 | 97 | | |||
99 | protected: | 98 | protected: | ||
100 | XRenderBackend(); | 99 | XRenderBackend(); | ||
101 | /** | 100 | /** | ||
102 | * @brief A subclass needs to call this method once it created the compositing back buffer. | 101 | * @brief A subclass needs to call this method once it created the compositing back buffer. | ||
103 | * | 102 | * | ||
104 | * @param buffer The buffer to use for compositing | 103 | * @param buffer The buffer to use for compositing | ||
105 | * @return void | 104 | * @return void | ||
106 | */ | 105 | **/ | ||
107 | void setBuffer(xcb_render_picture_t buffer); | 106 | void setBuffer(xcb_render_picture_t buffer); | ||
108 | /** | 107 | /** | ||
109 | * @brief Sets the backend initialization to failed. | 108 | * @brief Sets the backend initialization to failed. | ||
110 | * | 109 | * | ||
111 | * This method should be called by the concrete subclass in case the initialization failed. | 110 | * This method should be called by the concrete subclass in case the initialization failed. | ||
112 | * The given @p reason is logged as a warning. | 111 | * The given @p reason is logged as a warning. | ||
113 | * | 112 | * | ||
114 | * @param reason The reason why the initialization failed. | 113 | * @param reason The reason why the initialization failed. | ||
115 | **/ | 114 | **/ | ||
116 | void setFailed(const QString &reason); | 115 | void setFailed(const QString &reason); | ||
117 | 116 | | |||
118 | private: | 117 | private: | ||
119 | // Create the compositing buffer. The root window is not double-buffered, | 118 | // Create the compositing buffer. The root window is not double-buffered, | ||
120 | // so it is done manually using this buffer, | 119 | // so it is done manually using this buffer, | ||
121 | xcb_render_picture_t m_buffer; | 120 | xcb_render_picture_t m_buffer; | ||
122 | bool m_failed; | 121 | bool m_failed; | ||
123 | }; | 122 | }; | ||
124 | 123 | | |||
125 | /** | 124 | /** | ||
126 | * @brief XRenderBackend using an X11 Overlay Window as compositing target. | 125 | * @brief XRenderBackend using an X11 Overlay Window as compositing target. | ||
127 | * | 126 | **/ | ||
128 | */ | | |||
129 | class X11XRenderBackend : public XRenderBackend | 127 | class X11XRenderBackend : public XRenderBackend | ||
130 | { | 128 | { | ||
131 | public: | 129 | public: | ||
132 | X11XRenderBackend(); | 130 | X11XRenderBackend(); | ||
133 | ~X11XRenderBackend(); | 131 | ~X11XRenderBackend(); | ||
134 | 132 | | |||
135 | virtual void present(int mask, const QRegion &damage); | 133 | virtual void present(int mask, const QRegion &damage); | ||
136 | virtual OverlayWindow* overlayWindow(); | 134 | virtual OverlayWindow* overlayWindow(); | ||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Line(s) | |||||
277 | } | 275 | } | ||
278 | 276 | | |||
279 | /** | 277 | /** | ||
280 | * @short XRender implementation of Shadow. | 278 | * @short XRender implementation of Shadow. | ||
281 | * | 279 | * | ||
282 | * This class extends Shadow by the elements required for XRender rendering. | 280 | * This class extends Shadow by the elements required for XRender rendering. | ||
283 | * @author Jacopo De Simoi <wilderkde@gmail.org> | 281 | * @author Jacopo De Simoi <wilderkde@gmail.org> | ||
284 | **/ | 282 | **/ | ||
285 | | ||||
286 | class SceneXRenderShadow | 283 | class SceneXRenderShadow | ||
287 | : public Shadow | 284 | : public Shadow | ||
288 | { | 285 | { | ||
289 | public: | 286 | public: | ||
290 | explicit SceneXRenderShadow(Toplevel *toplevel); | 287 | explicit SceneXRenderShadow(Toplevel *toplevel); | ||
291 | using Shadow::ShadowElements; | 288 | using Shadow::ShadowElements; | ||
292 | using Shadow::ShadowElementTop; | 289 | using Shadow::ShadowElementTop; | ||
293 | using Shadow::ShadowElementTopRight; | 290 | using Shadow::ShadowElementTopRight; | ||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |