Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
scene.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 #ifndef MIR_COMPOSITOR_SCENE_H_
20 #define MIR_COMPOSITOR_SCENE_H_
21 
22 #include "mir/geometry/forward.h"
23 
24 #include <memory>
25 #include <functional>
26 
27 namespace mir
28 {
29 namespace surfaces
30 {
31 class BufferStream;
32 }
33 namespace compositor
34 {
35 class CompositingCriteria;
36 
38 {
39 public:
40  virtual ~FilterForScene() {}
41 
42  virtual bool operator()(CompositingCriteria const&) = 0;
43 
44 protected:
45  FilterForScene() = default;
46  FilterForScene(const FilterForScene&) = delete;
47  FilterForScene& operator=(const FilterForScene&) = delete;
48 };
49 
51 {
52 public:
53  virtual ~OperatorForScene() {}
54 
55  virtual void operator()(CompositingCriteria const&, surfaces::BufferStream&) = 0;
56 
57 protected:
58  OperatorForScene() = default;
59  OperatorForScene(const OperatorForScene&) = delete;
61 
62 };
63 
64 class Scene
65 {
66 public:
67  virtual ~Scene() {}
68 
69  // Back to front; normal rendering order
70  virtual void for_each_if(FilterForScene& filter, OperatorForScene& op) = 0;
71 
72  // Front to back; as used when scanning for occlusions
73  virtual void reverse_for_each_if(FilterForScene& filter,
74  OperatorForScene& op) = 0;
75 
84  virtual void set_change_callback(std::function<void()> const& f) = 0;
85 
86  // Implement BasicLockable, to temporarily lock scene state:
87  virtual void lock() = 0;
88  virtual void unlock() = 0;
89 
90 protected:
91  Scene() = default;
92 
93 private:
94  Scene(Scene const&) = delete;
95  Scene& operator=(Scene const&) = delete;
96 };
97 
98 }
99 }
100 
101 #endif /* MIR_COMPOSITOR_SCENE_H_ */

Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013