1 /*
2  * Copyright (c) 2021 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 HDI_COMPOSER_H
17 #define HDI_COMPOSER_H
18 #include <vector>
19 #include <memory>
20 #include "hdi_layer.h"
21 
22 namespace OHOS {
23 namespace HDI {
24 namespace DISPLAY {
25 class HdiComposition {
26 public:
HdiComposition()27     HdiComposition() {}
Init()28     virtual int32_t Init()
29     {
30         return DISPLAY_SUCCESS;
31     };
SetLayers(std::vector<HdiLayer * > & layers,HdiLayer & clientLayer)32     virtual int32_t SetLayers(std::vector<HdiLayer *> &layers, HdiLayer &clientLayer)
33     {
34         return DISPLAY_SUCCESS;
35     }
Apply(bool modeSet)36     virtual int32_t Apply(bool modeSet)
37     {
38         return DISPLAY_SUCCESS;
39     }
~HdiComposition()40     virtual ~HdiComposition() {}
41 
42 protected:
43     std::vector<HdiLayer *> mCompLayers;
44 };
45 
46 class HdiComposer {
47 public:
48     HdiComposer(std::unique_ptr<HdiComposition> pre, std::unique_ptr<HdiComposition> post);
~HdiComposer()49     virtual ~HdiComposer() {};
50     int32_t Prepare(std::vector<HdiLayer *> &layers, HdiLayer &clientLayer);
51     int32_t Commit(bool modeSet);
GetPreCompostion()52     HdiComposition *GetPreCompostion()
53     {
54         return mPreComp.get();
55     }
GetPostCompostion()56     HdiComposition *GetPostCompostion()
57     {
58         return mPostComp.get();
59     }
60 
61 private:
62     std::unique_ptr<HdiComposition> mPreComp;
63     std::unique_ptr<HdiComposition> mPostComp;
64 };
65 } // namespace OHOS
66 } // namespace HDI
67 } // namespace DISPLAY
68 
69 #endif // HDI_COMPOSER_H