Mir

Merge lp:~vanvugt/mir/simplify-DisplayBufferCompositors into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: kevin gunn
Approved revision: no longer in the source branch.
Merged at revision: 1101
Proposed branch: lp:~vanvugt/mir/simplify-DisplayBufferCompositors
Merge into: lp:mir
Diff against target: 211 lines (+22/-112)
5 files modified
include/server/mir/compositor/basic_display_buffer_compositor.h (+0/-58)
src/server/compositor/CMakeLists.txt (+0/-1)
src/server/compositor/basic_display_buffer_compositor.cpp (+0/-49)
src/server/compositor/default_display_buffer_compositor.cpp (+13/-2)
src/server/compositor/default_display_buffer_compositor.h (+9/-2)
To merge this branch: bzr merge lp:~vanvugt/mir/simplify-DisplayBufferCompositors
Reviewer Review Type Date Requested Status
Kevin DuBois (community) Approve
Alan Griffiths Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+188773@code.launchpad.net

Commit message

Simplify {Default,Basic}DisplayBufferCompositor classes into one.
Less code and resolves a TODO.

Description of the change

This does not appear to affect Unity8 or ABIs.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

This make more sense in conjunction with the dependent composite-not-compose, but is OK.

Note that this is both an API and ABI change - but shouldn't affect any downstream projects we know about.

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

