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 <stdint.h>
20
21#include <functional>
22#include <memory>
23#include <string>
24#include <tuple>
25#include <vector>
26
27#include "freetype/ftglyph.h" // $(croot)/external/freetype
28#include "fruit/fruit.h"
29#include "teeui/utils.h" // $(croot)/system/teeui/libteeui/.../include
30
35
36namespace cuttlefish {
37namespace confui {
39 public:
40 TeeUiFrameWrapper(const int w, const int h, const teeui::Color color)
41 : w_(w), h_(h), teeui_frame_(ScreenSizeInBytes(w, h), color) {}
43 auto data() { return teeui_frame_.data(); }
44 int Width() const { return w_; }
45 int Height() const { return h_; }
46 bool IsEmpty() const { return teeui_frame_.empty(); }
47 auto Size() const { return teeui_frame_.size(); }
48 auto& operator[](const int idx) { return teeui_frame_[idx]; }
49 uint32_t ScreenStrideBytes() const {
51 }
52
53 private:
54 static uint32_t ScreenSizeInBytes(const int w, const int h) {
56 }
57
58 int w_;
59 int h_;
61};
62
65 public:
68 Result<void> RenderDialog(uint32_t display_num,
69 const std::string& prompt_text,
70 const std::string& locale,
71 const std::vector<teeui::UIOption>& ui_options);
72 bool IsInConfirm(uint32_t x, uint32_t y);
73 bool IsInCancel(uint32_t x, uint32_t y);
74
75 private:
76 bool IsInverted(const std::vector<teeui::UIOption>& ui_options) const;
77 bool IsMagnified(const std::vector<teeui::UIOption>& ui_options) const;
79 std::unique_ptr<ConfUiRendererImpl> renderer_impl_;
80};
81
82} // end of namespace confui
83} // end of namespace cuttlefish
Definition: host_renderer.cc:56
Definition: host_renderer.h:64
INJECT(ConfUiRenderer(ScreenConnectorFrameRenderer &screen_connector))
std::unique_ptr< ConfUiRendererImpl > renderer_impl_
Definition: host_renderer.h:79
Result< void > RenderDialog(uint32_t display_num, const std::string &prompt_text, const std::string &locale, const std::vector< teeui::UIOption > &ui_options)
Definition: host_renderer.cc:402
~ConfUiRenderer()
Definition: host_renderer.cc:400
bool IsMagnified(const std::vector< teeui::UIOption > &ui_options) const
Definition: host_renderer.cc:427
bool IsInverted(const std::vector< teeui::UIOption > &ui_options) const
Definition: host_renderer.cc:422
ScreenConnectorFrameRenderer & screen_connector_
Definition: host_renderer.h:78
bool IsInCancel(uint32_t x, uint32_t y)
Definition: host_renderer.cc:438
bool IsInConfirm(uint32_t x, uint32_t y)
Definition: host_renderer.cc:432
Definition: host_renderer.h:38
int w_
Definition: host_renderer.h:58
static uint32_t ScreenSizeInBytes(const int w, const int h)
Definition: host_renderer.h:54
auto data()
Definition: host_renderer.h:43
bool IsEmpty() const
Definition: host_renderer.h:46
TeeUiFrame teeui_frame_
Definition: host_renderer.h:60
TeeUiFrameWrapper(const int w, const int h, const teeui::Color color)
Definition: host_renderer.h:40
uint32_t ScreenStrideBytes() const
Definition: host_renderer.h:49
int Height() const
Definition: host_renderer.h:45
int h_
Definition: host_renderer.h:59
auto Size() const
Definition: host_renderer.h:47
int Width() const
Definition: host_renderer.h:44
auto & operator[](const int idx)
Definition: host_renderer.h:48
#define color
Definition: dict.c:54
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< uint32_t > TeeUiFrame
Definition: server_common.h:38
Definition: alloc_driver.h:20
tl::expected< T, StackTraceError > Result
Definition: result_type.h:30
uint32_t Color
Definition: utils.h:594
Definition: screen_connector_common.h:51