chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 1 | /* |
| 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 Nair | 9245d3b | 2019-03-22 13:38:56 -0700 | [diff] [blame] | 19 | #include <Layer.h> |
chaviw | 98318de | 2021-05-19 16:45:23 -0500 | [diff] [blame^] | 20 | #include <gui/WindowInfo.h> |
Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 21 | #include <math/vec4.h> |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 22 | #include <ui/GraphicBuffer.h> |
| 23 | #include <ui/Rect.h> |
| 24 | #include <ui/Region.h> |
Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 25 | #include <ui/Transform.h> |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 26 | |
| 27 | namespace android { |
| 28 | namespace surfaceflinger { |
| 29 | class LayerProtoHelper { |
| 30 | public: |
Nataniel Borges | 797b0e4 | 2019-02-15 14:11:58 -0800 | [diff] [blame] | 31 | 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 Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 40 | static void writeToProto(const ui::Transform& transform, TransformProto* transformProto); |
Nataniel Borges | 797b0e4 | 2019-02-15 14:11:58 -0800 | [diff] [blame] | 41 | static void writeToProto(const sp<GraphicBuffer>& buffer, |
| 42 | std::function<ActiveBufferProto*()> getActiveBufferProto); |
chaviw | 98318de | 2021-05-19 16:45:23 -0500 | [diff] [blame^] | 43 | static void writeToProto(const gui::WindowInfo& inputInfo, |
Vishnu Nair | 9245d3b | 2019-03-22 13:38:56 -0700 | [diff] [blame] | 44 | const wp<Layer>& touchableRegionBounds, |
| 45 | std::function<InputWindowInfoProto*()> getInputWindowInfoProto); |
chaviw | ddeae26 | 2020-01-06 10:31:23 -0800 | [diff] [blame] | 46 | static void writeToProto(const mat4 matrix, ColorTransformProto* colorTransformProto); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | } // namespace surfaceflinger |
Yiwei Zhang | 7124ad3 | 2018-02-21 13:02:45 -0800 | [diff] [blame] | 50 | } // namespace android |