Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
surface_data.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 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: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_SURFACES_SURFACE_DATA_STORAGE_H_
20 #define MIR_SURFACES_SURFACE_DATA_STORAGE_H_
21 
22 #include "surface_state.h"
23 
24 #include <vector>
25 #include <functional>
26 #include <mutex>
27 
28 namespace mir
29 {
30 namespace surfaces
31 {
32 
33 class SurfaceData : public SurfaceState
34 {
35 public:
36  SurfaceData(std::string const& name, geometry::Rectangle rect,
37  std::function<void()> change_cb,
38  bool nonrectangular);
39 
40  //mc::CompositingCriteria
41  glm::mat4 const& transformation() const;
42  float alpha() const;
43  bool should_be_rendered_in(geometry::Rectangle const& rect) const;
44  bool shaped() const override;
45 
46  //mi::Surface
47  std::string const& name() const;
48  geometry::Point position() const;
49  geometry::Size size() const;
50  bool contains(geometry::Point const& point) const;
51 
52  //ms::MutableSurfaceState
54  void frame_posted();
55  void set_hidden(bool hidden);
56  void apply_alpha(float alpha);
57  void apply_rotation(float degrees, glm::vec3 const&);
58  void set_input_region(std::vector<geometry::Rectangle> const& input_rectangles);
59 
60 private:
61  std::mutex mutable guard;
62  std::function<void()> notify_change;
63  std::string surface_name;
64  geometry::Rectangle surface_rect;
65  glm::mat4 rotation_matrix;
66  mutable glm::mat4 transformation_matrix;
67  mutable geometry::Size transformation_size;
68  mutable bool transformation_dirty;
69  float surface_alpha;
70  bool first_frame_posted;
71  bool hidden;
72  const bool nonrectangular;
73  std::vector<geometry::Rectangle> input_rectangles;
74 };
75 
76 }
77 }
78 #endif /* MIR_SURFACES_SURFACE_DATA_STORAGE_H_ */

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Oct 15 00:23:28 UTC 2013