• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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()
28                 {
29                 }
Init()30                 virtual int32_t Init()
31                 {
32                     return DISPLAY_SUCCESS;
33                 };
SetLayers(std::vector<HdiLayer * > & layers,HdiLayer & clientLayer)34                 virtual int32_t SetLayers(std::vector<HdiLayer *> &layers, HdiLayer &clientLayer)
35                 {
36                     return DISPLAY_SUCCESS;
37                 }
Apply(bool modeSet)38                 virtual int32_t Apply(bool modeSet)
39                 {
40                     return DISPLAY_SUCCESS;
41                 }
~HdiComposition()42                 virtual ~HdiComposition()
43                 {
44                 }
45 
46             protected:
47                 std::vector<HdiLayer *> mCompLayers;
48             };
49 
50             class HdiComposer {
51             public:
52                 HdiComposer(std::unique_ptr<HdiComposition> pre, std::unique_ptr<HdiComposition> post);
~HdiComposer()53                 virtual ~HdiComposer() {};
54                 int32_t Prepare(std::vector<HdiLayer *> &layers, HdiLayer &clientLayer);
55                 int32_t Commit(bool modeSet);
GetPreCompostion()56                 HdiComposition *GetPreCompostion()
57                 {
58                     return mPreComp.get();
59                 }
GetPostCompostion()60                 HdiComposition *GetPostCompostion()
61                 {
62                     return mPostComp.get();
63                 }
64 
65             private:
66                 std::unique_ptr<HdiComposition> mPreComp;
67                 std::unique_ptr<HdiComposition> mPostComp;
68             };
69         } // namespace OHOS
70     }     // namespace HDI
71 } // namespace DISPLAY
72 
73 #endif // HDI_COMPOSER_H