dbacc97ade69532b60244c8d69318f8e95715fef
[iec.git] / src / type3_AndroidCloud / anbox-master / src / anbox / graphics / layer_composer.cpp
1 /*
2  * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
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, as published
6  * by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranties of
10  * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11  * PURPOSE.  See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program.  If not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17
18 #include "anbox/graphics/layer_composer.h"
19 #include "anbox/graphics/emugl/Renderer.h"
20 #include "anbox/logger.h"
21 #include "anbox/wm/manager.h"
22
23 namespace anbox {
24 namespace graphics {
25 LayerComposer::LayerComposer(const std::shared_ptr<Renderer> renderer, const std::shared_ptr<Strategy> &strategy)
26     : renderer_(renderer), strategy_(strategy) {}
27
28 LayerComposer::~LayerComposer() {}
29
30 void LayerComposer::submit_layers(const RenderableList &renderables) {
31   auto win_layers = strategy_->process_layers(renderables);
32   for (auto &w : win_layers) {
33     renderer_->draw(w.first->native_handle(),
34                     Rect{0, 0, w.first->frame().width(), w.first->frame().height()},
35                     w.second);
36   }
37 }
38 }  // namespace graphics
39 }  // namespace anbox