b4f72ee5cf5c3201baf708472061459d3505b764
[iec.git] / src / type3_AndroidCloud / anbox-master / src / anbox / graphics / single_window_composer_strategy.cpp
1 /*
2  * Copyright (C) 2017 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/single_window_composer_strategy.h"
19 #include "anbox/wm/manager.h"
20 #include "anbox/utils.h"
21 #include "anbox/logger.h"
22
23 namespace {
24 const constexpr char *sprite_name{"Sprite"};
25 }
26
27 namespace anbox {
28 namespace graphics {
29 SingleWindowComposerStrategy::SingleWindowComposerStrategy(const std::shared_ptr<wm::Manager> &wm) : wm_(wm) {}
30
31 std::map<std::shared_ptr<wm::Window>, RenderableList> SingleWindowComposerStrategy::process_layers(const RenderableList &renderables) {
32   WindowRenderableList win_layers;
33   // FIXME there will be only one window in single-window mode ever so it
34   // doesn't matter which task
35   auto window = wm_->find_window_for_task(0);
36
37   // Filter out any unwanted layers like the one responsible for the mouse
38   // cursor which we don't want to render.
39   RenderableList final_renderables;
40   for (const auto &r : renderables) {
41     if (r.name() == sprite_name)
42       continue;
43     final_renderables.push_back(r);
44   }
45
46   win_layers.insert({window, final_renderables});
47   return win_layers;
48 }
49 }  // namespace graphics
50 }  // namespace anbox