much better

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'include/server/mir/compositor/basic_display_buffer_compositor.h'
2--- include/server/mir/compositor/basic_display_buffer_compositor.h 2013-08-28 03:41:48 +0000
3+++ include/server/mir/compositor/basic_display_buffer_compositor.h 1970-01-01 00:00:00 +0000
4@@ -1,58 +0,0 @@
5-/*
6- * Copyright © 2013 Canonical Ltd.
7- *
8- * This program is free software: you can redistribute it and/or modify
9- * it under the terms of the GNU General Public License version 3 as
10- * published by the Free Software Foundation.
11- *
12- * This program is distributed in the hope that it will be useful,
13- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15- * GNU General Public License for more details.
16- *
17- * You should have received a copy of the GNU General Public License
18- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19- *
20- * Authored by: Alan Griffiths <alan@octopull.co.uk>
21- */
22-
23-
24-#ifndef MIR_COMPOSITOR_BASIC_DISPLAY_BUFFER_COMPOSITOR_H_
25-#define MIR_COMPOSITOR_BASIC_DISPLAY_BUFFER_COMPOSITOR_H_
26-
27-#include "mir/compositor/display_buffer_compositor.h"
28-
29-#include <functional>
30-#include <memory>
31-
32-namespace mir
33-{
34-namespace graphics
35-{
36-class DisplayBuffer;
37-}
38-
39-namespace geometry
40-{
41-struct Rectangle;
42-}
43-
44-namespace compositor
45-{
46-class BasicDisplayBufferCompositor : public DisplayBufferCompositor
47-{
48-public:
49- BasicDisplayBufferCompositor(graphics::DisplayBuffer& display_buffer);
50-
51- virtual void composite();
52- virtual void compose(
53- mir::geometry::Rectangle const& view_area,
54- std::function<void(std::shared_ptr<void> const&)> save_resource) = 0;
55-
56-protected:
57- graphics::DisplayBuffer& display_buffer;
58-};
59-}
60-}
61-
62-#endif /* MIR_COMPOSITOR_BASIC_DISPLAY_BUFFER_COMPOSITOR_H_ */
63
64=== modified file 'src/server/compositor/CMakeLists.txt'
65--- src/server/compositor/CMakeLists.txt 2013-08-28 03:41:48 +0000
66+++ src/server/compositor/CMakeLists.txt 2013-10-02 07:14:01 +0000
67@@ -1,7 +1,6 @@
68 set(
69 MIR_COMPOSITOR_SRCS
70
71- basic_display_buffer_compositor.cpp
72 default_display_buffer_compositor.cpp
73 default_display_buffer_compositor_factory.cpp
74 temporary_buffers.cpp
75
76=== removed file 'src/server/compositor/basic_display_buffer_compositor.cpp'
77--- src/server/compositor/basic_display_buffer_compositor.cpp 2013-08-28 03:41:48 +0000
78+++ src/server/compositor/basic_display_buffer_compositor.cpp 1970-01-01 00:00:00 +0000
79@@ -1,49 +0,0 @@
80-/*
81- * Copyright © 2013 Canonical Ltd.
82- *
83- * This program is free software: you can redistribute it and/or modify
84- * it under the terms of the GNU General Public License version 3 as
85- * published by the Free Software Foundation.
86- *
87- * This program is distributed in the hope that it will be useful,
88- * but WITHOUT ANY WARRANTY; without even the implied warranty of
89- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
90- * GNU General Public License for more details.
91- *
92- * You should have received a copy of the GNU General Public License
93- * along with this program. If not, see <http://www.gnu.org/licenses/>.
94- *
95- * Authored by: Alan Griffiths <alan@octopull.co.uk>
96- */
97-
98-#include "mir/compositor/basic_display_buffer_compositor.h"
99-
100-#include "mir/graphics/display_buffer.h"
101-
102-#include <vector>
103-
104-namespace mc = mir::compositor;
105-namespace mg = mir::graphics;
106-
107-mc::BasicDisplayBufferCompositor::BasicDisplayBufferCompositor(
108- mg::DisplayBuffer& display_buffer)
109- : display_buffer(display_buffer)
110-{
111-}
112-
113-// TODO I'm not clear why this code is in the DisplayBufferCompositor hierarchy.
114-// (As opposed to the call site calling compose directly.)
115-// But changing that breaks RecordingDisplayBufferCompositor - which is too
116-// much churn for this refactoring.
117-void mc::BasicDisplayBufferCompositor::composite()
118-{
119- // preserves buffers used in rendering until after post_update()
120- std::vector<std::shared_ptr<void>> saved_resources;
121- auto save_resource = [&](std::shared_ptr<void> const& r) { saved_resources.push_back(r); };
122-
123- display_buffer.make_current();
124-
125- compose(display_buffer.view_area(), save_resource);
126-
127- display_buffer.post_update();
128-}
129
130=== modified file 'src/server/compositor/default_display_buffer_compositor.cpp'
131--- src/server/compositor/default_display_buffer_compositor.cpp 2013-09-20 18:19:53 +0000
132+++ src/server/compositor/default_display_buffer_compositor.cpp 2013-10-02 07:14:01 +0000
133@@ -28,6 +28,7 @@
134 #include "bypass.h"
135 #include <mutex>
136 #include <cstdlib>
137+#include <vector>
138
139 namespace mc = mir::compositor;
140 namespace mg = mir::graphics;
141@@ -64,7 +65,7 @@
142 std::shared_ptr<mc::Scene> const& scene,
143 std::shared_ptr<mc::Renderer> const& renderer,
144 std::shared_ptr<mc::OverlayRenderer> const& overlay_renderer)
145- : mc::BasicDisplayBufferCompositor{display_buffer},
146+ : display_buffer(display_buffer),
147 scene{scene},
148 renderer{renderer},
149 overlay_renderer{overlay_renderer},
150@@ -118,7 +119,17 @@
151 }
152
153 if (!bypassed)
154- mc::BasicDisplayBufferCompositor::composite();
155+ {
156+ // preserves buffers used in rendering until after post_update()
157+ std::vector<std::shared_ptr<void>> saved_resources;
158+ auto save_resource = [&](std::shared_ptr<void> const& r) { saved_resources.push_back(r); };
159+
160+ display_buffer.make_current();
161+
162+ compose(display_buffer.view_area(), save_resource);
163+
164+ display_buffer.post_update();
165+ }
166 }
167
168 void mc::DefaultDisplayBufferCompositor::compose(
169
170=== modified file 'src/server/compositor/default_display_buffer_compositor.h'
171--- src/server/compositor/default_display_buffer_compositor.h 2013-08-29 09:00:55 +0000
172+++ src/server/compositor/default_display_buffer_compositor.h 2013-10-02 07:14:01 +0000
173@@ -19,7 +19,8 @@
174 #ifndef MIR_COMPOSITOR_DEFAULT_DISPLAY_BUFFER_COMPOSITOR_H_
175 #define MIR_COMPOSITOR_DEFAULT_DISPLAY_BUFFER_COMPOSITOR_H_
176
177-#include "mir/compositor/basic_display_buffer_compositor.h"
178+#include "mir/compositor/display_buffer_compositor.h"
179+#include <memory>
180
181 namespace mir
182 {
183@@ -27,6 +28,10 @@
184 {
185 class DisplayBuffer;
186 }
187+namespace geometry
188+{
189+struct Rectangle;
190+}
191 namespace compositor
192 {
193
194@@ -34,7 +39,7 @@
195 class Renderer;
196 class OverlayRenderer;
197
198-class DefaultDisplayBufferCompositor : public BasicDisplayBufferCompositor
199+class DefaultDisplayBufferCompositor : public DisplayBufferCompositor
200 {
201 public:
202 DefaultDisplayBufferCompositor(
203@@ -50,6 +55,8 @@
204 std::function<void(std::shared_ptr<void> const&)> save_resource);
205
206 private:
207+ graphics::DisplayBuffer& display_buffer;
208+
209 std::shared_ptr<Scene> const scene;
210 std::shared_ptr<Renderer> const renderer;
211 std::shared_ptr<OverlayRenderer> const overlay_renderer;

Subscribers

People subscribed via source and target branches