blob: 187ce3d1346f5c049ad59728d3df169e5ad7984d [file] [log] [blame]
chaviw1d044282017-09-27 12:19:28 -07001/*
2 * Copyright (C) 2017 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#include <layerproto/LayerProtoHeader.h>
18
Vishnu Nair9245d3b2019-03-22 13:38:56 -070019#include <Layer.h>
chaviw98318de2021-05-19 16:45:23 -050020#include <gui/WindowInfo.h>
Peiyong Linefefaac2018-08-17 12:27:51 -070021#include <math/vec4.h>
chaviw1d044282017-09-27 12:19:28 -070022#include <ui/GraphicBuffer.h>
23#include <ui/Rect.h>
24#include <ui/Region.h>
Peiyong Linefefaac2018-08-17 12:27:51 -070025#include <ui/Transform.h>
chaviw1d044282017-09-27 12:19:28 -070026
27namespace android {
28namespace surfaceflinger {
29class LayerProtoHelper {
30public:
Nataniel Borges797b0e42019-02-15 14:11:58 -080031 static void writePositionToProto(const float x, const float y,
32 std::function<PositionProto*()> getPositionProto);
33 static void writeSizeToProto(const uint32_t w, const uint32_t h,
34 std::function<SizeProto*()> getSizeProto);
35 static void writeToProto(const Rect& rect, std::function<RectProto*()> getRectProto);
36 static void writeToProto(const FloatRect& rect,
37 std::function<FloatRectProto*()> getFloatRectProto);
38 static void writeToProto(const Region& region, std::function<RegionProto*()> getRegionProto);
39 static void writeToProto(const half4 color, std::function<ColorProto*()> getColorProto);
Peiyong Linefefaac2018-08-17 12:27:51 -070040 static void writeToProto(const ui::Transform& transform, TransformProto* transformProto);
Nataniel Borges797b0e42019-02-15 14:11:58 -080041 static void writeToProto(const sp<GraphicBuffer>& buffer,
42 std::function<ActiveBufferProto*()> getActiveBufferProto);
chaviw98318de2021-05-19 16:45:23 -050043 static void writeToProto(const gui::WindowInfo& inputInfo,
Vishnu Nair9245d3b2019-03-22 13:38:56 -070044 const wp<Layer>& touchableRegionBounds,
45 std::function<InputWindowInfoProto*()> getInputWindowInfoProto);
chaviwddeae262020-01-06 10:31:23 -080046 static void writeToProto(const mat4 matrix, ColorTransformProto* colorTransformProto);
chaviw1d044282017-09-27 12:19:28 -070047};
48
49} // namespace surfaceflinger
Yiwei Zhang7124ad32018-02-21 13:02:45 -080050} // namespace android