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_GFX_COMPOSITION_H
17 #define HDI_GFX_COMPOSITION_H
18 #include "display_gfx.h"
19 #include "hdi_composer.h"
20 namespace OHOS {
21 namespace HDI {
22 namespace DISPLAY {
23 class HdiGfxComposition : public HdiComposition {
24 public:
25     int32_t Init(void) override;
26     int32_t SetLayers(std::vector<HdiLayer *> &layers, HdiLayer &clientLayer) override;
27     int32_t Apply(bool modeSet) override;
~HdiGfxComposition()28     ~HdiGfxComposition() override
29     {
30         (void)GfxModuleDeinit();
31     }
32 
33 private:
34     bool CanHandle(HdiLayer &hdiLayer);
35     bool UseCompositionClient(std::vector<HdiLayer *> &layers);
36     void InitGfxSurface(ISurface &iSurface, HdiLayerBuffer &buffer);
37     int32_t BlitLayer(HdiLayer &src, HdiLayer &dst);
38     int32_t ClearRect(HdiLayer &src, HdiLayer &dst);
39     int32_t GfxModuleInit(void);
40     int32_t GfxModuleDeinit(void);
41     void *mGfxModule = nullptr;
42     GfxFuncs *mGfxFuncs = nullptr;
43     HdiLayer *mClientLayer;
44 };
45 } // namespace OHOS
46 } // namespace HDI
47 } // namespace DISPLAY
48 
49 #endif // HDI_GFX_COMPOSITION_H
50