1 /*
2  * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ROSEN_RENDER_SERVICE_BASE_RS_OCCLUSION_DATA_H
17 #define ROSEN_RENDER_SERVICE_BASE_RS_OCCLUSION_DATA_H
18 
19 #include <vector>
20 #include <parcel.h>
21 
22 #include "common/rs_macros.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 enum WINDOW_LAYER_INFO_TYPE : uint32_t {
27     ALL_VISIBLE = 0,
28     SEMI_VISIBLE,
29     INVISIBLE,
30     WINDOW_LAYER_DYNAMIC_STATUS,
31     WINDOW_LAYER_STATIC_STATUS,
32     WINDOW_LAYER_UNKNOWN_TYPE,
33 };
34 using VisibleData = std::vector<std::pair<uint64_t, WINDOW_LAYER_INFO_TYPE>>;
35 class RSB_EXPORT RSOcclusionData : public Parcelable {
36 public:
37     RSOcclusionData() = default;
RSOcclusionData(VisibleData & vec)38     RSOcclusionData(VisibleData& vec)
39     {
40         std::copy(vec.begin(), vec.end(), std::back_inserter(visibleData_));
41     }
RSOcclusionData(RSOcclusionData && other)42     RSOcclusionData(RSOcclusionData&& other) : visibleData_(std::move(other.visibleData_)) {}
43     ~RSOcclusionData() noexcept;
44 
GetVisibleData()45     VisibleData& GetVisibleData()
46     {
47         return visibleData_;
48     }
49     [[nodiscard]] static RSOcclusionData* Unmarshalling(Parcel& parcel);
50     bool Marshalling(Parcel& parcel) const override;
51 
52 private:
53     VisibleData visibleData_;
54 };
55 } // namespace Rosen
56 } // namespace OHOS
57 
58 #endif
59