~hikiko/mir/mir.unity8-desktop-session

« back to all changes in this revision

Viewing changes to src/platform/graphics/mesa/overlapping_output_grouping.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Daniel van Vugt, Ubuntu daily release
  • Date: 2014-01-08 02:04:38 UTC
  • mfrom: (1.1.54)
  • Revision ID: package-import@ubuntu.com-20140108020438-ikbu7qqm9v2l026y
Tags: 0.1.3+14.04.20140108-0ubuntu1
[ Daniel van Vugt ]
* Preparing for release 0.1.3

[ Ubuntu daily release ]
* Automatic snapshot from revision 1170

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 Lesser 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 Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef MIR_GRAPHICS_MESA_OVERLAPPING_OUTPUT_GROUPING_H_
 
20
#define MIR_GRAPHICS_MESA_OVERLAPPING_OUTPUT_GROUPING_H_
 
21
 
 
22
#include <vector>
 
23
#include <functional>
 
24
 
 
25
namespace mir
 
26
{
 
27
namespace geometry
 
28
{
 
29
struct Rectangle;
 
30
}
 
31
namespace graphics
 
32
{
 
33
 
 
34
class DisplayConfiguration;
 
35
struct DisplayConfigurationOutput;
 
36
 
 
37
namespace mesa
 
38
{
 
39
 
 
40
class OverlappingOutputGroup
 
41
{
 
42
public:
 
43
    template <typename Iterator>
 
44
    OverlappingOutputGroup(Iterator begin, Iterator end) : outputs(begin, end) {}
 
45
    OverlappingOutputGroup(OverlappingOutputGroup const&) = default;
 
46
    OverlappingOutputGroup& operator=(OverlappingOutputGroup const&) = default;
 
47
 
 
48
    geometry::Rectangle bounding_rectangle() const;
 
49
    void for_each_output(std::function<void(DisplayConfigurationOutput const&)> const& f) const;
 
50
 
 
51
private:
 
52
    std::vector<DisplayConfigurationOutput> outputs;
 
53
};
 
54
 
 
55
/** Helper class that groups overlapping outputs together. */
 
56
class OverlappingOutputGrouping
 
57
{
 
58
public:
 
59
    OverlappingOutputGrouping(DisplayConfiguration const& conf);
 
60
    void for_each_group(std::function<void(OverlappingOutputGroup const& group)> const& f);
 
61
 
 
62
private:
 
63
    void add_output(DisplayConfigurationOutput const& conf_output);
 
64
 
 
65
    std::vector<OverlappingOutputGroup> groups;
 
66
};
 
67
 
 
68
}
 
69
}
 
70
}
 
71
 
 
72
#endif /* MIR_GRAPHICS_MESA_OVERLAPPING_OUTPUT_GROUPING_H_ */