2bcbfc23322d0cd77992c76377180863e412ff2c
[iec.git] / src / type3_AndroidCloud / anbox-master / src / anbox / graphics / emugl / Renderable.cpp
1 /*
2 * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "anbox/graphics/emugl/Renderable.h"
18
19 Renderable::Renderable(const std::string &name, const std::uint32_t &buffer, float alpha,
20                        const anbox::graphics::Rect &screen_position,
21                        const anbox::graphics::Rect &crop,
22                        const glm::mat4 &transformation)
23     : name_(name),
24       buffer_(buffer),
25       screen_position_(screen_position),
26       crop_(crop),
27       transformation_(transformation),
28       alpha_(alpha) {}
29
30 Renderable::~Renderable() {}
31
32 std::string Renderable::name() const { return name_; }
33
34 std::uint32_t Renderable::buffer() const { return buffer_; }
35
36 anbox::graphics::Rect Renderable::screen_position() const {
37   return screen_position_;
38 }
39
40 anbox::graphics::Rect Renderable::crop() const { return crop_; }
41
42 glm::mat4 Renderable::transformation() const { return transformation_; }
43
44 float Renderable::alpha() const { return alpha_; }
45
46 void Renderable::set_screen_position(
47     const anbox::graphics::Rect &screen_position) {
48   screen_position_ = screen_position;
49 }
50
51 std::ostream &operator<<(std::ostream &out, const Renderable &r) {
52   return out << "{ name " << r.name() << " buffer " << r.buffer()
53              << " screen position " << r.screen_position() << " crop "
54              << r.crop() << " alpha " << r.alpha();
55 }