Mir
output_properties_cache.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 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: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17  */
18 
19 #ifndef MIR_SCENE_OUTPUT_PROPERTIES_CACHE_H_
20 #define MIR_SCENE_OUTPUT_PROPERTIES_CACHE_H_
21 
22 #include "mir_toolkit/common.h"
23 #include "mir/geometry/rectangle.h"
24 
25 #include <vector>
26 #include <memory>
27 #include <mutex>
28 
29 namespace mir
30 {
31 namespace graphics
32 {
33 class DisplayConfiguration;
34 }
35 
36 namespace scene
37 {
39 {
41  int dpi;
42  float scale;
44 };
45 
47 {
48 public:
49 
50  void update_from(graphics::DisplayConfiguration const& config);
51 
52  std::shared_ptr<OutputProperties const> properties_for(geometry::Rectangle const& extents) const;
53 
54 private:
55  std::shared_ptr<std::vector<OutputProperties>> get_cache() const;
56 
57  std::mutex mutable mutex;
58  std::shared_ptr<std::vector<OutputProperties>> cache;
59 };
60 
61 }
62 }
63 
64 
65 
66 #endif //MIR_SCENE_OUTPUT_PROPERTIES_CACHE_H_
All things Mir.
Definition: atomic_callback.h:25
geometry::Rectangle extents
Definition: output_properties_cache.h:40
Definition: output_properties_cache.h:38
float scale
Definition: output_properties_cache.h:42
std::shared_ptr< OutputProperties const > properties_for(geometry::Rectangle const &extents) const
Definition: output_properties_cache.cpp:75
int dpi
Definition: output_properties_cache.h:41
void update_from(graphics::DisplayConfiguration const &config)
Definition: output_properties_cache.cpp:46
MirFormFactor
Form factor associated with a physical output.
Definition: common.h:197
Definition: rectangle.h:33
MirFormFactor form_factor
Definition: output_properties_cache.h:43
Definition: output_properties_cache.h:46
Interface to a configuration of display cards and outputs.
Definition: display_configuration.h:166

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015