Android-cuttlefish cvd tool
host_renderer.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 The Android Open Source Project
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#pragma once
18
19#include <cstdint>
20#include <functional>
21#include <memory>
22#include <string>
23#include <tuple>
24#include <vector>
25
27#include <freetype/ftglyph.h> // $(croot)/external/freetype
28#include <fruit/fruit.h>
29#include <teeui/utils.h> // $(croot)/system/teeui/libteeui/.../include
30
36
37namespace cuttlefish {
38namespace confui {
40 public:
41 TeeUiFrameWrapper(const int w, const int h, const teeui::Color color)
42 : w_(w), h_(h), teeui_frame_(ScreenSizeInBytes(w, h), color) {}
44 auto data() { return teeui_frame_.data(); }
45 int Width() const { return w_; }
46 int Height() const { return h_; }
47 bool IsEmpty() const { return teeui_frame_.empty(); }
48 auto Size() const { return teeui_frame_.size(); }
49 auto& operator[](const int idx) { return teeui_frame_[idx]; }
50 std::uint32_t ScreenStrideBytes() const {
52 }
53
54 private:
55 static std::uint32_t ScreenSizeInBytes(const int w, const int h) {
57 }
58
59 int w_;
60 int h_;
62};
63
66 public:
69 Result<void> RenderDialog(const std::uint32_t display_num,
70 const std::string& prompt_text,
71 const std::string& locale,
72 const std::vector<teeui::UIOption>& ui_options);
73 bool IsInConfirm(const std::uint32_t x, const std::uint32_t y);
74 bool IsInCancel(const std::uint32_t x, const std::uint32_t y);
75
76 private:
77 bool IsInverted(const std::vector<teeui::UIOption>& ui_options) const;
78 bool IsMagnified(const std::vector<teeui::UIOption>& ui_options) const;
80 std::unique_ptr<ConfUiRendererImpl> renderer_impl_;
81};
82
83} // end of namespace confui
84} // end of namespace cuttlefish
Definition: expected.h:86
Definition: host_renderer.cc:49
Definition: host_renderer.h:65
INJECT(ConfUiRenderer(ScreenConnectorFrameRenderer &screen_connector))
std::unique_ptr< ConfUiRendererImpl > renderer_impl_
Definition: host_renderer.h:80
~ConfUiRenderer()
Definition: host_renderer.cc:397
bool IsMagnified(const std::vector< teeui::UIOption > &ui_options) const
Definition: host_renderer.cc:424
bool IsInCancel(const std::uint32_t x, const std::uint32_t y)
Definition: host_renderer.cc:435
Result< void > RenderDialog(const std::uint32_t display_num, const std::string &prompt_text, const std::string &locale, const std::vector< teeui::UIOption > &ui_options)
Definition: host_renderer.cc:399
bool IsInverted(const std::vector< teeui::UIOption > &ui_options) const
Definition: host_renderer.cc:419
ScreenConnectorFrameRenderer & screen_connector_
Definition: host_renderer.h:79
bool IsInConfirm(const std::uint32_t x, const std::uint32_t y)
Definition: host_renderer.cc:429
Definition: host_renderer.h:39
int w_
Definition: host_renderer.h:59
auto data()
Definition: host_renderer.h:44
bool IsEmpty() const
Definition: host_renderer.h:47
TeeUiFrame teeui_frame_
Definition: host_renderer.h:61
std::uint32_t ScreenStrideBytes() const
Definition: host_renderer.h:50
TeeUiFrameWrapper(const int w, const int h, const teeui::Color color)
Definition: host_renderer.h:41
int Height() const
Definition: host_renderer.h:46
int h_
Definition: host_renderer.h:60
static std::uint32_t ScreenSizeInBytes(const int w, const int h)
Definition: host_renderer.h:55
auto Size() const
Definition: host_renderer.h:48
int Width() const
Definition: host_renderer.h:45
auto & operator[](const int idx)
Definition: host_renderer.h:49
uint32_t ComputeScreenSizeInBytes(const uint32_t w, const uint32_t h)
Definition: screen_connector_common.cc:56
uint32_t ComputeScreenStrideBytes(const uint32_t w)
Definition: screen_connector_common.cc:52
std::vector< std::uint32_t > TeeUiFrame
Definition: server_common.h:36
Definition: alloc_utils.cpp:23
uint32_t Color
Definition: utils.h:594
Definition: screen_connector_common.h:51