1 /*
2  * Copyright (c) 2021-2022 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 RS_SURFACE_FRAME_OHOS_GL_H
17 #define RS_SURFACE_FRAME_OHOS_GL_H
18 
19 #include <surface.h>
20 
21 #ifdef NEW_SKIA
22 #include "include/gpu/GrDirectContext.h"
23 #else
24 #include "include/gpu/GrContext.h"
25 #endif
26 
27 #include "platform/drawing/rs_surface_frame.h"
28 #include "platform/ohos/rs_surface_frame_ohos.h"
29 
30 namespace OHOS {
31 namespace Rosen {
32 
33 class RSSurfaceFrameOhosGl : public RSSurfaceFrameOhos {
34 public:
35     RSSurfaceFrameOhosGl(int32_t width, int32_t height);
36     ~RSSurfaceFrameOhosGl() = default;
37 
38     Drawing::Canvas* GetCanvas() override;
39     std::shared_ptr<Drawing::Surface> GetSurface() override;
40     void SetDamageRegion(int32_t left, int32_t top, int32_t width, int32_t height) override;
41     void SetDamageRegion(const std::vector<RectI> &rects) override;
42     int32_t GetBufferAge() const override;
43     int32_t GetReleaseFence() const;
44     void SetReleaseFence(const int32_t& fence);
45 
46 private:
47     int32_t releaseFence_ = 0;
48     int width_ = 0;
49     int height_ = 0;
50     void CreateSurface();
51 };
52 } // namespace Rosen
53 } // namespace OHOS
54 
55 #endif // RENDER_SERVICE_BASE_PLATFORM_RS_SURFACE_FRAME_OHOS_H
56