• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PAINTS_RENDER_SURFACE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PAINTS_RENDER_SURFACE_H
18 
19 #include <cstdint>
20 #include <stdint.h>
21 
22 #include "base/memory/ace_type.h"
23 #include "base/utils/noncopyable.h"
24 #include "core/components_ng/render/ext_surface_callback_interface.h"
25 #include "core/components_ng/render/render_context.h"
26 
27 namespace OHOS::Ace::NG {
28 // RenderSurface is used for SurfaceNode
29 class RenderSurface : public virtual AceType {
30     DECLARE_ACE_TYPE(NG::RenderSurface, AceType)
31 
32 public:
33     RenderSurface() = default;
34     ~RenderSurface() override = default;
35 
36     static RefPtr<RenderSurface> Create();
37 
InitSurface()38     virtual void InitSurface() {}
39 
UpdateXComponentConfig()40     virtual void UpdateXComponentConfig() {}
41 
GetNativeWindow()42     virtual void* GetNativeWindow()
43     {
44         return nullptr;
45     }
46 
SetRenderContext(const RefPtr<RenderContext> & renderContext)47     virtual void SetRenderContext(const RefPtr<RenderContext>& renderContext) {};
48 
ConfigSurface(uint32_t surfaceWidth,uint32_t surfaceHeight)49     virtual void ConfigSurface(uint32_t surfaceWidth, uint32_t surfaceHeight) {};
50 
IsSurfaceValid()51     virtual bool IsSurfaceValid() const
52     {
53         return false;
54     }
55 
CreateNativeWindow()56     virtual void CreateNativeWindow() {};
57 
AdjustNativeWindowSize(uint32_t width,uint32_t height)58     virtual void AdjustNativeWindowSize(uint32_t width, uint32_t height) {}
59 
GetUniqueId()60     virtual std::string GetUniqueId() const
61     {
62         return "";
63     }
64 
SetExtSurfaceBounds(int32_t left,int32_t top,int32_t width,int32_t height)65     virtual void SetExtSurfaceBounds(int32_t left, int32_t top, int32_t width, int32_t height) {}
66 
SetExtSurfaceBoundsSync(int32_t left,int32_t top,int32_t width,int32_t height)67     virtual bool SetExtSurfaceBoundsSync(int32_t left, int32_t top, int32_t width, int32_t height)
68     {
69         return true;
70     }
71 
SetExtSurfaceCallback(const RefPtr<ExtSurfaceCallbackInterface> & extSurfaceCallback)72     virtual void SetExtSurfaceCallback(const RefPtr<ExtSurfaceCallbackInterface>& extSurfaceCallback) {}
73 
SetIsTexture(bool isTexture)74     virtual void SetIsTexture(bool isTexture) {}
75 
SetIsFullScreen(bool isFullScreen)76     virtual void SetIsFullScreen(bool isFullScreen) {}
77 
SetInstanceId(int32_t instanceId)78     virtual void SetInstanceId(int32_t instanceId) {}
79 
80 protected:
81     ACE_DISALLOW_COPY_AND_MOVE(RenderSurface);
82 };
83 } // namespace OHOS::Ace::NG
84 
85 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PAINTS_RENDER_SURFACE_H
86