2
* Copyright © 2013 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
19
#ifndef MIR_TEST_DOUBLES_FAKE_RENDERABLE_H_
20
#define MIR_TEST_DOUBLES_FAKE_RENDERABLE_H_
22
#include "stub_buffer.h"
23
#include "mir/graphics/renderable.h"
24
#define GLM_FORCE_RADIANS
25
#include <glm/gtc/matrix_transform.hpp>
26
#include <gmock/gmock.h>
35
class FakeRenderable : public graphics::Renderable
38
FakeRenderable(int x, int y, int width, int height)
39
: FakeRenderable{geometry::Rectangle{{x,y},{width,height}}}
42
FakeRenderable(geometry::Rectangle display_area)
43
: FakeRenderable{display_area, 1.0f, true, true, true}
47
FakeRenderable(geometry::Rectangle display_area,
49
: FakeRenderable{display_area, opacity, true, true, true}
53
FakeRenderable(geometry::Rectangle display_area,
57
: FakeRenderable{display_area, opacity, rectangular, visible, true}
61
FakeRenderable(geometry::Rectangle display_area,
66
: buf{std::make_shared<StubBuffer>()},
69
rectangular(rectangular),
75
ID id() const override
80
float alpha() const override
85
glm::mat4 transformation() const override
90
bool visible() const override
92
return visible_ && posted;
95
bool shaped() const override
100
void set_buffer(std::shared_ptr<graphics::Buffer> b)
105
std::shared_ptr<graphics::Buffer> buffer() const override
110
geometry::Rectangle screen_position() const override
115
int buffers_ready_for_compositor() const override
121
std::shared_ptr<graphics::Buffer> buf;
122
mir::geometry::Rectangle rect;
129
} // namespace doubles
132
#endif // MIR_TEST_DOUBLES_FAKE_RENDERABLE_H_