~ubuntu-branches/ubuntu/utopic/mir/utopic-proposed

« back to all changes in this revision

Viewing changes to src/server/scene/surface_data.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-03-10 19:28:46 UTC
  • mto: This revision was merged to the branch mainline in revision 63.
  • Revision ID: package-import@ubuntu.com-20140310192846-rq9qm3ec26yrelo2
Tags: upstream-0.1.6+14.04.20140310
Import upstream version 0.1.6+14.04.20140310

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 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_SCENE_SURFACE_DATA_STORAGE_H_
20
 
#define MIR_SCENE_SURFACE_DATA_STORAGE_H_
21
 
 
22
 
#include "mir/compositor/compositing_criteria.h"
23
 
#include "mir/input/surface.h"
24
 
#include "mutable_surface_state.h"
25
 
 
26
 
#include <vector>
27
 
#include <functional>
28
 
#include <mutex>
29
 
 
30
 
namespace mir
31
 
{
32
 
namespace scene
33
 
{
34
 
 
35
 
class SurfaceData : public compositor::CompositingCriteria, public input::Surface,
36
 
                    public MutableSurfaceState
37
 
{
38
 
public:
39
 
    SurfaceData(std::string const& name, geometry::Rectangle rect,
40
 
                std::function<void()> change_cb,
41
 
                bool nonrectangular);
42
 
 
43
 
    //mc::CompositingCriteria
44
 
    glm::mat4 const& transformation() const;
45
 
    float alpha() const;
46
 
    bool should_be_rendered_in(geometry::Rectangle const& rect) const;
47
 
    bool shaped() const override;
48
 
 
49
 
    //mi::Surface
50
 
    std::string const& name() const;
51
 
    geometry::Point position() const;
52
 
    geometry::Size size() const;
53
 
    bool contains(geometry::Point const& point) const;
54
 
 
55
 
    //ms::MutableSurfaceState
56
 
    void move_to(geometry::Point);
57
 
    void resize(geometry::Size const& size);
58
 
    void frame_posted();
59
 
    void set_hidden(bool hidden);
60
 
    void apply_alpha(float alpha);
61
 
    void apply_rotation(float degrees, glm::vec3 const&);
62
 
    void set_input_region(std::vector<geometry::Rectangle> const& input_rectangles);
63
 
 
64
 
private:
65
 
    std::mutex mutable guard;
66
 
    std::function<void()> notify_change;
67
 
    std::string surface_name;
68
 
    geometry::Rectangle surface_rect;
69
 
    glm::mat4 rotation_matrix;
70
 
    mutable glm::mat4 transformation_matrix;
71
 
    mutable geometry::Size transformation_size;
72
 
    mutable bool transformation_dirty;
73
 
    float surface_alpha;
74
 
    bool first_frame_posted;
75
 
    bool hidden;
76
 
    const bool nonrectangular;
77
 
    std::vector<geometry::Rectangle> input_rectangles;
78
 
};
79
 
 
80
 
}
81
 
}
82
 
#endif /* MIR_SCENE_SURFACE_DATA_STORAGE_H_ */