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 22namespace OHOS { 23namespace HDI { 24namespace DISPLAY { 25class HdiComposition { 26public: 27 HdiComposition() {} 28 virtual int32_t Init() 29 { 30 return DISPLAY_SUCCESS; 31 }; 32 virtual int32_t SetLayers(std::vector<HdiLayer *> &layers, HdiLayer &clientLayer) 33 { 34 return DISPLAY_SUCCESS; 35 } 36 virtual int32_t Apply(bool modeSet) 37 { 38 return DISPLAY_SUCCESS; 39 } 40 virtual ~HdiComposition() {} 41 42protected: 43 std::vector<HdiLayer *> mCompLayers; 44}; 45 46class HdiComposer { 47public: 48 HdiComposer(std::unique_ptr<HdiComposition> pre, std::unique_ptr<HdiComposition> post); 49 virtual ~HdiComposer() {}; 50 int32_t Prepare(std::vector<HdiLayer *> &layers, HdiLayer &clientLayer); 51 int32_t Commit(bool modeSet); 52 HdiComposition *GetPreCompostion() 53 { 54 return mPreComp.get(); 55 } 56 HdiComposition *GetPostCompostion() 57 { 58 return mPostComp.get(); 59 } 60 61private: 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